From: monojenkins Date: Thu, 7 Apr 2016 19:06:02 +0000 (+0100) Subject: Merge pull request #2824 from lambdageek/dev/monoerror-icalls-noraise X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=1af57bfcb6d04d43043a122a92e4c6d880f9acf0;hp=cd9b8eb791d33c892d1c89edbaa25770820f09fd;p=mono.git Merge pull request #2824 from lambdageek/dev/monoerror-icalls-noraise [runtime] Set pending exception in icalls instead of raising. --- diff --git a/acceptance-tests/coreclr.mk b/acceptance-tests/coreclr.mk index 2271e371f69..8f75b05470f 100644 --- a/acceptance-tests/coreclr.mk +++ b/acceptance-tests/coreclr.mk @@ -5152,7 +5152,7 @@ $(CORECLR_PATH)%.exe: $(CORECLR_PATH)%.cs coreclr-testlibrary.dll $(MCS) -unsafe -debug -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 -nowarn:0197 -r:coreclr-testlibrary.dll -d:MONO -out:$@ $< test-runner.exe: $(top_srcdir)/mono/tests/test-runner.cs - $(MCS) -debug -out:$@ $< + $(MCS) -debug -r:Mono.Posix.dll -out:$@ $< GCStressTests.exe: $(CORECLR_STRESSTEST_RUNNER_CS_SRC) $(MCS) -out:$@ -debug -d:PROJECTK_BUILD $(CORECLR_STRESSTEST_RUNNER_CS_SRC) diff --git a/configure.ac b/configure.ac index 12ed84fb843..0341987c485 100644 --- a/configure.ac +++ b/configure.ac @@ -1076,6 +1076,7 @@ if test x$host_win32 = xno; then dnl hires monotonic clock support AC_SEARCH_LIBS(clock_gettime, rt) + AC_CHECK_FUNCS(clock_nanosleep) dnl dynamic loader support AC_CHECK_FUNC(dlopen, DL_LIB="", diff --git a/docs/docs.make b/docs/docs.make index c19ba5c3375..f0b97990356 100644 --- a/docs/docs.make +++ b/docs/docs.make @@ -13,10 +13,10 @@ ASSEMBLED_DOCS = \ monoapi.tree monoapi.zip convert.exe: $(srcdir)/convert.cs AgilityPack.dll - $(CSCOMPILE) -r:System.Xml.dll -out:$@ $< -r:AgilityPack.dll + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -out:$@ $< -r:AgilityPack.dll AgilityPack.dll: - $(CSCOMPILE) -r:System.dll -r:System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs monoapi.zip: monoapi.tree @test -f $@ || { rm -f $< && $(MAKE) $<; } diff --git a/external/android-libunwind/README b/external/android-libunwind/README new file mode 100644 index 00000000000..b226141e567 --- /dev/null +++ b/external/android-libunwind/README @@ -0,0 +1,9 @@ +This is a copy of a few libunwind headers from https://android.googlesource.com/platform/external/libunwind + +We can't make the repo a git submodule because it contains a folder called 'aux' which +is reserved on Windows and would break on checkout there. + +These files are unmodified from the originals and should preferably stay that +way to avoid merge hell. + +Commit: 338c9755cfe3d009c3dfff7d108e2c3ddaa6f3bb (android-6.0.1_r24) \ No newline at end of file diff --git a/external/android-libunwind/include/libunwind-aarch64.h b/external/android-libunwind/include/libunwind-aarch64.h new file mode 100644 index 00000000000..700ed172229 --- /dev/null +++ b/external/android-libunwind/include/libunwind-aarch64.h @@ -0,0 +1,219 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET aarch64 +#define UNW_TARGET_AARCH64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +#define UNW_TDEP_CURSOR_LEN 4096 + +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef struct + { + /* no aarch64-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +typedef enum + { + /* 64-bit general registers. */ + UNW_AARCH64_X0, + UNW_AARCH64_X1, + UNW_AARCH64_X2, + UNW_AARCH64_X3, + UNW_AARCH64_X4, + UNW_AARCH64_X5, + UNW_AARCH64_X6, + UNW_AARCH64_X7, + UNW_AARCH64_X8, + + /* Temporary registers. */ + UNW_AARCH64_X9, + UNW_AARCH64_X10, + UNW_AARCH64_X11, + UNW_AARCH64_X12, + UNW_AARCH64_X13, + UNW_AARCH64_X14, + UNW_AARCH64_X15, + + /* Intra-procedure-call temporary registers. */ + UNW_AARCH64_X16, + UNW_AARCH64_X17, + + /* Callee-saved registers. */ + UNW_AARCH64_X18, + UNW_AARCH64_X19, + UNW_AARCH64_X20, + UNW_AARCH64_X21, + UNW_AARCH64_X22, + UNW_AARCH64_X23, + UNW_AARCH64_X24, + UNW_AARCH64_X25, + UNW_AARCH64_X26, + UNW_AARCH64_X27, + UNW_AARCH64_X28, + + /* 64-bit frame pointer. */ + UNW_AARCH64_X29, + + /* 64-bit link register. */ + UNW_AARCH64_X30, + + /* 64-bit stack pointer. */ + UNW_AARCH64_SP = 31, + UNW_AARCH64_PC, + UNW_AARCH64_PSTATE, + + /* 128-bit FP/Advanced SIMD registers. */ + UNW_AARCH64_V0 = 64, + UNW_AARCH64_V1, + UNW_AARCH64_V2, + UNW_AARCH64_V3, + UNW_AARCH64_V4, + UNW_AARCH64_V5, + UNW_AARCH64_V6, + UNW_AARCH64_V7, + UNW_AARCH64_V8, + UNW_AARCH64_V9, + UNW_AARCH64_V10, + UNW_AARCH64_V11, + UNW_AARCH64_V12, + UNW_AARCH64_V13, + UNW_AARCH64_V14, + UNW_AARCH64_V15, + UNW_AARCH64_V16, + UNW_AARCH64_V17, + UNW_AARCH64_V18, + UNW_AARCH64_V19, + UNW_AARCH64_V20, + UNW_AARCH64_V21, + UNW_AARCH64_V22, + UNW_AARCH64_V23, + UNW_AARCH64_V24, + UNW_AARCH64_V25, + UNW_AARCH64_V26, + UNW_AARCH64_V27, + UNW_AARCH64_V28, + UNW_AARCH64_V29, + UNW_AARCH64_V30, + UNW_AARCH64_V31, + + UNW_AARCH64_FPSR, + UNW_AARCH64_FPCR, + + /* For AArch64, the CFA is the value of SP (x31) at the call site of the + previous frame. */ + UNW_AARCH64_CFA = UNW_AARCH64_SP, + + UNW_TDEP_LAST_REG = UNW_AARCH64_FPCR, + + UNW_TDEP_IP = UNW_AARCH64_X30, + UNW_TDEP_SP = UNW_AARCH64_SP, + UNW_TDEP_EH = UNW_AARCH64_X0, + + } +aarch64_regnum_t; + +/* Use R0 through R3 to pass exception handling information. */ +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + + +/* On AArch64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-common.h" +#include "libunwind-dynamic.h" + +/* ANDROID support update. */ +/* There is no getcontext in Android. */ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \ + __asm__ __volatile__ ( \ + "stp x0, x1, [%[base], #0]\n" \ + "stp x2, x3, [%[base], #16]\n" \ + "stp x4, x5, [%[base], #32]\n" \ + "stp x6, x7, [%[base], #48]\n" \ + "stp x8, x9, [%[base], #64]\n" \ + "stp x10, x11, [%[base], #80]\n" \ + "stp x12, x13, [%[base], #96]\n" \ + "stp x14, x13, [%[base], #112]\n" \ + "stp x16, x17, [%[base], #128]\n" \ + "stp x18, x19, [%[base], #144]\n" \ + "stp x20, x21, [%[base], #160]\n" \ + "stp x22, x23, [%[base], #176]\n" \ + "stp x24, x25, [%[base], #192]\n" \ + "stp x26, x27, [%[base], #208]\n" \ + "stp x28, x29, [%[base], #224]\n" \ + "str x30, [%[base], #240]\n" \ + "mov x1, sp\n" \ + "stp x1, x30, [%[base], #248]\n" \ + : [base] "+r" (unw_base) : : "x1", "memory"); \ + }), 0) +/* End of ANDROID update. */ +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) + +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-arm.h b/external/android-libunwind/include/libunwind-arm.h new file mode 100644 index 00000000000..495948e70c6 --- /dev/null +++ b/external/android-libunwind/include/libunwind-arm.h @@ -0,0 +1,308 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET arm +#define UNW_TARGET_ARM 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +/* FIXME for ARM. Too big? What do other things use for similar tasks? */ +#define UNW_TDEP_CURSOR_LEN 4096 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_ARM_R0, + UNW_ARM_R1, + UNW_ARM_R2, + UNW_ARM_R3, + UNW_ARM_R4, + UNW_ARM_R5, + UNW_ARM_R6, + UNW_ARM_R7, + UNW_ARM_R8, + UNW_ARM_R9, + UNW_ARM_R10, + UNW_ARM_R11, + UNW_ARM_R12, + UNW_ARM_R13, + UNW_ARM_R14, + UNW_ARM_R15, + + /* VFPv2 s0-s31 (obsolescent numberings). */ + UNW_ARM_S0 = 64, + UNW_ARM_S1, + UNW_ARM_S2, + UNW_ARM_S3, + UNW_ARM_S4, + UNW_ARM_S5, + UNW_ARM_S6, + UNW_ARM_S7, + UNW_ARM_S8, + UNW_ARM_S9, + UNW_ARM_S10, + UNW_ARM_S11, + UNW_ARM_S12, + UNW_ARM_S13, + UNW_ARM_S14, + UNW_ARM_S15, + UNW_ARM_S16, + UNW_ARM_S17, + UNW_ARM_S18, + UNW_ARM_S19, + UNW_ARM_S20, + UNW_ARM_S21, + UNW_ARM_S22, + UNW_ARM_S23, + UNW_ARM_S24, + UNW_ARM_S25, + UNW_ARM_S26, + UNW_ARM_S27, + UNW_ARM_S28, + UNW_ARM_S29, + UNW_ARM_S30, + UNW_ARM_S31, + + /* FPA register numberings. */ + UNW_ARM_F0 = 96, + UNW_ARM_F1, + UNW_ARM_F2, + UNW_ARM_F3, + UNW_ARM_F4, + UNW_ARM_F5, + UNW_ARM_F6, + UNW_ARM_F7, + + /* iWMMXt GR register numberings. */ + UNW_ARM_wCGR0 = 104, + UNW_ARM_wCGR1, + UNW_ARM_wCGR2, + UNW_ARM_wCGR3, + UNW_ARM_wCGR4, + UNW_ARM_wCGR5, + UNW_ARM_wCGR6, + UNW_ARM_wCGR7, + + /* iWMMXt register numberings. */ + UNW_ARM_wR0 = 112, + UNW_ARM_wR1, + UNW_ARM_wR2, + UNW_ARM_wR3, + UNW_ARM_wR4, + UNW_ARM_wR5, + UNW_ARM_wR6, + UNW_ARM_wR7, + UNW_ARM_wR8, + UNW_ARM_wR9, + UNW_ARM_wR10, + UNW_ARM_wR11, + UNW_ARM_wR12, + UNW_ARM_wR13, + UNW_ARM_wR14, + UNW_ARM_wR15, + + /* Two-byte encodings from here on. */ + + /* SPSR. */ + UNW_ARM_SPSR = 128, + UNW_ARM_SPSR_FIQ, + UNW_ARM_SPSR_IRQ, + UNW_ARM_SPSR_ABT, + UNW_ARM_SPSR_UND, + UNW_ARM_SPSR_SVC, + + /* User mode registers. */ + UNW_ARM_R8_USR = 144, + UNW_ARM_R9_USR, + UNW_ARM_R10_USR, + UNW_ARM_R11_USR, + UNW_ARM_R12_USR, + UNW_ARM_R13_USR, + UNW_ARM_R14_USR, + + /* FIQ registers. */ + UNW_ARM_R8_FIQ = 151, + UNW_ARM_R9_FIQ, + UNW_ARM_R10_FIQ, + UNW_ARM_R11_FIQ, + UNW_ARM_R12_FIQ, + UNW_ARM_R13_FIQ, + UNW_ARM_R14_FIQ, + + /* IRQ registers. */ + UNW_ARM_R13_IRQ = 158, + UNW_ARM_R14_IRQ, + + /* ABT registers. */ + UNW_ARM_R13_ABT = 160, + UNW_ARM_R14_ABT, + + /* UND registers. */ + UNW_ARM_R13_UND = 162, + UNW_ARM_R14_UND, + + /* SVC registers. */ + UNW_ARM_R13_SVC = 164, + UNW_ARM_R14_SVC, + + /* iWMMXt control registers. */ + UNW_ARM_wC0 = 192, + UNW_ARM_wC1, + UNW_ARM_wC2, + UNW_ARM_wC3, + UNW_ARM_wC4, + UNW_ARM_wC5, + UNW_ARM_wC6, + UNW_ARM_wC7, + + /* VFPv3/Neon 64-bit registers. */ + UNW_ARM_D0 = 256, + UNW_ARM_D1, + UNW_ARM_D2, + UNW_ARM_D3, + UNW_ARM_D4, + UNW_ARM_D5, + UNW_ARM_D6, + UNW_ARM_D7, + UNW_ARM_D8, + UNW_ARM_D9, + UNW_ARM_D10, + UNW_ARM_D11, + UNW_ARM_D12, + UNW_ARM_D13, + UNW_ARM_D14, + UNW_ARM_D15, + UNW_ARM_D16, + UNW_ARM_D17, + UNW_ARM_D18, + UNW_ARM_D19, + UNW_ARM_D20, + UNW_ARM_D21, + UNW_ARM_D22, + UNW_ARM_D23, + UNW_ARM_D24, + UNW_ARM_D25, + UNW_ARM_D26, + UNW_ARM_D27, + UNW_ARM_D28, + UNW_ARM_D29, + UNW_ARM_D30, + UNW_ARM_D31, + + /* For ARM, the CFA is the value of SP (r13) at the call site in the + previous frame. */ + UNW_ARM_CFA, + + UNW_TDEP_LAST_REG = UNW_ARM_D31, + + UNW_TDEP_IP = UNW_ARM_R14, /* A little white lie. */ + UNW_TDEP_SP = UNW_ARM_R13, + UNW_TDEP_EH = UNW_ARM_R0 /* FIXME. */ + } +arm_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for ARM. */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On ARM, we define our own unw_tdep_context instead of using ucontext_t. + This allows us to support systems that don't support getcontext and + therefore do not define ucontext_t. */ +typedef struct unw_tdep_context + { + unsigned long regs[16]; + } +unw_tdep_context_t; + +/* There is no getcontext() on ARM. Use a stub version which only saves GP + registers. FIXME: Not ideal, may not be sufficient for all libunwind + use cases. Stores pc+8, which is only approximately correct, really. */ +#ifndef __thumb__ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ + __asm__ __volatile__ ( \ + "stmia %[base], {r0-r15}" \ + : : [base] "r" (unw_base) : "memory"); \ + }), 0) +#else /* __thumb__ */ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ + __asm__ __volatile__ ( \ + ".align 2\nbx pc\nnop\n.code 32\n" \ + "stmia %[base], {r0-r15}\n" \ + "orr %[base], pc, #1\nbx %[base]" \ + : [base] "+r" (unw_base) : : "memory", "cc"); \ + }), 0) +#endif + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no arm-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-common.h b/external/android-libunwind/include/libunwind-common.h new file mode 100644 index 00000000000..f4cbc88afbd --- /dev/null +++ b/external/android-libunwind/include/libunwind-common.h @@ -0,0 +1,308 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* ANDROID support update. */ +#include +/* End of ANDROID update. */ + +#define UNW_VERSION_MAJOR 1 +#define UNW_VERSION_MINOR 1 +#define UNW_VERSION_EXTRA + +#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min)) +#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR) + +#define UNW_PASTE2(x,y) x##y +#define UNW_PASTE(x,y) UNW_PASTE2(x,y) +#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn) +#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn) + +#ifdef UNW_LOCAL_ONLY +# ifdef UNW_ADDITIONAL_PREFIX +# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UUL,UNW_TARGET),_) +# else +# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_) +# endif +#else /* !UNW_LOCAL_ONLY */ +# ifdef UNW_ADDITIONAL_PREFIX +# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UU,UNW_TARGET),_) +# else +# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_) +# endif +#endif /* !UNW_LOCAL_ONLY */ + +/* Error codes. The unwind routines return the *negated* values of + these error codes on error and a non-negative value on success. */ +typedef enum + { + UNW_ESUCCESS = 0, /* no error */ + UNW_EUNSPEC, /* unspecified (general) error */ + UNW_ENOMEM, /* out of memory */ + UNW_EBADREG, /* bad register number */ + UNW_EREADONLYREG, /* attempt to write read-only register */ + UNW_ESTOPUNWIND, /* stop unwinding */ + UNW_EINVALIDIP, /* invalid IP */ + UNW_EBADFRAME, /* bad frame */ + UNW_EINVAL, /* unsupported operation or bad value */ + UNW_EBADVERSION, /* unwind info has unsupported version */ + UNW_ENOINFO /* no unwind info found */ + } +unw_error_t; + +/* The following enum defines the indices for a couple of + (pseudo-)registers which have the same meaning across all + platforms. (RO) means read-only. (RW) means read-write. General + registers (aka "integer registers") are expected to start with + index 0. The number of such registers is architecture-dependent. + The remaining indices can be used as an architecture sees fit. The + last valid register index is given by UNW_REG_LAST. */ +typedef enum + { + UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */ + UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */ + UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */ + UNW_REG_LAST = UNW_TDEP_LAST_REG + } +unw_frame_regnum_t; + +/* Number of exception-handler argument registers: */ +#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS + +typedef enum + { + UNW_CACHE_NONE, /* no caching */ + UNW_CACHE_GLOBAL, /* shared global cache */ + UNW_CACHE_PER_THREAD /* per-thread caching */ + } +unw_caching_policy_t; + +typedef int unw_regnum_t; + +/* The unwind cursor starts at the youngest (most deeply nested) frame + and is used to track the frame state as the unwinder steps from + frame to frame. It is safe to make (shallow) copies of variables + of this type. */ +typedef struct unw_cursor + { + unw_word_t opaque[UNW_TDEP_CURSOR_LEN]; + } +unw_cursor_t; + +/* This type encapsulates the entire (preserved) machine-state. */ +typedef unw_tdep_context_t unw_context_t; + +/* unw_getcontext() fills the unw_context_t pointed to by UC with the + machine state as it exists at the call-site. For implementation + reasons, this needs to be a target-dependent macro. It's easiest + to think of unw_getcontext() as being identical to getcontext(). */ +#define unw_getcontext(uc) unw_tdep_getcontext(uc) + +/* Return 1 if register number R is a floating-point register, zero + otherwise. + This routine is signal-safe. */ +#define unw_is_fpreg(r) unw_tdep_is_fpreg(r) + +typedef unw_tdep_fpreg_t unw_fpreg_t; + +typedef struct unw_addr_space *unw_addr_space_t; + +/* Each target may define it's own set of flags, but bits 0-15 are + reserved for general libunwind-use. */ +#define UNW_PI_FLAG_FIRST_TDEP_BIT 16 +/* The information comes from a .debug_frame section. */ +#define UNW_PI_FLAG_DEBUG_FRAME 32 + +typedef struct unw_proc_info + { + unw_word_t start_ip; /* first IP covered by this procedure */ + unw_word_t end_ip; /* first IP NOT covered by this procedure */ + unw_word_t lsda; /* address of lang.-spec. data area (if any) */ + unw_word_t handler; /* optional personality routine */ + unw_word_t gp; /* global-pointer value for this procedure */ + unw_word_t flags; /* misc. flags */ + + int format; /* unwind-info format (arch-specific) */ + int unwind_info_size; /* size of the information (if applicable) */ + void *unwind_info; /* unwind-info (arch-specific) */ + unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */ + } +unw_proc_info_t; + +/* These are backend callback routines that provide access to the + state of a "remote" process. This can be used, for example, to + unwind another process through the ptrace() interface. */ +typedef struct unw_accessors + { + /* Look up the unwind info associated with instruction-pointer IP. + On success, the routine fills in the PROC_INFO structure. */ + int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *, + int, void *); + + /* Release any resources (e.g., memory) that were allocated for + the unwind info returned in by a previous call to + find_proc_info() with NEED_UNWIND_INFO set to 1. */ + void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *); + + /* Return the list-head of the dynamically registered unwind + info. */ + int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *); + + /* Access aligned word at address ADDR. The value is returned + according to the endianness of the host (e.g., if the host is + little-endian and the target is big-endian, access_mem() needs + to byte-swap the value before returning it). */ + int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int, + void *); + + /* Access register number REG at address ADDR. */ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int, + void *); + + /* Access register number REG at address ADDR. */ + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, + unw_fpreg_t *, int, void *); + + int (*resume) (unw_addr_space_t, unw_cursor_t *, void *); + + /* Optional call back to obtain the name of a (static) procedure. + Dynamically generated procedures are handled automatically by + libunwind. This callback is optional and may be set to + NULL. */ + int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t, + unw_word_t *, void *); + } +unw_accessors_t; + +typedef enum unw_save_loc_type + { + UNW_SLT_NONE, /* register is not saved ("not an l-value") */ + UNW_SLT_MEMORY, /* register has been saved in memory */ + UNW_SLT_REG /* register has been saved in (another) register */ + } +unw_save_loc_type_t; + +typedef struct unw_save_loc + { + unw_save_loc_type_t type; + union + { + unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */ + unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */ + } + u; + unw_tdep_save_loc_t extra; /* target-dependent additional information */ + } +unw_save_loc_t; + +/* ANDROID support update. */ +typedef struct unw_map_cursor + { + void *map_list; + void *cur_map; + } +unw_map_cursor_t; + +typedef struct unw_map + { + unw_word_t start; + unw_word_t end; + unw_word_t offset; + unw_word_t load_base; + char *path; + int flags; + } +unw_map_t; +/* End of ANDROID update. */ + +/* These routines work both for local and remote unwinding. */ + +#define unw_local_access_addr_space_init UNW_OBJ(local_access_addr_space_init) +#define unw_local_addr_space UNW_OBJ(local_addr_space) +#define unw_create_addr_space UNW_OBJ(create_addr_space) +#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space) +#define unw_get_accessors UNW_ARCH_OBJ(get_accessors) +#define unw_init_local UNW_OBJ(init_local) +#define unw_init_remote UNW_OBJ(init_remote) +#define unw_step UNW_OBJ(step) +#define unw_resume UNW_OBJ(resume) +#define unw_get_proc_info UNW_OBJ(get_proc_info) +#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip) +#define unw_get_reg UNW_OBJ(get_reg) +#define unw_set_reg UNW_OBJ(set_reg) +#define unw_get_fpreg UNW_OBJ(get_fpreg) +#define unw_set_fpreg UNW_OBJ(set_fpreg) +#define unw_get_save_loc UNW_OBJ(get_save_loc) +#define unw_is_signal_frame UNW_OBJ(is_signal_frame) +#define unw_handle_signal_frame UNW_OBJ(handle_signal_frame) +#define unw_get_proc_name UNW_OBJ(get_proc_name) +#define unw_get_proc_name_by_ip UNW_OBJ(get_proc_name_by_ip) +#define unw_set_caching_policy UNW_OBJ(set_caching_policy) +#define unw_regname UNW_ARCH_OBJ(regname) +#define unw_flush_cache UNW_ARCH_OBJ(flush_cache) +#define unw_strerror UNW_ARCH_OBJ(strerror) + +extern void unw_local_access_addr_space_init (unw_addr_space_t); +extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int); +extern void unw_destroy_addr_space (unw_addr_space_t); +extern unw_accessors_t *unw_get_accessors (unw_addr_space_t); +extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t); +extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t); +extern const char *unw_regname (unw_regnum_t); + +extern int unw_init_local (unw_cursor_t *, unw_context_t *); +extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *); +extern int unw_step (unw_cursor_t *); +extern int unw_resume (unw_cursor_t *); +extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *); +extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t, + unw_proc_info_t *, void *); +extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *); +extern int unw_set_reg (unw_cursor_t *, int, unw_word_t); +extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *); +extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t); +extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *); +extern int unw_is_signal_frame (unw_cursor_t *); +extern int unw_handle_signal_frame (unw_cursor_t *); +extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *); +extern int unw_get_proc_name_by_ip (unw_addr_space_t, unw_word_t, char *, + size_t, unw_word_t *, void *); +extern const char *unw_strerror (int); +extern int unw_backtrace (void **, int); + +/* ANDROID support update. */ +extern int unw_map_local_cursor_valid (unw_map_cursor_t *); +extern void unw_map_local_cursor_get (unw_map_cursor_t *); +extern int unw_map_local_cursor_get_next (unw_map_cursor_t *, unw_map_t *); +extern int unw_map_local_create (void); +extern void unw_map_local_destroy (void); +extern void unw_map_set (unw_addr_space_t, unw_map_cursor_t *); +extern void unw_map_cursor_reset (unw_map_cursor_t *); +extern void unw_map_cursor_clear (unw_map_cursor_t *); +extern int unw_map_cursor_create (unw_map_cursor_t *, pid_t); +extern void unw_map_cursor_destroy (unw_map_cursor_t *); +extern int unw_map_cursor_get_next (unw_map_cursor_t *, unw_map_t *); +/* End of ANDROID update. */ + +extern unw_addr_space_t unw_local_addr_space; diff --git a/external/android-libunwind/include/libunwind-coredump.h b/external/android-libunwind/include/libunwind-coredump.h new file mode 100644 index 00000000000..d2b05e71c2e --- /dev/null +++ b/external/android-libunwind/include/libunwind-coredump.h @@ -0,0 +1,73 @@ +/* libunwind - a platform-independent unwind library + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef libunwind_coredump_h +#define libunwind_coredump_h + +#include + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* Helper routines which make it easy to use libunwind on a coredump. + They're available only if UNW_REMOTE_ONLY is _not_ defined and they + aren't really part of the libunwind API. They are implemented in a + archive library called libunwind-coredump.a. */ + +struct UCD_info; + +extern struct UCD_info *_UCD_create(const char *filename); +extern void _UCD_destroy(struct UCD_info *); + +extern int _UCD_get_num_threads(struct UCD_info *); +extern void _UCD_select_thread(struct UCD_info *, int); +extern pid_t _UCD_get_pid(struct UCD_info *); +extern int _UCD_get_cursig(struct UCD_info *); +extern int _UCD_add_backing_file_at_segment(struct UCD_info *, int phdr_no, const char *filename); +extern int _UCD_add_backing_file_at_vaddr(struct UCD_info *, + unsigned long vaddr, + const char *filename); + +extern int _UCD_find_proc_info (unw_addr_space_t, unw_word_t, + unw_proc_info_t *, int, void *); +extern void _UCD_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); +extern int _UCD_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, + void *); +extern int _UCD_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, + void *); +extern int _UCD_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int, void *); +extern int _UCD_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int, void *); +extern int _UCD_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, + unw_word_t *, void *); +extern int _UCD_resume (unw_addr_space_t, unw_cursor_t *, void *); +extern unw_accessors_t _UCD_accessors; + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* libunwind_coredump_h */ diff --git a/external/android-libunwind/include/libunwind-dynamic.h b/external/android-libunwind/include/libunwind-dynamic.h new file mode 100644 index 00000000000..584f392c567 --- /dev/null +++ b/external/android-libunwind/include/libunwind-dynamic.h @@ -0,0 +1,210 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* This file defines the runtime-support routines for dynamically +generated code. Even though it is implemented as part of libunwind, +it is logically separate from the interface to perform the actual +unwinding. In particular, this interface is always used in the +context of the unwind target, whereas the rest of the unwind API is +used in context of the process that is doing the unwind (which may be +a debugger running on another machine, for example). + +Note that the data-structures declared here server a dual purpose: +when a program registers a dynamically generated procedure, it uses +these structures directly. On the other hand, with remote-unwinding, +the data-structures are read from the remote process's memory and +translated into internalized versions. To facilitate remote-access, +the following rules should be followed in declaring these structures: + + (1) Declare a member as a pointer only if the the information the + member points to needs to be internalized as well (e.g., a + string representing a procedure name should be declared as + "const char *", but the instruction pointer should be declared + as unw_word_t). + + (2) Provide sufficient padding to ensure that no implicit padding + will be needed on any of the supported target architectures. For + the time being, padding data structures with the assumption that + sizeof (unw_word_t) == 8 should be sufficient. (Note: it's not + impossible to internalize structures with internal padding, but + it does make the process a bit harder). + + (3) Don't declare members that contain bitfields or floating-point + values. + + (4) Don't declare members with enumeration types. Declare them as + int32_t instead. */ + +typedef enum + { + UNW_DYN_STOP = 0, /* end-of-unwind-info marker */ + UNW_DYN_SAVE_REG, /* save register to another register */ + UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */ + UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */ + UNW_DYN_ADD, /* add constant value to a register */ + UNW_DYN_POP_FRAMES, /* drop one or more stack frames */ + UNW_DYN_LABEL_STATE, /* name the current state */ + UNW_DYN_COPY_STATE, /* set the region's entry-state */ + UNW_DYN_ALIAS /* get unwind info from an alias */ + } +unw_dyn_operation_t; + +typedef enum + { + UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */ + UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */ + UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */ + UNW_INFO_FORMAT_ARM_EXIDX /* ARM specific unwind info */ + } +unw_dyn_info_format_t; + +typedef struct unw_dyn_op + { + int8_t tag; /* what operation? */ + int8_t qp; /* qualifying predicate register */ + int16_t reg; /* what register */ + int32_t when; /* when does it take effect? */ + unw_word_t val; /* auxiliary value */ + } +unw_dyn_op_t; + +typedef struct unw_dyn_region_info + { + struct unw_dyn_region_info *next; /* linked list of regions */ + int32_t insn_count; /* region length (# of instructions) */ + uint32_t op_count; /* length of op-array */ + unw_dyn_op_t op[1]; /* variable-length op-array */ + } +unw_dyn_region_info_t; + +typedef struct unw_dyn_proc_info + { + unw_word_t name_ptr; /* address of human-readable procedure name */ + unw_word_t handler; /* address of personality routine */ + uint32_t flags; + int32_t pad0; + unw_dyn_region_info_t *regions; + } +unw_dyn_proc_info_t; + +typedef struct unw_dyn_table_info + { + unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ + unw_word_t segbase; /* segment base */ + unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ + unw_word_t *table_data; + } +unw_dyn_table_info_t; + +typedef struct unw_dyn_remote_table_info + { + unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ + unw_word_t segbase; /* segment base */ + unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ + unw_word_t table_data; + } +unw_dyn_remote_table_info_t; + +typedef struct unw_dyn_info + { + /* doubly-linked list of dyn-info structures: */ + struct unw_dyn_info *next; + struct unw_dyn_info *prev; + unw_word_t start_ip; /* first IP covered by this entry */ + unw_word_t end_ip; /* first IP NOT covered by this entry */ + unw_word_t gp; /* global-pointer in effect for this entry */ + int32_t format; /* real type: unw_dyn_info_format_t */ + int32_t pad; + union + { + unw_dyn_proc_info_t pi; + unw_dyn_table_info_t ti; + unw_dyn_remote_table_info_t rti; + } + u; + } +unw_dyn_info_t; + +typedef struct unw_dyn_info_list + { + uint32_t version; + uint32_t generation; + unw_dyn_info_t *first; + } +unw_dyn_info_list_t; + +/* Return the size (in bytes) of an unw_dyn_region_info_t structure that can + hold OP_COUNT ops. */ +#define _U_dyn_region_info_size(op_count) \ + ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \ + - (char *) NULL) + +/* Register the unwind info for a single procedure. + This routine is NOT signal-safe. */ +extern void _U_dyn_register (unw_dyn_info_t *); + +/* Cancel the unwind info for a single procedure. + This routine is NOT signal-safe. */ +extern void _U_dyn_cancel (unw_dyn_info_t *); + + +/* Convenience routines. */ + +#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \ + ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) }) + +#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \ + (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst))) + +#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \ + (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \ + (offset))) + +#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \ + (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \ + (offset))) + +#define _U_dyn_op_add(op, qp, when, reg, value) \ + (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value))) + +#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \ + (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames))) + +#define _U_dyn_op_label_state(op, label) \ + (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label))) + +#define _U_dyn_op_copy_state(op, label) \ + (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label))) + +#define _U_dyn_op_alias(op, qp, when, addr) \ + (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr))) + +#define _U_dyn_op_stop(op) \ + (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0)) + +/* The target-dependent qualifying predicate which is always TRUE. On + IA-64, that's p0 (0), on non-predicated architectures, the value is + ignored. */ +#define _U_QP_TRUE _U_TDEP_QP_TRUE diff --git a/external/android-libunwind/include/libunwind-hppa.h b/external/android-libunwind/include/libunwind-hppa.h new file mode 100644 index 00000000000..b5fba562718 --- /dev/null +++ b/external/android-libunwind/include/libunwind-hppa.h @@ -0,0 +1,131 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003-2004 Hewlett-Packard Co + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET hppa +#define UNW_TARGET_HPPA 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 511 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef union + { + struct { unw_word_t bits[2]; } raw; + double val; + } +unw_tdep_fpreg_t; + +typedef enum + { + /* Note: general registers are expected to start with index 0. + This convention facilitates architecture-independent + implementation of the C++ exception handling ABI. See + _Unwind_SetGR() and _Unwind_GetGR() for details. */ + UNW_HPPA_GR = 0, + UNW_HPPA_RP = 2, /* return pointer */ + UNW_HPPA_FP = 3, /* frame pointer */ + UNW_HPPA_SP = UNW_HPPA_GR + 30, + + UNW_HPPA_FR = UNW_HPPA_GR + 32, + + UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */ + + /* other "preserved" registers (fpsr etc.)... */ + + /* PA-RISC has 4 exception-argument registers but they're not + contiguous. To deal with this, we define 4 pseudo + exception-handling registers which we then alias to the actual + physical register. */ + + UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */ + UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */ + UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */ + UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */ + + /* frame info (read-only) */ + UNW_HPPA_CFA, + + UNW_TDEP_LAST_REG = UNW_HPPA_IP, + + UNW_TDEP_IP = UNW_HPPA_IP, + UNW_TDEP_SP = UNW_HPPA_SP, + UNW_TDEP_EH = UNW_HPPA_EH0 + } +hppa_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On PA-RISC, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32) + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no PA-RISC-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) +extern int unw_tdep_getcontext (unw_tdep_context_t *); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ia64.h b/external/android-libunwind/include/libunwind-ia64.h new file mode 100644 index 00000000000..4dcc4f9c34f --- /dev/null +++ b/external/android-libunwind/include/libunwind-ia64.h @@ -0,0 +1,197 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#include +#include + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#ifdef ia64 + /* This works around a bug in Intel's ECC v7.0 which defines "ia64" + as "1". */ +# undef ia64 +#endif + +#ifdef __hpux + /* On HP-UX, there is no hope of supporting UNW_LOCAL_ONLY, because + it's impossible to obtain the address of the members in the + sigcontext structure. */ +# undef UNW_LOCAL_ONLY +# define UNW_GENERIC_ONLY +#endif + +#define UNW_TARGET ia64 +#define UNW_TARGET_IA64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 511 + +/* If this bit is it indicates that the procedure saved all of ar.bsp, + ar.bspstore, and ar.rnat. If, additionally, ar.bsp != saved ar.bsp, + then this procedure has performed a register-backing-store switch. */ +#define UNW_PI_FLAG_IA64_RBS_SWITCH_BIT (UNW_PI_FLAG_FIRST_TDEP_BIT + 0) + +#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT) + +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; + +/* On IA-64, we want to access the contents of floating-point + registers as a pair of "words", but to ensure 16-byte alignment, we + make it a union that contains a "long double". This will do the + Right Thing on all known IA-64 platforms, including HP-UX. */ +typedef union + { + struct { unw_word_t bits[2]; } raw; + long double dummy; /* dummy to force 16-byte alignment */ + } +unw_tdep_fpreg_t; + +typedef struct + { + /* no ia64-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +typedef enum + { + /* Note: general registers are excepted to start with index 0. + This convention facilitates architecture-independent + implementation of the C++ exception handling ABI. See + _Unwind_SetGR() and _Unwind_GetGR() for details. */ + UNW_IA64_GR = 0, /* general registers (r0..r127) */ + UNW_IA64_GP = UNW_IA64_GR + 1, + UNW_IA64_TP = UNW_IA64_GR + 13, + + UNW_IA64_NAT = UNW_IA64_GR + 128, /* NaT registers (nat0..nat127) */ + + UNW_IA64_FR = UNW_IA64_NAT + 128, /* fp registers (f0..f127) */ + + UNW_IA64_AR = UNW_IA64_FR + 128, /* application registers (ar0..r127) */ + UNW_IA64_AR_RSC = UNW_IA64_AR + 16, + UNW_IA64_AR_BSP = UNW_IA64_AR + 17, + UNW_IA64_AR_BSPSTORE = UNW_IA64_AR + 18, + UNW_IA64_AR_RNAT = UNW_IA64_AR + 19, + UNW_IA64_AR_CSD = UNW_IA64_AR + 25, + UNW_IA64_AR_26 = UNW_IA64_AR + 26, + UNW_IA64_AR_SSD = UNW_IA64_AR_26, + UNW_IA64_AR_CCV = UNW_IA64_AR + 32, + UNW_IA64_AR_UNAT = UNW_IA64_AR + 36, + UNW_IA64_AR_FPSR = UNW_IA64_AR + 40, + UNW_IA64_AR_PFS = UNW_IA64_AR + 64, + UNW_IA64_AR_LC = UNW_IA64_AR + 65, + UNW_IA64_AR_EC = UNW_IA64_AR + 66, + + UNW_IA64_BR = UNW_IA64_AR + 128, /* branch registers (b0..p7) */ + UNW_IA64_RP = UNW_IA64_BR + 0, /* return pointer (rp) */ + UNW_IA64_PR = UNW_IA64_BR + 8, /* predicate registers (p0..p63) */ + UNW_IA64_CFM, + + /* frame info: */ + UNW_IA64_BSP, + UNW_IA64_IP, + UNW_IA64_SP, + + UNW_TDEP_LAST_REG = UNW_IA64_SP, + + UNW_TDEP_IP = UNW_IA64_IP, + UNW_TDEP_SP = UNW_IA64_SP, + UNW_TDEP_EH = UNW_IA64_GR + 15 + } +ia64_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 4 /* r15-r18 are exception args */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. On IA-64, + we use this to provide the bit number in which a NaT bit gets + saved. */ + uint8_t nat_bitnr; + + /* Padding reserved for future use. */ + uint8_t reserved[7]; + } +unw_tdep_save_loc_t; + +/* On IA-64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_IA64_FR) < 128) + +#include "libunwind-dynamic.h" +#include "libunwind-common.h" + +#ifdef __hpux + /* In theory, we could use _Uia64_getcontext() on HP-UX as well, but + the benefit of doing so would be marginal given that it can't + support UNW_LOCAL_ONLY. */ +# define unw_tdep_getcontext getcontext +#else +# define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) + extern int unw_tdep_getcontext (unw_tdep_context_t *); +#endif + +/* This is a helper routine to search an ia64 unwind table. If the + address-space argument AS points to something other than the local + address-space, the memory for the unwind-info will be allocated + with malloc(), and should be free()d during the put_unwind_info() + callback. This routine is signal-safe for the local-address-space + case ONLY. */ +#define unw_search_ia64_unwind_table UNW_OBJ(search_unwind_table) +extern int unw_search_ia64_unwind_table (unw_addr_space_t, unw_word_t, + unw_dyn_info_t *, unw_proc_info_t *, + int, void *); + +/* This is a helper routine which the get_dyn_info_list_addr() + callback can use to locate the special dynamic-info list entry in + an IA-64 unwind table. If the entry exists in the table, the + list-address is returned. In all other cases, 0 is returned. */ +extern unw_word_t _Uia64_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *, + void *); + +/* This is a helper routine to obtain the kernel-unwind info. It is + signal-safe. */ +extern int _Uia64_get_kernel_table (unw_dyn_info_t *); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-mips.h b/external/android-libunwind/include/libunwind-mips.h new file mode 100644 index 00000000000..83e44dead7f --- /dev/null +++ b/external/android-libunwind/include/libunwind-mips.h @@ -0,0 +1,163 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#ifdef mips +# undef mips +#endif + +#define UNW_TARGET mips +#define UNW_TARGET_MIPS 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +/* FIXME for MIPS. Too big? What do other things use for similar tasks? */ +#define UNW_TDEP_CURSOR_LEN 4096 + +/* The size of a "word" varies on MIPS. This type is used for memory + addresses and register values. To allow a single library to support + multiple ABIs, and to support N32 at all, we must use a 64-bit type + even when addresses are only 32 bits. */ +typedef uint64_t unw_word_t; +typedef int32_t unw_sword_t; + +/* FIXME: MIPS ABIs. */ +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_MIPS_R0, + UNW_MIPS_R1, + UNW_MIPS_R2, + UNW_MIPS_R3, + UNW_MIPS_R4, + UNW_MIPS_R5, + UNW_MIPS_R6, + UNW_MIPS_R7, + UNW_MIPS_R8, + UNW_MIPS_R9, + UNW_MIPS_R10, + UNW_MIPS_R11, + UNW_MIPS_R12, + UNW_MIPS_R13, + UNW_MIPS_R14, + UNW_MIPS_R15, + UNW_MIPS_R16, + UNW_MIPS_R17, + UNW_MIPS_R18, + UNW_MIPS_R19, + UNW_MIPS_R20, + UNW_MIPS_R21, + UNW_MIPS_R22, + UNW_MIPS_R23, + UNW_MIPS_R24, + UNW_MIPS_R25, + UNW_MIPS_R26, + UNW_MIPS_R27, + UNW_MIPS_R28, + UNW_MIPS_R29, + UNW_MIPS_R30, + UNW_MIPS_R31, + + UNW_MIPS_PC = 34, + + /* FIXME: Other registers! */ + + /* For MIPS, the CFA is the value of SP (r29) at the call site in the + previous frame. */ + UNW_MIPS_CFA, + + UNW_TDEP_LAST_REG = UNW_MIPS_R31, + + UNW_TDEP_IP = UNW_MIPS_R31, + UNW_TDEP_SP = UNW_MIPS_R29, + UNW_TDEP_EH = UNW_MIPS_R0 /* FIXME. */ + } +mips_regnum_t; + +typedef enum + { + UNW_MIPS_ABI_O32, + UNW_MIPS_ABI_N32, + UNW_MIPS_ABI_N64 + } +mips_abi_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for MIPS. */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On x86, we can directly use ucontext_t as the unwind context. FIXME for + MIPS. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no mips-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +/* There is no getcontext() on MIPS. Use a stub version which only saves GP + registers. FIXME: Not ideal, may not be sufficient for all libunwind + use cases. */ +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +extern int unw_tdep_getcontext (ucontext_t *uc); + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ppc32.h b/external/android-libunwind/include/libunwind-ppc32.h new file mode 100644 index 00000000000..51852e86571 --- /dev/null +++ b/external/android-libunwind/include/libunwind-ppc32.h @@ -0,0 +1,213 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET ppc32 +#define UNW_TARGET_PPC32 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* + * This needs to be big enough to accommodate "struct cursor", while + * leaving some slack for future expansion. Changing this value will + * require recompiling all users of this library. Stack allocation is + * relatively cheap and unwind-state copying is relatively rare, so we want + * to err on making it rather too big than too small. + * + * To simplify this whole process, we are at least initially taking the + * tack that UNW_PPC32_* map straight across to the .eh_frame column register + * numbers. These register numbers come from gcc's source in + * gcc/config/rs6000/rs6000.h + * + * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115 + * elements in the loc array, each sized 2 * unw_word_t, plus the rest of + * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's + * round that up to 280. + */ + +#define UNW_TDEP_CURSOR_LEN 280 + +#if __WORDSIZE==32 +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; +#else +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; +#endif + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_PPC32_R0, + UNW_PPC32_R1, /* called STACK_POINTER in gcc */ + UNW_PPC32_R2, + UNW_PPC32_R3, + UNW_PPC32_R4, + UNW_PPC32_R5, + UNW_PPC32_R6, + UNW_PPC32_R7, + UNW_PPC32_R8, + UNW_PPC32_R9, + UNW_PPC32_R10, + UNW_PPC32_R11, /* called STATIC_CHAIN in gcc */ + UNW_PPC32_R12, + UNW_PPC32_R13, + UNW_PPC32_R14, + UNW_PPC32_R15, + UNW_PPC32_R16, + UNW_PPC32_R17, + UNW_PPC32_R18, + UNW_PPC32_R19, + UNW_PPC32_R20, + UNW_PPC32_R21, + UNW_PPC32_R22, + UNW_PPC32_R23, + UNW_PPC32_R24, + UNW_PPC32_R25, + UNW_PPC32_R26, + UNW_PPC32_R27, + UNW_PPC32_R28, + UNW_PPC32_R29, + UNW_PPC32_R30, + UNW_PPC32_R31, /* called HARD_FRAME_POINTER in gcc */ + + /* Count Register */ + UNW_PPC32_CTR = 32, + /* Fixed-Point Status and Control Register */ + UNW_PPC32_XER = 33, + /* Condition Register */ + UNW_PPC32_CCR = 34, + /* Machine State Register */ + //UNW_PPC32_MSR = 35, + /* MQ or SPR0, not part of generic Power, part of MPC601 */ + //UNW_PPC32_MQ = 36, + /* Link Register */ + UNW_PPC32_LR = 36, + /* Floating Pointer Status and Control Register */ + UNW_PPC32_FPSCR = 37, + + UNW_PPC32_F0 = 48, + UNW_PPC32_F1, + UNW_PPC32_F2, + UNW_PPC32_F3, + UNW_PPC32_F4, + UNW_PPC32_F5, + UNW_PPC32_F6, + UNW_PPC32_F7, + UNW_PPC32_F8, + UNW_PPC32_F9, + UNW_PPC32_F10, + UNW_PPC32_F11, + UNW_PPC32_F12, + UNW_PPC32_F13, + UNW_PPC32_F14, + UNW_PPC32_F15, + UNW_PPC32_F16, + UNW_PPC32_F17, + UNW_PPC32_F18, + UNW_PPC32_F19, + UNW_PPC32_F20, + UNW_PPC32_F21, + UNW_PPC32_F22, + UNW_PPC32_F23, + UNW_PPC32_F24, + UNW_PPC32_F25, + UNW_PPC32_F26, + UNW_PPC32_F27, + UNW_PPC32_F28, + UNW_PPC32_F29, + UNW_PPC32_F30, + UNW_PPC32_F31, + + UNW_TDEP_LAST_REG = UNW_PPC32_F31, + + UNW_TDEP_IP = UNW_PPC32_LR, + UNW_TDEP_SP = UNW_PPC32_R1, + UNW_TDEP_EH = UNW_PPC32_R12 + } +ppc32_regnum_t; + +/* + * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for + * passing parameters to exception handlers. + */ + +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On ppc, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +/* XXX this is not ideal: an application should not be prevented from + using the "getcontext" name just because it's using libunwind. We + can't just use __getcontext() either, because that isn't exported + by glibc... */ +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no ppc32-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ppc64.h b/external/android-libunwind/include/libunwind-ppc64.h new file mode 100644 index 00000000000..e0dbaaa9e00 --- /dev/null +++ b/external/android-libunwind/include/libunwind-ppc64.h @@ -0,0 +1,270 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + + Copied from libunwind-x86_64.h, modified slightly for building + frysk successfully on ppc64, by Wu Zhou + Will be replaced when libunwind is ready on ppc64 platform. + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include + +#define UNW_TARGET ppc64 +#define UNW_TARGET_PPC64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* + * This needs to be big enough to accommodate "struct cursor", while + * leaving some slack for future expansion. Changing this value will + * require recompiling all users of this library. Stack allocation is + * relatively cheap and unwind-state copying is relatively rare, so we want + * to err on making it rather too big than too small. + * + * To simplify this whole process, we are at least initially taking the + * tack that UNW_PPC64_* map straight across to the .eh_frame column register + * numbers. These register numbers come from gcc's source in + * gcc/config/rs6000/rs6000.h + * + * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115 + * elements in the loc array, each sized 2 * unw_word_t, plus the rest of + * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's + * round that up to 280. + */ + +#define UNW_TDEP_CURSOR_LEN 280 + +#if __WORDSIZE==32 +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; +#else +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; +#endif + +typedef long double unw_tdep_fpreg_t; + +/* + * Vector register (in PowerPC64 used for AltiVec registers) + */ +typedef struct { + uint64_t halves[2]; +} unw_tdep_vreg_t; + +typedef enum + { + UNW_PPC64_R0, + UNW_PPC64_R1, /* called STACK_POINTER in gcc */ + UNW_PPC64_R2, + UNW_PPC64_R3, + UNW_PPC64_R4, + UNW_PPC64_R5, + UNW_PPC64_R6, + UNW_PPC64_R7, + UNW_PPC64_R8, + UNW_PPC64_R9, + UNW_PPC64_R10, + UNW_PPC64_R11, /* called STATIC_CHAIN in gcc */ + UNW_PPC64_R12, + UNW_PPC64_R13, + UNW_PPC64_R14, + UNW_PPC64_R15, + UNW_PPC64_R16, + UNW_PPC64_R17, + UNW_PPC64_R18, + UNW_PPC64_R19, + UNW_PPC64_R20, + UNW_PPC64_R21, + UNW_PPC64_R22, + UNW_PPC64_R23, + UNW_PPC64_R24, + UNW_PPC64_R25, + UNW_PPC64_R26, + UNW_PPC64_R27, + UNW_PPC64_R28, + UNW_PPC64_R29, + UNW_PPC64_R30, + UNW_PPC64_R31, /* called HARD_FRAME_POINTER in gcc */ + + UNW_PPC64_F0 = 32, + UNW_PPC64_F1, + UNW_PPC64_F2, + UNW_PPC64_F3, + UNW_PPC64_F4, + UNW_PPC64_F5, + UNW_PPC64_F6, + UNW_PPC64_F7, + UNW_PPC64_F8, + UNW_PPC64_F9, + UNW_PPC64_F10, + UNW_PPC64_F11, + UNW_PPC64_F12, + UNW_PPC64_F13, + UNW_PPC64_F14, + UNW_PPC64_F15, + UNW_PPC64_F16, + UNW_PPC64_F17, + UNW_PPC64_F18, + UNW_PPC64_F19, + UNW_PPC64_F20, + UNW_PPC64_F21, + UNW_PPC64_F22, + UNW_PPC64_F23, + UNW_PPC64_F24, + UNW_PPC64_F25, + UNW_PPC64_F26, + UNW_PPC64_F27, + UNW_PPC64_F28, + UNW_PPC64_F29, + UNW_PPC64_F30, + UNW_PPC64_F31, + /* Note that there doesn't appear to be an .eh_frame register column + for the FPSCR register. I don't know why this is. Since .eh_frame + info is what this implementation uses for unwinding, we have no way + to unwind this register, and so we will not expose an FPSCR register + number in the libunwind API. + */ + + UNW_PPC64_LR = 65, + UNW_PPC64_CTR = 66, + UNW_PPC64_ARG_POINTER = 67, + + UNW_PPC64_CR0 = 68, + UNW_PPC64_CR1, + UNW_PPC64_CR2, + UNW_PPC64_CR3, + UNW_PPC64_CR4, + /* CR5 .. CR7 are currently unused */ + UNW_PPC64_CR5, + UNW_PPC64_CR6, + UNW_PPC64_CR7, + + UNW_PPC64_XER = 76, + + UNW_PPC64_V0 = 77, + UNW_PPC64_V1, + UNW_PPC64_V2, + UNW_PPC64_V3, + UNW_PPC64_V4, + UNW_PPC64_V5, + UNW_PPC64_V6, + UNW_PPC64_V7, + UNW_PPC64_V8, + UNW_PPC64_V9, + UNW_PPC64_V10, + UNW_PPC64_V11, + UNW_PPC64_V12, + UNW_PPC64_V13, + UNW_PPC64_V14, + UNW_PPC64_V15, + UNW_PPC64_V16, + UNW_PPC64_V17, + UNW_PPC64_V18, + UNW_PPC64_V19, + UNW_PPC64_V20, + UNW_PPC64_V21, + UNW_PPC64_V22, + UNW_PPC64_V23, + UNW_PPC64_V24, + UNW_PPC64_V25, + UNW_PPC64_V26, + UNW_PPC64_V27, + UNW_PPC64_V28, + UNW_PPC64_V29, + UNW_PPC64_V30, + UNW_PPC64_V31, + + UNW_PPC64_VRSAVE = 109, + UNW_PPC64_VSCR = 110, + UNW_PPC64_SPE_ACC = 111, + UNW_PPC64_SPEFSCR = 112, + + /* frame info (read-only) */ + UNW_PPC64_FRAME_POINTER, + UNW_PPC64_NIP, + + + UNW_TDEP_LAST_REG = UNW_PPC64_NIP, + + UNW_TDEP_IP = UNW_PPC64_NIP, + UNW_TDEP_SP = UNW_PPC64_R1, + UNW_TDEP_EH = UNW_PPC64_R12 + } +ppc64_regnum_t; + +/* + * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for + * passing parameters to exception handlers. + */ + +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On ppc64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +/* XXX this is not ideal: an application should not be prevented from + using the "getcontext" name just because it's using libunwind. We + can't just use __getcontext() either, because that isn't exported + by glibc... */ +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no ppc64-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ptrace.h b/external/android-libunwind/include/libunwind-ptrace.h new file mode 100644 index 00000000000..7fca205e50c --- /dev/null +++ b/external/android-libunwind/include/libunwind-ptrace.h @@ -0,0 +1,63 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef libunwind_ptrace_h +#define libunwind_ptrace_h + +#include + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* Helper routines which make it easy to use libunwind via ptrace(). + They're available only if UNW_REMOTE_ONLY is _not_ defined and they + aren't really part of the libunwind API. They are implemented in a + archive library called libunwind-ptrace.a. */ + +extern void *_UPT_create (pid_t); +extern void _UPT_destroy (void *); +extern int _UPT_find_proc_info (unw_addr_space_t, unw_word_t, + unw_proc_info_t *, int, void *); +extern void _UPT_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); +extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, + void *); +extern int _UPT_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, + void *); +extern int _UPT_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int, void *); +extern int _UPT_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int, void *); +extern int _UPT_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, + unw_word_t *, void *); +extern int _UPT_resume (unw_addr_space_t, unw_cursor_t *, void *); +extern unw_accessors_t _UPT_accessors; + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* libunwind_ptrace_h */ diff --git a/external/android-libunwind/include/libunwind-sh.h b/external/android-libunwind/include/libunwind-sh.h new file mode 100644 index 00000000000..8f36a258db7 --- /dev/null +++ b/external/android-libunwind/include/libunwind-sh.h @@ -0,0 +1,120 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET sh +#define UNW_TARGET_SH 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +#define UNW_TDEP_CURSOR_LEN 4096 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_SH_R0, + UNW_SH_R1, + UNW_SH_R2, + UNW_SH_R3, + UNW_SH_R4, + UNW_SH_R5, + UNW_SH_R6, + UNW_SH_R7, + UNW_SH_R8, + UNW_SH_R9, + UNW_SH_R10, + UNW_SH_R11, + UNW_SH_R12, + UNW_SH_R13, + UNW_SH_R14, + UNW_SH_R15, + + UNW_SH_PC, + UNW_SH_PR, + + UNW_TDEP_LAST_REG = UNW_SH_PR, + + UNW_TDEP_IP = UNW_SH_PR, + UNW_TDEP_SP = UNW_SH_R15, + UNW_TDEP_EH = UNW_SH_R0 + } +sh_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 + +typedef ucontext_t unw_tdep_context_t; + +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no sh-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-x86.h b/external/android-libunwind/include/libunwind-x86.h new file mode 100644 index 00000000000..e46632d51f0 --- /dev/null +++ b/external/android-libunwind/include/libunwind-x86.h @@ -0,0 +1,193 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET x86 +#define UNW_TARGET_X86 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 127 + +typedef uint32_t unw_word_t; +typedef int32_t unw_sword_t; + +typedef union { + struct { uint8_t b[4]; } val32; + struct { uint8_t b[10]; } val80; + struct { uint8_t b[16]; } val128; +} unw_tdep_fpreg_t; + +typedef enum + { + /* Note: general registers are expected to start with index 0. + This convention facilitates architecture-independent + implementation of the C++ exception handling ABI. See + _Unwind_SetGR() and _Unwind_GetGR() for details. + + The described register usage convention is based on "System V + Application Binary Interface, Intel386 Architecture Processor + Supplement, Fourth Edition" at + + http://www.linuxbase.org/spec/refspecs/elf/abi386-4.pdf + + It would have been nice to use the same register numbering as + DWARF, but that doesn't work because the libunwind requires + that the exception argument registers be consecutive, which the + wouldn't be with the DWARF numbering. */ + UNW_X86_EAX, /* scratch (exception argument 1) */ + UNW_X86_EDX, /* scratch (exception argument 2) */ + UNW_X86_ECX, /* scratch */ + UNW_X86_EBX, /* preserved */ + UNW_X86_ESI, /* preserved */ + UNW_X86_EDI, /* preserved */ + UNW_X86_EBP, /* (optional) frame-register */ + UNW_X86_ESP, /* (optional) frame-register */ + UNW_X86_EIP, /* frame-register */ + UNW_X86_EFLAGS, /* scratch (except for "direction", which is fixed */ + UNW_X86_TRAPNO, /* scratch */ + + /* MMX/stacked-fp registers */ + UNW_X86_ST0, /* fp return value */ + UNW_X86_ST1, /* scratch */ + UNW_X86_ST2, /* scratch */ + UNW_X86_ST3, /* scratch */ + UNW_X86_ST4, /* scratch */ + UNW_X86_ST5, /* scratch */ + UNW_X86_ST6, /* scratch */ + UNW_X86_ST7, /* scratch */ + + UNW_X86_FCW, /* scratch */ + UNW_X86_FSW, /* scratch */ + UNW_X86_FTW, /* scratch */ + UNW_X86_FOP, /* scratch */ + UNW_X86_FCS, /* scratch */ + UNW_X86_FIP, /* scratch */ + UNW_X86_FEA, /* scratch */ + UNW_X86_FDS, /* scratch */ + + /* SSE registers */ + UNW_X86_XMM0_lo, /* scratch */ + UNW_X86_XMM0_hi, /* scratch */ + UNW_X86_XMM1_lo, /* scratch */ + UNW_X86_XMM1_hi, /* scratch */ + UNW_X86_XMM2_lo, /* scratch */ + UNW_X86_XMM2_hi, /* scratch */ + UNW_X86_XMM3_lo, /* scratch */ + UNW_X86_XMM3_hi, /* scratch */ + UNW_X86_XMM4_lo, /* scratch */ + UNW_X86_XMM4_hi, /* scratch */ + UNW_X86_XMM5_lo, /* scratch */ + UNW_X86_XMM5_hi, /* scratch */ + UNW_X86_XMM6_lo, /* scratch */ + UNW_X86_XMM6_hi, /* scratch */ + UNW_X86_XMM7_lo, /* scratch */ + UNW_X86_XMM7_hi, /* scratch */ + + UNW_X86_MXCSR, /* scratch */ + + /* segment registers */ + UNW_X86_GS, /* special */ + UNW_X86_FS, /* special */ + UNW_X86_ES, /* special */ + UNW_X86_DS, /* special */ + UNW_X86_SS, /* special */ + UNW_X86_CS, /* special */ + UNW_X86_TSS, /* special */ + UNW_X86_LDT, /* special */ + + /* frame info (read-only) */ + UNW_X86_CFA, + + UNW_X86_XMM0, /* scratch */ + UNW_X86_XMM1, /* scratch */ + UNW_X86_XMM2, /* scratch */ + UNW_X86_XMM3, /* scratch */ + UNW_X86_XMM4, /* scratch */ + UNW_X86_XMM5, /* scratch */ + UNW_X86_XMM6, /* scratch */ + UNW_X86_XMM7, /* scratch */ + + UNW_TDEP_LAST_REG = UNW_X86_XMM7, + + UNW_TDEP_IP = UNW_X86_EIP, + UNW_TDEP_SP = UNW_X86_ESP, + UNW_TDEP_EH = UNW_X86_EAX + } +x86_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* eax and edx are exception args */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On x86, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no x86-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +extern int unw_tdep_getcontext (unw_tdep_context_t *); + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-x86_64.h b/external/android-libunwind/include/libunwind-x86_64.h new file mode 100644 index 00000000000..ed8cb11fbdb --- /dev/null +++ b/external/android-libunwind/include/libunwind-x86_64.h @@ -0,0 +1,145 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2002-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + + Modified for x86_64 by Max Asbock + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET x86_64 +#define UNW_TARGET_X86_64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ +#define UNW_TDEP_CURSOR_LEN 127 + +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_X86_64_RAX, + UNW_X86_64_RDX, + UNW_X86_64_RCX, + UNW_X86_64_RBX, + UNW_X86_64_RSI, + UNW_X86_64_RDI, + UNW_X86_64_RBP, + UNW_X86_64_RSP, + UNW_X86_64_R8, + UNW_X86_64_R9, + UNW_X86_64_R10, + UNW_X86_64_R11, + UNW_X86_64_R12, + UNW_X86_64_R13, + UNW_X86_64_R14, + UNW_X86_64_R15, + UNW_X86_64_RIP, +#ifdef CONFIG_MSABI_SUPPORT + UNW_X86_64_XMM0, + UNW_X86_64_XMM1, + UNW_X86_64_XMM2, + UNW_X86_64_XMM3, + UNW_X86_64_XMM4, + UNW_X86_64_XMM5, + UNW_X86_64_XMM6, + UNW_X86_64_XMM7, + UNW_X86_64_XMM8, + UNW_X86_64_XMM9, + UNW_X86_64_XMM10, + UNW_X86_64_XMM11, + UNW_X86_64_XMM12, + UNW_X86_64_XMM13, + UNW_X86_64_XMM14, + UNW_X86_64_XMM15, + UNW_TDEP_LAST_REG = UNW_X86_64_XMM15, +#else + UNW_TDEP_LAST_REG = UNW_X86_64_RIP, +#endif + + /* XXX Add other regs here */ + + /* frame info (read-only) */ + UNW_X86_64_CFA, + + UNW_TDEP_IP = UNW_X86_64_RIP, + UNW_TDEP_SP = UNW_X86_64_RSP, + UNW_TDEP_BP = UNW_X86_64_RBP, + UNW_TDEP_EH = UNW_X86_64_RAX + } +x86_64_regnum_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_save_loc_t; + +/* On x86_64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +typedef struct + { + /* no x86-64-specific auxiliary proc-info */ + /* ANDROID support update. */ + char __reserved; + /* End of ANDROID update. */ + } +unw_tdep_proc_info_t; + +#include "libunwind-dynamic.h" +#include "libunwind-common.h" + +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) + +extern int unw_tdep_getcontext (unw_tdep_context_t *); +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind.h b/external/android-libunwind/include/libunwind.h new file mode 100644 index 00000000000..0fafda653b8 --- /dev/null +++ b/external/android-libunwind/include/libunwind.h @@ -0,0 +1,34 @@ +/* Provide a real file - not a symlink - as it would cause multiarch conflicts + when multiple different arch releases are installed simultaneously. */ + +#ifndef UNW_REMOTE_ONLY + +#if defined __aarch64__ +#include "libunwind-aarch64.h" +#elif defined __arm__ +# include "libunwind-arm.h" +#elif defined __hppa__ +# include "libunwind-hppa.h" +#elif defined __ia64__ +# include "libunwind-ia64.h" +#elif defined __mips__ +# include "libunwind-mips.h" +#elif defined __powerpc__ && !defined __powerpc64__ +# include "libunwind-ppc32.h" +#elif defined __powerpc64__ +# include "libunwind-ppc64.h" +#elif defined __sh__ +# include "libunwind-sh.h" +#elif defined __i386__ +# include "libunwind-x86.h" +#elif defined __x86_64__ +# include "libunwind-x86_64.h" +#else +# error "Unsupported arch" +#endif + +#else /* UNW_REMOTE_ONLY */ + +# include "libunwind-arm.h" + +#endif /* UNW_REMOTE_ONLY */ diff --git a/external/android-libunwind/include/unwind.h b/external/android-libunwind/include/unwind.h new file mode 100644 index 00000000000..f8d43d0d0e1 --- /dev/null +++ b/external/android-libunwind/include/unwind.h @@ -0,0 +1,154 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2003 Hewlett-Packard Co + Contributed by David Mosberger-Tang + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +/* For uint64_t */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimal interface as per C++ ABI draft standard: + + http://www.codesourcery.com/cxx-abi/abi-eh.html */ + +typedef enum + { + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 + } +_Unwind_Reason_Code; + +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 + +struct _Unwind_Context; /* opaque data-structure */ +struct _Unwind_Exception; /* forward-declaration */ + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, + uint64_t, + struct _Unwind_Exception *, + struct _Unwind_Context *, + void *); + +/* The C++ ABI requires exception_class, private_1, and private_2 to + be of type uint64 and the entire structure to be + double-word-aligned. Please note that exception_class stays 64-bit + even on 32-bit machines for gcc compatibility. */ +struct _Unwind_Exception + { + uint64_t exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + unsigned long private_1; + unsigned long private_2; + } __attribute__((__aligned__)); + +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, void *); +extern void _Unwind_Resume (struct _Unwind_Exception *); +extern void _Unwind_DeleteException (struct _Unwind_Exception *); +extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); +extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); +extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); +extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); +extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); +extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); + +#ifdef _GNU_SOURCE + +/* Callback for _Unwind_Backtrace(). The backtrace stops immediately + if the callback returns any value other than _URC_NO_REASON. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, + void *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why + _UA_END_OF_STACK exists. */ +# define _UA_END_OF_STACK 16 + +/* If the unwind was initiated due to a forced unwind, resume that + operation, else re-raise the exception. This is used by + __cxa_rethrow(). */ +extern _Unwind_Reason_Code + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why + _Unwind_GetBSP() exists. */ +extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); + +/* Return the "canonical frame address" for the given context. + This is used by NPTL... */ +extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); + +/* Return the base-address for data references. */ +extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); + +/* Return the base-address for text references. */ +extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); + +/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any + cleanup. The first frame for which the callback is invoked is the + one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() + returns _URC_END_OF_STACK when the backtrace stopped due to + reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it + stops for any other reason. */ +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* Find the start-address of the procedure containing the specified IP + or NULL if it cannot be found (e.g., because the function has no + unwind info). Note: there is not necessarily a one-to-one + correspondence between source-level functions and procedures: some + functions don't have unwind-info and others are split into multiple + procedures. */ +extern void *_Unwind_FindEnclosingFunction (void *); + +/* See also Linux Standard Base Spec: + http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ + +#endif /* _GNU_SOURCE */ + +#ifdef __cplusplus +}; +#endif + +#endif /* _UNWIND_H */ diff --git a/external/referencesource b/external/referencesource index 6c6e36218c4..2f66da8d34b 160000 --- a/external/referencesource +++ b/external/referencesource @@ -1 +1 @@ -Subproject commit 6c6e36218c4a0b6dfb85bd27fa6746467761e8a0 +Subproject commit 2f66da8d34b30473dac23f02b1a843d0717b9f1a diff --git a/libgc/configure.ac b/libgc/configure.ac index ac992abfaf9..7f5aa03148d 100644 --- a/libgc/configure.ac +++ b/libgc/configure.ac @@ -233,10 +233,8 @@ AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue) AC_MSG_CHECKING(for __sync_bool_compare_and_swap) AC_TRY_COMPILE([],[ volatile unsigned int foo = 0; -int main(int argc, char** argv) { - unsigned int r1 = __sync_bool_compare_and_swap(&foo, 0, 1); - return 0; -} +unsigned int r1 = __sync_bool_compare_and_swap(&foo, 0, 1); +return 0; ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAS___SYNC_BOOL_COMPARE_AND_SWAP) diff --git a/man/mono.1 b/man/mono.1 index 7eb8055fb4f..4c0d27d949b 100644 --- a/man/mono.1 +++ b/man/mono.1 @@ -786,8 +786,7 @@ to Mono, like this: .PP In the above sample Mono will load the user defined profiler from the shared library `mono-profiler-custom.so'. This profiler module must -be on your dynamic linker library path, or in the MONO_PROFILER_LIB_DIR -path (see "RUNTIME OPTIONS" below). +be on your dynamic linker library path. .PP A list of other third party profilers is available from Mono's web site (www.mono-project.com/docs/advanced/performance-tips/) @@ -1509,30 +1508,6 @@ For a complete description of recommended practices for application deployment, see http://www.mono-project.com/docs/getting-started/application-deployment/ .TP -\fBMONO_PROFILER_LIB_DIR\fR -Provides a search path to the runtime where to look for custom profilers. See the -section "CUSTOM PROFILERS" above for more information. Custom profilers will be -searched for in the MONO_PROFILER_LIB_DIR path before the standard library paths. - -.TP -\fBMONO_RTC\fR -Experimental RTC support in the statistical profiler: if the user has -the permission, more accurate statistics are gathered. The MONO_RTC -value must be restricted to what the Linux rtc allows: power of two -from 64 to 8192 Hz. To enable higher frequencies like 4096 Hz, run as root: -.nf - - echo 4096 > /proc/sys/dev/rtc/max-user-freq - -.fi -.Sp -For example: -.nf - - MONO_RTC=4096 mono --profiler=default:stat program.exe - -.fi -.TP \fBMONO_SHARED_DIR\fR If set its the directory where the ".wapi" handle state is stored. This is the directory where the Windows I/O Emulation layer stores its diff --git a/mcs/Makefile b/mcs/Makefile index 1f4566b61c7..7dbfb638917 100644 --- a/mcs/Makefile +++ b/mcs/Makefile @@ -86,11 +86,9 @@ package := mcs-$(VERSION) DISTFILES = \ AUTHORS \ COPYING \ - COPYING.LIB \ INSTALL.txt \ Makefile \ mkinstalldirs \ - MIT.X11 \ MonoIcon.png \ README \ ScalableMonoIcon.svg \ diff --git a/mcs/build/config-default.make b/mcs/build/config-default.make index 658faa991ce..145665799cc 100644 --- a/mcs/build/config-default.make +++ b/mcs/build/config-default.make @@ -10,7 +10,7 @@ CODEPAGE = 65001 RUNTIME_FLAGS = -TEST_HARNESS = $(topdir)/class/lib/$(PROFILE)/nunit-console.exe +TEST_HARNESS = $(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-console.exe MCS_FLAGS = MBAS_FLAGS = $(PLATFORM_DEBUG_FLAGS) LIBRARY_FLAGS = /noconfig diff --git a/mcs/build/executable.make b/mcs/build/executable.make index 7ac3b338462..29ba89909e6 100644 --- a/mcs/build/executable.make +++ b/mcs/build/executable.make @@ -31,6 +31,9 @@ ifdef base_prog_config PROGRAM_config := $(build_libdir)$(PROGRAM).config endif +sn = $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/sn.exe +SN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(sn) -q + the_lib = $(the_libdir)$(base_prog) build_lib = $(build_libdir)$(base_prog) @@ -110,7 +113,10 @@ endif $(the_lib): $(the_libdir)/.stamp $(build_lib): $(BUILT_SOURCES) $(EXTRA_SOURCES) $(response) $(build_libdir:=/.stamp) - $(PROGRAM_COMPILE) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response) + $(PROGRAM_COMPILE) $(MCS_REFERENCES) -target:exe -out:$@ $(BUILT_SOURCES) $(EXTRA_SOURCES) @$(response) +ifdef PROGRAM_SNK + $(Q) $(SN) -R $@ $(PROGRAM_SNK) +endif ifdef PROGRAM_USE_INTERMEDIATE_FILE $(the_lib): $(build_lib) @@ -143,6 +149,9 @@ endif -include $(makefrag) +MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(LIB_REFS)) +MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.exe,$(EXE_REFS)) + all-local: $(makefrag) $(extra_targets) csproj-local: diff --git a/mcs/build/library.make b/mcs/build/library.make index 1df98aeea1f..b420a8364d7 100644 --- a/mcs/build/library.make +++ b/mcs/build/library.make @@ -18,7 +18,13 @@ # Have to rename to handle differences between assembly/directory names DEP_LIBS=$(patsubst System.Xml,System.XML,$(LIB_REFS)) -LIB_MCS_FLAGS += $(patsubst %,-r:%.dll,$(LIB_REFS)) +_FILTER_OUT = $(foreach x,$(2),$(if $(findstring $(1),$(x)),,$(x))) + +LIB_REFS_FULL = $(call _FILTER_OUT,=, $(LIB_REFS)) +LIB_REFS_ALIAS = $(filter-out $(LIB_REFS_FULL),$(LIB_REFS)) + +LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(LIB_REFS_FULL)) +LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE)/,$(LIB_REFS_ALIAS))) sourcefile = $(LIBRARY).sources @@ -253,6 +259,7 @@ dist-local: dist-default for f in `$(topdir)/tools/removecomments.sh $(wildcard *$(LIBRARY).sources)` $(TEST_FILES) ; do \ case $$f in \ ../*) : ;; \ + *.g.cs) : ;; \ *) dest=`dirname "$$f"` ; \ case $$subs in *" $$dest "*) : ;; *) subs=" $$dest$$subs" ; $(MKINSTALLDIRS) $(distdir)/$$dest ;; esac ; \ cp -p "$$f" $(distdir)/$$dest || exit 1 ;; \ diff --git a/mcs/build/profiles/build.make b/mcs/build/profiles/build.make index 5273928a0ed..3b4c7e0706e 100644 --- a/mcs/build/profiles/build.make +++ b/mcs/build/profiles/build.make @@ -12,8 +12,8 @@ MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARAT profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll -PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll +PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) NO_SIGN_ASSEMBLY = yes NO_TEST = yes diff --git a/mcs/build/profiles/mobile.make b/mcs/build/profiles/mobile.make index 6f6108c08aa..70908afa4e1 100644 --- a/mcs/build/profiles/mobile.make +++ b/mcs/build/profiles/mobile.make @@ -11,7 +11,7 @@ RESGEN = resgen2 profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll PROFILE_MCS_FLAGS = \ -d:NET_1_1 \ @@ -26,7 +26,6 @@ PROFILE_MCS_FLAGS = \ -d:DISABLE_CAS_USE \ -nowarn:1699 \ -nostdlib \ - -lib:$(topdir)/class/lib/$(PROFILE) \ $(DEFAULT_REFERENCES) \ $(PLATFORM_DEBUG_FLAGS) diff --git a/mcs/build/profiles/mobile_static.make b/mcs/build/profiles/mobile_static.make index 0c3c8125cfd..f13e65d83cc 100644 --- a/mcs/build/profiles/mobile_static.make +++ b/mcs/build/profiles/mobile_static.make @@ -11,7 +11,7 @@ RESGEN = resgen2 profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll PROFILE_MCS_FLAGS = \ -d:NET_1_1 \ @@ -28,7 +28,6 @@ PROFILE_MCS_FLAGS = \ -d:DISABLE_COM \ -nowarn:1699 \ -nostdlib \ - -lib:$(topdir)/class/lib/$(PROFILE) \ $(DEFAULT_REFERENCES) \ $(PLATFORM_DEBUG_FLAGS) diff --git a/mcs/build/profiles/monodroid.make b/mcs/build/profiles/monodroid.make index 49f85dcf8ee..9ea27d6c9c7 100644 --- a/mcs/build/profiles/monodroid.make +++ b/mcs/build/profiles/monodroid.make @@ -11,7 +11,7 @@ RESGEN = resgen2 profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll PROFILE_MCS_FLAGS = \ -d:NET_1_1 \ @@ -28,7 +28,6 @@ PROFILE_MCS_FLAGS = \ -d:ANDROID \ -nowarn:1699 \ -nostdlib \ - -lib:$(topdir)/class/lib/$(PROFILE) \ $(DEFAULT_REFERENCES) \ $(PLATFORM_DEBUG_FLAGS) diff --git a/mcs/build/profiles/monotouch_runtime.make b/mcs/build/profiles/monotouch_runtime.make index 7e963cb73c0..f127fd7d190 100644 --- a/mcs/build/profiles/monotouch_runtime.make +++ b/mcs/build/profiles/monotouch_runtime.make @@ -13,7 +13,7 @@ RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2 profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll PROFILE_MCS_FLAGS = \ -d:NET_1_1 \ -d:NET_2_0 \ @@ -30,7 +30,6 @@ PROFILE_MCS_FLAGS = \ -d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \ -nowarn:1699 \ -nostdlib \ - -lib:$(topdir)/class/lib/$(PROFILE) \ $(DEFAULT_REFERENCES) \ $(PLATFORM_DEBUG_FLAGS) diff --git a/mcs/build/profiles/net_4_x.make b/mcs/build/profiles/net_4_x.make index a634dac3928..a93b03b7f6b 100644 --- a/mcs/build/profiles/net_4_x.make +++ b/mcs/build/profiles/net_4_x.make @@ -10,8 +10,8 @@ MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARAT profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll -PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS) +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll +PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS) FRAMEWORK_VERSION = 4.5 XBUILD_VERSION = 4.0 diff --git a/mcs/build/profiles/xammac.make b/mcs/build/profiles/xammac.make index a9a6ef9ab25..d3cbdb5d972 100644 --- a/mcs/build/profiles/xammac.make +++ b/mcs/build/profiles/xammac.make @@ -9,7 +9,7 @@ RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2 profile-check: @: -DEFAULT_REFERENCES = -r:mscorlib.dll +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll PROFILE_MCS_FLAGS = \ -d:NET_1_1 \ @@ -27,7 +27,6 @@ PROFILE_MCS_FLAGS = \ -d:XAMARIN_MODERN \ -nowarn:1699 \ -nostdlib \ - -lib:$(topdir)/class/lib/$(PROFILE) \ $(DEFAULT_REFERENCES) \ $(PLATFORM_DEBUG_FLAGS) diff --git a/mcs/build/profiles/xbuild_12.make b/mcs/build/profiles/xbuild_12.make index 7150d2529e9..a0b681071dd 100644 --- a/mcs/build/profiles/xbuild_12.make +++ b/mcs/build/profiles/xbuild_12.make @@ -2,6 +2,10 @@ include $(topdir)/build/profiles/net_4_x.make -PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12 -d:MONO -d:DISABLE_CAS_USE -lib:$(topdir)/class/lib/net_4_x +PARENT_PROFILE = ../net_4_x/ +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x/mscorlib.dll +PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12 + +RESGEN_EXE = $(topdir)/class/lib/net_4_x/resgen.exe XBUILD_VERSION = 12.0 diff --git a/mcs/build/profiles/xbuild_14.make b/mcs/build/profiles/xbuild_14.make index 4e35ffc2305..60809393a62 100644 --- a/mcs/build/profiles/xbuild_14.make +++ b/mcs/build/profiles/xbuild_14.make @@ -1,7 +1,7 @@ # -*- makefile -*- -include $(topdir)/build/profiles/net_4_x.make +include $(topdir)/build/profiles/xbuild_12.make -PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12 -d:XBUILD_14 -d:MONO -d:DISABLE_CAS_USE -lib:$(topdir)/class/lib/net_4_x +PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_14 XBUILD_VERSION = 14.0 diff --git a/mcs/build/rules.make b/mcs/build/rules.make index 54c946a8730..5fda8826d12 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -43,9 +43,10 @@ MKINSTALLDIRS = $(SHELL) $(topdir)/mkinstalldirs INTERNAL_MBAS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/mbas/mbas.exe INTERNAL_GMCS = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/mcs.exe INTERNAL_ILASM = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/ilasm.exe -corlib = mscorlib.dll +INTERNAL_CSC = $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION) -INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/resgen.exe +RESGEN_EXE = $(topdir)/class/lib/$(PROFILE)/resgen.exe +INTERNAL_RESGEN = $(RUNTIME) $(RUNTIME_FLAGS) $(RESGEN_EXE) RESGEN = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_RESGEN) STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe diff --git a/mcs/build/tests.make b/mcs/build/tests.make index e8d52d00332..7f27dd9fd51 100644 --- a/mcs/build/tests.make +++ b/mcs/build/tests.make @@ -25,7 +25,9 @@ else test_nunit_lib = nunit.framework.dll nunit.core.dll nunit.util.dll nunit.mocks.dll endif -test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%) +TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(TEST_LIB_REFS)) + +test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)%) test_nunit_ref = $(test_nunit_dep:%=-r:%) tests_CLEAN_FILES += TestResult*.xml @@ -41,7 +43,7 @@ test_sourcefile_excludes = $(test_lib).excludes test_pdb = $(test_lib:.dll=.pdb) test_response = $(depsdir)/$(test_lib).response test_makefrag = $(depsdir)/$(test_lib).makefrag -test_flags = -r:$(the_assembly) $(test_nunit_ref) $(TEST_MCS_FLAGS) +test_flags = -r:$(the_assembly) $(test_nunit_ref) $(TEST_MCS_FLAGS) $(TEST_LIB_MCS_FLAGS) tests_CLEAN_FILES += $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.dll) $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.pdb) $(test_response) $(test_makefrag) ifndef HAVE_CS_TESTS @@ -58,11 +60,15 @@ $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp ifdef NUNIT_LITE $(topdir)/build/deps/nunit-$(PROFILE).stamp: +ifndef PARENT_PROFILE cd ${topdir}/tools/nunit-lite && $(MAKE) +endif echo "stamp" >$@ else $(topdir)/build/deps/nunit-$(PROFILE).stamp: +ifndef PARENT_PROFILE cd ${topdir}/nunit24 && $(MAKE) +endif echo "stamp" >$@ endif diff --git a/mcs/class/Accessibility/Makefile b/mcs/class/Accessibility/Makefile index 907ce82bb5b..8700935681b 100644 --- a/mcs/class/Accessibility/Makefile +++ b/mcs/class/Accessibility/Makefile @@ -3,7 +3,7 @@ SUBDIRS = include ../../build/rules.make LIBRARY = Accessibility.dll -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/Commons.Xml.Relaxng/Makefile b/mcs/class/Commons.Xml.Relaxng/Makefile index 1bc0fd2f277..d63e7af0565 100644 --- a/mcs/class/Commons.Xml.Relaxng/Makefile +++ b/mcs/class/Commons.Xml.Relaxng/Makefile @@ -8,7 +8,7 @@ OTHER_RES = $(RESOURCE_FILES) LIBRARY = Commons.Xml.Relaxng.dll LIB_REFS = System System.Xml -LIB_MCS_FLAGS = /r:$(corlib) \ +LIB_MCS_FLAGS = \ $(foreach r, $(OTHER_RES), /resource:$(r),$(notdir $(r))) TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 EXTRA_DISTFILES = \ diff --git a/mcs/class/Compat.ICSharpCode.SharpZipLib/Makefile b/mcs/class/Compat.ICSharpCode.SharpZipLib/Makefile index 9c11dbac65c..74debbe57e6 100644 --- a/mcs/class/Compat.ICSharpCode.SharpZipLib/Makefile +++ b/mcs/class/Compat.ICSharpCode.SharpZipLib/Makefile @@ -8,7 +8,7 @@ LIBRARY_COMPAT = yes LIBRARY_SNK = SharpZipLib.key LIB_REFS = System System.Xml -LIB_MCS_FLAGS = -r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes EXTRA_DISTFILES = SharpZipLib.pub $(LIBRARY_SNK) diff --git a/mcs/class/Cscompmgd/Makefile b/mcs/class/Cscompmgd/Makefile index 3afddcca8fa..54ff581cee0 100644 --- a/mcs/class/Cscompmgd/Makefile +++ b/mcs/class/Cscompmgd/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = Cscompmgd.dll LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 LIBRARY_NAME = cscompmgd.dll diff --git a/mcs/class/CustomMarshalers/Makefile b/mcs/class/CustomMarshalers/Makefile index 0e432dc33b1..366921c583f 100644 --- a/mcs/class/CustomMarshalers/Makefile +++ b/mcs/class/CustomMarshalers/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = CustomMarshalers.dll LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/Facades/Makefile b/mcs/class/Facades/Makefile index 12f045eebd8..d984f22ecd5 100644 --- a/mcs/class/Facades/Makefile +++ b/mcs/class/Facades/Makefile @@ -37,7 +37,9 @@ doc-update-local: doc-update-recursive: @echo "do not recurse the Facades folder" -System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML System.ComponentModel.Composition System.ServiceModel System.Xml.Linq: +System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML \ +System.ComponentModel.Composition System.ServiceModel System.Xml.Linq System.Data System.IO.Compression.FileSystem \ +System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http: all-local-aot: diff --git a/mcs/class/Facades/Microsoft.Win32.Primitives/Makefile b/mcs/class/Facades/Microsoft.Win32.Primitives/Makefile index 4b0a8ce48f8..d1b93730000 100644 --- a/mcs/class/Facades/Microsoft.Win32.Primitives/Makefile +++ b/mcs/class/Facades/Microsoft.Win32.Primitives/Makefile @@ -12,7 +12,7 @@ LIBRARY = Microsoft.Win32.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Makefile b/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Makefile index 68c77b28ef9..0b5f4acf6da 100644 --- a/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Makefile +++ b/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Makefile @@ -12,7 +12,7 @@ LIBRARY = Microsoft.Win32.Registry.AccessControl.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/Microsoft.Win32.Registry/Makefile b/mcs/class/Facades/Microsoft.Win32.Registry/Makefile index 95a931f2a73..5f1030b7c72 100644 --- a/mcs/class/Facades/Microsoft.Win32.Registry/Makefile +++ b/mcs/class/Facades/Microsoft.Win32.Registry/Makefile @@ -12,7 +12,7 @@ LIBRARY = Microsoft.Win32.Registry.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.AppContext/Makefile b/mcs/class/Facades/System.AppContext/Makefile index a428634b310..9170d927e04 100644 --- a/mcs/class/Facades/System.AppContext/Makefile +++ b/mcs/class/Facades/System.AppContext/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.AppContext.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Collections.Concurrent/Makefile b/mcs/class/Facades/System.Collections.Concurrent/Makefile index 9fe40d3d849..d94e5d55dd2 100644 --- a/mcs/class/Facades/System.Collections.Concurrent/Makefile +++ b/mcs/class/Facades/System.Collections.Concurrent/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Collections.Concurrent.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Collections.NonGeneric/Makefile b/mcs/class/Facades/System.Collections.NonGeneric/Makefile index 6aa88932bd3..f2f3cdb4772 100644 --- a/mcs/class/Facades/System.Collections.NonGeneric/Makefile +++ b/mcs/class/Facades/System.Collections.NonGeneric/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Collections.NonGeneric.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Collections.Specialized/Makefile b/mcs/class/Facades/System.Collections.Specialized/Makefile index 7730dc6182e..d391fa9ac51 100644 --- a/mcs/class/Facades/System.Collections.Specialized/Makefile +++ b/mcs/class/Facades/System.Collections.Specialized/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Collections.Specialized.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Collections/Makefile b/mcs/class/Facades/System.Collections/Makefile index e91fa63b8d8..dc6dca0073a 100644 --- a/mcs/class/Facades/System.Collections/Makefile +++ b/mcs/class/Facades/System.Collections/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Collections.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ComponentModel.Annotations/Makefile b/mcs/class/Facades/System.ComponentModel.Annotations/Makefile index 0e5a336b82c..a4f1cc41c4d 100644 --- a/mcs/class/Facades/System.ComponentModel.Annotations/Makefile +++ b/mcs/class/Facades/System.ComponentModel.Annotations/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ComponentModel.Annotations.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.ComponentModel.DataAnnotations -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ComponentModel.EventBasedAsync/Makefile b/mcs/class/Facades/System.ComponentModel.EventBasedAsync/Makefile index 3bb78c16995..48a6b9c11e6 100644 --- a/mcs/class/Facades/System.ComponentModel.EventBasedAsync/Makefile +++ b/mcs/class/Facades/System.ComponentModel.EventBasedAsync/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ComponentModel.EventBasedAsync.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ComponentModel.Primitives/Makefile b/mcs/class/Facades/System.ComponentModel.Primitives/Makefile index 8b46af0e4c2..dac065757de 100644 --- a/mcs/class/Facades/System.ComponentModel.Primitives/Makefile +++ b/mcs/class/Facades/System.ComponentModel.Primitives/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ComponentModel.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ComponentModel.TypeConverter/Makefile b/mcs/class/Facades/System.ComponentModel.TypeConverter/Makefile index 9479c31e5d5..6062e304a95 100644 --- a/mcs/class/Facades/System.ComponentModel.TypeConverter/Makefile +++ b/mcs/class/Facades/System.ComponentModel.TypeConverter/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ComponentModel.TypeConverter.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ComponentModel/Makefile b/mcs/class/Facades/System.ComponentModel/Makefile index 57c23bab8fc..33b88f9541e 100644 --- a/mcs/class/Facades/System.ComponentModel/Makefile +++ b/mcs/class/Facades/System.ComponentModel/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ComponentModel.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Console/Makefile b/mcs/class/Facades/System.Console/Makefile index 7ec5ccd75e5..ea7312a4d70 100644 --- a/mcs/class/Facades/System.Console/Makefile +++ b/mcs/class/Facades/System.Console/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Console.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Data.Common/Makefile b/mcs/class/Facades/System.Data.Common/Makefile index ca5b55bb5e4..30bf3dd0181 100644 --- a/mcs/class/Facades/System.Data.Common/Makefile +++ b/mcs/class/Facades/System.Data.Common/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Data.Common.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Data.dll +LIB_REFS = System System.Data +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Data.SqlClient/Makefile b/mcs/class/Facades/System.Data.SqlClient/Makefile index 0fa130c8e28..f5eb7097fd6 100644 --- a/mcs/class/Facades/System.Data.SqlClient/Makefile +++ b/mcs/class/Facades/System.Data.SqlClient/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Data.SqlClient.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Data.dll /r:System.Xml.dll +LIB_REFS = System System.Data System.Xml +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.Contracts/Makefile b/mcs/class/Facades/System.Diagnostics.Contracts/Makefile index 23dad544fc9..391da57605b 100644 --- a/mcs/class/Facades/System.Diagnostics.Contracts/Makefile +++ b/mcs/class/Facades/System.Diagnostics.Contracts/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Diagnostics.Contracts.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.Debug/Makefile b/mcs/class/Facades/System.Diagnostics.Debug/Makefile index 34574abc438..0eccd876719 100644 --- a/mcs/class/Facades/System.Diagnostics.Debug/Makefile +++ b/mcs/class/Facades/System.Diagnostics.Debug/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.Debug.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.FileVersionInfo/Makefile b/mcs/class/Facades/System.Diagnostics.FileVersionInfo/Makefile index 2d2c4bfe8bb..1ac2f6cc2a0 100644 --- a/mcs/class/Facades/System.Diagnostics.FileVersionInfo/Makefile +++ b/mcs/class/Facades/System.Diagnostics.FileVersionInfo/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.FileVersionInfo.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.PerformanceCounter/Makefile b/mcs/class/Facades/System.Diagnostics.PerformanceCounter/Makefile index 499d313fc6c..beda8606888 100644 --- a/mcs/class/Facades/System.Diagnostics.PerformanceCounter/Makefile +++ b/mcs/class/Facades/System.Diagnostics.PerformanceCounter/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.PerformanceCounter.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.Process/Makefile b/mcs/class/Facades/System.Diagnostics.Process/Makefile index c6980725fd1..83fd768e251 100644 --- a/mcs/class/Facades/System.Diagnostics.Process/Makefile +++ b/mcs/class/Facades/System.Diagnostics.Process/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.Process.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.StackTrace/Makefile b/mcs/class/Facades/System.Diagnostics.StackTrace/Makefile index 169d8b79e1e..25d8ac37edd 100644 --- a/mcs/class/Facades/System.Diagnostics.StackTrace/Makefile +++ b/mcs/class/Facades/System.Diagnostics.StackTrace/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.StackTrace.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/Makefile b/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/Makefile index 27e24e5ed7a..aa7c6dc119f 100644 --- a/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/Makefile +++ b/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.TextWriterTraceListener.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.Tools/Makefile b/mcs/class/Facades/System.Diagnostics.Tools/Makefile index 494f8b90da0..3d9b5158255 100644 --- a/mcs/class/Facades/System.Diagnostics.Tools/Makefile +++ b/mcs/class/Facades/System.Diagnostics.Tools/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.Tools.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.TraceEvent/Makefile b/mcs/class/Facades/System.Diagnostics.TraceEvent/Makefile index a109b64df9a..342e82dbf4a 100644 --- a/mcs/class/Facades/System.Diagnostics.TraceEvent/Makefile +++ b/mcs/class/Facades/System.Diagnostics.TraceEvent/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.TraceEvent.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.TraceSource/Makefile b/mcs/class/Facades/System.Diagnostics.TraceSource/Makefile index 2dbd5475cca..3467273f7c9 100644 --- a/mcs/class/Facades/System.Diagnostics.TraceSource/Makefile +++ b/mcs/class/Facades/System.Diagnostics.TraceSource/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Diagnostics.TraceSource.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Diagnostics.Tracing/Makefile b/mcs/class/Facades/System.Diagnostics.Tracing/Makefile index 53a49cfff70..14b380da866 100644 --- a/mcs/class/Facades/System.Diagnostics.Tracing/Makefile +++ b/mcs/class/Facades/System.Diagnostics.Tracing/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Diagnostics.Tracing.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Dynamic.Runtime/Makefile b/mcs/class/Facades/System.Dynamic.Runtime/Makefile index 9380c0ecba4..a6bcda9f3de 100644 --- a/mcs/class/Facades/System.Dynamic.Runtime/Makefile +++ b/mcs/class/Facades/System.Dynamic.Runtime/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Dynamic.Runtime.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Core System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Globalization.Calendars/Makefile b/mcs/class/Facades/System.Globalization.Calendars/Makefile index 1659260c032..5f419e9b635 100644 --- a/mcs/class/Facades/System.Globalization.Calendars/Makefile +++ b/mcs/class/Facades/System.Globalization.Calendars/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Globalization.Calendars.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Globalization.Extensions/Makefile b/mcs/class/Facades/System.Globalization.Extensions/Makefile index e4923237e7b..d3a57fa307d 100644 --- a/mcs/class/Facades/System.Globalization.Extensions/Makefile +++ b/mcs/class/Facades/System.Globalization.Extensions/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Globalization.Extensions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Globalization/Makefile b/mcs/class/Facades/System.Globalization/Makefile index e94f4b5561b..4f01dfeb762 100644 --- a/mcs/class/Facades/System.Globalization/Makefile +++ b/mcs/class/Facades/System.Globalization/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Globalization.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.Compression.ZipFile/Makefile b/mcs/class/Facades/System.IO.Compression.ZipFile/Makefile index 0865314a1bd..b4e4896a629 100644 --- a/mcs/class/Facades/System.IO.Compression.ZipFile/Makefile +++ b/mcs/class/Facades/System.IO.Compression.ZipFile/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.IO.Compression.ZipFile.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.IO.Compression.FileSystem.dll +LIB_REFS = System System.IO.Compression.FileSystem +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.FileSystem.AccessControl/Makefile b/mcs/class/Facades/System.IO.FileSystem.AccessControl/Makefile index 6574fc62499..0198747a8a3 100644 --- a/mcs/class/Facades/System.IO.FileSystem.AccessControl/Makefile +++ b/mcs/class/Facades/System.IO.FileSystem.AccessControl/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.FileSystem.AccessControl.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.FileSystem.DriveInfo/Makefile b/mcs/class/Facades/System.IO.FileSystem.DriveInfo/Makefile index 096d6c7a7fa..0925c49d155 100644 --- a/mcs/class/Facades/System.IO.FileSystem.DriveInfo/Makefile +++ b/mcs/class/Facades/System.IO.FileSystem.DriveInfo/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.FileSystem.DriveInfo.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.FileSystem.Primitives/Makefile b/mcs/class/Facades/System.IO.FileSystem.Primitives/Makefile index 2622a088f2d..31b27077e45 100644 --- a/mcs/class/Facades/System.IO.FileSystem.Primitives/Makefile +++ b/mcs/class/Facades/System.IO.FileSystem.Primitives/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.FileSystem.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.FileSystem.Watcher/Makefile b/mcs/class/Facades/System.IO.FileSystem.Watcher/Makefile index 2a4d25e1073..caade8a02a0 100644 --- a/mcs/class/Facades/System.IO.FileSystem.Watcher/Makefile +++ b/mcs/class/Facades/System.IO.FileSystem.Watcher/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.FileSystem.Watcher.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.FileSystem/Makefile b/mcs/class/Facades/System.IO.FileSystem/Makefile index cbd49ccc535..178aa60efea 100644 --- a/mcs/class/Facades/System.IO.FileSystem/Makefile +++ b/mcs/class/Facades/System.IO.FileSystem/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.FileSystem.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.IsolatedStorage/Makefile b/mcs/class/Facades/System.IO.IsolatedStorage/Makefile index e89d4be370b..be6a315004b 100644 --- a/mcs/class/Facades/System.IO.IsolatedStorage/Makefile +++ b/mcs/class/Facades/System.IO.IsolatedStorage/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.IsolatedStorage.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.MemoryMappedFiles/Makefile b/mcs/class/Facades/System.IO.MemoryMappedFiles/Makefile index 1ea56e44d94..656b03cd126 100644 --- a/mcs/class/Facades/System.IO.MemoryMappedFiles/Makefile +++ b/mcs/class/Facades/System.IO.MemoryMappedFiles/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.IO.MemoryMappedFiles.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Core.dll +LIB_REFS = System System.Core +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.Pipes/Makefile b/mcs/class/Facades/System.IO.Pipes/Makefile index 999b161afd3..0d156aafeb1 100644 --- a/mcs/class/Facades/System.IO.Pipes/Makefile +++ b/mcs/class/Facades/System.IO.Pipes/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.IO.Pipes.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Core.dll +LIB_REFS = System System.Core +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO.UnmanagedMemoryStream/Makefile b/mcs/class/Facades/System.IO.UnmanagedMemoryStream/Makefile index c65888b2311..c1605d9ccf8 100644 --- a/mcs/class/Facades/System.IO.UnmanagedMemoryStream/Makefile +++ b/mcs/class/Facades/System.IO.UnmanagedMemoryStream/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.UnmanagedMemoryStream.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.IO/Makefile b/mcs/class/Facades/System.IO/Makefile index 42a6a9413b4..89fc0db0963 100644 --- a/mcs/class/Facades/System.IO/Makefile +++ b/mcs/class/Facades/System.IO/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.IO.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Linq.Expressions/Makefile b/mcs/class/Facades/System.Linq.Expressions/Makefile index d2ad276ef09..bb78580fb43 100644 --- a/mcs/class/Facades/System.Linq.Expressions/Makefile +++ b/mcs/class/Facades/System.Linq.Expressions/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Linq.Expressions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Linq.Parallel/Makefile b/mcs/class/Facades/System.Linq.Parallel/Makefile index d68ebb41633..7d314bf5e95 100644 --- a/mcs/class/Facades/System.Linq.Parallel/Makefile +++ b/mcs/class/Facades/System.Linq.Parallel/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Linq.Parallel.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Linq.Queryable/Makefile b/mcs/class/Facades/System.Linq.Queryable/Makefile index 1f0225e3aea..6ea4c746ec8 100644 --- a/mcs/class/Facades/System.Linq.Queryable/Makefile +++ b/mcs/class/Facades/System.Linq.Queryable/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Linq.Queryable.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Linq/Makefile b/mcs/class/Facades/System.Linq/Makefile index 17bcabbdf83..d9778697d4c 100644 --- a/mcs/class/Facades/System.Linq/Makefile +++ b/mcs/class/Facades/System.Linq/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Linq.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.AuthenticationManager/Makefile b/mcs/class/Facades/System.Net.AuthenticationManager/Makefile index 4efed6d1b28..293f80d25d3 100644 --- a/mcs/class/Facades/System.Net.AuthenticationManager/Makefile +++ b/mcs/class/Facades/System.Net.AuthenticationManager/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.AuthenticationManager.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Cache/Makefile b/mcs/class/Facades/System.Net.Cache/Makefile index 9826235d5b1..bbdcfce7592 100644 --- a/mcs/class/Facades/System.Net.Cache/Makefile +++ b/mcs/class/Facades/System.Net.Cache/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Cache.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Http.WebRequestHandler/Makefile b/mcs/class/Facades/System.Net.Http.WebRequestHandler/Makefile index 202bfbe892a..7750bbae45a 100644 --- a/mcs/class/Facades/System.Net.Http.WebRequestHandler/Makefile +++ b/mcs/class/Facades/System.Net.Http.WebRequestHandler/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Net.Http.WebRequestHandler.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Net.Http.WebRequest.dll /r:System.Net.Http.dll +LIB_REFS = System System.Net.Http.WebRequest System.Net.Http +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.HttpListener/Makefile b/mcs/class/Facades/System.Net.HttpListener/Makefile index 401f473303c..3109e707615 100644 --- a/mcs/class/Facades/System.Net.HttpListener/Makefile +++ b/mcs/class/Facades/System.Net.HttpListener/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.HttpListener.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Mail/Makefile b/mcs/class/Facades/System.Net.Mail/Makefile index 32aca2f9665..fe936b17d91 100644 --- a/mcs/class/Facades/System.Net.Mail/Makefile +++ b/mcs/class/Facades/System.Net.Mail/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Mail.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.NameResolution/Makefile b/mcs/class/Facades/System.Net.NameResolution/Makefile index ae8b68c79d6..142a303c38e 100644 --- a/mcs/class/Facades/System.Net.NameResolution/Makefile +++ b/mcs/class/Facades/System.Net.NameResolution/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.NameResolution.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.NetworkInformation/Makefile b/mcs/class/Facades/System.Net.NetworkInformation/Makefile index 29df735469a..bc2a7ec8166 100644 --- a/mcs/class/Facades/System.Net.NetworkInformation/Makefile +++ b/mcs/class/Facades/System.Net.NetworkInformation/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.NetworkInformation.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Primitives/Makefile b/mcs/class/Facades/System.Net.Primitives/Makefile index babbd33274b..bc362713259 100644 --- a/mcs/class/Facades/System.Net.Primitives/Makefile +++ b/mcs/class/Facades/System.Net.Primitives/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Requests/Makefile b/mcs/class/Facades/System.Net.Requests/Makefile index 947ca929cef..7a8a231bc3b 100644 --- a/mcs/class/Facades/System.Net.Requests/Makefile +++ b/mcs/class/Facades/System.Net.Requests/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Requests.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Security/Makefile b/mcs/class/Facades/System.Net.Security/Makefile index 4eab13bc8c8..cdd7db906c9 100644 --- a/mcs/class/Facades/System.Net.Security/Makefile +++ b/mcs/class/Facades/System.Net.Security/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Security.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.ServicePoint/Makefile b/mcs/class/Facades/System.Net.ServicePoint/Makefile index bb8e7229f72..f0d095317dc 100644 --- a/mcs/class/Facades/System.Net.ServicePoint/Makefile +++ b/mcs/class/Facades/System.Net.ServicePoint/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.ServicePoint.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Sockets/Makefile b/mcs/class/Facades/System.Net.Sockets/Makefile index 0cd78a8dac0..bf60d5fef6b 100644 --- a/mcs/class/Facades/System.Net.Sockets/Makefile +++ b/mcs/class/Facades/System.Net.Sockets/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Sockets.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.Utilities/Makefile b/mcs/class/Facades/System.Net.Utilities/Makefile index 77d83647a6d..6f1a5166b8a 100644 --- a/mcs/class/Facades/System.Net.Utilities/Makefile +++ b/mcs/class/Facades/System.Net.Utilities/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.Utilities.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.WebHeaderCollection/Makefile b/mcs/class/Facades/System.Net.WebHeaderCollection/Makefile index b3fe02b3456..f6ec2a06526 100644 --- a/mcs/class/Facades/System.Net.WebHeaderCollection/Makefile +++ b/mcs/class/Facades/System.Net.WebHeaderCollection/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.WebHeaderCollection.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.WebSockets.Client/Makefile b/mcs/class/Facades/System.Net.WebSockets.Client/Makefile index 8489220e960..2552b0e0d5b 100644 --- a/mcs/class/Facades/System.Net.WebSockets.Client/Makefile +++ b/mcs/class/Facades/System.Net.WebSockets.Client/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.WebSockets.Client.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Net.WebSockets/Makefile b/mcs/class/Facades/System.Net.WebSockets/Makefile index 783ae541c93..e9fa98fd8b4 100644 --- a/mcs/class/Facades/System.Net.WebSockets/Makefile +++ b/mcs/class/Facades/System.Net.WebSockets/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Net.WebSockets.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ObjectModel/Makefile b/mcs/class/Facades/System.ObjectModel/Makefile index 56ca84ae0da..0838b23d3cf 100644 --- a/mcs/class/Facades/System.ObjectModel/Makefile +++ b/mcs/class/Facades/System.ObjectModel/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ObjectModel.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile b/mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile index ee55fc62375..7b03ca8fdb0 100644 --- a/mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile +++ b/mcs/class/Facades/System.Private.CoreLib.InteropServices/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Private.CoreLib.InteropServices.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile b/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile index 52ce0e308ad..347b171983e 100644 --- a/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile +++ b/mcs/class/Facades/System.Private.CoreLib.Threading/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Private.CoreLib.Threading.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection.Emit.ILGeneration/Makefile b/mcs/class/Facades/System.Reflection.Emit.ILGeneration/Makefile index f9c54c54b2f..6ee536f7b71 100644 --- a/mcs/class/Facades/System.Reflection.Emit.ILGeneration/Makefile +++ b/mcs/class/Facades/System.Reflection.Emit.ILGeneration/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Reflection.Emit.ILGeneration.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection.Emit.Lightweight/Makefile b/mcs/class/Facades/System.Reflection.Emit.Lightweight/Makefile index 70a46b888d5..93292276ab1 100644 --- a/mcs/class/Facades/System.Reflection.Emit.Lightweight/Makefile +++ b/mcs/class/Facades/System.Reflection.Emit.Lightweight/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Reflection.Emit.Lightweight.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection.Emit/Makefile b/mcs/class/Facades/System.Reflection.Emit/Makefile index 2227a3ca80f..798d457271e 100644 --- a/mcs/class/Facades/System.Reflection.Emit/Makefile +++ b/mcs/class/Facades/System.Reflection.Emit/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Reflection.Emit.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection.Extensions/Makefile b/mcs/class/Facades/System.Reflection.Extensions/Makefile index db7f3df173d..e1799cc150e 100644 --- a/mcs/class/Facades/System.Reflection.Extensions/Makefile +++ b/mcs/class/Facades/System.Reflection.Extensions/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Reflection.Extensions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection.Primitives/Makefile b/mcs/class/Facades/System.Reflection.Primitives/Makefile index 99a3a39505d..ee500e52ecb 100644 --- a/mcs/class/Facades/System.Reflection.Primitives/Makefile +++ b/mcs/class/Facades/System.Reflection.Primitives/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Reflection.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection.TypeExtensions/Makefile b/mcs/class/Facades/System.Reflection.TypeExtensions/Makefile index 3e4d713ac53..b2bb49ecfd1 100644 --- a/mcs/class/Facades/System.Reflection.TypeExtensions/Makefile +++ b/mcs/class/Facades/System.Reflection.TypeExtensions/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Reflection.TypeExtensions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Reflection/Makefile b/mcs/class/Facades/System.Reflection/Makefile index 862b9333ccc..3061a268a23 100644 --- a/mcs/class/Facades/System.Reflection/Makefile +++ b/mcs/class/Facades/System.Reflection/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Reflection.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Resources.ReaderWriter/Makefile b/mcs/class/Facades/System.Resources.ReaderWriter/Makefile index 48c56ade5a3..e2795e40f7d 100644 --- a/mcs/class/Facades/System.Resources.ReaderWriter/Makefile +++ b/mcs/class/Facades/System.Resources.ReaderWriter/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Resources.ReaderWriter.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Resources.ResourceManager/Makefile b/mcs/class/Facades/System.Resources.ResourceManager/Makefile index 72e539364cf..15f241e4091 100644 --- a/mcs/class/Facades/System.Resources.ResourceManager/Makefile +++ b/mcs/class/Facades/System.Resources.ResourceManager/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Resources.ResourceManager.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/Makefile b/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/Makefile index 21d3f78844e..6f7f15c612e 100644 --- a/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/Makefile +++ b/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.CompilerServices.VisualC.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.Extensions/Makefile b/mcs/class/Facades/System.Runtime.Extensions/Makefile index 981cb5f8233..70fd8c93305 100644 --- a/mcs/class/Facades/System.Runtime.Extensions/Makefile +++ b/mcs/class/Facades/System.Runtime.Extensions/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.Extensions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.Handles/Makefile b/mcs/class/Facades/System.Runtime.Handles/Makefile index 396738e44e5..db800c29abf 100644 --- a/mcs/class/Facades/System.Runtime.Handles/Makefile +++ b/mcs/class/Facades/System.Runtime.Handles/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.Handles.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/Makefile b/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/Makefile index a6340fb3e76..1aaf02e2fc5 100644 --- a/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/Makefile +++ b/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Runtime.InteropServices.WindowsRuntime.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.InteropServices/Makefile b/mcs/class/Facades/System.Runtime.InteropServices/Makefile index 51ef698b24c..dd20654dcd3 100644 --- a/mcs/class/Facades/System.Runtime.InteropServices/Makefile +++ b/mcs/class/Facades/System.Runtime.InteropServices/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.InteropServices.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.Numerics/Makefile b/mcs/class/Facades/System.Runtime.Numerics/Makefile index e452fc5aca5..57867bb26a1 100644 --- a/mcs/class/Facades/System.Runtime.Numerics/Makefile +++ b/mcs/class/Facades/System.Runtime.Numerics/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.Numerics.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Numerics -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.Serialization.Json/Makefile b/mcs/class/Facades/System.Runtime.Serialization.Json/Makefile index 304059eaabb..b5ca5ce40b2 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Json/Makefile +++ b/mcs/class/Facades/System.Runtime.Serialization.Json/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.Serialization.Json.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Runtime.Serialization -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.Serialization.Primitives/Makefile b/mcs/class/Facades/System.Runtime.Serialization.Primitives/Makefile index 648884fc9b7..3a2519549fc 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Primitives/Makefile +++ b/mcs/class/Facades/System.Runtime.Serialization.Primitives/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.Serialization.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Runtime.Serialization -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime.Serialization.Xml/Makefile b/mcs/class/Facades/System.Runtime.Serialization.Xml/Makefile index cc0aec4a369..774289eb4de 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Xml/Makefile +++ b/mcs/class/Facades/System.Runtime.Serialization.Xml/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.Serialization.Xml.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Runtime.Serialization System.Xml -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Runtime/Makefile b/mcs/class/Facades/System.Runtime/Makefile index c59de138408..e8ab4049a26 100644 --- a/mcs/class/Facades/System.Runtime/Makefile +++ b/mcs/class/Facades/System.Runtime/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Runtime.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System System.ComponentModel.Composition System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.AccessControl/Makefile b/mcs/class/Facades/System.Security.AccessControl/Makefile index 3491238f861..5c6ad1c09ec 100644 --- a/mcs/class/Facades/System.Security.AccessControl/Makefile +++ b/mcs/class/Facades/System.Security.AccessControl/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.AccessControl.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Claims/Makefile b/mcs/class/Facades/System.Security.Claims/Makefile index 72b761e38a5..36ff76137ba 100644 --- a/mcs/class/Facades/System.Security.Claims/Makefile +++ b/mcs/class/Facades/System.Security.Claims/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Claims.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.DeriveBytes/Makefile b/mcs/class/Facades/System.Security.Cryptography.DeriveBytes/Makefile index 1beaa35e013..4988d34843d 100644 --- a/mcs/class/Facades/System.Security.Cryptography.DeriveBytes/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.DeriveBytes/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.DeriveBytes.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Encoding/Makefile b/mcs/class/Facades/System.Security.Cryptography.Encoding/Makefile index 5bf1ccf0ab3..71d37e200e0 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encoding/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Encoding/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.Encoding.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/Makefile b/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/Makefile index b43610b6764..0598a53f1d4 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.Encryption.Aes.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/Makefile b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/Makefile index a2c373ac08a..03e69f1f95a 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Security.Cryptography.Encryption.ECDiffieHellman.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Core.dll +LIB_REFS = System System.Core +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/Makefile b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/Makefile index 2bae1ac269d..08e99941082 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Security.Cryptography.Encryption.ECDsa.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Core.dll +LIB_REFS = System System.Core +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption/Makefile b/mcs/class/Facades/System.Security.Cryptography.Encryption/Makefile index 26d1d81df80..0e8b1644280 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.Encryption.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/Makefile b/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/Makefile index e146e689b97..45dad5331da 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.Hashing.Algorithms.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.Hashing/Makefile b/mcs/class/Facades/System.Security.Cryptography.Hashing/Makefile index 450bb596fd8..9df5800609b 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Hashing/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.Hashing/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.Hashing.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.ProtectedData/Makefile b/mcs/class/Facades/System.Security.Cryptography.ProtectedData/Makefile index f82c8604162..1cdbf1de8f3 100644 --- a/mcs/class/Facades/System.Security.Cryptography.ProtectedData/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.ProtectedData/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Security.Cryptography.ProtectedData.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Security.dll +LIB_REFS = System System.Security +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.RSA/Makefile b/mcs/class/Facades/System.Security.Cryptography.RSA/Makefile index a88e14ef6cc..ea7df7a042a 100644 --- a/mcs/class/Facades/System.Security.Cryptography.RSA/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.RSA/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.RSA.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/Makefile b/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/Makefile index d9fdec015a2..2ffcdbc236f 100644 --- a/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.RandomNumberGenerator.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Cryptography.X509Certificates/Makefile b/mcs/class/Facades/System.Security.Cryptography.X509Certificates/Makefile index 911aa9fd268..5ad2d813f95 100644 --- a/mcs/class/Facades/System.Security.Cryptography.X509Certificates/Makefile +++ b/mcs/class/Facades/System.Security.Cryptography.X509Certificates/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Cryptography.X509Certificates.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Principal.Windows/Makefile b/mcs/class/Facades/System.Security.Principal.Windows/Makefile index 8284f5fd5ba..a287f05cb84 100644 --- a/mcs/class/Facades/System.Security.Principal.Windows/Makefile +++ b/mcs/class/Facades/System.Security.Principal.Windows/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.Principal.Windows.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.Principal/Makefile b/mcs/class/Facades/System.Security.Principal/Makefile index c4db6800149..1a1265a0e05 100644 --- a/mcs/class/Facades/System.Security.Principal/Makefile +++ b/mcs/class/Facades/System.Security.Principal/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Security.Principal.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Security.SecureString/Makefile b/mcs/class/Facades/System.Security.SecureString/Makefile index fb949fbe07e..b33d20dc202 100644 --- a/mcs/class/Facades/System.Security.SecureString/Makefile +++ b/mcs/class/Facades/System.Security.SecureString/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Security.SecureString.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ServiceModel.Duplex/Makefile b/mcs/class/Facades/System.ServiceModel.Duplex/Makefile index 90f55a71d5e..a8f568f78b5 100644 --- a/mcs/class/Facades/System.ServiceModel.Duplex/Makefile +++ b/mcs/class/Facades/System.ServiceModel.Duplex/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ServiceModel.Duplex.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.ServiceModel -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ServiceModel.Http/Makefile b/mcs/class/Facades/System.ServiceModel.Http/Makefile index 99587810c49..05f7925c2c6 100644 --- a/mcs/class/Facades/System.ServiceModel.Http/Makefile +++ b/mcs/class/Facades/System.ServiceModel.Http/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ServiceModel.Http.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.ServiceModel -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ServiceModel.NetTcp/Makefile b/mcs/class/Facades/System.ServiceModel.NetTcp/Makefile index c01e4819efb..f0af8c7dc60 100644 --- a/mcs/class/Facades/System.ServiceModel.NetTcp/Makefile +++ b/mcs/class/Facades/System.ServiceModel.NetTcp/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ServiceModel.NetTcp.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.ServiceModel -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/Makefile b/mcs/class/Facades/System.ServiceModel.Primitives/Makefile index 6f94ff346f8..5f65e0599a3 100644 --- a/mcs/class/Facades/System.ServiceModel.Primitives/Makefile +++ b/mcs/class/Facades/System.ServiceModel.Primitives/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ServiceModel.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.ServiceModel System.Xml -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ServiceModel.Security/Makefile b/mcs/class/Facades/System.ServiceModel.Security/Makefile index 4e572464aa8..f68beafd26e 100644 --- a/mcs/class/Facades/System.ServiceModel.Security/Makefile +++ b/mcs/class/Facades/System.ServiceModel.Security/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.ServiceModel.Security.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.ServiceModel -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/Makefile b/mcs/class/Facades/System.ServiceProcess.ServiceController/Makefile index 9025a6cd91d..2724a34a105 100644 --- a/mcs/class/Facades/System.ServiceProcess.ServiceController/Makefile +++ b/mcs/class/Facades/System.ServiceProcess.ServiceController/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.ServiceProcess.ServiceController.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.ServiceProcess.dll +LIB_REFS = System System.ServiceProcess +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Text.Encoding.Extensions/Makefile b/mcs/class/Facades/System.Text.Encoding.Extensions/Makefile index 114132e3a0f..e851968fdb4 100644 --- a/mcs/class/Facades/System.Text.Encoding.Extensions/Makefile +++ b/mcs/class/Facades/System.Text.Encoding.Extensions/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Text.Encoding.Extensions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Text.Encoding/Makefile b/mcs/class/Facades/System.Text.Encoding/Makefile index aeb003f7bb8..fdfff718497 100644 --- a/mcs/class/Facades/System.Text.Encoding/Makefile +++ b/mcs/class/Facades/System.Text.Encoding/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Text.Encoding.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Text.RegularExpressions/Makefile b/mcs/class/Facades/System.Text.RegularExpressions/Makefile index 423212c687c..b345b0d5dcd 100644 --- a/mcs/class/Facades/System.Text.RegularExpressions/Makefile +++ b/mcs/class/Facades/System.Text.RegularExpressions/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Text.RegularExpressions.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.AccessControl/Makefile b/mcs/class/Facades/System.Threading.AccessControl/Makefile index 56cf986675d..b0c9264a03b 100644 --- a/mcs/class/Facades/System.Threading.AccessControl/Makefile +++ b/mcs/class/Facades/System.Threading.AccessControl/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.AccessControl.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.Overlapped/Makefile b/mcs/class/Facades/System.Threading.Overlapped/Makefile index 29dbfe5e191..460fb4aff26 100644 --- a/mcs/class/Facades/System.Threading.Overlapped/Makefile +++ b/mcs/class/Facades/System.Threading.Overlapped/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.Overlapped.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.Tasks.Parallel/Makefile b/mcs/class/Facades/System.Threading.Tasks.Parallel/Makefile index 1f74d4934d3..7e350f61c2a 100644 --- a/mcs/class/Facades/System.Threading.Tasks.Parallel/Makefile +++ b/mcs/class/Facades/System.Threading.Tasks.Parallel/Makefile @@ -11,7 +11,7 @@ LIBRARY = System.Threading.Tasks.Parallel.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.Tasks/Makefile b/mcs/class/Facades/System.Threading.Tasks/Makefile index c89db2377a8..deea2c66a8a 100644 --- a/mcs/class/Facades/System.Threading.Tasks/Makefile +++ b/mcs/class/Facades/System.Threading.Tasks/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.Tasks.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.Thread/Makefile b/mcs/class/Facades/System.Threading.Thread/Makefile index 177e8890f9f..cc0bb96aa06 100644 --- a/mcs/class/Facades/System.Threading.Thread/Makefile +++ b/mcs/class/Facades/System.Threading.Thread/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.Thread.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.ThreadPool/Makefile b/mcs/class/Facades/System.Threading.ThreadPool/Makefile index 67b0082be9e..604a88c87e7 100644 --- a/mcs/class/Facades/System.Threading.ThreadPool/Makefile +++ b/mcs/class/Facades/System.Threading.ThreadPool/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.ThreadPool.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading.Timer/Makefile b/mcs/class/Facades/System.Threading.Timer/Makefile index 35df02e1825..5ab3f840901 100644 --- a/mcs/class/Facades/System.Threading.Timer/Makefile +++ b/mcs/class/Facades/System.Threading.Timer/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.Timer.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Threading/Makefile b/mcs/class/Facades/System.Threading/Makefile index 1982ff8384e..b6b5c4cd67b 100644 --- a/mcs/class/Facades/System.Threading/Makefile +++ b/mcs/class/Facades/System.Threading/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Threading.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System System.Core -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.ReaderWriter/Makefile b/mcs/class/Facades/System.Xml.ReaderWriter/Makefile index 373c1ff882e..27f820f582e 100644 --- a/mcs/class/Facades/System.Xml.ReaderWriter/Makefile +++ b/mcs/class/Facades/System.Xml.ReaderWriter/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Xml.ReaderWriter.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Xml -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.XDocument/Makefile b/mcs/class/Facades/System.Xml.XDocument/Makefile index e55fec5512e..79eaaf44249 100644 --- a/mcs/class/Facades/System.Xml.XDocument/Makefile +++ b/mcs/class/Facades/System.Xml.XDocument/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Xml.XDocument.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Xml.Linq System.Xml -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.XPath.XDocument/Makefile b/mcs/class/Facades/System.Xml.XPath.XDocument/Makefile index ee05487967b..45ffe3482e0 100644 --- a/mcs/class/Facades/System.Xml.XPath.XDocument/Makefile +++ b/mcs/class/Facades/System.Xml.XPath.XDocument/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Xml.XPath.XDocument.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Xml.Linq.dll +LIB_REFS = System System.Xml.Linq +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.XPath/Makefile b/mcs/class/Facades/System.Xml.XPath/Makefile index 86a093ba7ad..7a7ebf6de9d 100644 --- a/mcs/class/Facades/System.Xml.XPath/Makefile +++ b/mcs/class/Facades/System.Xml.XPath/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Xml.XPath.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Xml.dll +LIB_REFS = System System.Xml +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.XmlDocument/Makefile b/mcs/class/Facades/System.Xml.XmlDocument/Makefile index 68224f9f25f..8628579f2f1 100644 --- a/mcs/class/Facades/System.Xml.XmlDocument/Makefile +++ b/mcs/class/Facades/System.Xml.XmlDocument/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Xml.XmlDocument.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Xml.dll +LIB_REFS = System System.Xml +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.XmlSerializer/Makefile b/mcs/class/Facades/System.Xml.XmlSerializer/Makefile index 3a1e1396f75..f8c09af8c35 100644 --- a/mcs/class/Facades/System.Xml.XmlSerializer/Makefile +++ b/mcs/class/Facades/System.Xml.XmlSerializer/Makefile @@ -12,7 +12,7 @@ LIBRARY = System.Xml.XmlSerializer.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = System.Xml -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/Facades/System.Xml.Xsl.Primitives/Makefile b/mcs/class/Facades/System.Xml.Xsl.Primitives/Makefile index d038a8d5840..abddd14886e 100644 --- a/mcs/class/Facades/System.Xml.Xsl.Primitives/Makefile +++ b/mcs/class/Facades/System.Xml.Xsl.Primitives/Makefile @@ -11,8 +11,8 @@ LIBRARY = System.Xml.Xsl.Primitives.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 -LIB_REFS = System -LIB_MCS_FLAGS = $(SIGN_FLAGS) /r:mscorlib.dll /r:System.Xml.dll +LIB_REFS = System System.Xml +LIB_MCS_FLAGS = $(SIGN_FLAGS) PLATFORM_DEBUG_FLAGS = diff --git a/mcs/class/I18N/CJK/Makefile b/mcs/class/I18N/CJK/Makefile index 9d6c885099c..e5b85c14f00 100644 --- a/mcs/class/I18N/CJK/Makefile +++ b/mcs/class/I18N/CJK/Makefile @@ -3,7 +3,9 @@ SUBDIRS = include ../../../build/rules.make LIBRARY = I18N.CJK.dll -LOCAL_MCS_FLAGS = /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /r:$(corlib) /r:I18N.dll /define:DISABLE_UNSAFE +LIB_REFS = I18N +LOCAL_MCS_FLAGS = /unsafe /resource:big5.table /resource:gb2312.table /resource:jis.table /resource:ks.table /resource:gb18030.table /define:DISABLE_UNSAFE +TEST_LIB_REFS = I18N EXTRA_DISTFILES = big5.table jis.table gb2312.table ks.table gb18030.table \ README.gb18030 \ diff --git a/mcs/class/I18N/Common/Makefile b/mcs/class/I18N/Common/Makefile index af1aa401cd5..b68973bdc26 100644 --- a/mcs/class/I18N/Common/Makefile +++ b/mcs/class/I18N/Common/Makefile @@ -3,7 +3,7 @@ SUBDIRS = include ../../../build/rules.make LIBRARY = I18N.dll -LOCAL_MCS_FLAGS = /r:$(corlib) /unsafe /define:DISABLE_UNSAFE +LOCAL_MCS_FLAGS = /unsafe /define:DISABLE_UNSAFE NO_TEST = yes include ../../../build/library.make diff --git a/mcs/class/I18N/MidEast/Makefile b/mcs/class/I18N/MidEast/Makefile index aafe245f6a4..1872c831e58 100644 --- a/mcs/class/I18N/MidEast/Makefile +++ b/mcs/class/I18N/MidEast/Makefile @@ -3,8 +3,9 @@ SUBDIRS = include ../../../build/rules.make LIBRARY = I18N.MidEast.dll -LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll /unsafe -#NO_TEST = yes +LIB_REFS = I18N +LOCAL_MCS_FLAGS = /unsafe +TEST_LIB_REFS = I18N EXTRA_DISTFILES = $(wildcard *.ucm) \ $(wildcard Test/texts/*.txt) diff --git a/mcs/class/I18N/Other/Makefile b/mcs/class/I18N/Other/Makefile index e5740f32cb6..47fac195ad9 100644 --- a/mcs/class/I18N/Other/Makefile +++ b/mcs/class/I18N/Other/Makefile @@ -3,7 +3,8 @@ SUBDIRS = include ../../../build/rules.make LIBRARY = I18N.Other.dll -LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll /unsafe +LIB_REFS = I18N +LOCAL_MCS_FLAGS = /unsafe NO_TEST = yes EXTRA_DISTFILES = $(wildcard *.ucm) diff --git a/mcs/class/I18N/Rare/Makefile b/mcs/class/I18N/Rare/Makefile index fd315cfce14..f558e20e555 100644 --- a/mcs/class/I18N/Rare/Makefile +++ b/mcs/class/I18N/Rare/Makefile @@ -3,7 +3,8 @@ SUBDIRS = include ../../../build/rules.make LIBRARY = I18N.Rare.dll -LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll /unsafe +LIB_REFS = I18N +LOCAL_MCS_FLAGS = /unsafe NO_TEST = yes EXTRA_DISTFILES = $(wildcard *.ucm) diff --git a/mcs/class/I18N/West/Makefile b/mcs/class/I18N/West/Makefile index e8b7afe3d07..bc4b2386188 100644 --- a/mcs/class/I18N/West/Makefile +++ b/mcs/class/I18N/West/Makefile @@ -3,7 +3,8 @@ SUBDIRS = include ../../../build/rules.make LIBRARY = I18N.West.dll -LOCAL_MCS_FLAGS = /r:$(corlib) /r:I18N.dll /unsafe +LIB_REFS = I18N +LOCAL_MCS_FLAGS = /unsafe #NO_TEST = yes EXTRA_DISTFILES = $(wildcard *.ucm) \ diff --git a/mcs/class/IBM.Data.DB2/Makefile b/mcs/class/IBM.Data.DB2/Makefile index 732087d903e..630df027785 100644 --- a/mcs/class/IBM.Data.DB2/Makefile +++ b/mcs/class/IBM.Data.DB2/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = IBM.Data.DB2.dll LIB_REFS = System System.Xml System.Data -LIB_MCS_FLAGS = /unsafe /r:$(corlib) -warn:1 +LIB_MCS_FLAGS = /unsafe -warn:1 NO_TEST = yes EXTRA_DISTFILES = ibm.pub diff --git a/mcs/class/ICSharpCode.SharpZipLib/Makefile b/mcs/class/ICSharpCode.SharpZipLib/Makefile index 6a4052c5577..bd64d2a4d66 100644 --- a/mcs/class/ICSharpCode.SharpZipLib/Makefile +++ b/mcs/class/ICSharpCode.SharpZipLib/Makefile @@ -6,7 +6,7 @@ LIBRARY = ICSharpCode.SharpZipLib.dll LIBRARY_SNK = SharpZipLib.key LIB_REFS = System System.Xml -LIB_MCS_FLAGS = /r:$(corlib) -warn:1 +LIB_MCS_FLAGS = -warn:1 NO_TEST = yes EXTRA_DISTFILES = SharpZipLib.pub $(LIBRARY_SNK) diff --git a/mcs/class/Microsoft.Build.Engine/Makefile b/mcs/class/Microsoft.Build.Engine/Makefile index 47216dc7d24..9aed8120654 100644 --- a/mcs/class/Microsoft.Build.Engine/Makefile +++ b/mcs/class/Microsoft.Build.Engine/Makefile @@ -7,38 +7,28 @@ include $(XBUILD_DIR)/xbuild.make LIBRARY = Microsoft.Build.Engine.dll -LIB_REFS = System System.Core System.Xml -LIB_MCS_FLAGS = \ - /r:$(corlib) \ - /r:System.dll \ - /r:System.Core.dll \ - /r:System.Xml.dll \ - /r:$(XBUILD_FRAMEWORK) \ - /r:$(XBUILD_UTILITIES) - -TEST_MCS_FLAGS = \ - /r:$(XBUILD_FRAMEWORK) \ - /r:$(XBUILD_UTILITIES) \ - /r:System.Xml.dll +LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml $(XBUILD_FRAMEWORK) $(XBUILD_UTILITIES) +LIB_MCS_FLAGS = + +TEST_MCS_FLAGS = +TEST_LIB_REFS = $(XBUILD_FRAMEWORK) $(XBUILD_UTILITIES) $(PARENT_PROFILE)System.Xml EXTRA_DISTFILES = \ Test/resources/TestTasks.cs \ Test/resources/*.*proj \ Test/resources/*.csproj -Test/resources/TestTasks-$(PROFILE).dll: Test/resources/TestTasks.cs - $(CSCOMPILE) /out:$@ Test/resources/TestTasks.cs /r:$(XBUILD_FRAMEWORK) /r:$(XBUILD_UTILITIES) /target:library +CLEAN_FILES = Test/resources/TestTasks-$(PROFILE).dll Test/resources/TestTasks-$(PROFILE).dll.mdb Test/resources/TestTasks-$(PROFILE).pdb -clean-test-resources: - rm -f Test/resources/TestTasks*.dll Test/resources/TestTasks*.dll.mdb +Test/resources/TestTasks-$(PROFILE).dll: Test/resources/TestTasks.cs + $(CSCOMPILE) /out:$@ Test/resources/TestTasks.cs /r:$(topdir)/class/lib/$(PROFILE)/$(XBUILD_FRAMEWORK).dll /r:$(topdir)/class/lib/$(PROFILE)/$(XBUILD_UTILITIES).dll /target:library test-local: compile-resources compile-resources: Test/resources/TestTasks-$(PROFILE).dll cp Test/resources/TestTasks-$(PROFILE).dll Test/resources/TestTasks.dll cp Test/resources/TestTasks-$(PROFILE).dll.mdb Test/resources/TestTasks.dll.mdb - -clean-local: clean-test-resources +# cp Test/resources/TestTasks-$(PROFILE).pdb Test/resources/TestTasks.pdb include $(XBUILD_DIR)/xbuild_test.make include ../../build/library.make diff --git a/mcs/class/Microsoft.Build.Framework/Makefile b/mcs/class/Microsoft.Build.Framework/Makefile index 779dc9e2fd4..f31f5a5835e 100644 --- a/mcs/class/Microsoft.Build.Framework/Makefile +++ b/mcs/class/Microsoft.Build.Framework/Makefile @@ -7,10 +7,8 @@ include $(XBUILD_DIR)/xbuild.make LIBRARY = Microsoft.Build.Framework.dll -LIB_REFS = System -LIB_MCS_FLAGS = \ - /r:$(corlib) \ - /r:System.dll +LIB_REFS = $(PARENT_PROFILE)System +LIB_MCS_FLAGS = EXTRA_DISTFILES = \ Mono.XBuild.Framework/AssemblyLoadInfo.cs diff --git a/mcs/class/Microsoft.Build.Tasks/Makefile b/mcs/class/Microsoft.Build.Tasks/Makefile index 66b74a84728..d451c754e74 100644 --- a/mcs/class/Microsoft.Build.Tasks/Makefile +++ b/mcs/class/Microsoft.Build.Tasks/Makefile @@ -9,28 +9,14 @@ LIBRARY = Microsoft.Build.Tasks.dll LIBRARY_NAME = Microsoft.Build.Tasks$(NAME_SUFFIX).dll -LIB_REFS = System System.Core System.Xml System.Windows.Forms -LIB_MCS_FLAGS = \ - /r:$(corlib) \ - /r:System.dll \ - /r:System.Core.dll \ - /r:System.Xml.dll \ - /r:System.Windows.Forms.dll \ - /r:$(XBUILD_UTILITIES) \ - /r:$(XBUILD_FRAMEWORK) \ - /r:$(XBUILD_ENGINE) \ - /r:$(XBUILD_TASKS) - -TEST_MCS_FLAGS = \ - /r:System.Xml.dll \ - /r:$(XBUILD_ENGINE) \ - /r:$(XBUILD_FRAMEWORK) \ - /r:$(XBUILD_TASKS) \ - /r:$(XBUILD_UTILITIES) \ - /r:System.Core.dll +LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml $(PARENT_PROFILE)System.Windows.Forms \ + $(XBUILD_UTILITIES) $(XBUILD_FRAMEWORK) $(XBUILD_ENGINE) $(XBUILD_TASKS) + +TEST_MCS_FLAGS = +TEST_LIB_REFS = $(PARENT_PROFILE)System.Xml $(XBUILD_ENGINE) $(XBUILD_FRAMEWORK) $(XBUILD_TASKS) $(XBUILD_UTILITIES) $(PARENT_PROFILE)System.Core ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) - TEST_MCS_FLAGS += /r:Microsoft.Build.dll +TEST_LIB_REFS += Microsoft.Build endif EXTRA_DISTFILES = \ @@ -41,7 +27,7 @@ EXTRA_DISTFILES = \ Test/test-config-file* Test/resources/test.dll: Test/resources/test.cs - $(CSCOMPILE) -target:library Test/resources/test.cs + $(CSCOMPILE) -target:library /out:$@ $< clean-test-resources: rm -f Test/resources/test.dll diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignProjectConfiguration.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignProjectConfiguration.cs index 6fd7954ab42..bb85df584df 100644 --- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignProjectConfiguration.cs +++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignProjectConfiguration.cs @@ -41,6 +41,8 @@ namespace Microsoft.Build.Tasks { ITaskItem[] assignedProjects; string solutionConfigurationContents; ITaskItem[] unassignedProjects; + Dictionary guidToConfigPlatform; + Dictionary absolutePathToConfigPlatform; public AssignProjectConfiguration () { @@ -53,10 +55,10 @@ namespace Microsoft.Build.Tasks { return true; XmlReader xr = null; - Dictionary guidToConfigPlatform = null; + guidToConfigPlatform = new Dictionary (); + absolutePathToConfigPlatform = new Dictionary (); try { xr = XmlReader.Create (new StringReader (solutionConfigurationContents)); - guidToConfigPlatform = new Dictionary (); xr.Read (); while (!xr.EOF) { @@ -65,12 +67,20 @@ namespace Microsoft.Build.Tasks { continue; string guid_str = xr.GetAttribute ("Project"); + string abs_path = xr.GetAttribute ("AbsolutePath"); string config_str = xr.ReadString (); + if (String.IsNullOrEmpty (config_str)) + continue; + Guid guid; - if (!String.IsNullOrEmpty (guid_str) && !String.IsNullOrEmpty (config_str) && - TryParseGuid (guid_str, out guid)) + if (TryParseGuid (guid_str, out guid)) guidToConfigPlatform [guid] = config_str; + + if (!String.IsNullOrEmpty (abs_path)) { + abs_path = Path.GetFullPath (abs_path); + absolutePathToConfigPlatform [abs_path] = config_str; + } } } catch (XmlException xe) { Log.LogError ("XmlException while parsing SolutionConfigurationContents: {0}", @@ -84,32 +94,22 @@ namespace Microsoft.Build.Tasks { List tempAssignedProjects = new List (); List tempUnassignedProjects = new List (); foreach (ITaskItem item in ProjectReferences) { - string config; - - string guid_str = item.GetMetadata ("Project"); + string config = GetConfigPlatformFromProjectReference (item); - Guid guid = Guid.Empty; - if (!string.IsNullOrEmpty(guid_str) && !TryParseGuid (guid_str, out guid)) { - Log.LogError ("Project reference '{0}' has invalid or missing guid for metadata 'Project'.", - item.ItemSpec); - return false; + if (String.IsNullOrEmpty (config)) { + tempUnassignedProjects.Add (item); + continue; } - if (guid != Guid.Empty && guidToConfigPlatform.TryGetValue (guid, out config)) { - string [] parts = config.Split (new char [] {'|'}, 2); + string [] parts = config.Split (new char [] {'|'}, 2); - ITaskItem new_item = new TaskItem (item); + ITaskItem new_item = new TaskItem (item); - new_item.SetMetadata ("SetConfiguration", "Configuration=" + parts [0]); - new_item.SetMetadata ("SetPlatform", "Platform=" + - ((parts.Length > 1) ? parts [1] : String.Empty)); + new_item.SetMetadata ("SetConfiguration", "Configuration=" + parts [0]); + new_item.SetMetadata ("SetPlatform", "Platform=" + + ((parts.Length > 1) ? parts [1] : String.Empty)); - tempAssignedProjects.Add (new_item); - } else { - Log.LogWarning ("Project reference '{0}' could not be resolved.", - item.ItemSpec); - tempUnassignedProjects.Add (item); - } + tempAssignedProjects.Add (new_item); } assignedProjects = tempAssignedProjects.ToArray (); @@ -118,9 +118,29 @@ namespace Microsoft.Build.Tasks { return true; } + string GetConfigPlatformFromProjectReference (ITaskItem item) + { + string guid_str = item.GetMetadata ("Project"); + string proj_full_path = item.GetMetadata ("FullPath"); + + string config; + Guid guid = Guid.Empty; + if (TryParseGuid (guid_str, out guid) && guidToConfigPlatform.TryGetValue (guid, out config)) + return config; + + string abs_path = item.GetMetadata ("FullPath"); + if (absolutePathToConfigPlatform.TryGetValue (abs_path, out config)) + return config; + + return null; + } + bool TryParseGuid (string guid_str, out Guid guid) { guid = Guid.Empty; + if (String.IsNullOrEmpty (guid_str)) + return false; + try { guid = new Guid (guid_str); } catch (ArgumentNullException) { diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CodeTaskFactory.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CodeTaskFactory.cs index 2102d41c3f3..9d759e09d9d 100644 --- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CodeTaskFactory.cs +++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/CodeTaskFactory.cs @@ -185,7 +185,7 @@ namespace Microsoft.Build.Tasks var cscParams = new CompilerParameters (); cscParams.ReferencedAssemblies.Add ("Microsoft.Build.Framework.dll"); cscParams.ReferencedAssemblies.Add ("Microsoft.Build.Utilities.v4.0.dll"); // since we use Task, it depends on this dll. - cscParams.ReferencedAssemblies.AddRange (references.ToArray ()); + cscParams.ReferencedAssemblies.AddRange (GetReferences (references, taskFactoryLoggingHost)); cscParams.GenerateInMemory = true; var results = CodeDomProvider.CreateProvider (language).CompileAssemblyFromDom (cscParams, ccu); var errors = new CompilerError [results.Errors.Count]; @@ -197,6 +197,36 @@ namespace Microsoft.Build.Tasks assembly = results.CompiledAssembly; return true; } + + static string[] GetReferences (List references, IBuildEngine log) + { + var res = new List (); + foreach (var r in references) { + if (File.Exists (r)) { + res.Add (r); + continue; + } + + Assembly assembly = null; + + try { + if (!r.EndsWith (".dll", StringComparison.OrdinalIgnoreCase) || !r.EndsWith (".exe", StringComparison.OrdinalIgnoreCase)) { + assembly = Assembly.LoadWithPartialName (r); + } + + if (assembly != null) { + res.Add (assembly.Location); + continue; + } + } catch { + } + + log.LogErrorEvent (new BuildErrorEventArgs ("", "", "", 0, 0, 0, 0, "Assembly reference {r} could not be resolved", "", "")); + } + + return res.ToArray (); + } + public string FactoryName { get { return "Code Task Factory"; } } diff --git a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs index f7d25591a8c..be1ea2c0fb7 100644 --- a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs +++ b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs @@ -32,6 +32,7 @@ using Microsoft.Build.Framework; using Microsoft.Build.Tasks; using Microsoft.Build.Utilities; using NUnit.Framework; +using System.IO; using System.Text; namespace MonoTests.Microsoft.Build.Tasks @@ -58,22 +59,73 @@ namespace MonoTests.Microsoft.Build.Tasks "{DAE34193-B5C7-4488-A911-29EE15C84CBE}" }; - CreateAndCheckProject (guids, project_ref_guids, new string[] { - "AssignedProjects : foo0.csproj;foo1.csproj;foo2.csproj;foo3.csproj: SetConfig: Configuration=Release", + CreateAndCheckProject (guids, new bool[] {true, true, true, true, true, true}, + project_ref_guids, new string[] { + "AssignedProjects : foo0.csproj;foo1.csproj;foo2.csproj;foo3.csproj;foo4.csproj: SetConfig: Configuration=Release", "AssignedProjects : foo0.csproj: SetPlatform: Platform=AnyCPU0", "AssignedProjects : foo1.csproj: SetPlatform: Platform=AnyCPU1", "AssignedProjects : foo2.csproj: SetPlatform: Platform=AnyCPU2", "AssignedProjects : foo3.csproj: SetPlatform: Platform=AnyCPU3", - "UnassignedProjects : foo4.csproj"}, + "AssignedProjects : foo4.csproj: SetPlatform: Platform=AnyCPU4", + "UnassignedProjects : "}, true, "A1#"); } [Test] - public void TestInvalidProjectGuid () + public void TestNoGuidAndNoAbsolutePathFound() { string[] guids = new string[] { + "asd" + }; + + string[] project_ref_guids = new string[] { + "{DAE34193-B5C7-4488-A911-29EE15C84CB8}", + "invalid guid", + "" + }; + + CreateAndCheckProject (guids, new bool[]{false}, + project_ref_guids, + new string[] { + "AssignedProjects : : SetConfig: ", + "AssignedProjects : : SetPlatform: ", + "UnassignedProjects : foo0.csproj;foo1.csproj;foo2.csproj" + }, + true, "A1#"); + } + + [Test] + public void TestInvalidProjectGuidWithAbsolutePath () + { + string[] guids = new string[] { + null, // no AbsPath + "another invalid guid", // has AbsPath + }; + + string[] project_ref_guids = new string[] { + "1234zxc", // this won't match because no AbsPath + "xzxoiu", // match with the second project, foo1.csproj "{23F291D9-78DF-4133-8CF2-78CE104DDE63}", + "badref" // no corresponding project at all + }; + + CreateAndCheckProject (guids, new bool[]{false, true}, + project_ref_guids, + new string[] { + "AssignedProjects : foo1.csproj: SetConfig: Configuration=Release", + "AssignedProjects : foo1.csproj: SetPlatform: Platform=AnyCPU1", + "UnassignedProjects : foo0.csproj;foo2.csproj;foo3.csproj" + }, + true, "A1#"); + } + + [Test] + public void TestNoGuidWithAbsolutePath () + { + string[] guids = new string[] { + "", + null }; string[] project_ref_guids = new string[] { @@ -82,7 +134,14 @@ namespace MonoTests.Microsoft.Build.Tasks "invalid guid" }; - CreateAndCheckProject (guids, project_ref_guids, null, false, "A1#"); + CreateAndCheckProject (guids, new bool[]{true, false}, + project_ref_guids, + new string[] { + "AssignedProjects : foo0.csproj: SetConfig: Configuration=Release", + "AssignedProjects : foo0.csproj: SetPlatform: Platform=AnyCPU0", + "UnassignedProjects : foo1.csproj;foo2.csproj" + }, + true, "A1#"); } [Test] @@ -97,7 +156,8 @@ namespace MonoTests.Microsoft.Build.Tasks "{23F291D9-78DF-4133-8CF2-78CE104DDE63}" }; - CreateAndCheckProject (guids, project_ref_guids, + CreateAndCheckProject (guids, new bool[]{false, true}, + project_ref_guids, new string [] { "AssignedProjects : foo1.csproj: SetConfig: Configuration=Release", "AssignedProjects : foo1.csproj: SetPlatform: Platform=AnyCPU0", @@ -106,14 +166,14 @@ namespace MonoTests.Microsoft.Build.Tasks } - void CreateAndCheckProject (string[] guids, string[] project_ref_guids, string[] messages, bool build_result, string prefix) + void CreateAndCheckProject (string[] guids, bool[] set_project_paths, string[] project_ref_guids, string[] messages, bool build_result, string prefix) { Engine engine = new Engine (Consts.BinPath); Project project = engine.CreateNewProject (); TestMessageLogger testLogger = new TestMessageLogger (); engine.RegisterLogger (testLogger); - string projectString = CreateProject (guids, project_ref_guids); + string projectString = CreateProject (guids, set_project_paths, project_ref_guids); project.LoadXml (projectString); try { @@ -131,12 +191,12 @@ namespace MonoTests.Microsoft.Build.Tasks } } - string CreateProject (string[] guids, string[] project_ref_guids) + string CreateProject (string[] guids, bool[] set_project_paths, string[] project_ref_guids) { StringBuilder sb = new StringBuilder (); sb.Append (@""); sb.Append ("\n" + GetUsingTask ("AssignProjectConfiguration")); - sb.AppendFormat (@"{0}", CreateSolutionConfigurationProperty (guids, "Release|AnyCPU")); + sb.AppendFormat (@"{0}", CreateSolutionConfigurationProperty (guids, set_project_paths, "Release|AnyCPU")); sb.Append (CreateProjectReferencesItemGroup (project_ref_guids)); sb.Append ("\n\t\n"); @@ -154,13 +214,19 @@ namespace MonoTests.Microsoft.Build.Tasks return sb.ToString (); } - string CreateSolutionConfigurationProperty (string[] guids, string config_str) + string CreateSolutionConfigurationProperty (string[] guids, bool[] set_project_paths, string config_str) { + string abs_proj_path_prefix = Path.GetFullPath ("foo"); StringBuilder sb = new StringBuilder (); sb.Append ("\n\n"); sb.Append ("\t\n"); for (int i = 0; i < guids.Length; i++) { - sb.AppendFormat ("\t\t{1}{2}\n", + sb.Append ("\t\t{1}{2}\n", guids[i], config_str, i); } sb.Append ("\t\n"); @@ -173,8 +239,12 @@ namespace MonoTests.Microsoft.Build.Tasks { StringBuilder sb = new StringBuilder (); sb.Append ("\n\n"); - for (int i = 0; i < guids.Length; i ++) - sb.AppendFormat ("\t{0}\n", guids [i], i); + for (int i = 0; i < guids.Length; i ++) { + sb.AppendFormat ("\t", i); + if (guids[i] != null) + sb.AppendFormat ("{0}", guids[i]); + sb.Append ("\n"); + } sb.Append ("\n"); return sb.ToString (); } diff --git a/mcs/class/Microsoft.Build.Utilities/Makefile b/mcs/class/Microsoft.Build.Utilities/Makefile index e44bbc2fe80..10ef6780d4a 100644 --- a/mcs/class/Microsoft.Build.Utilities/Makefile +++ b/mcs/class/Microsoft.Build.Utilities/Makefile @@ -8,17 +8,13 @@ include $(XBUILD_DIR)/xbuild.make LIBRARY = Microsoft.Build.Utilities.dll LIBRARY_NAME = Microsoft.Build.Utilities$(NAME_SUFFIX).dll -LIB_REFS = System System.Core System.Xml -LIB_MCS_FLAGS = \ - /r:$(corlib) \ - /r:System.dll \ - /r:System.Core.dll \ - /r:System.Xml.dll \ - /r:$(XBUILD_FRAMEWORK) +LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml $(XBUILD_FRAMEWORK) +LIB_MCS_FLAGS = TEST_RESX_RESOURCES = Test/Microsoft.Build.Utilities/Strings.resources -TEST_MCS_FLAGS = /r:$(XBUILD_ENGINE) /r:$(XBUILD_FRAMEWORK) -r:System.dll -r:System.Core.dll $(TEST_RESX_RESOURCES:%=-resource:%) +TEST_LIB_REFS = $(XBUILD_ENGINE) $(XBUILD_FRAMEWORK) $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core +TEST_MCS_FLAGS = $(TEST_RESX_RESOURCES:%=-resource:%) include $(XBUILD_DIR)/xbuild_test.make include ../../build/library.make @@ -27,6 +23,8 @@ EXTRA_DISTFILES = $(TEST_RESX_RESOURCES:.resources=.resx) CLEAN_FILES += $(TEST_RESX_RESOURCES) +.NOTPARALLEL: $(TEST_RESX_RESOURCES) + $(TEST_RESX_RESOURCES): %.resources: %.resx $(RESGEN) $< || cp $@.prebuilt $@ diff --git a/mcs/class/Microsoft.Build/Makefile b/mcs/class/Microsoft.Build/Makefile index 68cd09eb043..933782ff268 100644 --- a/mcs/class/Microsoft.Build/Makefile +++ b/mcs/class/Microsoft.Build/Makefile @@ -7,18 +7,12 @@ include $(XBUILD_DIR)/xbuild.make LIBRARY = Microsoft.Build.dll -LIB_REFS = System System.Core System.Xml Microsoft.Build.Engine Microsoft.Build.Framework +LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core $(PARENT_PROFILE)System.Xml Microsoft.Build.Engine Microsoft.Build.Framework LIB_MCS_FLAGS = \ - /r:$(corlib) \ - /r:System.dll \ - /r:System.Core.dll \ - /r:System.Xml.dll \ - /r:Microsoft.Build.Engine.dll \ - /r:Microsoft.Build.Framework.dll \ /d:MICROSOFT_BUILD_DLL -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) \ - /r:Microsoft.Build.Utilities.v4.0.dll +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) +TEST_LIB_REFS = $(XBUILD_UTILITIES) EXTRA_DISTFILES = \ Microsoft.Build.Internal/ExpressionParser.jay \ diff --git a/mcs/class/Microsoft.VisualC/Makefile b/mcs/class/Microsoft.VisualC/Makefile index 4110234a980..5d38210947f 100644 --- a/mcs/class/Microsoft.VisualC/Makefile +++ b/mcs/class/Microsoft.VisualC/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = Microsoft.VisualC.dll LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/Mono.C5/Makefile b/mcs/class/Mono.C5/Makefile index 71430e72932..c5f80e37114 100644 --- a/mcs/class/Mono.C5/Makefile +++ b/mcs/class/Mono.C5/Makefile @@ -5,7 +5,7 @@ include ../../build/rules.make LIBRARY = Mono.C5.dll LIBRARY_SNK = c5.snk LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) -nowarn:169,219,414,1030,3001,3005,3006 +LIB_MCS_FLAGS = -nowarn:169,219,414,1030,3001,3005,3006 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 EXTRA_DISTFILES = \ diff --git a/mcs/class/Mono.C5/Test/AssemblyInfo.cs b/mcs/class/Mono.C5/Test/AssemblyInfo.cs index 485639075e7..2e7e70305ae 100644 --- a/mcs/class/Mono.C5/Test/AssemblyInfo.cs +++ b/mcs/class/Mono.C5/Test/AssemblyInfo.cs @@ -47,7 +47,7 @@ using System.Runtime.CompilerServices; // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] // // In order to sign your assembly you must specify a key to use. Refer to the diff --git a/mcs/class/Mono.CSharp/Makefile b/mcs/class/Mono.CSharp/Makefile index 5fe1a18705a..d2ed176601d 100644 --- a/mcs/class/Mono.CSharp/Makefile +++ b/mcs/class/Mono.CSharp/Makefile @@ -15,9 +15,14 @@ ifndef NO_THREAD_ABORT REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT endif -TEST_MCS_FLAGS = -r:System.Core.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.Core LIB_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS) include ../../build/library.make +$(topdir)/mcs/cs-parser.cs: + $(MAKE) -C $(topdir)/mcs cs-parser.cs + +$(the_lib): $(topdir)/mcs/cs-parser.cs diff --git a/mcs/class/Mono.Cecil.Mdb/Makefile b/mcs/class/Mono.Cecil.Mdb/Makefile index 70c759c1dab..50357a7903d 100644 --- a/mcs/class/Mono.Cecil.Mdb/Makefile +++ b/mcs/class/Mono.Cecil.Mdb/Makefile @@ -6,7 +6,7 @@ LIBRARY_SNK = ../mono.snk LIBRARY_PACKAGE = none LIB_REFS = System Mono.Cecil -LIB_MCS_FLAGS = /r:$(corlib) /d:CECIL -keyfile:$(LIBRARY_SNK) +LIB_MCS_FLAGS = /d:CECIL -keyfile:$(LIBRARY_SNK) -publicsign NO_TEST = yes NO_INSTALL = yes diff --git a/mcs/class/Mono.Cecil/Makefile b/mcs/class/Mono.Cecil/Makefile index 790a21809ff..53aee64f34a 100644 --- a/mcs/class/Mono.Cecil/Makefile +++ b/mcs/class/Mono.Cecil/Makefile @@ -6,7 +6,7 @@ LIBRARY_SNK = ../mono.snk LIBRARY_PACKAGE = none LIB_REFS = System.Core -LIB_MCS_FLAGS = /r:$(corlib) -keyfile:$(LIBRARY_SNK) -d:NET_3_5 +LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_3_5 /publicsign NO_TEST = yes diff --git a/mcs/class/Mono.CodeContracts/Makefile b/mcs/class/Mono.CodeContracts/Makefile index 92a7619d104..b5e733dbcd9 100644 --- a/mcs/class/Mono.CodeContracts/Makefile +++ b/mcs/class/Mono.CodeContracts/Makefile @@ -6,8 +6,8 @@ LIBRARY = Mono.CodeContracts.dll LIB_REFS = System System.Core Mono.Cecil Mono.Cecil.Mdb LIB_MCS_FLAGS = -#-r:Mono.Cecil.Pdb.dll -TEST_MCS_FLAGS = -r:System.Core.dll -debug +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.Core include ../../build/library.make diff --git a/mcs/class/Mono.Data.Tds/Makefile b/mcs/class/Mono.Data.Tds/Makefile index 4f6cc0ca353..f1764c2282b 100644 --- a/mcs/class/Mono.Data.Tds/Makefile +++ b/mcs/class/Mono.Data.Tds/Makefile @@ -4,8 +4,9 @@ include ../../build/rules.make LIBRARY = Mono.Data.Tds.dll LIB_REFS = System System.Xml Mono.Security -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = -TEST_MCS_FLAGS = /r:System.dll /r:System.Net.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System System.Net include ../../build/library.make diff --git a/mcs/class/Mono.Debugger.Soft/Makefile b/mcs/class/Mono.Debugger.Soft/Makefile index 659cf71668e..d92fb61f8a9 100644 --- a/mcs/class/Mono.Debugger.Soft/Makefile +++ b/mcs/class/Mono.Debugger.Soft/Makefile @@ -5,9 +5,10 @@ LIBRARY = Mono.Debugger.Soft.dll LIBRARY_SNK = ../mono.snk LIB_REFS = System Mono.Cecil System.Core -LIB_MCS_FLAGS = /r:$(corlib) /unsafe -D:MONO_DATACONVERTER_STATIC_METHODS -keyfile:$(LIBRARY_SNK) +LIB_MCS_FLAGS = /unsafe -D:MONO_DATACONVERTER_STATIC_METHODS -keyfile:$(LIBRARY_SNK) /publicsign -TEST_MCS_FLAGS = /r:Mono.Cecil.dll /r:System.dll /r:System.Core.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = Mono.Cecil System System.Core VALID_TEST_PROFILE := $(filter net_4_x, $(PROFILE)) @@ -17,7 +18,7 @@ ifdef VALID_TEST_PROFILE test-local: dtest-app.exe dtest-excfilter.exe dtest-app.exe: Test/dtest-app.cs - $(CSCOMPILE) -out:$@ -unsafe -debug -optimize- Test/dtest-app.cs + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs dtest-excfilter.exe: Test/dtest-excfilter.il MONO_PATH=$(topdir)/class/lib/$(PROFILE) $(INTERNAL_ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il @@ -29,7 +30,7 @@ check: endif -CLEAN_FILES = dtest-app.exe dtest-app.exe.mdb dtest-excfilter.exe dtest-excfilter.exe.mdb +CLEAN_FILES = dtest-app.exe dtest-app.exe.mdb dtest-app.pdb dtest-excfilter.exe dtest-excfilter.exe.mdb dtest-excfilter.pdb EXTRA_DISTFILES = \ Test/dtest-app.cs \ diff --git a/mcs/class/Mono.Directory.LDAP/Makefile b/mcs/class/Mono.Directory.LDAP/Makefile index 919f24f0d62..040a1801e1c 100644 --- a/mcs/class/Mono.Directory.LDAP/Makefile +++ b/mcs/class/Mono.Directory.LDAP/Makefile @@ -4,6 +4,6 @@ include ../../build/rules.make LIBRARY = Mono.Directory.LDAP.dll LIB_REFS = System System.Data -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = include ../../build/library.make diff --git a/mcs/class/Mono.Dynamic.Interpreter/Makefile b/mcs/class/Mono.Dynamic.Interpreter/Makefile index 903006b49b5..6d9565ccbee 100644 --- a/mcs/class/Mono.Dynamic.Interpreter/Makefile +++ b/mcs/class/Mono.Dynamic.Interpreter/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = Mono.Dynamic.Interpreter.dll -LIB_REFS = System System.Core +LIB_REFS = System LIB_MCS_FLAGS = \ -d:FEATURE_CORE_DLR,FEATURE_DBNULL,FEATURE_DEFAULT_PARAMETER_VALUE,FEATURE_GET_TYPE_INFO,FEATURE_VARIANCE,FEATURE_SERIALIZATION,CLR45 \ -d:MONO_INTERPRETER \ @@ -12,7 +12,9 @@ LIB_MCS_FLAGS = \ ifdef MOBILE_STATIC mono_dynamic_interpreter_deps = $(the_libdir_base)plaincore/System.Core.dll -LIB_MCS_FLAGS += -lib:$(the_libdir_base)plaincore +LIB_REFS += plaincore/System.Core +else +LIB_REFS += System.Core endif include ../../build/library.make diff --git a/mcs/class/Mono.Http/Makefile b/mcs/class/Mono.Http/Makefile index d52144b2154..f3801411afa 100644 --- a/mcs/class/Mono.Http/Makefile +++ b/mcs/class/Mono.Http/Makefile @@ -4,8 +4,7 @@ include ../../build/rules.make LIBRARY = Mono.Http.dll LIB_REFS = System System.Xml System.Web ICSharpCode.SharpZipLib Mono.Security -LIB_MCS_FLAGS = -r:$(corlib) \ - -nowarn:618 +LIB_MCS_FLAGS = -nowarn:618 NO_TEST = yes diff --git a/mcs/class/Mono.Management/Makefile b/mcs/class/Mono.Management/Makefile index c4a97a86a89..5b7c92c5e4d 100644 --- a/mcs/class/Mono.Management/Makefile +++ b/mcs/class/Mono.Management/Makefile @@ -5,7 +5,7 @@ include ../../build/rules.make LIBRARY = Mono.Management.dll LIB_REFS = System Mono.Posix -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/Mono.Messaging.RabbitMQ/Makefile b/mcs/class/Mono.Messaging.RabbitMQ/Makefile index d07fee59e7e..67f382812d8 100644 --- a/mcs/class/Mono.Messaging.RabbitMQ/Makefile +++ b/mcs/class/Mono.Messaging.RabbitMQ/Makefile @@ -6,8 +6,8 @@ LIBRARY = Mono.Messaging.RabbitMQ.dll LIB_REFS = System System.Messaging Mono.Messaging RabbitMQ.Client LIB_MCS_FLAGS = -nowarn:618 -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 \ - /r:nunit.mocks.dll +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 +TEST_LIB_REFS = nunit.mocks include ../../build/library.make diff --git a/mcs/class/Mono.Messaging/Makefile b/mcs/class/Mono.Messaging/Makefile index a2e3fbf7b44..7788dfb60c8 100644 --- a/mcs/class/Mono.Messaging/Makefile +++ b/mcs/class/Mono.Messaging/Makefile @@ -7,6 +7,7 @@ LIBRARY = Mono.Messaging.dll LIB_REFS = System System.Configuration LIB_MCS_FLAGS = -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 /r:System.Messaging.dll /r:nunit.mocks.dll +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 +TEST_LIB_REFS = System.Messaging nunit.mocks include ../../build/library.make diff --git a/mcs/class/Mono.Options/Makefile b/mcs/class/Mono.Options/Makefile index beee719c77f..2fb4724b281 100644 --- a/mcs/class/Mono.Options/Makefile +++ b/mcs/class/Mono.Options/Makefile @@ -8,8 +8,9 @@ LIBRARY_PACKAGE = none NO_INSTALL = yes LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) -TEST_MCS_FLAGS = /r:Mono.Posix.dll /r:System.dll /r:System.Core.dll +LIB_MCS_FLAGS = +TEST_MCS_FLAGS = +TEST_LIB_REFS = Mono.Posix System System.Core mono_sourcelibs_DIR = $(DESTDIR)$(mono_libdir)/mono-source-libs mono_options_DATA = Mono.Options/Options.cs diff --git a/mcs/class/Mono.Options/Mono.Options/Options.cs b/mcs/class/Mono.Options/Mono.Options/Options.cs index 23ee99324e8..05810c39481 100644 --- a/mcs/class/Mono.Options/Mono.Options/Options.cs +++ b/mcs/class/Mono.Options/Mono.Options/Options.cs @@ -477,7 +477,10 @@ namespace Mono.Options try { if (value != null) { #if PCL - t = (T) Convert.ChangeType (value, targetType); + if (targetType.GetTypeInfo ().IsEnum) + t = (T) Enum.Parse (targetType, value, true); + else + t = (T) Convert.ChangeType (value, targetType); #else TypeConverter conv = TypeDescriptor.GetConverter (targetType); t = (T) conv.ConvertFromString (value); diff --git a/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs b/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs index a66f2784989..572223ebd66 100644 --- a/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs +++ b/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs @@ -269,6 +269,26 @@ namespace MonoTests.Mono.Options p, v => { v.Parse (_("-n=")); }); } + [Test] + public void EnumValues () + { + DayOfWeek a = 0; + OptionSet p = new OptionSet () { + { "a=", (DayOfWeek v) => a = v }, + }; + p.Parse (_ ("-a=Monday")); + Assert.AreEqual (a, DayOfWeek.Monday); + p.Parse (_ ("-a=tuesday")); + Assert.AreEqual (a, DayOfWeek.Tuesday); + p.Parse (_ ("-a=3")); + Assert.AreEqual (a, DayOfWeek.Wednesday); + p.Parse (_ ("-a=Monday,Tuesday")); + Assert.AreEqual (a, DayOfWeek.Monday | DayOfWeek.Tuesday); + Utils.AssertException (typeof (OptionException), + "Could not convert string `Noday' to type DayOfWeek for option `-a'.", + p, v => { v.Parse (_ ("-a=Noday")); }); + } + [Test] public void BooleanValues () { diff --git a/mcs/class/Mono.Parallel/Makefile b/mcs/class/Mono.Parallel/Makefile index e2f587ed5e6..75b5aff640b 100644 --- a/mcs/class/Mono.Parallel/Makefile +++ b/mcs/class/Mono.Parallel/Makefile @@ -6,7 +6,8 @@ LIBRARY = Mono.Parallel.dll include ../../build/library.make -TEST_MCS_FLAGS = /r:System.Core.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.Core LIB_REFS += System.Core System -LIB_MCS_FLAGS += -d:INSIDE_MONO_PARALLEL -r:$(corlib) +LIB_MCS_FLAGS += -d:INSIDE_MONO_PARALLEL diff --git a/mcs/class/Mono.Posix/Makefile b/mcs/class/Mono.Posix/Makefile index 9cde3498e4d..10d14fc45ed 100644 --- a/mcs/class/Mono.Posix/Makefile +++ b/mcs/class/Mono.Posix/Makefile @@ -6,8 +6,9 @@ LIBRARY = Mono.Posix.dll # Don't warn about [Obsolete] members, as there are now *lots* of [Obsolete] # members, generating volumes of output. LIB_REFS = System -LIB_MCS_FLAGS = /unsafe /r:$(corlib) /nowarn:0618,612 -TEST_MCS_FLAGS = /unsafe /r:Mono.Posix.dll /r:System.dll /nowarn:0219,0618 +LIB_MCS_FLAGS = /unsafe /nowarn:0618,612 +TEST_MCS_FLAGS = /unsafe /nowarn:0219,0618 +TEST_LIB_REFS = Mono.Posix System LIBRARY_COMPILE = $(BOOT_COMPILE) diff --git a/mcs/class/Mono.Security.Providers.NewTls/Makefile b/mcs/class/Mono.Security.Providers.NewTls/Makefile index a5f641229e4..54270bccc55 100644 --- a/mcs/class/Mono.Security.Providers.NewTls/Makefile +++ b/mcs/class/Mono.Security.Providers.NewTls/Makefile @@ -3,8 +3,8 @@ SUBDIRS = include ../../build/rules.make LIBRARY = Mono.Security.Providers.NewTls.dll -LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign -r:System.dll \ - -r:NewSystemSource=Mono.Security.Providers.NewSystemSource.dll -r:Mono.Security.dll +LIB_REFS = System NewSystemSource=Mono.Security.Providers.NewSystemSource Mono.Security +LIB_MCS_FLAGS = -unsafe -nowarn:1030 -keyfile:../mono.pub -delaysign include ../../build/library.make diff --git a/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs b/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs index 55e17aad73d..b5bf191148e 100644 --- a/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs +++ b/mcs/class/Mono.Security/Assembly/AssemblyInfo.cs @@ -70,3 +70,4 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("Mono.Security.Providers.OldTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewSystemSource, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] +[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")] diff --git a/mcs/class/Mono.Security/Makefile b/mcs/class/Mono.Security/Makefile index 8a873fa9a47..30d065aa304 100644 --- a/mcs/class/Mono.Security/Makefile +++ b/mcs/class/Mono.Security/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = Mono.Security.dll LOCAL_MCS_FLAGS = -lib:$(the_libdir_base)bare -LIB_REFS = System +LIB_REFS = bare/System LIB_MCS_FLAGS = -unsafe -nowarn:1030,3009 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:169,219,618,672 diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs b/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs index fc901084a70..561e7888db7 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs @@ -95,6 +95,14 @@ namespace Mono.Security.Interface * If @serverMode is true, then we're a server and want to validate a certificate that we received from a client. */ ValidationResult ValidateCertificate (string targetHost, bool serverMode, X509CertificateCollection certificates); + } + + internal interface ICertificateValidator2 : ICertificateValidator + { + /* + * Internal use only. + */ + ValidationResult ValidateCertificate (string targetHost, bool serverMode, X509Certificate leaf, X509Chain chain); /* * On OS X and Mobile, the @chain will be initialized with the @certificates, but not actually built. @@ -137,15 +145,15 @@ namespace Mono.Security.Interface get { return supportsTrustAnchors; } } - static ICertificateValidator GetDefaultValidator (MonoTlsProvider provider, MonoTlsSettings settings) + static ICertificateValidator2 GetDefaultValidator (MonoTlsProvider provider, MonoTlsSettings settings) { - return (ICertificateValidator)NoReflectionHelper.GetDefaultCertificateValidator (provider, settings); + return (ICertificateValidator2)NoReflectionHelper.GetDefaultCertificateValidator (provider, settings); } /* * Internal API, intended to be used by MonoTlsProvider implementations. */ - public static ICertificateValidator GetValidator (MonoTlsProvider provider, MonoTlsSettings settings) + internal static ICertificateValidator2 GetValidator (MonoTlsProvider provider, MonoTlsSettings settings) { return GetDefaultValidator (provider, settings); } diff --git a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs index 8b7c6ddecfc..59b148c48c6 100644 --- a/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs +++ b/mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs @@ -129,7 +129,7 @@ namespace Mono.Security.Interface /* * Allows a TLS provider to provide a custom system certificiate validator. */ - public virtual bool HasCustomSystemCertificateValidator { + internal virtual bool HasCustomSystemCertificateValidator { get { return false; } } @@ -142,13 +142,12 @@ namespace Mono.Security.Interface * Returns `true` if certificate validation has been performed and `false` to invoke the * default system validator. */ - public virtual bool InvokeSystemCertificateValidator ( - ICertificateValidator validator, string targetHost, bool serverMode, - X509CertificateCollection certificates, ref X509Chain chain, out bool success, - ref MonoSslPolicyErrors errors, ref int status11) + internal virtual bool InvokeSystemCertificateValidator ( + ICertificateValidator2 validator, string targetHost, bool serverMode, + X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain, + out bool success, ref MonoSslPolicyErrors errors, ref int status11) { - success = false; - return false; + throw new InvalidOperationException (); } #endregion diff --git a/mcs/class/Mono.Security/monotouch_tv_opt_Mono.Security.dll.sources b/mcs/class/Mono.Security/monotouch_tv_opt_Mono.Security.dll.sources deleted file mode 100644 index 19d6a0452cc..00000000000 --- a/mcs/class/Mono.Security/monotouch_tv_opt_Mono.Security.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_Mono.Security.dll.sources diff --git a/mcs/class/Mono.Security/monotouch_watch_opt_Mono.Security.dll.sources b/mcs/class/Mono.Security/monotouch_watch_opt_Mono.Security.dll.sources deleted file mode 100644 index 19d6a0452cc..00000000000 --- a/mcs/class/Mono.Security/monotouch_watch_opt_Mono.Security.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_opt_Mono.Security.dll.sources diff --git a/mcs/class/Mono.Simd/Makefile b/mcs/class/Mono.Simd/Makefile index 3e394f9287d..d8e1e474141 100644 --- a/mcs/class/Mono.Simd/Makefile +++ b/mcs/class/Mono.Simd/Makefile @@ -4,8 +4,7 @@ include ../../build/rules.make LIBRARY = Mono.Simd.dll LIB_REFS = System.Core -LIB_MCS_FLAGS = -r:$(corlib) /unsafe -TEST_MCS_FLAGS = -r:Mono.Simd.dll +LIB_MCS_FLAGS = /unsafe NO_TEST = yes diff --git a/mcs/class/Mono.XBuild.Tasks/Makefile b/mcs/class/Mono.XBuild.Tasks/Makefile index ef144fe461d..8d50c7ad629 100644 --- a/mcs/class/Mono.XBuild.Tasks/Makefile +++ b/mcs/class/Mono.XBuild.Tasks/Makefile @@ -7,11 +7,8 @@ include $(XBUILD_DIR)/xbuild.make LIBRARY = Mono.XBuild.Tasks.dll -LIB_REFS = System System.Xml -LIB_MCS_FLAGS = \ - /r:$(corlib) \ - /r:System.dll \ - /r:System.Xml.dll +LIB_REFS = $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Xml +LIB_MCS_FLAGS = include $(XBUILD_DIR)/xbuild_test.make diff --git a/mcs/class/Mono.Xml.Ext/Makefile b/mcs/class/Mono.Xml.Ext/Makefile index 32b46e6664a..e7ac06790fb 100644 --- a/mcs/class/Mono.Xml.Ext/Makefile +++ b/mcs/class/Mono.Xml.Ext/Makefile @@ -11,7 +11,7 @@ SCARY_LIB=/lib:$(prefix)/lib endif LIB_REFS = System System.Xml -LIB_MCS_FLAGS = $(SCARY_LIB) /unsafe /r:$(corlib) +LIB_MCS_FLAGS = $(SCARY_LIB) /unsafe TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) EXTRA_DISTFILES = \ diff --git a/mcs/class/Novell.Directory.Ldap/Makefile b/mcs/class/Novell.Directory.Ldap/Makefile index 25cd6cc4fdc..9e0d99d6c0b 100644 --- a/mcs/class/Novell.Directory.Ldap/Makefile +++ b/mcs/class/Novell.Directory.Ldap/Makefile @@ -7,9 +7,6 @@ LIBRARY = Novell.Directory.Ldap.dll LIB_REFS = System Mono.Security LIB_MCS_FLAGS = \ -warn:1 -nowarn:612 \ - -r:$(corlib) \ - -r:System.dll \ - -r:Mono.Security.dll \ $(RESX_RES:%=/res:%) include ../../build/library.make diff --git a/mcs/class/PEAPI/Makefile b/mcs/class/PEAPI/Makefile index e699f77f53f..f303415ba6d 100644 --- a/mcs/class/PEAPI/Makefile +++ b/mcs/class/PEAPI/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = PEAPI.dll LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) -nowarn:414,618 +LIB_MCS_FLAGS = -nowarn:414,618 NO_TEST = yes EXTRA_DISTFILES = README.txt diff --git a/mcs/class/RabbitMQ.Client/src/apigen/Makefile b/mcs/class/RabbitMQ.Client/src/apigen/Makefile index 9d5e49a3181..9c48a40e29d 100644 --- a/mcs/class/RabbitMQ.Client/src/apigen/Makefile +++ b/mcs/class/RabbitMQ.Client/src/apigen/Makefile @@ -4,9 +4,7 @@ SUBDIRS = include ../../../../build/rules.make PROGRAM = RabbitMQ.Client.Apigen.exe - -LOCAL_MCS_FLAGS = /r:System.dll \ - /r:System.Xml.dll \ - /main:RabbitMQ.Client.Apigen.Apigen +LIB_REFS = System System.Xml +LOCAL_MCS_FLAGS = /main:RabbitMQ.Client.Apigen.Apigen include ../../../../build/executable.make diff --git a/mcs/class/System.Configuration.Install/Makefile b/mcs/class/System.Configuration.Install/Makefile index 2da44f09fe5..cc8b4f8e95c 100644 --- a/mcs/class/System.Configuration.Install/Makefile +++ b/mcs/class/System.Configuration.Install/Makefile @@ -3,7 +3,7 @@ include ../../build/rules.make LIBRARY = System.Configuration.Install.dll LIB_REFS = System System.Xml -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes diff --git a/mcs/class/System.Configuration/Makefile b/mcs/class/System.Configuration/Makefile index 43fc4253383..06575305051 100644 --- a/mcs/class/System.Configuration/Makefile +++ b/mcs/class/System.Configuration/Makefile @@ -5,11 +5,11 @@ include ../../build/rules.make LIBRARY = System.Configuration.dll -LOCAL_MCS_FLAGS = -lib:$(secxml_libdir) -lib:$(bare_libdir) -test_remove = $(LOCAL_MCS_FLAGS) -LIB_REFS = System System.Xml System.Security -LIB_MCS_FLAGS = -r:$(corlib) -nowarn:618 -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) +LOCAL_MCS_FLAGS = +LIB_REFS = secxml/System bare/System.Xml System.Security +LIB_MCS_FLAGS = -nowarn:618 +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.Xml System include ../../build/library.make diff --git a/mcs/class/System.Data.OracleClient/Makefile b/mcs/class/System.Data.OracleClient/Makefile index a4415a382bd..2a70299375e 100644 --- a/mcs/class/System.Data.OracleClient/Makefile +++ b/mcs/class/System.Data.OracleClient/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = System.Data.OracleClient.dll LIB_REFS = System System.Xml System.Data System.EnterpriseServices System.Drawing -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) /nowarn:618 diff --git a/mcs/class/System.Data.Services/Makefile b/mcs/class/System.Data.Services/Makefile index 5f9aeccafce..b5fb3cb6fdd 100644 --- a/mcs/class/System.Data.Services/Makefile +++ b/mcs/class/System.Data.Services/Makefile @@ -11,6 +11,7 @@ ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) LIB_REFS += System.ServiceModel.Activation endif -TEST_MCS_FLAGS = -r:System.ServiceModel.dll -r:System.Core.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.ServiceModel System.Core include ../../build/library.make diff --git a/mcs/class/System.Data/Makefile b/mcs/class/System.Data/Makefile index 9e19d39aed4..0c84bbb1b45 100644 --- a/mcs/class/System.Data/Makefile +++ b/mcs/class/System.Data/Makefile @@ -28,7 +28,8 @@ endif TXT_RESOURCE_STRINGS = ../../../external/referencesource/System.Data/system.data.txt -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:System.Core.dll -r:Mono.Data.Sqlite.dll -nowarn:618,169,612,219,168 +TEST_LIB_REFS = System.Core Mono.Data.Sqlite +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:618,169,612,219,168 TEST_MONO_PATH = . diff --git a/mcs/class/System.Design/Makefile b/mcs/class/System.Design/Makefile index e941324ef83..3dc11aa3b01 100644 --- a/mcs/class/System.Design/Makefile +++ b/mcs/class/System.Design/Makefile @@ -4,13 +4,11 @@ include ../../build/rules.make LIBRARY = System.Design.dll -LIB_REFS = System System.Xml System.Web System.Windows.Forms System.Drawing Accessibility System.Data System.Configuration -LIB_MCS_FLAGS = -r:$(corlib) +LIB_REFS = System System.Xml plainweb/System.Web System.Windows.Forms System.Drawing Accessibility System.Data System.Configuration +LIB_MCS_FLAGS = -plainweb_dir = $(the_libdir_base)plainweb -LOCAL_MCS_FLAGS = -lib:$(plainweb_dir) - -TEST_MCS_FLAGS = /r:System.dll -r:System.Drawing.dll -r:System.Windows.Forms +TEST_LIB_REFS = System System.Drawing System.Windows.Forms +TEST_MCS_FLAGS = include ../../build/library.make diff --git a/mcs/class/System.DirectoryServices/Makefile b/mcs/class/System.DirectoryServices/Makefile index ff5403fd06a..7eccfe87a4e 100644 --- a/mcs/class/System.DirectoryServices/Makefile +++ b/mcs/class/System.DirectoryServices/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = System.DirectoryServices.dll LIB_REFS = System Novell.Directory.Ldap -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 include ../../build/library.make diff --git a/mcs/class/System.Drawing.Design/Makefile b/mcs/class/System.Drawing.Design/Makefile index 9fa2fea63b5..7abb4b3f3ae 100644 --- a/mcs/class/System.Drawing.Design/Makefile +++ b/mcs/class/System.Drawing.Design/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = System.Drawing.Design.dll LIB_REFS = System System.Drawing System.Windows.Forms -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/System.Drawing/Makefile b/mcs/class/System.Drawing/Makefile index 8827cb4f826..59ff776b9f1 100644 --- a/mcs/class/System.Drawing/Makefile +++ b/mcs/class/System.Drawing/Makefile @@ -5,13 +5,14 @@ SUBDIRS = LIBRARY = System.Drawing.dll LIB_REFS = System -LIB_MCS_FLAGS = /unsafe /r:$(corlib) \ +LIB_MCS_FLAGS = /unsafe \ -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico \ -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico \ -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico +TEST_LIB_REFS = System.Drawing System.Runtime.Serialization.Formatters.Soap System.Xml + TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -define:TEST -resource:Test/resources/indexed.png,indexed.png \ - -r:System.Drawing.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Xml.dll \ -nowarn:0618 -nowarn:219 -nowarn:169 include ../../build/library.make diff --git a/mcs/class/System.EnterpriseServices/Makefile b/mcs/class/System.EnterpriseServices/Makefile index f0eac39bcdf..90f38e9fc9a 100644 --- a/mcs/class/System.EnterpriseServices/Makefile +++ b/mcs/class/System.EnterpriseServices/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = System.EnterpriseServices.dll LIB_REFS = System.Transactions -LIB_MCS_FLAGS = /nowarn:0168 /nowarn:0162 /r:$(corlib) +LIB_MCS_FLAGS = /nowarn:0168 /nowarn:0162 NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/System.IO.Compression.FileSystem/Makefile b/mcs/class/System.IO.Compression.FileSystem/Makefile index abc4e30ee80..7cfa024a71d 100644 --- a/mcs/class/System.IO.Compression.FileSystem/Makefile +++ b/mcs/class/System.IO.Compression.FileSystem/Makefile @@ -5,6 +5,7 @@ include ../../build/rules.make LIBRARY = System.IO.Compression.FileSystem.dll LIB_REFS = System System.IO.Compression LIB_MCS_FLAGS = -TEST_MCS_FLAGS = /r:System.dll /r:System.Core.dll /r:System.IO.Compression.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System System.Core System.IO.Compression include ../../build/library.make diff --git a/mcs/class/System.IO.Compression/Makefile b/mcs/class/System.IO.Compression/Makefile index 3ca6899dacd..0987f09e6e3 100644 --- a/mcs/class/System.IO.Compression/Makefile +++ b/mcs/class/System.IO.Compression/Makefile @@ -5,6 +5,7 @@ include ../../build/rules.make LIBRARY = System.IO.Compression.dll LIB_REFS = System System.Core LIB_MCS_FLAGS = /unsafe -TEST_MCS_FLAGS = /r:System.dll /r:System.Core.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System System.Core include ../../build/library.make diff --git a/mcs/class/System.IdentityModel/Makefile b/mcs/class/System.IdentityModel/Makefile index 9bf7e1d5877..5a8a72c4c50 100644 --- a/mcs/class/System.IdentityModel/Makefile +++ b/mcs/class/System.IdentityModel/Makefile @@ -2,12 +2,6 @@ thisdir = class/System.IdentityModel SUBDIRS = include ../../build/rules.make -ifndef NO_SYSTEM_WEB_APPSERVICES_DEPENDENCY -ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) -OTHER_LIB_MCS_FLAGS = -r:System.Web.ApplicationServices.dll -endif -endif - LIBRARY = System.IdentityModel.dll LIB_REFS = System System.Xml System.Security System.Configuration Mono.Security System.Runtime.Serialization LIB_MCS_FLAGS = \ @@ -18,6 +12,13 @@ ifndef NO_SYSTEM_WEB_DEPENDENCY LIB_REFS += System.Web endif + +ifndef NO_SYSTEM_WEB_APPSERVICES_DEPENDENCY +ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) +LIB_REFS += System.Web.ApplicationServices +endif +endif + TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) EXTRA_DISTFILES = \ diff --git a/mcs/class/System.Management/Makefile b/mcs/class/System.Management/Makefile index 4fe9d03dca2..df76cf43bc2 100644 --- a/mcs/class/System.Management/Makefile +++ b/mcs/class/System.Management/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make LIBRARY = System.Management.dll LIB_REFS = System System.Configuration.Install -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = NO_TEST = yes include ../../build/library.make diff --git a/mcs/class/System.Messaging/Makefile b/mcs/class/System.Messaging/Makefile index 4cf4c29ab08..0412ea01555 100644 --- a/mcs/class/System.Messaging/Makefile +++ b/mcs/class/System.Messaging/Makefile @@ -10,8 +10,8 @@ LIB_REFS += System.Drawing endif LIB_MCS_FLAGS = /resource:System.Messaging/MessageQueue.resx -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 \ - /r:nunit.mocks.dll +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 +TEST_LIB_REFS = nunit.mocks EXTRA_DISTFILES = System.Messaging/MessageQueue.resx diff --git a/mcs/class/System.Net.Http.WebRequest/Makefile b/mcs/class/System.Net.Http.WebRequest/Makefile index fad726ff5f3..b0d8e7a1a87 100644 --- a/mcs/class/System.Net.Http.WebRequest/Makefile +++ b/mcs/class/System.Net.Http.WebRequest/Makefile @@ -7,6 +7,7 @@ LIBRARY = System.Net.Http.WebRequest.dll LIB_REFS = System.Net.Http System LIB_MCS_FLAGS = -TEST_MCS_FLAGS = -r:System.Net.Http.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.Net.Http include ../../build/library.make diff --git a/mcs/class/System.Net.Http/Makefile b/mcs/class/System.Net.Http/Makefile index aa3cdf921e5..bf1cbbd2799 100644 --- a/mcs/class/System.Net.Http/Makefile +++ b/mcs/class/System.Net.Http/Makefile @@ -7,6 +7,7 @@ LIBRARY = System.Net.Http.dll LIB_REFS = System.Core System LIB_MCS_FLAGS = $(EXTRA_LIB_MCS_FLAGS) -TEST_MCS_FLAGS = -r:System.dll -r:System.Core.dll +TEST_LIB_REFS = System System.Core +TEST_MCS_FLAGS = include ../../build/library.make diff --git a/mcs/class/System.Reactive.Core/Makefile b/mcs/class/System.Reactive.Core/Makefile index 8e5efe308ce..fc666baf51c 100644 --- a/mcs/class/System.Reactive.Core/Makefile +++ b/mcs/class/System.Reactive.Core/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Core.dll LIB_REFS = System System.Core System.Reactive.Interfaces LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Reactive.Interfaces.dll + @more_build_args ifeq (true, $(GENERATE_RESOURCES)) LIB_MCS_FLAGS += /define:GENERATING_RESOURCES diff --git a/mcs/class/System.Reactive.Linq/Makefile b/mcs/class/System.Reactive.Linq/Makefile index e05d3c0236e..f7f8f44e195 100644 --- a/mcs/class/System.Reactive.Linq/Makefile +++ b/mcs/class/System.Reactive.Linq/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Linq.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Reactive.Core.dll + @more_build_args ifeq (true, $(GENERATE_RESOURCES)) LIB_MCS_FLAGS += /define:GENERATING_RESOURCES diff --git a/mcs/class/System.Reactive.Observable.Aliases/Makefile b/mcs/class/System.Reactive.Observable.Aliases/Makefile index ec5e06a73a8..0db9de14052 100644 --- a/mcs/class/System.Reactive.Observable.Aliases/Makefile +++ b/mcs/class/System.Reactive.Observable.Aliases/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Observable.Aliases.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Reactive.Providers LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Reactive.Providers.dll + @more_build_args ifeq (true, $(GENERATE_RESOURCES)) LIB_MCS_FLAGS += /define:GENERATING_RESOURCES diff --git a/mcs/class/System.Reactive.PlatformServices/Makefile b/mcs/class/System.Reactive.PlatformServices/Makefile index 1a8675dc69a..0333c27f2e7 100644 --- a/mcs/class/System.Reactive.PlatformServices/Makefile +++ b/mcs/class/System.Reactive.PlatformServices/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.PlatformServices.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Reactive.Linq.dll + @more_build_args ifeq (true, $(GENERATE_RESOURCES)) LIB_MCS_FLAGS += /define:GENERATING_RESOURCES @@ -35,7 +34,8 @@ ifndef NO_TASK_DELAY LIB_MCS_FLAGS += -d:NO_TASK_DELAY endif -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:Mono.Reactive.Tests.dll +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) +TEST_LIB_REFS = Mono.Reactive.Tests EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT) diff --git a/mcs/class/System.Reactive.Providers/Makefile b/mcs/class/System.Reactive.Providers/Makefile index 9aedac157d7..ab1f274d150 100644 --- a/mcs/class/System.Reactive.Providers/Makefile +++ b/mcs/class/System.Reactive.Providers/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Providers.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Reactive.Linq.dll + @more_build_args ifeq (true, $(GENERATE_RESOURCES)) LIB_MCS_FLAGS += /define:GENERATING_RESOURCES diff --git a/mcs/class/System.Reactive.Runtime.Remoting/Makefile b/mcs/class/System.Reactive.Runtime.Remoting/Makefile index 389920631a7..1834e7aaa25 100644 --- a/mcs/class/System.Reactive.Runtime.Remoting/Makefile +++ b/mcs/class/System.Reactive.Runtime.Remoting/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Runtime.Remoting.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Reactive.Linq.dll + @more_build_args ifeq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -d:NO_TASK_DELAY diff --git a/mcs/class/System.Reactive.Windows.Forms/Makefile b/mcs/class/System.Reactive.Windows.Forms/Makefile index e2f9d24fa92..ef3327d3e3e 100644 --- a/mcs/class/System.Reactive.Windows.Forms/Makefile +++ b/mcs/class/System.Reactive.Windows.Forms/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Windows.Forms.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq System.Windows.Forms LIB_MCS_FLAGS = \ - @more_build_args \ - -r:System.Windows.Forms.dll + @more_build_args ifeq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -d:NO_TASK_DELAY -d:HAS_AWAIT diff --git a/mcs/class/System.Reactive.Windows.Threading/Makefile b/mcs/class/System.Reactive.Windows.Threading/Makefile index 3c0654cfac3..66a3ff14f6c 100644 --- a/mcs/class/System.Reactive.Windows.Threading/Makefile +++ b/mcs/class/System.Reactive.Windows.Threading/Makefile @@ -5,8 +5,7 @@ include ../../build/rules.make LIBRARY = System.Reactive.Windows.Threading.dll LIB_REFS = System System.Core System.Reactive.Interfaces System.Reactive.Core System.Reactive.Linq WindowsBase LIB_MCS_FLAGS = \ - @more_build_args \ - -r:WindowsBase.dll + @more_build_args ifeq (true, $(GENERATE_RESOURCES)) LIB_MCS_FLAGS += /define:GENERATING_RESOURCES diff --git a/mcs/class/System.Runtime.Remoting/Makefile b/mcs/class/System.Runtime.Remoting/Makefile index eeb73d0894e..323d4241eb5 100644 --- a/mcs/class/System.Runtime.Remoting/Makefile +++ b/mcs/class/System.Runtime.Remoting/Makefile @@ -5,13 +5,14 @@ include ../../build/rules.make LIBRARY = System.Runtime.Remoting.dll LIB_REFS = System System.Xml System.Runtime.Serialization.Formatters.Soap -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = ifndef NO_SYSTEM_WEB_DEPENDENCY LIB_REFS += System.Web endif -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:618 /r:System.Runtime.Remoting.dll +TEST_MCS_FLAGS = -nowarn:618 +TEST_LIB_REFS = System System.Xml TEST_MONO_PATH = . diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/Makefile b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Makefile index 76d3270616d..7a673f01fa3 100644 --- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/Makefile +++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Makefile @@ -6,8 +6,10 @@ include ../../build/rules.make LIBRARY = System.Runtime.Serialization.Formatters.Soap.dll LIB_REFS = System.Xml -LIB_MCS_FLAGS = /r:$(corlib) -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:System.dll -nowarn:0618 -nowarn:219 -nowarn:169 +LIB_MCS_FLAGS = + +TEST_LIB_REFS = System +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 EXTRA_DISTFILES = \ README \ diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/AssemblyInfo.cs b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/AssemblyInfo.cs index dbacda112e8..487ff5f1dd7 100644 --- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/AssemblyInfo.cs +++ b/mcs/class/System.Runtime.Serialization.Formatters.Soap/Test/AssemblyInfo.cs @@ -23,7 +23,7 @@ using System.Runtime.CompilerServices; // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] // The following attributes specify the key for the sign of your assembly. See the // .NET Framework documentation for more information about signing. diff --git a/mcs/class/System.Runtime.Serialization/Makefile b/mcs/class/System.Runtime.Serialization/Makefile index 21d8e716a39..03b78193d75 100644 --- a/mcs/class/System.Runtime.Serialization/Makefile +++ b/mcs/class/System.Runtime.Serialization/Makefile @@ -11,6 +11,7 @@ LIB_MCS_FLAGS = \ -d:NO_DYNAMIC_CODEGEN \ /nowarn:168,169,219,414 \ $(RESOURCE_FILES:%=/resource:%) +TXT_RESOURCE_STRINGS = ../../../external/referencesource/System.Runtime.Serialization/System.Runtime.Serialization.txt ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_REFS += System.Data System.Configuration @@ -27,8 +28,8 @@ TEST_RESOURCE_FILES = \ Test/Resources/WSDL/collections.wsdl \ Test/Resources/WSDL/custom-collections.wsdl -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) /r:System.ServiceModel.dll /r:System.Web.Services.dll \ - $(TEST_RESOURCE_FILES:%=/resource:%) +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(TEST_RESOURCE_FILES:%=/resource:%) +TEST_LIB_REFS = System.ServiceModel System.Web.Services EXTRA_DISTFILES = $(RESOURCE_FILES) $(TEST_RESOURCE_FILES) \ Test/Resources/FrameworkTypes/* \ diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs index ae10d9fefa1..856841518bf 100644 --- a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs +++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.cs @@ -1,371 +1,264 @@ -using System.Globalization; - -#region "copy of ../../build/common/SR.cs" - -namespace System.Runtime.Serialization +// +// This file was generated by txt2sr tool +// +namespace System.Runtime.Serialization { +partial class SR { - static partial class SR - { - - internal static string GetString(string name, params object[] args) - { - return GetString (CultureInfo.InvariantCulture, name, args); - } - - internal static string GetString(CultureInfo culture, string name, params object[] args) { - return string.Format (culture, name, args); - } - - internal static string GetString(string name) - { - return name; - } - - internal static string GetString(CultureInfo culture, string name) - { - return name; - } + public const string ArrayExceededSize = "Array length '{0}' provided by the get-only collection of type '{1}' is less than the number of array elements found in the input stream. Consider increasing the length of the array."; + public const string ArrayExceededSizeAttribute = "Array length '{0}' provided by Size attribute is not equal to the number of array elements '{1}' from namespace '{2}' found."; + public const string ArrayTypeIsNotSupported = "An internal error has occurred. '{0}[]' is not supported when generating code for serialization."; + public const string CannotDeserializeRefAtTopLevel = "Cannot deserialize since root element references unrecognized object with id '{0}'."; + public const string CannotLoadMemberType = "Cannot load member type '{0}'."; + public const string CannotSerializeObjectWithCycles = "Object graph for type '{0}' contains cycles and cannot be serialized if references are not tracked. Consider using the DataContractAttribute with the IsReference property set to true."; + public const string CanOnlyStoreIntoArgOrLocGot0 = "An internal error has occurred. Data can only be stored into ArgBuilder or LocalBuilder. Got: {0}."; + public const string CharIsInvalidPrimitive = "An internal error has occurred. Char is not a valid schema primitive and should be treated as int in DataContract."; + public const string CallbackMustReturnVoid = "Serialization Callback '{1}' in type '{0}' must return void."; + public const string CallbackParameterInvalid = "Serialization Callback '{1}' in type '{0}' must have a single parameter of type '{2}'."; + public const string CallbacksCannotBeVirtualMethods = "Virtual Method '{0}' of type '{1}' cannot be marked with '{2}' attribute."; + public const string CollectionMustHaveAddMethod = "Collection type '{0}' does not have a valid Add method."; + public const string CollectionMustHaveGetEnumeratorMethod = "Collection type '{0}' does not have a valid GetEnumerator method."; + public const string CollectionMustHaveItemType = "Collection type '{0}' must have a non-null item type."; + public const string CollectionTypeCannotBeBuiltIn = "{0} is a built-in type and cannot be a collection."; + public const string CollectionTypeCannotHaveDataContract = "{0} has DataContractAttribute attribute."; + public const string CollectionTypeDoesNotHaveAddMethod = "{0} does not have a valid Add method with parameter of type '{1}'."; + public const string CollectionTypeDoesNotHaveDefaultCtor = "{0} does not have a default constructor."; + public const string CollectionTypeHasMultipleDefinitionsOfInterface = "{0} has multiple definitions of interface '{1}'."; + public const string CollectionTypeIsNotIEnumerable = "{0} does not implement IEnumerable interface."; + public const string DataContractCacheOverflow = "An internal error has occurred. DataContract cache overflow."; + public const string DataContractNamespaceAlreadySet = "ContractNamespaceAttribute attribute maps CLR namespace '{2}' to multiple data contract namespaces '{0}' and '{1}'. You can map a CLR namespace to only one data contract namespace."; + public const string DataContractNamespaceIsNotValid = "DataContract namespace '{0}' is not a valid URI."; + public const string DataContractNamespaceReserved = "DataContract namespace '{0}' cannot be specified since it is reserved."; + public const string DataMemberOnEnumField = "Member '{0}.{1}' has DataMemberAttribute attribute. Use EnumMemberAttribute attribute instead."; + public const string DcTypeNotFoundOnDeserialize = "Element '{2}:{3}' contains data of the '{0}:{1}' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to '{1}' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer."; + public const string DcTypeNotFoundOnSerialize = "Type '{0}' with data contract name '{1}:{2}' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer."; + public const string DcTypeNotResolvedOnDeserialize = "Element '{2}:{3}' contains data from a type that maps to the name '{0}:{1}'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name '{1}' and namespace '{0}'."; + public const string DeserializedObjectWithIdNotFound = "Deserialized object with reference id '{0}' not found in stream."; + public const string DupContractInKnownTypes = "Type '{0}' cannot be added to list of known types since another type '{1}' with the same data contract name '{2}:{3}' is already present."; + public const string DupKeyValueName = "The collection data contract type '{0}' specifies the same value '{1}' for both the KeyName and the ValueName properties. This is not allowed. Consider changing either the KeyName or the ValueName property."; + public const string DupEnumMemberValue = "Type '{2}' contains two members '{0}' 'and '{1}' with the same name '{3}'. Multiple members with the same name in one type are not supported. Consider changing one of the member names using EnumMemberAttribute attribute."; + public const string DupMemberName = "Type '{2}' contains two members '{0}' 'and '{1}' with the same data member name '{3}'. Multiple members with the same name in one type are not supported. Consider changing one of the member names using DataMemberAttribute attribute."; + public const string DuplicateAttribute = "Invalid Callback. Method '{3}' in type '{2}' has both '{0}' and '{1}'."; + public const string DuplicateCallback = "Invalid attribute. Both '{0}' and '{1}' in type '{2}' have '{3}'."; + public const string EncounteredWithNameNamespace = "{0}. Encountered '{1}' with name '{2}', namespace '{3}'."; + public const string EnumTypeCannotHaveIsReference = "Enum type '{0}' cannot have the IsReference setting of '{1}'. Either change the setting to '{2}', or remove it completely."; + public const string ErrorDeserializing = "There was an error deserializing the object {0}. {1}"; + public const string ErrorInLine = "Error in line {0} position {1}."; + public const string ErrorIsStartObject = "There was an error checking start element of object {0}. {1}"; + public const string ErrorSerializing = "There was an error serializing the object {0}. {1}"; + public const string ErrorTypeInfo = "of type {0}"; + public const string ErrorWriteEndObject = "There was an error writing end element of object {0}. {1}"; + public const string ErrorWriteStartObject = "There was an error writing start element of object {0}. {1}"; + public const string ExceededMaxItemsQuota = "Maximum number of items that can be serialized or deserialized in an object graph is '{0}'."; + public const string ExpectingElement = "Expecting element '{1}' from namespace '{0}'."; + public const string ExpectingElementAtDeserialize = "Expecting state '{0}' when ReadObject is called."; + public const string ExpectingEnd = "Expecting End'{0}'."; + public const string ExpectingState = "Expecting state '{0}'."; + public const string GenericNameBraceMismatch = "The data contract name '{0}' for type '{1}' has a curly brace '{{' that is not matched with a closing curly brace. Curly braces have special meaning in data contract names - they are used to customize the naming of data contracts for generic types."; + public const string GenericParameterNotValid = "In the data contract name for type '{1}', there are curly braces with '{0}' inside, which is an invalid value. Curly braces have special meaning in data contract names - they are used to customize the naming of data contracts for generic types. Based on the number of generic parameters this type has, the contents of the curly braces must either be a number between 0 and '{2}' to insert the name of the generic parameter at that index or the '#' symbol to insert a digest of the generic parameter namespaces."; + public const string InconsistentIsReference = "The IsReference setting for type '{0}' is '{1}', but the same setting for its parent class '{2}' is '{3}'. Derived types must have the same value for IsReference as the base type. Change the setting on type '{0}' to '{3}', or on type '{2}' to '{1}', or do not set IsReference explicitly."; + public const string IndexedPropertyCannotBeSerialized = "Property '{1}' in type '{0}' cannot be serialized because serialization of indexed properties is not supported."; + public const string InterfaceTypeCannotBeCreated = "Interface type '{0}' cannot be created. Consider replacing with a non-interface serializable type."; + public const string InvalidCollectionContractItemName = "Type '{0}' cannot have CollectionDataContractAttribute attribute ItemName set to null or empty string."; + public const string InvalidCollectionContractKeyName = "Type '{0}' cannot have CollectionDataContractAttribute attribute KeyName set to null or empty string."; + public const string InvalidCollectionContractKeyNoDictionary = "The collection data contract type '{0}' specifies '{1}' for the KeyName property. This is not allowed since the type is not IDictionary. Remove the setting for the KeyName property."; + public const string InvalidCollectionContractName = "Type '{0}' cannot have CollectionDataContractAttribute attribute Name set to null or empty string."; + public const string InvalidCollectionContractNamespace = "Type '{0}' cannot have CollectionDataContractAttribute attribute Namespace set to null."; + public const string InvalidCollectionContractValueName = "Type '{0}' cannot have CollectionDataContractAttribute attribute ValueName set to null or empty string."; + public const string InvalidCollectionContractValueNoDictionary = "The collection data contract type '{0}' specifies '{1}' for the ValueName property. This is not allowed since the type is not IDictionary. Remove the setting for the ValueName property."; + public const string InvalidCollectionDataContract = "Type '{0}' with CollectionDataContractAttribute attribute is an invalid collection type since it"; + public const string InvalidCollectionType = "Type '{0}' is an invalid collection type since it"; + public const string InvalidDataContractName = "Type '{0}' cannot have DataContractAttribute attribute Name set to null or empty string."; + public const string InvalidDataContractNamespace = "Type '{0}' cannot have DataContractAttribute attribute Namespace set to null."; + public const string InvalidDataMemberName = "Member '{0}' in type '{1}' cannot have DataMemberAttribute attribute Name set to null or empty string."; + public const string InvalidEnumMemberValue = "'{0}' in type '{1}' cannot have EnumMemberAttribute attribute Value set to null or empty string."; + public const string InvalidEnumValueOnRead = "Invalid enum value '{0}' cannot be deserialized into type '{1}'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute."; + public const string InvalidEnumValueOnWrite = "Enum value '{0}' is invalid for type '{1}' and cannot be serialized. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute."; + public const string InvalidGetSchemaMethod = "Type '{0}' cannot have MethodName on XmlSchemaProviderAttribute attribute set to null or empty string."; + public const string InvalidGlobalDataContractNamespace = "CLR namespace '{0}' cannot have ContractNamespace set to null."; + public const string InvalidMember = "Member '{0}.{1}' cannot be serialized since it is neither a field nor a property, and therefore cannot be marked with the DataMemberAttribute attribute. Remove the DataMemberAttribute attribute from the '{1}' member."; + public const string InvalidNonNullReturnValueByIsAny = "Method '{0}.{1}()' returns a non-null value. The return value must be null since IsAny=true."; + public const string InvalidPrimitiveType = "Type '{0}' is not a valid serializable type."; + public const string InvalidReturnTypeOnGetSchemaMethod = "Method '{0}.{1}()' returns '{2}'. The return type must be compatible with '{3}'."; + public const string InvalidSizeDefinition = "Invalid Size '{0}'. Must be non-negative integer."; + public const string InvalidXmlDataContractName = "XML data contract Name for type '{0}' cannot be set to null or empty string."; + public const string InvalidXsIdDefinition = "Invalid Id '{0}'. Must not be null or empty."; + public const string InvalidXsRefDefinition = "Invalid Ref '{0}'. Must not be null or empty."; + public const string IsAnyCannotBeNull = "A null value cannot be serialized at the top level for IXmlSerializable root type '{0}' since its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct."; + public const string IsAnyCannotBeSerializedAsDerivedType = "An object of type '{0}' cannot be serialized at the top level for IXmlSerializable root type '{1}' since its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct."; + public const string IsAnyCannotHaveXmlRoot = "Type '{0}' cannot specify an XmlRootAttribute attribute because its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct."; + public const string IsNotAssignableFrom = "An internal error has occurred. '{0}' is not assignable from '{1}' - error generating code for serialization."; + public const string IsRequiredDataMemberOnIsReferenceDataContractType = "'{0}.{1}' has the IsRequired setting of '{2}. However, '{0}' has the IsReference setting of '{2}', because either it is set explicitly, or it is derived from a base class. Set IsRequired on '{0}.{1}' to false, or disable IsReference on '{0}'."; + public const string IXmlSerializableCannotHaveCollectionDataContract = "Type '{0}' cannot be IXmlSerializable and have CollectionDataContractAttribute attribute."; + public const string IXmlSerializableCannotHaveDataContract = "Type '{0}' cannot be IXmlSerializable and have DataContractAttribute attribute."; + public const string IXmlSerializableIllegalOperation = "This method cannot be called from IXmlSerializable implementations."; + public const string IXmlSerializableMissingEndElements = "IXmlSerializable.WriteXml method of type '{0}' did not close all open tags. Verify that the IXmlSerializable implementation is correct."; + public const string IXmlSerializableMustHaveDefaultConstructor = "IXmlSerializable Type '{0}' must have default constructor."; + public const string IXmlSerializableWritePastSubTree = "IXmlSerializable.WriteXml method of type '{0}' attempted to close too many tags. Verify that the IXmlSerializable implementation is correct."; + public const string KnownTypeAttributeEmptyString = "Method name specified by KnownTypeAttribute attribute on type '{0}' cannot be the empty string."; + public const string KnownTypeAttributeUnknownMethod = "KnownTypeAttribute attribute on type '{1}' specifies a method named '{0}' to provide known types. Static method '{0}()' was not found on this type. Ensure that the method exists and is marked as static."; + public const string KnownTypeAttributeReturnType = "KnownTypeAttribute attribute on type '{0}' specifies a method named '{1}' to provide known types. The return type of this method is invalid because it is not assignable to IEnumerable. Ensure that the method exists and has a valid signature."; + public const string KnownTypeAttributeOneScheme = "Type '{0}': If a KnownTypeAttribute attribute specifies a method it must be the only KnownTypeAttribute attribute on that type."; + public const string KnownTypeAttributeNoType = "KnownTypeAttribute attribute on type '{0}' contains no Type."; + public const string KnownTypeConfigClosedGenericDeclared = "Declared type '{0}' in config cannot be a closed or partial generic type."; + public const string KnownTypeAttributeValidMethodTypes = "Method specified by KnownTypeAttribute attribute on type '{0}' does not expose valid types."; + public const string KnownTypeAttributeNoData = "KnownTypeAttribute attribute on type '{0}' contains no data."; + public const string KnownTypeAttributeMethodNull = "Method specified by KnownTypeAttribute attribute on type '{0}' returned null."; + public const string MaxArrayLengthExceeded = "The maximum array length ({0}) has been exceeded while reading XML data for array of type '{1}'."; + public const string MissingGetSchemaMethod = "Type '{0}' does not have a static method '{1}' that takes a parameter of type 'System.Xml.Schema.XmlSchemaSet' as specified by the XmlSchemaProviderAttribute attribute."; + public const string MultipleIdDefinition = "Invalid XML encountered. The same Id value '{0}' is defined more than once. Multiple objects cannot be deserialized using the same Id."; + public const string NoConversionPossibleTo = "An internal error has occurred. No conversion is possible to '{0}' - error generating code for serialization."; + public const string NoGetMethodForProperty = "No get method for property '{1}' in type '{0}'."; + public const string NoSetMethodForProperty = "No set method for property '{1}' in type '{0}'."; + public const string NullKnownType = "One of the known types provided to the serializer via '{0}' argument was invalid because it was null. All known types specified must be non-null values."; + public const string NullValueReturnedForGetOnlyCollection = "The get-only collection of type '{0}' returned a null value. The input stream contains collection items which cannot be added if the instance is null. Consider initializing the collection either in the constructor of the the object or in the getter."; + public const string ObjectTableOverflow = "An internal error has occurred. Object table overflow. This could be caused by serializing or deserializing extremely large object graphs."; + public const string OrderCannotBeNegative = "Property 'Order' in DataMemberAttribute attribute cannot be a negative number."; + public const string ParameterCountMismatch = "Invalid number of parameters to call method '{0}'. Expected '{1}' parameters, but '{2}' were provided."; + public const string PartialTrustCollectionContractAddMethodNotPublic = "The collection data contract type '{0}' cannot be deserialized because the method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustCollectionContractNoPublicConstructor = "The collection data contract type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustCollectionContractTypeNotPublic = "The collection data contract type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractOnSerializingNotPublic = "The data contract type '{0}' cannot be serialized because the OnSerializing method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractOnSerializedNotPublic = "The data contract type '{0}' cannot be serialized because the OnSerialized method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractOnDeserializingNotPublic = "The data contract type '{0}' cannot be deserialized because the OnDeserializing method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractOnDeserializedNotPublic = "The data contract type '{0}' cannot be deserialized because the OnDeserialized method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractFieldGetNotPublic = "The data contract type '{0}' cannot be serialized because the member '{1}' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractFieldSetNotPublic = "The data contract type '{0}' cannot be deserialized because the member '{1}' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractPropertyGetNotPublic = "The data contract type '{0}' cannot be serialized because the property '{1}' does not have a public getter. Adding a public getter will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractPropertySetNotPublic = "The data contract type '{0}' cannot be deserialized because the property '{1}' does not have a public setter. Adding a public setter will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustDataContractTypeNotPublic = "The data contract type '{0}' is not serializable because it is not public. Making the type public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustNonAttributedSerializableTypeNoPublicConstructor = "The type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustIXmlSerializableTypeNotPublic = "The IXmlSerializable type '{0}' is not serializable in partial trust because it is not public. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string PartialTrustIXmlSerialzableNoPublicConstructor = "The IXmlSerializable type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; + public const string NonAttributedSerializableTypesMustHaveDefaultConstructor = "The Type '{0}' must have a parameterless constructor."; + public const string AttributedTypesCannotInheritFromNonAttributedSerializableTypes = "Type '{0}' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base type '{1}' with DataContractAttribute or SerializableAttribute, or removing them from the derived type."; + public const string GetOnlyCollectionsNotSupported = "Get-only collection properties are not supported. Consider adding a public setter to property '{0}.{1}' or marking the it with the IgnoreDataMemberAttribute."; + public const string QuotaMustBePositive = "Quota must be a positive value."; + public const string QuotaIsReadOnly = "The '{0}' quota is readonly."; + public const string QuotaCopyReadOnly = "Cannot copy XmlDictionaryReaderQuotas. Target is readonly."; + public const string RequiredMemberMustBeEmitted = "Member {0} in type {1} cannot be serialized. This exception is usually caused by trying to use a null value where a null value is not allowed. The '{0}' member is set to its default value (usually null or zero). The member's EmitDefault setting is 'false', indicating that the member should not be serialized. However, the member's IsRequired setting is 'true', indicating that it must be serialized. This conflict cannot be resolved. Consider setting '{0}' to a non-default value. Alternatively, you can change the EmitDefaultValue property on the DataMemberAttribute attribute to true, or changing the IsRequired property to false."; + public const string ResolveTypeReturnedFalse = "An object of type '{0}' which derives from DataContractResolver returned false from its TryResolveType method when attempting to resolve the name for an object of type '{1}', indicating that the resolution failed. Change the TryResolveType implementation to return true."; + public const string ResolveTypeReturnedNull = "An object of type '{0}' which derives from DataContractResolver returned a null typeName or typeNamespace but not both from its TryResolveType method when attempting to resolve the name for an object of type '{1}'. Change the TryResolveType implementation to return non-null values, or to return null values for both typeName and typeNamespace in order to serialize as the declared type."; + public const string SupportForMultidimensionalArraysNotPresent = "Multi-dimensional arrays are not supported."; + public const string TooManyCollectionContracts = "Type '{0}' has more than one CollectionDataContractAttribute attribute."; + public const string TooManyDataContracts = "Type '{0}' has more than one DataContractAttribute attribute."; + public const string TooManyDataMembers = "Member '{0}.{1}' has more than one DataMemberAttribute attribute."; + public const string TooManyEnumMembers = "Member '{0}.{1}' has more than one EnumMemberAttribute attribute."; + public const string TooManyIgnoreDataMemberAttributes = "Member '{0}.{1}' has more than one IgnoreDataMemberAttribute attribute."; + public const string TypeMustBeConcrete = "Error while getting known types for Type '{0}'. The type must not be an open or partial generic class."; + public const string TypeNotSerializable = "Type '{0}' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required."; + public const string UnexpectedContractType = "An internal error has occurred. Unexpected contract type '{0}' for type '{1}' encountered."; + public const string UnexpectedElementExpectingElements = "'{0}' '{1}' from namespace '{2}' is not expected. Expecting element '{3}'."; + public const string UnexpectedEndOfFile = "Unexpected end of file."; + public const string UnknownConstantType = "Unrecognized constant type '{0}'."; + public const string UnsupportedIDictionaryAsDataMemberType = "Cannot deserialize one of the DataMember because it is an IDictionary. Use IDictionary instead."; + public const string ValueMustBeNonNegative = "The value of this argument must be non-negative."; + public const string ValueTypeCannotBeNull = "ValueType '{0}' cannot be null."; + public const string ValueTypeCannotHaveBaseType = "Data contract '{0}' from namespace '{1}' is a value type and cannot have base contract '{2}' from namespace '{3}'."; + public const string ValueTypeCannotHaveId = "ValueType '{0}' cannot have id."; + public const string ValueTypeCannotHaveIsReference = "Value type '{0}' cannot have the IsReference setting of '{1}'. Either change the setting to '{2}', or remove it completely."; + public const string ValueTypeCannotHaveRef = "ValueType '{0}' cannot have ref to another object."; + public const string XmlElementAttributes = "Only Element nodes have attributes."; + public const string XmlForObjectCannotHaveContent = "Element {0} from namespace {1} cannot have child contents to be deserialized as an object. Please use XElement to deserialize this pattern of XML."; + public const string XmlInvalidConversion = "The value '{0}' cannot be parsed as the type '{1}'."; + public const string XmlInvalidConversionWithoutValue = "The value cannot be parsed as the type '{0}'."; + public const string XmlStartElementExpected = "Start element expected. Found {0}."; + public const string XmlWriterMustBeInElement = "WriteState '{0}' not valid. Caller must write start element before serializing in contentOnly mode."; + public const string OffsetExceedsBufferSize = "The specified offset exceeds the buffer size ({0} bytes)."; + public const string SizeExceedsRemainingBufferSpace = "The specified size exceeds the remaining buffer space ({0} bytes)."; + public const string ValueMustBeInRange = "The value of this argument must fall within the range {0} to {1}."; + public const string XmlArrayTooSmallOutput = "Array too small. Must be able to hold at least {0}."; + public const string XmlInvalidBase64Length = "Base64 sequence length ({0}) not valid. Must be a multiple of 4."; + public const string XmlInvalidBase64Sequence = "The characters '{0}' at offset {1} are not a valid Base64 sequence."; + public const string XmlInvalidBinHexLength = "BinHex sequence length ({0}) not valid. Must be a multiple of 2."; + public const string XmlInvalidBinHexSequence = "The characters '{0}' at offset {1} are not a valid BinHex sequence."; + public const string XmlInvalidHighSurrogate = "High surrogate char '0x{0}' not valid. High surrogate chars range from 0xD800 to 0xDBFF."; + public const string XmlInvalidLowSurrogate = "Low surrogate char '0x{0}' not valid. Low surrogate chars range from 0xDC00 to 0xDFFF."; + public const string XmlInvalidSurrogate = "Surrogate char '0x{0}' not valid. Surrogate chars range from 0x10000 to 0x10FFFF."; + public const string CombinedPrefixNSLength = "The combined length of the prefix and namespace must not be greater than {0}."; + public const string InvalidInclusivePrefixListCollection = "The inclusive namespace prefix collection cannot contain null as one of the items."; + public const string InvalidLocalNameEmpty = "The empty string is not a valid local name."; + public const string XmlArrayTooSmall = "Array too small."; + public const string XmlArrayTooSmallInput = "Array too small. Length of available data must be at least {0}."; + public const string XmlBadBOM = "Unrecognized Byte Order Mark."; + public const string XmlBase64DataExpected = "Base64 encoded data expected. Found {0}."; + public const string XmlCDATAInvalidAtTopLevel = "CData elements not valid at top level of an XML document."; + public const string XmlCloseCData = "']]>' not valid in text node content."; + public const string XmlConversionOverflow = "The value '{0}' cannot be represented with the type '{1}'."; + public const string XmlDeclarationRequired = "An XML declaration with an encoding is required for all non-UTF8 documents."; + public const string XmlDeclMissingVersion = "Version not found in XML declaration."; + public const string XmlDeclMissing = "An XML declaration is required for all non-UTF8 documents."; + public const string XmlDeclNotFirst = "No characters can appear before the XML declaration."; + public const string XmlDictionaryStringIDRange = "XmlDictionaryString IDs must be in the range from {0} to {1}."; + public const string XmlDictionaryStringIDUndefinedSession = "XmlDictionaryString ID {0} not defined in the XmlBinaryReaderSession."; + public const string XmlDictionaryStringIDUndefinedStatic = "XmlDictionaryString ID {0} not defined in the static dictionary."; + public const string XmlDuplicateAttribute = "Duplicate attribute found. Both '{0}' and '{1}' are from the namespace '{2}'."; + public const string XmlEmptyNamespaceRequiresNullPrefix = "The empty namespace requires a null or empty prefix."; + public const string XmlEncodingMismatch = "The encoding in the declaration '{0}' does not match the encoding of the document '{1}'."; + public const string XmlEncodingNotSupported = "XML encoding not supported."; + public const string XmlEndElementExpected = "End element '{0}' from namespace '{1}' expected. Found {2}."; + public const string XmlEndElementNoOpenNodes = "No corresponding start element is open."; + public const string XmlExpectedEncoding = "The expected encoding '{0}' does not match the actual encoding '{1}'."; + public const string XmlFoundCData = "cdata '{0}'"; + public const string XmlFoundComment = "comment '{0}'"; + public const string XmlFoundElement = "element '{0}' from namespace '{1}'"; + public const string XmlFoundEndElement = "end element '{0}' from namespace '{1}'"; + public const string XmlFoundEndOfFile = "end of file"; + public const string XmlFoundNodeType = "node {0}"; + public const string XmlFoundText = "text '{0}'"; + public const string XmlFullStartElementExpected = "Non-empty start element expected. Found {0}."; + public const string XmlFullStartElementLocalNameNsExpected = "Non-empty start element '{0}' from namespace '{1}' expected. Found {2}."; + public const string XmlFullStartElementNameExpected = "Non-empty start element '{0}' expected. Found {1}."; + public const string XmlIDDefined = "ID already defined."; + public const string XmlKeyAlreadyExists = "The specified key already exists in the dictionary."; + public const string XmlIllegalOutsideRoot = "Text cannot be written outside the root element."; + public const string XmlInvalidBytes = "Invalid byte encoding."; + public const string XmlInvalidCharRef = "Character reference not valid."; + public const string XmlInvalidCommentChars = "XML comments cannot contain '--' or end with '-'."; + public const string XmlInvalidDeclaration = "XML declaration can only be written at the beginning of the document."; + public const string XmlInvalidDepth = "Cannot call '{0}' while Depth is '{1}'."; + public const string XmlInvalidEncoding = "XML encoding must be 'UTF-8'."; + public const string XmlInvalidFFFE = "Characters with hexadecimal values 0xFFFE and 0xFFFF are not valid."; + public const string XmlInvalidFormat = "The input source is not correctly formatted."; + public const string XmlInvalidID = "ID must be >= 0."; + public const string XmlInvalidOperation = "The reader cannot be advanced."; + public const string XmlInvalidPrefixState = "A prefix cannot be defined while WriteState is '{0}'."; + public const string XmlInvalidQualifiedName = "Expected XML qualified name. Found '{0}'."; + public const string XmlInvalidRootData = "The data at the root level is invalid."; + public const string XmlInvalidStandalone = "'standalone' value in declaration must be 'yes' or 'no'."; + public const string XmlInvalidStream = "Stream returned by IStreamProvider cannot be null."; + public const string XmlInvalidUniqueId = "UniqueId cannot be zero length."; + public const string XmlInvalidUTF8Bytes = "'{0}' contains invalid UTF8 bytes."; + public const string XmlInvalidVersion = "XML version must be '1.0'."; + public const string XmlInvalidWriteState = "'{0}' cannot be called while WriteState is '{1}'."; + public const string XmlInvalidXmlByte = "The byte 0x{0} is not valid at this location."; + public const string XmlInvalidXmlSpace = "'{0}' is not a valid xml:space value. Valid values are 'default' and 'preserve'."; + public const string XmlLineInfo = "Line {0}, position {1}."; + public const string XmlMalformedDecl = "Malformed XML declaration."; + public const string XmlMaxArrayLengthExceeded = "The maximum array length quota ({0}) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader."; + public const string XmlMaxNameTableCharCountExceeded = "The maximum nametable character count quota ({0}) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader."; + public const string XmlMethodNotSupported = "This XmlWriter implementation does not support the '{0}' method."; + public const string XmlMissingLowSurrogate = "The surrogate pair is invalid. Missing a low surrogate character."; + public const string XmlMultipleRootElements = "There are multiple root elements."; + public const string XmlNamespaceNotFound = "The namespace '{0}' is not defined."; + public const string XmlNestedArraysNotSupported = "Nested arrays are not supported."; + public const string XmlNoRootElement = "The document does not have a root element."; + public const string XmlOnlyOneRoot = "Only one root element is permitted per document."; + public const string XmlOnlyWhitespace = "Only white space characters can be written with this method."; + public const string XmlOnlySingleValue = "Only a single typed value may be written inside an attribute or content."; + public const string XmlPrefixBoundToNamespace = "The prefix '{0}' is bound to the namespace '{1}' and cannot be changed to '{2}'."; + public const string XmlProcessingInstructionNotSupported = "Processing instructions (other than the XML declaration) and DTDs are not supported."; + public const string XmlReservedPrefix = "Prefixes beginning with \"xml\" (regardless of casing) are reserved for use by XML."; + public const string XmlSpaceBetweenAttributes = "Whitespace must appear between attributes."; + public const string XmlSpecificBindingNamespace = "The namespace '{1}' can only be bound to the prefix '{0}'."; + public const string XmlSpecificBindingPrefix = "The prefix '{0}' can only be bound to the namespace '{1}'."; + public const string XmlStartElementLocalNameNsExpected = "Start element '{0}' from namespace '{1}' expected. Found {2}."; + public const string XmlStartElementNameExpected = "Start element '{0}' expected. Found {1}."; + public const string XmlTagMismatch = "Start element '{0}' does not match end element '{1}'."; + public const string XmlTokenExpected = "The token '{0}' was expected but found '{1}'."; + public const string XmlUndefinedPrefix = "The prefix '{0}' is not defined."; + public const string XmlUnexpectedEndElement = "No matching start tag for end element."; + public const string XmlUnexpectedEndOfFile = "Unexpected end of file. Following elements are not closed: {0}."; + public const string XmlWriterClosed = "The XmlWriter is closed."; + public const string Xml_InvalidNmToken = "Invalid NmToken value '{0}'."; } -} - -/* -namespace System.Text -{ - static partial class SR - { - internal static string GetString(string name, params object[] args) - { - return GetString (CultureInfo.InvariantCulture, name, args); - } - - internal static string GetString(CultureInfo culture, string name, params object[] args) { - return string.Format (culture, name, args); - } - - internal static string GetString(string name) - { - return name; - } - - internal static string GetString(CultureInfo culture, string name) - { - return name; - } -} -} - -namespace System.Xml -{ - static partial class SR - { - internal static string GetString(string name, params object[] args) - { - return GetString (CultureInfo.InvariantCulture, name, args); - } - - internal static string GetString(CultureInfo culture, string name, params object[] args) { - return string.Format (culture, name, args); - } - - internal static string GetString(string name) - { - return name; - } - - internal static string GetString(CultureInfo culture, string name) - { - return name; - } -} -} -*/ -#endregion - - -#region "retrieved string resources" - -namespace System.Runtime.Serialization -{ - static partial class SR { - - -public const string ArrayExceededSize = @"Array length '{0}' provided by the get-only collection of type '{1}' is less than the number of array elements found in the input stream. Consider increasing the length of the array."; -public const string ArrayExceededSizeAttribute = @"Array length '{0}' provided by Size attribute is not equal to the number of array elements '{1}' from namespace '{2}' found."; -public const string ArrayTypeIsNotSupported = @"An internal error has occurred. '{0}[]' is not supported when generating code for serialization."; -public const string CannotDeserializeRefAtTopLevel = @"Cannot deserialize since root element references unrecognized object with id '{0}'."; -public const string CannotLoadMemberType = @"Cannot load member type '{0}'."; -public const string CannotSerializeObjectWithCycles = @"Object graph for type '{0}' contains cycles and cannot be serialized if references are not tracked. Consider using the DataContractAttribute with the IsReference property set to true."; -public const string CanOnlyStoreIntoArgOrLocGot0 = @"An internal error has occurred. Data can only be stored into ArgBuilder or LocalBuilder. Got: {0}."; -public const string CharIsInvalidPrimitive = @"An internal error has occurred. Char is not a valid schema primitive and should be treated as int in DataContract."; -public const string CallbackMustReturnVoid = @"Serialization Callback '{1}' in type '{0}' must return void. "; -public const string CallbackParameterInvalid = @"Serialization Callback '{1}' in type '{0}' must have a single parameter of type '{2}'. "; -public const string CallbacksCannotBeVirtualMethods = @"Virtual Method '{0}' of type '{1}' cannot be marked with '{2}' attribute. "; -public const string CollectionMustHaveAddMethod = @"Collection type '{0}' does not have a valid Add method."; -public const string CollectionMustHaveGetEnumeratorMethod = @"Collection type '{0}' does not have a valid GetEnumerator method."; -public const string CollectionMustHaveItemType = @"Collection type '{0}' must have a non-null item type."; -public const string CollectionTypeCannotBeBuiltIn = @"{0} is a built-in type and cannot be a collection."; -public const string CollectionTypeCannotHaveDataContract = @"{0} has DataContractAttribute attribute."; -public const string CollectionTypeDoesNotHaveAddMethod = @"{0} does not have a valid Add method with parameter of type '{1}'."; -public const string CollectionTypeDoesNotHaveDefaultCtor = @"{0} does not have a default constructor."; -public const string CollectionTypeHasMultipleDefinitionsOfInterface = @"{0} has multiple definitions of interface '{1}'."; -public const string CollectionTypeIsNotIEnumerable = @"{0} does not implement IEnumerable interface."; -public const string DataContractCacheOverflow = @"An internal error has occurred. DataContract cache overflow."; -public const string DataContractNamespaceAlreadySet = @"ContractNamespaceAttribute attribute maps CLR namespace '{2}' to multiple data contract namespaces '{0}' and '{1}'. You can map a CLR namespace to only one data contract namespace."; -public const string DataContractNamespaceIsNotValid = @"DataContract namespace '{0}' is not a valid URI."; -public const string DataContractNamespaceReserved = @"DataContract namespace '{0}' cannot be specified since it is reserved."; -public const string DataMemberOnEnumField = @"Member '{0}.{1}' has DataMemberAttribute attribute. Use EnumMemberAttribute attribute instead."; -public const string DcTypeNotFoundOnDeserialize = @"Element '{2}:{3}' contains data of the '{0}:{1}' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to '{1}' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer."; -public const string DcTypeNotFoundOnSerialize = @"Type '{0}' with data contract name '{1}:{2}' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer."; -public const string DcTypeNotResolvedOnDeserialize = @"Element '{2}:{3}' contains data from a type that maps to the name '{0}:{1}'. The deserializer has no knowledge of any type that maps to this name. Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name '{1}' and namespace '{0}'."; -public const string DeserializedObjectWithIdNotFound = @"Deserialized object with reference id '{0}' not found in stream."; -public const string DupContractInKnownTypes = @"Type '{0}' cannot be added to list of known types since another type '{1}' with the same data contract name '{2}:{3}' is already present."; -public const string DupKeyValueName = @"The collection data contract type '{0}' specifies the same value '{1}' for both the KeyName and the ValueName properties. This is not allowed. Consider changing either the KeyName or the ValueName property."; -public const string DupEnumMemberValue = @"Type '{2}' contains two members '{0}' 'and '{1}' with the same name '{3}'. Multiple members with the same name in one type are not supported. Consider changing one of the member names using EnumMemberAttribute attribute."; -public const string DupMemberName = @"Type '{2}' contains two members '{0}' 'and '{1}' with the same data member name '{3}'. Multiple members with the same name in one type are not supported. Consider changing one of the member names using DataMemberAttribute attribute."; -public const string DuplicateAttribute = @"Invalid Callback. Method '{3}' in type '{2}' has both '{0}' and '{1}'. "; -public const string DuplicateCallback = @"Invalid attribute. Both '{0}' and '{1}' in type '{2}' have '{3}'. "; -public const string EncounteredWithNameNamespace = @"{0}. Encountered '{1}' with name '{2}', namespace '{3}'."; -public const string EnumTypeCannotHaveIsReference = @"Enum type '{0}' cannot have the IsReference setting of '{1}'. Either change the setting to '{2}', or remove it completely."; -public const string ErrorDeserializing = @"There was an error deserializing the object {0}. {1}"; -public const string ErrorInLine = @"Error in line {0} position {1}."; -public const string ErrorIsStartObject = @"There was an error checking start element of object {0}. {1}"; -public const string ErrorSerializing = @"There was an error serializing the object {0}. {1}"; -public const string ErrorTypeInfo = @"of type {0}"; -public const string ErrorWriteEndObject = @"There was an error writing end element of object {0}. {1}"; -public const string ErrorWriteStartObject = @"There was an error writing start element of object {0}. {1}"; -public const string ExceededMaxItemsQuota = @"Maximum number of items that can be serialized or deserialized in an object graph is '{0}'."; -public const string ExpectingElement = @"Expecting element '{1}' from namespace '{0}'."; -public const string ExpectingElementAtDeserialize = @"Expecting state '{0}' when ReadObject is called."; -public const string ExpectingEnd = @"Expecting End'{0}'."; -public const string ExpectingState = @"Expecting state '{0}'."; -public const string GenericNameBraceMismatch = @"The data contract name '{0}' for type '{1}' has a curly brace '{{' that is not matched with a closing curly brace. Curly braces have special meaning in data contract names - they are used to customize the naming of data contracts for generic types."; -public const string GenericParameterNotValid = @"In the data contract name for type '{1}', there are curly braces with '{0}' inside, which is an invalid value. Curly braces have special meaning in data contract names - they are used to customize the naming of data contracts for generic types. Based on the number of generic parameters this type has, the contents of the curly braces must either be a number between 0 and '{2}' to insert the name of the generic parameter at that index or the '#' symbol to insert a digest of the generic parameter namespaces."; -public const string InconsistentIsReference = @"The IsReference setting for type '{0}' is '{1}', but the same setting for its parent class '{2}' is '{3}'. Derived types must have the same value for IsReference as the base type. Change the setting on type '{0}' to '{3}', or on type '{2}' to '{1}', or do not set IsReference explicitly."; -public const string IndexedPropertyCannotBeSerialized = @"Property '{1}' in type '{0}' cannot be serialized because serialization of indexed properties is not supported."; -public const string InterfaceTypeCannotBeCreated = @"Interface type '{0}' cannot be created. Consider replacing with a non-interface serializable type."; -public const string InvalidCollectionContractItemName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute ItemName set to null or empty string."; -public const string InvalidCollectionContractKeyName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute KeyName set to null or empty string."; -public const string InvalidCollectionContractKeyNoDictionary = @"The collection data contract type '{0}' specifies '{1}' for the KeyName property. This is not allowed since the type is not IDictionary. Remove the setting for the KeyName property."; -public const string InvalidCollectionContractName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute Name set to null or empty string."; -public const string InvalidCollectionContractNamespace = @"Type '{0}' cannot have CollectionDataContractAttribute attribute Namespace set to null."; -public const string InvalidCollectionContractValueName = @"Type '{0}' cannot have CollectionDataContractAttribute attribute ValueName set to null or empty string."; -public const string InvalidCollectionContractValueNoDictionary = @"The collection data contract type '{0}' specifies '{1}' for the ValueName property. This is not allowed since the type is not IDictionary. Remove the setting for the ValueName property."; -public const string InvalidCollectionDataContract = @"Type '{0}' with CollectionDataContractAttribute attribute is an invalid collection type since it"; -public const string InvalidCollectionType = @"Type '{0}' is an invalid collection type since it"; -public const string InvalidDataContractName = @"Type '{0}' cannot have DataContractAttribute attribute Name set to null or empty string."; -public const string InvalidDataContractNamespace = @"Type '{0}' cannot have DataContractAttribute attribute Namespace set to null."; -public const string InvalidDataMemberName = @"Member '{0}' in type '{1}' cannot have DataMemberAttribute attribute Name set to null or empty string."; -public const string InvalidEnumMemberValue = @"'{0}' in type '{1}' cannot have EnumMemberAttribute attribute Value set to null or empty string."; -public const string InvalidEnumValueOnRead = @"Invalid enum value '{0}' cannot be deserialized into type '{1}'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute."; -public const string InvalidEnumValueOnWrite = @"Enum value '{0}' is invalid for type '{1}' and cannot be serialized. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute."; -public const string InvalidGetSchemaMethod = @"Type '{0}' cannot have MethodName on XmlSchemaProviderAttribute attribute set to null or empty string. "; -public const string InvalidGlobalDataContractNamespace = @"CLR namespace '{0}' cannot have ContractNamespace set to null."; -public const string InvalidMember = @"Member '{0}.{1}' cannot be serialized since it is neither a field nor a property, and therefore cannot be marked with the DataMemberAttribute attribute. Remove the DataMemberAttribute attribute from the '{1}' member."; -public const string InvalidNonNullReturnValueByIsAny = @"Method '{0}.{1}()' returns a non-null value. The return value must be null since IsAny=true."; -public const string InvalidPrimitiveType = @"Type '{0}' is not a valid serializable type."; -public const string InvalidReturnTypeOnGetSchemaMethod = @"Method '{0}.{1}()' returns '{2}'. The return type must be compatible with '{3}'."; -public const string InvalidSizeDefinition = @"Invalid Size '{0}'. Must be non-negative integer."; -public const string InvalidXmlDataContractName = @"XML data contract Name for type '{0}' cannot be set to null or empty string."; -public const string InvalidXsIdDefinition = @"Invalid Id '{0}'. Must not be null or empty."; -public const string InvalidXsRefDefinition = @"Invalid Ref '{0}'. Must not be null or empty."; -public const string IsAnyCannotBeNull = @"A null value cannot be serialized at the top level for IXmlSerializable root type '{0}' since its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct."; -public const string IsAnyCannotBeSerializedAsDerivedType = @"An object of type '{0}' cannot be serialized at the top level for IXmlSerializable root type '{1}' since its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct."; -public const string IsAnyCannotHaveXmlRoot = @"Type '{0}' cannot specify an XmlRootAttribute attribute because its IsAny setting is 'true'. This type must write all its contents including the root element. Verify that the IXmlSerializable implementation is correct."; -public const string IsNotAssignableFrom = @"An internal error has occurred. '{0}' is not assignable from '{1}' - error generating code for serialization."; -public const string IsRequiredDataMemberOnIsReferenceDataContractType = @"'{0}.{1}' has the IsRequired setting of '{2}. However, '{0}' has the IsReference setting of '{2}', because either it is set explicitly, or it is derived from a base class. Set IsRequired on '{0}.{1}' to false, or disable IsReference on '{0}'."; -public const string IXmlSerializableCannotHaveCollectionDataContract = @"Type '{0}' cannot be IXmlSerializable and have CollectionDataContractAttribute attribute."; -public const string IXmlSerializableCannotHaveDataContract = @"Type '{0}' cannot be IXmlSerializable and have DataContractAttribute attribute."; -public const string IXmlSerializableIllegalOperation = @"This method cannot be called from IXmlSerializable implementations."; -public const string IXmlSerializableMissingEndElements = @"IXmlSerializable.WriteXml method of type '{0}' did not close all open tags. Verify that the IXmlSerializable implementation is correct."; -public const string IXmlSerializableMustHaveDefaultConstructor = @"IXmlSerializable Type '{0}' must have default constructor."; -public const string IXmlSerializableWritePastSubTree = @"IXmlSerializable.WriteXml method of type '{0}' attempted to close too many tags. Verify that the IXmlSerializable implementation is correct."; -public const string KnownTypeAttributeEmptyString = @"Method name specified by KnownTypeAttribute attribute on type '{0}' cannot be the empty string."; -public const string KnownTypeAttributeUnknownMethod = @"KnownTypeAttribute attribute on type '{1}' specifies a method named '{0}' to provide known types. Static method '{0}()' was not found on this type. Ensure that the method exists and is marked as static."; -public const string KnownTypeAttributeReturnType = @"KnownTypeAttribute attribute on type '{0}' specifies a method named '{1}' to provide known types. The return type of this method is invalid because it is not assignable to IEnumerable. Ensure that the method exists and has a valid signature."; -public const string KnownTypeAttributeOneScheme = @"Type '{0}': If a KnownTypeAttribute attribute specifies a method it must be the only KnownTypeAttribute attribute on that type."; -public const string KnownTypeAttributeNoType = @"KnownTypeAttribute attribute on type '{0}' contains no Type."; -public const string KnownTypeConfigClosedGenericDeclared = @"Declared type '{0}' in config cannot be a closed or partial generic type."; -public const string KnownTypeAttributeValidMethodTypes = @"Method specified by KnownTypeAttribute attribute on type '{0}' does not expose valid types."; -public const string KnownTypeAttributeNoData = @"KnownTypeAttribute attribute on type '{0}' contains no data."; -public const string KnownTypeAttributeMethodNull = @"Method specified by KnownTypeAttribute attribute on type '{0}' returned null."; -public const string MaxArrayLengthExceeded = @"The maximum array length ({0}) has been exceeded while reading XML data for array of type '{1}'."; -public const string MissingGetSchemaMethod = @"Type '{0}' does not have a static method '{1}' that takes a parameter of type 'System.Xml.Schema.XmlSchemaSet' as specified by the XmlSchemaProviderAttribute attribute."; -public const string MultipleIdDefinition = @"Invalid XML encountered. The same Id value '{0}' is defined more than once. Multiple objects cannot be deserialized using the same Id."; -public const string NoConversionPossibleTo = @"An internal error has occurred. No conversion is possible to '{0}' - error generating code for serialization."; -public const string NoGetMethodForProperty = @"No get method for property '{1}' in type '{0}'."; -public const string NoSetMethodForProperty = @"No set method for property '{1}' in type '{0}'."; -public const string NullKnownType = @"One of the known types provided to the serializer via '{0}' argument was invalid because it was null. All known types specified must be non-null values."; -public const string NullValueReturnedForGetOnlyCollection = @"The get-only collection of type '{0}' returned a null value. The input stream contains collection items which cannot be added if the instance is null. Consider initializing the collection either in the constructor of the the object or in the getter."; -public const string ObjectTableOverflow = @"An internal error has occurred. Object table overflow. This could be caused by serializing or deserializing extremely large object graphs."; -public const string OrderCannotBeNegative = @"Property 'Order' in DataMemberAttribute attribute cannot be a negative number."; -public const string ParameterCountMismatch = @"Invalid number of parameters to call method '{0}'. Expected '{1}' parameters, but '{2}' were provided."; -public const string PartialTrustCollectionContractAddMethodNotPublic = @"The collection data contract type '{0}' cannot be deserialized because the method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustCollectionContractNoPublicConstructor = @"The collection data contract type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustCollectionContractTypeNotPublic = @"The collection data contract type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractOnSerializingNotPublic = @"The data contract type '{0}' cannot be serialized because the OnSerializing method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractOnSerializedNotPublic = @"The data contract type '{0}' cannot be serialized because the OnSerialized method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractOnDeserializingNotPublic = @"The data contract type '{0}' cannot be deserialized because the OnDeserializing method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractOnDeserializedNotPublic = @"The data contract type '{0}' cannot be deserialized because the OnDeserialized method '{1}' is not public. Making the method public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractFieldGetNotPublic = @"The data contract type '{0}' cannot be serialized because the member '{1}' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractFieldSetNotPublic = @"The data contract type '{0}' cannot be deserialized because the member '{1}' is not public. Making the member public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractPropertyGetNotPublic = @"The data contract type '{0}' cannot be serialized because the property '{1}' does not have a public getter. Adding a public getter will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractPropertySetNotPublic = @"The data contract type '{0}' cannot be deserialized because the property '{1}' does not have a public setter. Adding a public setter will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustDataContractTypeNotPublic = @"The data contract type '{0}' is not serializable because it is not public. Making the type public will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustNonAttributedSerializableTypeNoPublicConstructor = @"The type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustIXmlSerializableTypeNotPublic = @"The IXmlSerializable type '{0}' is not serializable in partial trust because it is not public. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string PartialTrustIXmlSerialzableNoPublicConstructor = @"The IXmlSerializable type '{0}' cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor will fix this error. Alternatively, you can make it internal, and use the InternalsVisibleToAttribute attribute on your assembly in order to enable serialization of internal members - see documentation for more details. Be aware that doing so has certain security implications."; -public const string NonAttributedSerializableTypesMustHaveDefaultConstructor = @"The Type '{0}' must have a parameterless constructor."; -public const string AttributedTypesCannotInheritFromNonAttributedSerializableTypes = @"Type '{0}' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute. Consider marking the base type '{1}' with DataContractAttribute or SerializableAttribute, or removing them from the derived type."; -public const string GetOnlyCollectionsNotSupported = @"Get-only collection properties are not supported. Consider adding a public setter to property '{0}.{1}' or marking the it with the IgnoreDataMemberAttribute. "; -public const string QuotaMustBePositive = @"Quota must be a positive value."; -public const string QuotaIsReadOnly = @"The '{0}' quota is readonly."; -public const string QuotaCopyReadOnly = @"Cannot copy XmlDictionaryReaderQuotas. Target is readonly."; -public const string RequiredMemberMustBeEmitted = @"Member {0} in type {1} cannot be serialized. This exception is usually caused by trying to use a null value where a null value is not allowed. The '{0}' member is set to its default value (usually null or zero). The member's EmitDefault setting is 'false', indicating that the member should not be serialized. However, the member's IsRequired setting is 'true', indicating that it must be serialized. This conflict cannot be resolved. Consider setting '{0}' to a non-default value. Alternatively, you can change the EmitDefaultValue property on the DataMemberAttribute attribute to true, or changing the IsRequired property to false."; -public const string ResolveTypeReturnedFalse = @"An object of type '{0}' which derives from DataContractResolver returned false from its TryResolveType method when attempting to resolve the name for an object of type '{1}', indicating that the resolution failed. Change the TryResolveType implementation to return true."; -public const string ResolveTypeReturnedNull = @"An object of type '{0}' which derives from DataContractResolver returned a null typeName or typeNamespace but not both from its TryResolveType method when attempting to resolve the name for an object of type '{1}'. Change the TryResolveType implementation to return non-null values, or to return null values for both typeName and typeNamespace in order to serialize as the declared type."; -public const string SupportForMultidimensionalArraysNotPresent = @"Multi-dimensional arrays are not supported."; -public const string TooManyCollectionContracts = @"Type '{0}' has more than one CollectionDataContractAttribute attribute."; -public const string TooManyDataContracts = @"Type '{0}' has more than one DataContractAttribute attribute."; -public const string TooManyDataMembers = @"Member '{0}.{1}' has more than one DataMemberAttribute attribute."; -public const string TooManyEnumMembers = @"Member '{0}.{1}' has more than one EnumMemberAttribute attribute."; -public const string TooManyIgnoreDataMemberAttributes = @"Member '{0}.{1}' has more than one IgnoreDataMemberAttribute attribute."; -public const string TypeMustBeConcrete = @"Error while getting known types for Type '{0}'. The type must not be an open or partial generic class."; -public const string TypeNotSerializable = @"Type '{0}' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required."; -public const string UnexpectedContractType = @"An internal error has occurred. Unexpected contract type '{0}' for type '{1}' encountered."; -public const string UnexpectedElementExpectingElements = @"'{0}' '{1}' from namespace '{2}' is not expected. Expecting element '{3}'."; -public const string UnexpectedEndOfFile = @"Unexpected end of file."; -public const string UnknownConstantType = @"Unrecognized constant type '{0}'."; -public const string UnsupportedIDictionaryAsDataMemberType = @"Cannot deserialize one of the DataMember because it is an IDictionary. Use IDictionary instead."; -public const string ValueMustBeNonNegative = @"The value of this argument must be non-negative."; -public const string ValueTypeCannotBeNull = @"ValueType '{0}' cannot be null."; -public const string ValueTypeCannotHaveBaseType = @"Data contract '{0}' from namespace '{1}' is a value type and cannot have base contract '{2}' from namespace '{3}'."; -public const string ValueTypeCannotHaveId = @"ValueType '{0}' cannot have id."; -public const string ValueTypeCannotHaveIsReference = @"Value type '{0}' cannot have the IsReference setting of '{1}'. Either change the setting to '{2}', or remove it completely. "; -public const string ValueTypeCannotHaveRef = @"ValueType '{0}' cannot have ref to another object."; -public const string XmlElementAttributes = @"Only Element nodes have attributes."; -public const string XmlForObjectCannotHaveContent = @"Element {0} from namespace {1} cannot have child contents to be deserialized as an object. Please use XElement to deserialize this pattern of XML."; -public const string XmlInvalidConversion = @"The value '{0}' cannot be parsed as the type '{1}'."; -public const string XmlInvalidConversionWithoutValue = @"The value cannot be parsed as the type '{0}'."; -public const string XmlStartElementExpected = @"Start element expected. Found {0}."; -public const string XmlWriterMustBeInElement = @"WriteState '{0}' not valid. Caller must write start element before serializing in contentOnly mode."; - - } -} - -namespace System.Runtime.Serialization -{ - static partial class SR { - -public const string OffsetExceedsBufferSize = @"The specified offset exceeds the buffer size ({0} bytes)."; -public const string SizeExceedsRemainingBufferSpace = @"The specified size exceeds the remaining buffer space ({0} bytes)."; -public const string ValueMustBeInRange = @"The value of this argument must fall within the range {0} to {1}."; -public const string XmlArrayTooSmallOutput = @"Array too small. Must be able to hold at least {0}."; -public const string XmlInvalidBase64Length = @"Base64 sequence length ({0}) not valid. Must be a multiple of 4."; -public const string XmlInvalidBase64Sequence = @"The characters '{0}' at offset {1} are not a valid Base64 sequence."; -public const string XmlInvalidBinHexLength = @"BinHex sequence length ({0}) not valid. Must be a multiple of 2."; -public const string XmlInvalidBinHexSequence = @"The characters '{0}' at offset {1} are not a valid BinHex sequence."; -public const string XmlInvalidHighSurrogate = @"High surrogate char '0x{0}' not valid. High surrogate chars range from 0xD800 to 0xDBFF."; -public const string XmlInvalidLowSurrogate = @"Low surrogate char '0x{0}' not valid. Low surrogate chars range from 0xDC00 to 0xDFFF."; -public const string XmlInvalidSurrogate = @"Surrogate char '0x{0}' not valid. Surrogate chars range from 0x10000 to 0x10FFFF."; - - } -} - -namespace System.Runtime.Serialization -{ - static partial class SR { - -public const string CombinedPrefixNSLength = @"The combined length of the prefix and namespace must not be greater than {0}."; -public const string InvalidInclusivePrefixListCollection = @"The inclusive namespace prefix collection cannot contain null as one of the items."; -public const string InvalidLocalNameEmpty = @"The empty string is not a valid local name."; -public const string XmlArrayTooSmall = @"Array too small."; -public const string XmlArrayTooSmallInput = @"Array too small. Length of available data must be at least {0}."; -public const string XmlBadBOM = @"Unrecognized Byte Order Mark."; -public const string XmlBase64DataExpected = @"Base64 encoded data expected. Found {0}."; -public const string XmlCDATAInvalidAtTopLevel = @"CData elements not valid at top level of an XML document."; -public const string XmlCloseCData = @"']]>' not valid in text node content."; -public const string XmlConversionOverflow = @"The value '{0}' cannot be represented with the type '{1}'."; -public const string XmlDeclarationRequired = @"An XML declaration with an encoding is required for all non-UTF8 documents."; -public const string XmlDeclMissingVersion = @"Version not found in XML declaration."; -public const string XmlDeclMissing = @"An XML declaration is required for all non-UTF8 documents."; -public const string XmlDeclNotFirst = @"No characters can appear before the XML declaration."; -public const string XmlDictionaryStringIDRange = @"XmlDictionaryString IDs must be in the range from {0} to {1}."; -public const string XmlDictionaryStringIDUndefinedSession = @"XmlDictionaryString ID {0} not defined in the XmlBinaryReaderSession."; -public const string XmlDictionaryStringIDUndefinedStatic = @"XmlDictionaryString ID {0} not defined in the static dictionary."; -public const string XmlDuplicateAttribute = @"Duplicate attribute found. Both '{0}' and '{1}' are from the namespace '{2}'."; -public const string XmlEmptyNamespaceRequiresNullPrefix = @"The empty namespace requires a null or empty prefix."; -public const string XmlEncodingMismatch = @"The encoding in the declaration '{0}' does not match the encoding of the document '{1}'."; -public const string XmlEncodingNotSupported = @"XML encoding not supported."; -public const string XmlEndElementExpected = @"End element '{0}' from namespace '{1}' expected. Found {2}."; -public const string XmlEndElementNoOpenNodes = @"No corresponding start element is open."; -public const string XmlExpectedEncoding = @"The expected encoding '{0}' does not match the actual encoding '{1}'."; -public const string XmlFoundCData = @"cdata '{0}'"; -public const string XmlFoundComment = @"comment '{0}'"; -public const string XmlFoundElement = @"element '{0}' from namespace '{1}'"; -public const string XmlFoundEndElement = @"end element '{0}' from namespace '{1}'"; -public const string XmlFoundEndOfFile = @"end of file"; -public const string XmlFoundNodeType = @"node {0}"; -public const string XmlFoundText = @"text '{0}'"; -public const string XmlFullStartElementExpected = @"Non-empty start element expected. Found {0}."; -public const string XmlFullStartElementLocalNameNsExpected = @"Non-empty start element '{0}' from namespace '{1}' expected. Found {2}."; -public const string XmlFullStartElementNameExpected = @"Non-empty start element '{0}' expected. Found {1}."; -public const string XmlIDDefined = @"ID already defined."; -public const string XmlKeyAlreadyExists = @"The specified key already exists in the dictionary."; -public const string XmlIllegalOutsideRoot = @"Text cannot be written outside the root element."; -public const string XmlInvalidBytes = @"Invalid byte encoding."; -public const string XmlInvalidCharRef = @"Character reference not valid."; -public const string XmlInvalidCommentChars = @"XML comments cannot contain '--' or end with '-'."; -public const string XmlInvalidDeclaration = @"XML declaration can only be written at the beginning of the document."; -public const string XmlInvalidDepth = @"Cannot call '{0}' while Depth is '{1}'."; -public const string XmlInvalidEncoding = @"XML encoding must be 'UTF-8'."; -public const string XmlInvalidFFFE = @"Characters with hexadecimal values 0xFFFE and 0xFFFF are not valid."; -public const string XmlInvalidFormat = @"The input source is not correctly formatted."; -public const string XmlInvalidID = @"ID must be >= 0."; -public const string XmlInvalidOperation = @"The reader cannot be advanced."; -public const string XmlInvalidPrefixState = @"A prefix cannot be defined while WriteState is '{0}'."; -public const string XmlInvalidQualifiedName = @"Expected XML qualified name. Found '{0}'."; -public const string XmlInvalidRootData = @"The data at the root level is invalid."; -public const string XmlInvalidStandalone = @"'standalone' value in declaration must be 'yes' or 'no'."; -public const string XmlInvalidStream = @"Stream returned by IStreamProvider cannot be null."; -public const string XmlInvalidUniqueId = @"UniqueId cannot be zero length."; -public const string XmlInvalidUTF8Bytes = @"'{0}' contains invalid UTF8 bytes."; -public const string XmlInvalidVersion = @"XML version must be '1.0'."; -public const string XmlInvalidWriteState = @"'{0}' cannot be called while WriteState is '{1}'."; -public const string XmlInvalidXmlByte = @"The byte 0x{0} is not valid at this location."; -public const string XmlInvalidXmlSpace = @"'{0}' is not a valid xml:space value. Valid values are 'default' and 'preserve'."; -public const string XmlLineInfo = @"Line {0}, position {1}."; -public const string XmlMalformedDecl = @"Malformed XML declaration."; -public const string XmlMaxArrayLengthExceeded = @"The maximum array length quota ({0}) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader."; - - -public const string XmlMaxNameTableCharCountExceeded = @"The maximum nametable character count quota ({0}) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader."; - -public const string XmlMethodNotSupported = @"This XmlWriter implementation does not support the '{0}' method."; -public const string XmlMissingLowSurrogate = @"The surrogate pair is invalid. Missing a low surrogate character."; -public const string XmlMultipleRootElements = @"There are multiple root elements."; -public const string XmlNamespaceNotFound = @"The namespace '{0}' is not defined."; -public const string XmlNestedArraysNotSupported = @"Nested arrays are not supported."; -public const string XmlNoRootElement = @"The document does not have a root element."; -public const string XmlOnlyOneRoot = @"Only one root element is permitted per document."; -public const string XmlOnlyWhitespace = @"Only white space characters can be written with this method."; -public const string XmlOnlySingleValue = @"Only a single typed value may be written inside an attribute or content."; -public const string XmlPrefixBoundToNamespace = @"The prefix '{0}' is bound to the namespace '{1}' and cannot be changed to '{2}'."; -public const string XmlProcessingInstructionNotSupported = @"Processing instructions (other than the XML declaration) and DTDs are not supported."; -public const string XmlReservedPrefix = @"Prefixes beginning with ""xml"" (regardless of casing) are reserved for use by XML."; -public const string XmlSpaceBetweenAttributes = @"Whitespace must appear between attributes."; -public const string XmlSpecificBindingNamespace = @"The namespace '{1}' can only be bound to the prefix '{0}'."; -public const string XmlSpecificBindingPrefix = @"The prefix '{0}' can only be bound to the namespace '{1}'."; -public const string XmlStartElementLocalNameNsExpected = @"Start element '{0}' from namespace '{1}' expected. Found {2}."; -public const string XmlStartElementNameExpected = @"Start element '{0}' expected. Found {1}."; -public const string XmlTagMismatch = @"Start element '{0}' does not match end element '{1}'."; -public const string XmlTokenExpected = @"The token '{0}' was expected but found '{1}'."; -public const string XmlUndefinedPrefix = @"The prefix '{0}' is not defined."; -public const string XmlUnexpectedEndElement = @"No matching start tag for end element."; -public const string XmlUnexpectedEndOfFile = @"Unexpected end of file. Following elements are not closed: {0}."; -public const string XmlWriterClosed = @"The XmlWriter is closed."; -public const string Xml_InvalidNmToken = @"Invalid NmToken value '{0}'."; - - } -} - -#endregion +} \ No newline at end of file diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.missing.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.missing.cs new file mode 100644 index 00000000000..aa1b8418171 --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR.missing.cs @@ -0,0 +1,312 @@ +using System.Globalization; + +namespace System.Runtime.Serialization +{ + static partial class SR + { + internal static string GetString(string name, params object[] args) + { + return GetString (CultureInfo.InvariantCulture, name, args); + } + + internal static string GetString(CultureInfo culture, string name, params object[] args) + { + return string.Format (culture, name, args); + } + + internal static string GetString(string name) + { + return name; + } + + internal static string GetString(CultureInfo culture, string name) + { + return name; + } + +#region MissingInStrings.txt + +// +// This was retrieved as follows: +// +// 1. mcs ReferenceSources/SR.cs -t:library -out:existing.dll +// 2. mcs {https://raw.githubusercontent.com/mono/mono/wip-serialization-halfway/mcs/class/System.Runtime.Serialization/ReferenceSource/SR.cs} -t:library -out:full.dll +// 3. csharp -e "System.IO.File.WriteAllLines ("existing.txt", System.Reflection.Assembly.ReflectionOnlyLoadFrom ("existing.dll").GetTypes ().SelectMany (t => t.GetFields ()).Select (f => f.Name).ToArray ())" +// 4. csharp -e "System.IO.File.WriteAllLines ("full.txt", System.Reflection.Assembly.ReflectionOnlyLoadFrom ("full.dll").GetTypes ().SelectMany (t => t.GetFields ()).Select (f => f.Name).ToArray ())" +// 5. csharp +// var existing = System.IO.File.ReadAllLines ("existing.txt"); +// var full = System.IO.File.ReadAllLines ("full.txt"); +// var missing = full.Where (f => !existing.Contains (f)); +// System.IO.File.WriteAllLines ("missing.cs", missing.Select (m => "public const string " + m + " = @\"" + m + "\";").ToArray ()) +// 6. copy missing.cs contents here. +// + +public const string AbstractElementNotSupported = @"Abstract element '{0}' is not supported."; +public const string AbstractTypeNotSupported = @"Abstract type is not supported"; +public const string AmbiguousReferencedCollectionTypes1 = @"Ambiguous collection types were referenced: {0}"; +public const string AmbiguousReferencedCollectionTypes3 = @"In '{0}' element in '{1}' namespace, ambiguous collection types were referenced: {2}"; +public const string AmbiguousReferencedTypes1 = @"Ambiguous types were referenced: {0}"; +public const string AmbiguousReferencedTypes3 = @"In '{0}' element in '{1}' namespace, ambiguous types were referenced: {2}"; +public const string AnnotationAttributeNotFound = @"Annotation attribute was not found: default value annotation is '{0}', type is '{1}' in '{2}' namespace, emit default value is {3}."; +public const string AnonymousTypeNotSupported = @"Anonymous type is not supported. Type is '{0}' in '{1}' namespace."; +public const string AnyAttributeNotSupported = @"XML Schema 'any' attribute is not supported"; +public const string ArrayItemFormMustBe = @"For array item, element 'form' must be {0}."; +public const string ArraySizeAttributeIncorrect = @"Array size attribute is incorrect; must be between {0} and {1}."; + +public const string ArrayTypeCannotBeImported = @"Array type cannot be imported for '{0}' in '{1}' namespace: {2}."; +public const string AssemblyNotFound = @"Assembly '{0}' was not found."; +public const string AttributeNotFound = @"Attribute was not found for CLR type '{1}' in namespace '{0}'. XML reader node is on {2}, '{4}' node in '{3}' namespace."; +public const string BaseTypeNotISerializable = @"Base type '{0}' in '{1}' namespace is not ISerializable."; +public const string CannotComputeUniqueName = @"Cannot compute unique name for '{0}'."; +public const string CannotDeriveFromSealedReferenceType = @"Cannod drive from sealed reference type '{2}', for '{0}' element in '{1}' namespace."; +public const string CannotDeserializeForwardedType = @"Cannot deserialize forwarded type '{0}'."; +public const string CannotExportNullAssembly = @"Cannot export null assembly."; +public const string CannotExportNullKnownType = @"Cannot export null known type."; +public const string CannotExportNullType = @"Cannot export null type."; +public const string CannotHaveDuplicateAttributeNames = @"Cannot have duplicate attribute names '{0}'."; +public const string CannotHaveDuplicateElementNames = @"Cannot have duplicate element names '{0}'."; +public const string CannotImportInvalidSchemas = @"Cannot import invalid schemas."; +public const string CannotImportNullDataContractName = @"Cannot import data contract with null name."; +public const string CannotImportNullSchema = @"Cannot import from schema list that contains null."; +public const string CannotSetMembersForReferencedType = @"Cannot set members for already referenced type. Base type is '{0}'."; +public const string CannotSetNamespaceForReferencedType = @"Cannot set namespace for already referenced type. Base type is '{0}'."; +public const string CannotUseGenericTypeAsBase = @"For '{0}' in '{1}' namespace, generic type cannot be referenced as the base type."; +public const string ChangingFullTypeNameNotSupported = @"Changing full type name is not supported. Serialization type name: '{0}', data contract type name: '{1}'."; +public const string CircularTypeReference = @"Circular type reference was found for '{0}' in '{1}' namespace."; +public const string ClassDataContractReturnedForGetOnlyCollection = @"For '{0}' type, class data contract was returned for get-only collection."; +public const string CLRNamespaceMappedMultipleTimes = @"CLR namespace is mapped multiple times. Current data contract namespace is '{0}', found '{1}' for CLR namespace '{2}'."; +public const string ClrTypeNotFound = @"CLR type '{1}' in assembly '{0}' is not found."; +public const string CollectionAssignedToIncompatibleInterface = @"Collection of type '{0}' is assigned to an incompatible interface '{1}'"; +public const string ComplexTypeRestrictionNotSupported = @"XML schema complexType restriction is not supported."; +public const string ConfigDataContractSerializerSectionLoadError = @"Failed to load configuration section for dataContractSerializer."; +public const string ConfigIndexOutOfRange = @"For type '{0}', configuration index is out of range."; +public const string ConfigMustOnlyAddParamsWithType = @"Configuration parameter element must only add params with type."; // huh? the code doesn't make a lot of sense to me... +public const string ConfigMustOnlySetTypeOrIndex = @"Configuration parameter element can set only one of either type or index."; +public const string ConfigMustSetTypeOrIndex = @"Configuration parameter element must set either type or index."; +public const string CouldNotReadSerializationSchema = @"Could not read serialization schema for '{0}' namespace."; +public const string DefaultOnElementNotSupported = @"On element '{0}', default value is not supported."; +public const string DerivedTypeNotISerializable = @"On type '{0}' in '{1}' namespace, derived type is not ISerializable."; +public const string DupContractInDataContractSet = @"Duplicate contract in data contract set was found, for '{0}' in '{1}' namespace."; +public const string DuplicateExtensionDataSetMethod = @"Duplicate extension data set method was found, for method '{0}', existing method is '{1}', on data contract type '{2}'."; +public const string DupTypeContractInDataContractSet = @"Duplicate type contract in data contract set. Type name '{0}', for data contract '{1}' in '{2}' namespace."; +public const string ElementMaxOccursMustBe = @"On element '{0}', schema element maxOccurs must be 1."; +public const string ElementMinOccursMustBe = @"On element '{0}', schema element minOccurs must be less or equal to 1."; +public const string ElementRefOnLocalElementNotSupported = @"For local element, ref is not supported. The referenced name is '{0}' in '{1}' namespace."; +public const string EnumEnumerationFacetsMustHaveValue = @"Schema enumeration facet must have values."; +public const string EnumListInAnonymousTypeNotSupported = @"Enum list in anonymous type is not supported."; +public const string EnumListMustContainAnonymousType = @"Enum list must contain an anonymous type."; +public const string EnumOnlyEnumerationFacetsSupported = @"For schema facets, only enumeration is supported."; +public const string EnumRestrictionInvalid = @"For simpleType restriction, only enum is supported and this type could not be convert to enum."; +public const string EnumTypeCannotBeImported = @"For '{0}' in '{1}' namespace, enum type cannot be imported: {2}"; +public const string EnumTypeNotSupportedByDataContractJsonSerializer = @"Enum type is not supported by DataContractJsonSerializer. The underlying type is '{0}'."; +public const string EnumUnionInAnonymousTypeNotSupported = @"Enum union in anonymous type is not supported."; +public const string ExtensionDataSetMustReturnVoid = @"For type '{0}' method '{1}', extension data set method must return void."; +public const string ExtensionDataSetParameterInvalid = @"For type '{0}' method '{1}', extension data set method has invalid type of parameter '{2}'."; +public const string FactoryObjectContainsSelfReference = @"Factory object contains a reference to self. Old object is '{0}', new object is '{1}'."; +public const string FactoryTypeNotISerializable = @"For data contract '{1}', factory type '{0}' is not ISerializable."; +public const string FixedOnElementNotSupported = @"On schema element '{0}', fixed value is not supported."; +public const string FlushBufferAlreadyInUse = @"Flush buffer is already in use."; +public const string FormMustBeQualified = @"On schema element '{0}', form must be qualified."; +public const string GenericAnnotationAttributeNotFound = @"On type '{0}' Generic annotation attribute '{1}' was not found."; +public const string GenericAnnotationForNestedLevelMustBeIncreasing = @"On type '{2}', generic annotation for nested level must be increasing. Argument element is '{0}' in '{1}' namespace."; +public const string GenericAnnotationHasInvalidAttributeValue = @"On type '{2}', generic annotation has invalid attribute value '{3}'. Argument element is '{0}' in '{1}' namespace. Nested level attribute attribute name is '{4}'. Type is '{5}'."; // dunno if this makes sense... +public const string GenericAnnotationHasInvalidElement = @"On type '{2}', generic annotation has invalid element. Argument element is '{0}' in '{1}' namespace."; +public const string GenericTypeNameMismatch = @"Generic type name mismatch. Expected '{0}' in '{1}' namespace, got '{2}' in '{3}' namespace instead."; +public const string GenericTypeNotExportable = @"Generic type '{0}' is not exportable."; +public const string GetOnlyCollectionMustHaveAddMethod = @"On type '{0}', get-only collection must have an Add method."; +public const string GetRealObjectReturnedNull = @"On the surrogate data contract for '{0}', GetRealObject method returned null."; +public const string InvalidAnnotationExpectingText = @"For annotation element '{0}' in namespace '{1}', expected text but got element '{2}' in '{3}' namespace."; +public const string InvalidAssemblyFormat = @"'{0}': invalid assembly format."; +public const string InvalidCharacterEncountered = @"Encountered an invalid character '{0}'."; +public const string InvalidClassDerivation = @"Invalid class derivation from '{0}' in '{1}' namespace."; +public const string InvalidClrNameGeneratedForISerializable = @"Invalid CLR name '{2}' is generated for ISerializable type '{0}' in '{1}' namespace."; +public const string InvalidClrNamespaceGeneratedForISerializable = @"Invalid CLR namespace '{3}' is generated for ISerializable type '{0}' in '{1}' namespace. Data contract namespace from the URI would be generated as '{2}'."; +public const string InvalidDataNode = @"Invalid data node for '{0}' type."; +public const string InvalidEmitDefaultAnnotation = @"Invalid EmilDefault annotation for '{0}' in type '{1}' in '{2}' namespace."; +public const string InvalidEnumBaseType = @"Invalid enum base type is specified for type '{0}' in '{1}' namespace, element name is '{2}' in '{3}' namespace."; +public const string InvalidISerializableDerivation = @"Invalid ISerializable derivation from '{0}' in '{1}' namespace."; +public const string InvalidKeyValueType = @"'{0}' is an invalid key value type."; +public const string InvalidKeyValueTypeNamespace = @"'{0}' in '{1}' namespace is an invalid key value type."; +public const string InvalidReturnSchemaOnGetSchemaMethod = @"On type '{0}', the return value from GetSchema method was invalid."; +public const string InvalidStateInExtensionDataReader = @"Invalid state in extension data reader."; +public const string InvalidXmlDeserializingExtensionData = @"Invalid XML while deserializing extension data."; +public const string IsAnyNotSupportedByNetDataContractSerializer = @"For type '{0}', IsAny is not supported by NetDataContractSerializer."; +public const string IsDictionaryFormattedIncorrectly = @"IsDictionary formatted value '{0}' is incorrect: {1}"; +public const string ISerializableAssemblyNameSetToZero = @"ISerializable AssemblyName is set to ""0"" for type '{0}'."; +public const string ISerializableCannotHaveDataContract = @"ISerializable type '{0}' cannot have DataContract."; +public const string ISerializableContainsMoreThanOneItems = @"ISerializable cannot contain more than one item."; +public const string ISerializableDerivedContainsOneOrMoreItems = @"Type derived from ISerializable cannot contain more than one item."; +public const string ISerializableDoesNotContainAny = @"ISerializable does not contain any element."; +public const string ISerializableMustRefFactoryTypeAttribute = @"ISerializable must have ref attribute that points to its factory type."; +public const string ISerializableTypeCannotBeImported = @"ISerializable type '{0}' in '{1}' namespace cannot be imported: {2}"; +public const string ISerializableWildcardMaxOccursMustBe = @"ISerializable wildcard maxOccurs must be '{0}'."; +public const string ISerializableWildcardMinOccursMustBe = @"ISerializable wildcard maxOccurs must be '{0}'."; +public const string ISerializableWildcardNamespaceInvalid = @"ISerializable wildcard namespace is invalid: '{0}'."; +public const string ISerializableWildcardProcessContentsInvalid = @"ISerializable wildcard processContents is invalid: '{0}'."; +public const string IsReferenceGetOnlyCollectionsNotSupported = @"On type '{1}', attribute '{0}' points to get-only collection, which is not supported."; +public const string IsValueTypeFormattedIncorrectly = @"IsValueType is formatted incorrectly as '{0}': {1}"; +public const string JsonAttributeAlreadyWritten = @"JSON attribute '{0}' is already written."; +public const string JsonAttributeMustHaveElement = @"JSON attribute must have an owner element."; +public const string JsonCannotWriteStandaloneTextAfterQuotedText = @"JSON writer cannot write standalone text after quoted text."; +public const string JsonCannotWriteTextAfterNonTextAttribute = @"JSON writer cannot write text after non-text attribute. Data type is '{0}'."; +public const string JsonDateTimeOutOfRange = @"JSON DateTime is out of range."; +public const string JsonDuplicateMemberInInput = @"Duplicate member '{0}' is found in JSON input."; +public const string JsonDuplicateMemberNames = @"Duplicate member, including '{1}', is found in JSON input, in type '{0}'."; +public const string JsonEncodingNotSupported = @"JSON Encoding is not supported."; +public const string JsonEncounteredUnexpectedCharacter = @"Encountered an unexpected character '{0}' in JSON."; +public const string JsonEndElementNoOpenNodes = @"Encountered an end element while there was no open element in JSON writer."; +public const string JsonExpectedEncoding = @"Expected encoding '{0}', got '{1}' instead."; +public const string JsonInvalidBytes = @"Invalid bytes in JSON."; +public const string JsonInvalidDataTypeSpecifiedForServerType = @"The specified data type is invalid for server type. Type: '{0}', specified data type: '{1}', server type: '{2}', object '{3}'."; // I wonder if this makes sense... +public const string JsonInvalidDateTimeString = @"Invalid JSON dateTime string is specified: original value '{0}', start guide writer: {1}, end guard writer: {2}."; +public const string JsonInvalidFFFE = @"FFFE in JSON is invalid."; +public const string JsonInvalidItemNameForArrayElement = @"Invalid JSON item name '{0}' for array element (item element is '{1}' in JSON)."; +public const string JsonInvalidLocalNameEmpty = @"Empty string is invalid as a local name."; +public const string JsonInvalidMethodBetweenStartEndAttribute = @"Invalid method call state between start and end attribute."; +public const string JsonInvalidRootElementName = @"Invalid root element name '{0}' (root element is '{1}' in JSON)."; +public const string JsonInvalidStartElementCall = @"Invalid call to JSON WriteStartElement method."; +public const string JsonInvalidWriteState = @"Invalid write state {1} for '{0}' method."; +public const string JsonMethodNotSupported = @"Method {0} is not supported in JSON."; +public const string JsonMultipleRootElementsNotAllowedOnWriter = @"Multiple root element is not allowed on JSON writer."; +public const string JsonMustSpecifyDataType = @"On JSON writer data type '{0}' must be specified. Object string is '{1}', server type string is '{2}'."; +public const string JsonMustUseWriteStringForWritingAttributeValues = @"On JSON writer WriteString must be used for writing attribute values."; +public const string JsonNamespaceMustBeEmpty = @"JSON namespace is specified as '{0}' but it must be empty."; +public const string JsonNestedArraysNotSupported = @"Nested array is not supported in JSON: '{0}'"; +public const string JsonNodeTypeArrayOrObjectNotSpecified = @"Either Object or Array of JSON node type must be specified."; +public const string JsonNoMatchingStartAttribute = @"WriteEndAttribute was called while there is no open attribute."; +public const string JsonOffsetExceedsBufferSize = @"On JSON writer, offset exceeded buffer size {0}."; +public const string JsonOneRequiredMemberNotFound = @"Required member {1} in type '{0}' is not found."; +public const string JsonOnlyWhitespace = @"Only whitespace characters are allowed for {1} method. The specified value is '{0}'"; +public const string JsonOpenAttributeMustBeClosedFirst = @"JSON attribute must be closed first before calling {0} method."; +public const string JsonPrefixMustBeNullOrEmpty = @"JSON prefix must be null or empty. '{0}' is specified instead."; +public const string JsonRequiredMembersNotFound = @"Required members {0} in type '{1}' are not found."; +public const string JsonServerTypeSpecifiedForInvalidDataType = @"Server type is specified for invalid data type in JSON. Server type: '{0}', type: '{1}', dataType: '{2}', object: '{3}'."; +public const string JsonSizeExceedsRemainingBufferSpace = @"JSON size exceeded remaining buffer space, by {0} byte(s)."; +public const string JsonTypeNotSupportedByDataContractJsonSerializer = @"Type '{0}' is not suppotred by DataContractJsonSerializer."; +public const string JsonUnexpectedAttributeLocalName = @"Unexpected attribute local name '{0}'."; +public const string JsonUnexpectedAttributeValue = @"Unexpected attribute value '{0}'."; +public const string JsonUnexpectedEndOfFile = @"Unexpected end of file in JSON."; +public const string JsonUnsupportedForIsReference = @"Unsupported value for IsReference for type '{0}', IsReference value is {1}."; +public const string JsonWriteArrayNotSupported = @"JSON WriteArray is not supported."; +public const string JsonWriterClosed = @"JSON writer is already closed."; +public const string JsonXmlInvalidDeclaration = @"Attempt to write invalid XML declration."; +public const string JsonXmlProcessingInstructionNotSupported = @"processing instruction is not supported in JSON writer."; +public const string KeyTypeCannotBeParsedInSimpleDictionary = @"Key type '{1}' for collection type '{0}' cannot be parsed in simple dictionary."; +public const string KnownTypeConfigGenericParamMismatch = @"Generic parameter count do not match between known type and configuration. Type is '{0}', known type has {1} parameters, configuration has {2} parameters."; +public const string KnownTypeConfigIndexOutOfBounds = @"For known type configuration, index is out of bound. Root type: '{0}' has {1} type arguments, and index was {2}."; +public const string KnownTypeConfigIndexOutOfBoundsZero = @"For known type configuration, index is out of bound. Root type: '{0}' has {1} type arguments, and index was {2}."; +public const string KnownTypeConfigObject = @"Known type configuration specifies System.Object."; +public const string MaxMimePartsExceeded = @"MIME parts number exceeded the maximum settings. Must be less than {0}. Specified as '{1}'."; +public const string MimeContentTypeHeaderInvalid = @"MIME content type header is invalid."; +public const string MimeHeaderInvalidCharacter = @"MIME header has an invalid character ('{0}', {1} in hexadecimal value)."; +public const string MimeMessageGetContentStreamCalledAlready = @"On MimeMessage, GetContentStream method is already called."; +public const string MimeReaderHeaderAlreadyExists = @"MIME header '{0}' already exists."; +public const string MimeReaderMalformedHeader = @"Malformed MIME header."; +public const string MimeReaderResetCalledBeforeEOF = @"On MimeReader, Reset method is called before EOF."; +public const string MimeReaderTruncated = @"MIME parts are truncated."; +public const string MimeVersionHeaderInvalid = @"MIME version header is invalid."; +public const string MimeWriterInvalidStateForClose = @"MIME writer is at invalid state for closing."; +public const string MimeWriterInvalidStateForContent = @"MIME writer is at invalid state for content."; +public const string MimeWriterInvalidStateForHeader = @"MIME writer is at invalid state for header."; +public const string MimeWriterInvalidStateForStartPart = @"MIME writer is at invalid state for starting a part."; +public const string MimeWriterInvalidStateForStartPreface = @"MIME writer is at invalid state for starting preface."; +public const string MissingSchemaType = @"Schema type '{0}' is missing and required for '{1}' type."; +public const string MixedContentNotSupported = @"Mixed content is not supported."; +public const string MtomBoundaryInvalid = @"MIME boundary is invalid: '{0}'."; +public const string MtomBufferQuotaExceeded = @"MTOM buffer quota exceeded. The maximum size is {0}."; +public const string MtomContentTransferEncodingNotPresent = @"MTOM content transfer encoding is not present. ContentTransferEncoding header is '{0}'."; +public const string MtomContentTransferEncodingNotSupported = @"MTOM content transfer encoding value is not supported. Raw value is '{0}', '{1}' in 7bit encoding, '{2}' in 8bit encoding, and '{3}' in binary."; +public const string MtomContentTypeInvalid = @"MTOM content type is invalid."; +public const string MtomDataMustNotContainXopInclude = @"MTOM data must not contain xop:Include element. '{0}' element in '{1}' namespace."; +public const string MtomExceededMaxSizeInBytes = @"MTOM exceeded max size in bytes. The maximum size is {0}."; +public const string MtomInvalidCIDUri = @"Invalid MTOM CID URI: '{0}'."; +public const string MtomInvalidEmptyURI = @"empty URI is invalid for MTOM MIME part."; +public const string MtomInvalidStartUri = @"Invalid MTOM start URI: '{0}'."; +public const string MtomInvalidTransferEncodingForMimePart = @"Invalid transfer encoding for MIME part: '{0}', in binary: '{1}'."; +public const string MtomMessageContentTypeNotFound = @"MTOM message content type was not found."; +public const string MtomMessageInvalidContent = @"MTOM message content is invalid."; +public const string MtomMessageInvalidContentInMimePart = @"MTOM message content in MIME part is invalid."; +public const string MtomMessageInvalidMimeVersion = @"MTOM message has invalid MIME version. Expected '{1}', got '{0}' instead."; +public const string MtomMessageNotApplicationXopXml = @"MTOM msssage type is not '{0}'."; +public const string MtomMessageNotMultipart = @"MTOM message is not multipart: media type should be '{0}', media subtype should be '{1}'."; +public const string MtomMessageRequiredParamNotSpecified = @"Required MTOM parameter '{0}' is not specified."; +public const string MtomMimePartReferencedMoreThanOnce = @"Specified MIME part '{0}' is referenced more than once."; +public const string MtomPartNotFound = @"MTOM part with URI '{0}' is not found."; +public const string MtomRootContentTypeNotFound = @"MTOM root content type is not found."; +public const string MtomRootNotApplicationXopXml = @"MTOM root should have media type '{0}' and subtype '{1}'."; +public const string MtomRootPartNotFound = @"MTOM root part is not found."; +public const string MtomRootRequiredParamNotSpecified = @"Required MTOM root parameter '{0}' is not specified."; +public const string MtomRootUnexpectedCharset = @"Unexpected charset on MTOM root. Expected '{1}', got '{0}' instead."; +public const string MtomRootUnexpectedType = @"Unexpected type on MTOM root. Expected '{1}', got '{0}' instead."; +public const string MtomXopIncludeHrefNotSpecified = @"xop Include element did not specify '{0}' attribute."; +public const string MtomXopIncludeInvalidXopAttributes = @"xop Include element has invalid attribute: '{0}' in '{1}' namespace."; +public const string MtomXopIncludeInvalidXopElement = @"xop Include element has invalid element: '{0}' in '{1}' namespace."; +public const string MustContainOnlyLocalElements = @"Only local elements can be imported."; +public const string NoAsyncWritePending = @"No async write operation is pending."; +public const string NonOptionalFieldMemberOnIsReferenceSerializableType = @"For type '{0}', non-optional field member '{1}' is on the Serializable type that has IsReference as {2}."; +public const string OnlyDataContractTypesCanHaveExtensionData = @"On '{0}' type, only DataContract types can have extension data."; +public const string PartialTrustISerializableNoPublicConstructor = @"Partial trust access required for the constructor on the ISerializable type '{0}'"; +public const string QueryGeneratorPathToMemberNotFound = @"The path to member was not found for XPath query generator."; +public const string ReadNotSupportedOnStream = @"Read operation is not supported on the Stream."; +public const string ReadOnlyClassDeserialization = @"Error on deserializing read-only members in the class: {0}"; +public const string ReadOnlyCollectionDeserialization = @"Error on deserializing read-only collection: {0}"; +public const string RecursiveCollectionType = @"Type '{0}' involves recursive collection."; +public const string RedefineNotSupported = @"XML Schema 'redefine' is not supported."; +public const string ReferencedBaseTypeDoesNotExist = @"Referenced base type does not exist. Data contract name: '{0}' in '{1}' namespace, expected type: '{2}' in '{3}' namespace. Collection can be '{4}' or '{5}'."; // is it the expected message? I'm quite unsure. +public const string ReferencedCollectionTypesCannotContainNull = @"Referenced collection types cannot contain null."; +public const string ReferencedTypeDoesNotMatch = @"Referenced type '{0}' does not match the expected type '{1}' in '{2}' namespace."; +public const string ReferencedTypeMatchingMessage = @"Reference type matches."; +public const string ReferencedTypeNotMatchingMessage = @"Reference type does not match."; +public const string ReferencedTypesCannotContainNull = @"Referenced types cannot contain null."; +public const string RequiresClassDataContractToSetIsISerializable = @"To set IsISerializable, class data cotnract is required."; +public const string RootParticleMustBeSequence = @"Root particle must be sequence to be imported."; +public const string RootSequenceMaxOccursMustBe = @"On root sequence, maxOccurs must be 1."; +public const string RootSequenceMustBeRequired = @"Root sequence must have an item and minOccurs must be 1."; +public const string SeekNotSupportedOnStream = @"Seek operation is not supported on this Stream."; +public const string SerializationInfo_ConstructorNotFound = @"Constructor that takes SerializationInfo and StreamingContext is not found for '{0}'."; +public const string SimpleContentNotSupported = @"Simple content is not supported."; +public const string SimpleTypeRestrictionDoesNotSpecifyBase = @"This simpleType restriction does not specify the base type."; +public const string SimpleTypeUnionNotSupported = @"simpleType union is not supported."; +public const string SpecifiedTypeNotFoundInSchema = @"Specified type '{0}' in '{1}' namespace is not found in the schemas."; +public const string SubstitutionGroupOnElementNotSupported = @"substitutionGroups on elements are not supported."; +public const string SurrogatesWithGetOnlyCollectionsNotSupported = @"Surrogates with get-only collections are not supported. Type '{1}' contains '{2}' which is of '{0}' type."; +public const string SurrogatesWithGetOnlyCollectionsNotSupportedSerDeser = @"Surrogates with get-only collections are not supported. Found on type '{0}'."; +public const string TopLevelElementRepresentsDifferentType = @"Top-level element represents a different type. Expected '{0}' type in '{1}' namespace."; +public const string TraceCodeElementIgnored = @"Element ignored"; +public const string TraceCodeFactoryTypeNotFound = @"Factory type not found"; +public const string TraceCodeObjectWithLargeDepth = @"Object with large depth"; +public const string TraceCodeReadObjectBegin = @"ReadObject begins"; +public const string TraceCodeReadObjectEnd = @"ReadObject ends"; +public const string TraceCodeWriteObjectBegin = @"WriteObject begins"; +public const string TraceCodeWriteObjectContentBegin = @"WriteObjectContent begins"; +public const string TraceCodeWriteObjectContentEnd = @"WriteObjectContent ends"; +public const string TraceCodeWriteObjectEnd = @"WriteObject ends"; +public const string TraceCodeXsdExportAnnotationFailed = @"XSD export annotation failed"; +public const string TraceCodeXsdExportBegin = @"XSD export begins"; +public const string TraceCodeXsdExportDupItems = @"XSD export duplicate items"; +public const string TraceCodeXsdExportEnd = @"XSD export ends"; +public const string TraceCodeXsdExportError = @"XSD export error"; +public const string TraceCodeXsdImportAnnotationFailed = @"XSD import annotation failed"; +public const string TraceCodeXsdImportBegin = @"XSD import begins"; +public const string TraceCodeXsdImportEnd = @"XSD import ends"; +public const string TraceCodeXsdImportError = @"XSD import error"; +public const string TypeCannotBeForwardedFrom = @"Type '{0}' in assembly '{1}' cannot be forwarded from assembly '{2}'."; +public const string TypeCannotBeImported = @"Type '{0}' in '{1}' namespace cannot be imported: {2}"; +public const string TypeCannotBeImportedHowToFix = @"Type cannot be imported: {0}"; // I cannot see where HowToFix is given from... +public const string TypeHasNotBeenImported = @"Type '{0}' in '{1}' namespace has not been imported."; +public const string TypeMustBeIXmlSerializable = @"Type '{0}' must be IXmlSerializable. Contract type: '{1}', contract name: '{2}' in '{3}' namespace."; +public const string TypeShouldNotContainAttributes = @"Type should not contain attributes. Serialization namespace: '{0}'."; +public const string UnknownXmlType = @"Unknown XML type: '{0}'."; +public const string WriteBufferOverflow = @"Write buffer overflow."; +public const string WriteNotSupportedOnStream = @"Write operation is not supported on this '{0}' Stream."; +public const string XmlCanonicalizationNotStarted = @"XML canonicalization was not started."; +public const string XmlCanonicalizationStarted = @"XML canonicalization started"; +public const string XmlMaxArrayLengthOrMaxItemsQuotaExceeded = @"XML max array length or max items quota exceeded. It must be less than {0}."; +public const string XmlMaxBytesPerReadExceeded = @"XML max bytes per read exceeded. It must be less than {0}."; +public const string XmlMaxDepthExceeded = @"XML max depth exceeded. It must be less than {0}."; +public const string XmlMaxStringContentLengthExceeded = @"XML max string content length exceeded. It must be less than {0}."; +public const string XmlObjectAssignedToIncompatibleInterface = @"Object of type '{0}' is assigned to an incompatible interface '{1}'."; + +#endregion + } +} diff --git a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR_missing.cs b/mcs/class/System.Runtime.Serialization/ReferenceSources/SR_missing.cs deleted file mode 100644 index 972c50a33ab..00000000000 --- a/mcs/class/System.Runtime.Serialization/ReferenceSources/SR_missing.cs +++ /dev/null @@ -1,291 +0,0 @@ -namespace System.Runtime.Serialization -{ - static partial class SR - { - -#region MissingInStrings.txt - -// -// This was retrieved as follows: -// -// 1. mcs ReferenceSources/SR.cs -t:library -out:existing.dll -// 2. mcs {https://raw.githubusercontent.com/mono/mono/wip-serialization-halfway/mcs/class/System.Runtime.Serialization/ReferenceSource/SR.cs} -t:library -out:full.dll -// 3. csharp -e "System.IO.File.WriteAllLines ("existing.txt", System.Reflection.Assembly.ReflectionOnlyLoadFrom ("existing.dll").GetTypes ().SelectMany (t => t.GetFields ()).Select (f => f.Name).ToArray ())" -// 4. csharp -e "System.IO.File.WriteAllLines ("full.txt", System.Reflection.Assembly.ReflectionOnlyLoadFrom ("full.dll").GetTypes ().SelectMany (t => t.GetFields ()).Select (f => f.Name).ToArray ())" -// 5. csharp -// var existing = System.IO.File.ReadAllLines ("existing.txt"); -// var full = System.IO.File.ReadAllLines ("full.txt"); -// var missing = full.Where (f => !existing.Contains (f)); -// System.IO.File.WriteAllLines ("missing.cs", missing.Select (m => "public const string " + m + " = @\"" + m + "\";").ToArray ()) -// 6. copy missing.cs contents here. -// - -public const string AbstractElementNotSupported = @"Abstract element '{0}' is not supported."; -public const string AbstractTypeNotSupported = @"Abstract type is not supported"; -public const string AmbiguousReferencedCollectionTypes1 = @"Ambiguous collection types were referenced: {0}"; -public const string AmbiguousReferencedCollectionTypes3 = @"In '{0}' element in '{1}' namespace, ambiguous collection types were referenced: {2}"; -public const string AmbiguousReferencedTypes1 = @"Ambiguous types were referenced: {0}"; -public const string AmbiguousReferencedTypes3 = @"In '{0}' element in '{1}' namespace, ambiguous types were referenced: {2}"; -public const string AnnotationAttributeNotFound = @"Annotation attribute was not found: default value annotation is '{0}', type is '{1}' in '{2}' namespace, emit default value is {3}."; -public const string AnonymousTypeNotSupported = @"Anonymous type is not supported. Type is '{0}' in '{1}' namespace."; -public const string AnyAttributeNotSupported = @"XML Schema 'any' attribute is not supported"; -public const string ArrayItemFormMustBe = @"For array item, element 'form' must be {0}."; -public const string ArraySizeAttributeIncorrect = @"Array size attribute is incorrect; must be between {0} and {1}."; - -public const string ArrayTypeCannotBeImported = @"Array type cannot be imported for '{0}' in '{1}' namespace: {2}."; -public const string AssemblyNotFound = @"Assembly '{0}' was not found."; -public const string AttributeNotFound = @"Attribute was not found for CLR type '{1}' in namespace '{0}'. XML reader node is on {2}, '{4}' node in '{3}' namespace."; -public const string BaseTypeNotISerializable = @"Base type '{0}' in '{1}' namespace is not ISerializable."; -public const string CannotComputeUniqueName = @"Cannot compute unique name for '{0}'."; -public const string CannotDeriveFromSealedReferenceType = @"Cannod drive from sealed reference type '{2}', for '{0}' element in '{1}' namespace."; -public const string CannotDeserializeForwardedType = @"Cannot deserialize forwarded type '{0}'."; -public const string CannotExportNullAssembly = @"Cannot export null assembly."; -public const string CannotExportNullKnownType = @"Cannot export null known type."; -public const string CannotExportNullType = @"Cannot export null type."; -public const string CannotHaveDuplicateAttributeNames = @"Cannot have duplicate attribute names '{0}'."; -public const string CannotHaveDuplicateElementNames = @"Cannot have duplicate element names '{0}'."; -public const string CannotImportInvalidSchemas = @"Cannot import invalid schemas."; -public const string CannotImportNullDataContractName = @"Cannot import data contract with null name."; -public const string CannotImportNullSchema = @"Cannot import from schema list that contains null."; -public const string CannotSetMembersForReferencedType = @"Cannot set members for already referenced type. Base type is '{0}'."; -public const string CannotSetNamespaceForReferencedType = @"Cannot set namespace for already referenced type. Base type is '{0}'."; -public const string CannotUseGenericTypeAsBase = @"For '{0}' in '{1}' namespace, generic type cannot be referenced as the base type."; -public const string ChangingFullTypeNameNotSupported = @"Changing full type name is not supported. Serialization type name: '{0}', data contract type name: '{1}'."; -public const string CircularTypeReference = @"Circular type reference was found for '{0}' in '{1}' namespace."; -public const string ClassDataContractReturnedForGetOnlyCollection = @"For '{0}' type, class data contract was returned for get-only collection."; -public const string CLRNamespaceMappedMultipleTimes = @"CLR namespace is mapped multiple times. Current data contract namespace is '{0}', found '{1}' for CLR namespace '{2}'."; -public const string ClrTypeNotFound = @"CLR type '{1}' in assembly '{0}' is not found."; -public const string CollectionAssignedToIncompatibleInterface = @"Collection of type '{0}' is assigned to an incompatible interface '{1}'"; -public const string ComplexTypeRestrictionNotSupported = @"XML schema complexType restriction is not supported."; -public const string ConfigDataContractSerializerSectionLoadError = @"Failed to load configuration section for dataContractSerializer."; -public const string ConfigIndexOutOfRange = @"For type '{0}', configuration index is out of range."; -public const string ConfigMustOnlyAddParamsWithType = @"Configuration parameter element must only add params with type."; // huh? the code doesn't make a lot of sense to me... -public const string ConfigMustOnlySetTypeOrIndex = @"Configuration parameter element can set only one of either type or index."; -public const string ConfigMustSetTypeOrIndex = @"Configuration parameter element must set either type or index."; -public const string CouldNotReadSerializationSchema = @"Could not read serialization schema for '{0}' namespace."; -public const string DefaultOnElementNotSupported = @"On element '{0}', default value is not supported."; -public const string DerivedTypeNotISerializable = @"On type '{0}' in '{1}' namespace, derived type is not ISerializable."; -public const string DupContractInDataContractSet = @"Duplicate contract in data contract set was found, for '{0}' in '{1}' namespace."; -public const string DuplicateExtensionDataSetMethod = @"Duplicate extension data set method was found, for method '{0}', existing method is '{1}', on data contract type '{2}'."; -public const string DupTypeContractInDataContractSet = @"Duplicate type contract in data contract set. Type name '{0}', for data contract '{1}' in '{2}' namespace."; -public const string ElementMaxOccursMustBe = @"On element '{0}', schema element maxOccurs must be 1."; -public const string ElementMinOccursMustBe = @"On element '{0}', schema element minOccurs must be less or equal to 1."; -public const string ElementRefOnLocalElementNotSupported = @"For local element, ref is not supported. The referenced name is '{0}' in '{1}' namespace."; -public const string EnumEnumerationFacetsMustHaveValue = @"Schema enumeration facet must have values."; -public const string EnumListInAnonymousTypeNotSupported = @"Enum list in anonymous type is not supported."; -public const string EnumListMustContainAnonymousType = @"Enum list must contain an anonymous type."; -public const string EnumOnlyEnumerationFacetsSupported = @"For schema facets, only enumeration is supported."; -public const string EnumRestrictionInvalid = @"For simpleType restriction, only enum is supported and this type could not be convert to enum."; -public const string EnumTypeCannotBeImported = @"For '{0}' in '{1}' namespace, enum type cannot be imported: {2}"; -public const string EnumTypeNotSupportedByDataContractJsonSerializer = @"Enum type is not supported by DataContractJsonSerializer. The underlying type is '{0}'."; -public const string EnumUnionInAnonymousTypeNotSupported = @"Enum union in anonymous type is not supported."; -public const string ExtensionDataSetMustReturnVoid = @"For type '{0}' method '{1}', extension data set method must return void."; -public const string ExtensionDataSetParameterInvalid = @"For type '{0}' method '{1}', extension data set method has invalid type of parameter '{2}'."; -public const string FactoryObjectContainsSelfReference = @"Factory object contains a reference to self. Old object is '{0}', new object is '{1}'."; -public const string FactoryTypeNotISerializable = @"For data contract '{1}', factory type '{0}' is not ISerializable."; -public const string FixedOnElementNotSupported = @"On schema element '{0}', fixed value is not supported."; -public const string FlushBufferAlreadyInUse = @"Flush buffer is already in use."; -public const string FormMustBeQualified = @"On schema element '{0}', form must be qualified."; -public const string GenericAnnotationAttributeNotFound = @"On type '{0}' Generic annotation attribute '{1}' was not found."; -public const string GenericAnnotationForNestedLevelMustBeIncreasing = @"On type '{2}', generic annotation for nested level must be increasing. Argument element is '{0}' in '{1}' namespace."; -public const string GenericAnnotationHasInvalidAttributeValue = @"On type '{2}', generic annotation has invalid attribute value '{3}'. Argument element is '{0}' in '{1}' namespace. Nested level attribute attribute name is '{4}'. Type is '{5}'."; // dunno if this makes sense... -public const string GenericAnnotationHasInvalidElement = @"On type '{2}', generic annotation has invalid element. Argument element is '{0}' in '{1}' namespace."; -public const string GenericTypeNameMismatch = @"Generic type name mismatch. Expected '{0}' in '{1}' namespace, got '{2}' in '{3}' namespace instead."; -public const string GenericTypeNotExportable = @"Generic type '{0}' is not exportable."; -public const string GetOnlyCollectionMustHaveAddMethod = @"On type '{0}', get-only collection must have an Add method."; -public const string GetRealObjectReturnedNull = @"On the surrogate data contract for '{0}', GetRealObject method returned null."; -public const string InvalidAnnotationExpectingText = @"For annotation element '{0}' in namespace '{1}', expected text but got element '{2}' in '{3}' namespace."; -public const string InvalidAssemblyFormat = @"'{0}': invalid assembly format."; -public const string InvalidCharacterEncountered = @"Encountered an invalid character '{0}'."; -public const string InvalidClassDerivation = @"Invalid class derivation from '{0}' in '{1}' namespace."; -public const string InvalidClrNameGeneratedForISerializable = @"Invalid CLR name '{2}' is generated for ISerializable type '{0}' in '{1}' namespace."; -public const string InvalidClrNamespaceGeneratedForISerializable = @"Invalid CLR namespace '{3}' is generated for ISerializable type '{0}' in '{1}' namespace. Data contract namespace from the URI would be generated as '{2}'."; -public const string InvalidDataNode = @"Invalid data node for '{0}' type."; -public const string InvalidEmitDefaultAnnotation = @"Invalid EmilDefault annotation for '{0}' in type '{1}' in '{2}' namespace."; -public const string InvalidEnumBaseType = @"Invalid enum base type is specified for type '{0}' in '{1}' namespace, element name is '{2}' in '{3}' namespace."; -public const string InvalidISerializableDerivation = @"Invalid ISerializable derivation from '{0}' in '{1}' namespace."; -public const string InvalidKeyValueType = @"'{0}' is an invalid key value type."; -public const string InvalidKeyValueTypeNamespace = @"'{0}' in '{1}' namespace is an invalid key value type."; -public const string InvalidReturnSchemaOnGetSchemaMethod = @"On type '{0}', the return value from GetSchema method was invalid."; -public const string InvalidStateInExtensionDataReader = @"Invalid state in extension data reader."; -public const string InvalidXmlDeserializingExtensionData = @"Invalid XML while deserializing extension data."; -public const string IsAnyNotSupportedByNetDataContractSerializer = @"For type '{0}', IsAny is not supported by NetDataContractSerializer."; -public const string IsDictionaryFormattedIncorrectly = @"IsDictionary formatted value '{0}' is incorrect: {1}"; -public const string ISerializableAssemblyNameSetToZero = @"ISerializable AssemblyName is set to ""0"" for type '{0}'."; -public const string ISerializableCannotHaveDataContract = @"ISerializable type '{0}' cannot have DataContract."; -public const string ISerializableContainsMoreThanOneItems = @"ISerializable cannot contain more than one item."; -public const string ISerializableDerivedContainsOneOrMoreItems = @"Type derived from ISerializable cannot contain more than one item."; -public const string ISerializableDoesNotContainAny = @"ISerializable does not contain any element."; -public const string ISerializableMustRefFactoryTypeAttribute = @"ISerializable must have ref attribute that points to its factory type."; -public const string ISerializableTypeCannotBeImported = @"ISerializable type '{0}' in '{1}' namespace cannot be imported: {2}"; -public const string ISerializableWildcardMaxOccursMustBe = @"ISerializable wildcard maxOccurs must be '{0}'."; -public const string ISerializableWildcardMinOccursMustBe = @"ISerializable wildcard maxOccurs must be '{0}'."; -public const string ISerializableWildcardNamespaceInvalid = @"ISerializable wildcard namespace is invalid: '{0}'."; -public const string ISerializableWildcardProcessContentsInvalid = @"ISerializable wildcard processContents is invalid: '{0}'."; -public const string IsReferenceGetOnlyCollectionsNotSupported = @"On type '{1}', attribute '{0}' points to get-only collection, which is not supported."; -public const string IsValueTypeFormattedIncorrectly = @"IsValueType is formatted incorrectly as '{0}': {1}"; -public const string JsonAttributeAlreadyWritten = @"JSON attribute '{0}' is already written."; -public const string JsonAttributeMustHaveElement = @"JSON attribute must have an owner element."; -public const string JsonCannotWriteStandaloneTextAfterQuotedText = @"JSON writer cannot write standalone text after quoted text."; -public const string JsonCannotWriteTextAfterNonTextAttribute = @"JSON writer cannot write text after non-text attribute. Data type is '{0}'."; -public const string JsonDateTimeOutOfRange = @"JSON DateTime is out of range."; -public const string JsonDuplicateMemberInInput = @"Duplicate member '{0}' is found in JSON input."; -public const string JsonDuplicateMemberNames = @"Duplicate member, including '{1}', is found in JSON input, in type '{0}'."; -public const string JsonEncodingNotSupported = @"JSON Encoding is not supported."; -public const string JsonEncounteredUnexpectedCharacter = @"Encountered an unexpected character '{0}' in JSON."; -public const string JsonEndElementNoOpenNodes = @"Encountered an end element while there was no open element in JSON writer."; -public const string JsonExpectedEncoding = @"Expected encoding '{0}', got '{1}' instead."; -public const string JsonInvalidBytes = @"Invalid bytes in JSON."; -public const string JsonInvalidDataTypeSpecifiedForServerType = @"The specified data type is invalid for server type. Type: '{0}', specified data type: '{1}', server type: '{2}', object '{3}'."; // I wonder if this makes sense... -public const string JsonInvalidDateTimeString = @"Invalid JSON dateTime string is specified: original value '{0}', start guide writer: {1}, end guard writer: {2}."; -public const string JsonInvalidFFFE = @"FFFE in JSON is invalid."; -public const string JsonInvalidItemNameForArrayElement = @"Invalid JSON item name '{0}' for array element (item element is '{1}' in JSON)."; -public const string JsonInvalidLocalNameEmpty = @"Empty string is invalid as a local name."; -public const string JsonInvalidMethodBetweenStartEndAttribute = @"Invalid method call state between start and end attribute."; -public const string JsonInvalidRootElementName = @"Invalid root element name '{0}' (root element is '{1}' in JSON)."; -public const string JsonInvalidStartElementCall = @"Invalid call to JSON WriteStartElement method."; -public const string JsonInvalidWriteState = @"Invalid write state {1} for '{0}' method."; -public const string JsonMethodNotSupported = @"Method {0} is not supported in JSON."; -public const string JsonMultipleRootElementsNotAllowedOnWriter = @"Multiple root element is not allowed on JSON writer."; -public const string JsonMustSpecifyDataType = @"On JSON writer data type '{0}' must be specified. Object string is '{1}', server type string is '{2}'."; -public const string JsonMustUseWriteStringForWritingAttributeValues = @"On JSON writer WriteString must be used for writing attribute values."; -public const string JsonNamespaceMustBeEmpty = @"JSON namespace is specified as '{0}' but it must be empty."; -public const string JsonNestedArraysNotSupported = @"Nested array is not supported in JSON: '{0}'"; -public const string JsonNodeTypeArrayOrObjectNotSpecified = @"Either Object or Array of JSON node type must be specified."; -public const string JsonNoMatchingStartAttribute = @"WriteEndAttribute was called while there is no open attribute."; -public const string JsonOffsetExceedsBufferSize = @"On JSON writer, offset exceeded buffer size {0}."; -public const string JsonOneRequiredMemberNotFound = @"Required member {1} in type '{0}' is not found."; -public const string JsonOnlyWhitespace = @"Only whitespace characters are allowed for {1} method. The specified value is '{0}'"; -public const string JsonOpenAttributeMustBeClosedFirst = @"JSON attribute must be closed first before calling {0} method."; -public const string JsonPrefixMustBeNullOrEmpty = @"JSON prefix must be null or empty. '{0}' is specified instead."; -public const string JsonRequiredMembersNotFound = @"Required members {0} in type '{1}' are not found."; -public const string JsonServerTypeSpecifiedForInvalidDataType = @"Server type is specified for invalid data type in JSON. Server type: '{0}', type: '{1}', dataType: '{2}', object: '{3}'."; -public const string JsonSizeExceedsRemainingBufferSpace = @"JSON size exceeded remaining buffer space, by {0} byte(s)."; -public const string JsonTypeNotSupportedByDataContractJsonSerializer = @"Type '{0}' is not suppotred by DataContractJsonSerializer."; -public const string JsonUnexpectedAttributeLocalName = @"Unexpected attribute local name '{0}'."; -public const string JsonUnexpectedAttributeValue = @"Unexpected attribute value '{0}'."; -public const string JsonUnexpectedEndOfFile = @"Unexpected end of file in JSON."; -public const string JsonUnsupportedForIsReference = @"Unsupported value for IsReference for type '{0}', IsReference value is {1}."; -public const string JsonWriteArrayNotSupported = @"JSON WriteArray is not supported."; -public const string JsonWriterClosed = @"JSON writer is already closed."; -public const string JsonXmlInvalidDeclaration = @"Attempt to write invalid XML declration."; -public const string JsonXmlProcessingInstructionNotSupported = @"processing instruction is not supported in JSON writer."; -public const string KeyTypeCannotBeParsedInSimpleDictionary = @"Key type '{1}' for collection type '{0}' cannot be parsed in simple dictionary."; -public const string KnownTypeConfigGenericParamMismatch = @"Generic parameter count do not match between known type and configuration. Type is '{0}', known type has {1} parameters, configuration has {2} parameters."; -public const string KnownTypeConfigIndexOutOfBounds = @"For known type configuration, index is out of bound. Root type: '{0}' has {1} type arguments, and index was {2}."; -public const string KnownTypeConfigIndexOutOfBoundsZero = @"For known type configuration, index is out of bound. Root type: '{0}' has {1} type arguments, and index was {2}."; -public const string KnownTypeConfigObject = @"Known type configuration specifies System.Object."; -public const string MaxMimePartsExceeded = @"MIME parts number exceeded the maximum settings. Must be less than {0}. Specified as '{1}'."; -public const string MimeContentTypeHeaderInvalid = @"MIME content type header is invalid."; -public const string MimeHeaderInvalidCharacter = @"MIME header has an invalid character ('{0}', {1} in hexadecimal value)."; -public const string MimeMessageGetContentStreamCalledAlready = @"On MimeMessage, GetContentStream method is already called."; -public const string MimeReaderHeaderAlreadyExists = @"MIME header '{0}' already exists."; -public const string MimeReaderMalformedHeader = @"Malformed MIME header."; -public const string MimeReaderResetCalledBeforeEOF = @"On MimeReader, Reset method is called before EOF."; -public const string MimeReaderTruncated = @"MIME parts are truncated."; -public const string MimeVersionHeaderInvalid = @"MIME version header is invalid."; -public const string MimeWriterInvalidStateForClose = @"MIME writer is at invalid state for closing."; -public const string MimeWriterInvalidStateForContent = @"MIME writer is at invalid state for content."; -public const string MimeWriterInvalidStateForHeader = @"MIME writer is at invalid state for header."; -public const string MimeWriterInvalidStateForStartPart = @"MIME writer is at invalid state for starting a part."; -public const string MimeWriterInvalidStateForStartPreface = @"MIME writer is at invalid state for starting preface."; -public const string MissingSchemaType = @"Schema type '{0}' is missing and required for '{1}' type."; -public const string MixedContentNotSupported = @"Mixed content is not supported."; -public const string MtomBoundaryInvalid = @"MIME boundary is invalid: '{0}'."; -public const string MtomBufferQuotaExceeded = @"MTOM buffer quota exceeded. The maximum size is {0}."; -public const string MtomContentTransferEncodingNotPresent = @"MTOM content transfer encoding is not present. ContentTransferEncoding header is '{0}'."; -public const string MtomContentTransferEncodingNotSupported = @"MTOM content transfer encoding value is not supported. Raw value is '{0}', '{1}' in 7bit encoding, '{2}' in 8bit encoding, and '{3}' in binary."; -public const string MtomContentTypeInvalid = @"MTOM content type is invalid."; -public const string MtomDataMustNotContainXopInclude = @"MTOM data must not contain xop:Include element. '{0}' element in '{1}' namespace."; -public const string MtomExceededMaxSizeInBytes = @"MTOM exceeded max size in bytes. The maximum size is {0}."; -public const string MtomInvalidCIDUri = @"Invalid MTOM CID URI: '{0}'."; -public const string MtomInvalidEmptyURI = @"empty URI is invalid for MTOM MIME part."; -public const string MtomInvalidStartUri = @"Invalid MTOM start URI: '{0}'."; -public const string MtomInvalidTransferEncodingForMimePart = @"Invalid transfer encoding for MIME part: '{0}', in binary: '{1}'."; -public const string MtomMessageContentTypeNotFound = @"MTOM message content type was not found."; -public const string MtomMessageInvalidContent = @"MTOM message content is invalid."; -public const string MtomMessageInvalidContentInMimePart = @"MTOM message content in MIME part is invalid."; -public const string MtomMessageInvalidMimeVersion = @"MTOM message has invalid MIME version. Expected '{1}', got '{0}' instead."; -public const string MtomMessageNotApplicationXopXml = @"MTOM msssage type is not '{0}'."; -public const string MtomMessageNotMultipart = @"MTOM message is not multipart: media type should be '{0}', media subtype should be '{1}'."; -public const string MtomMessageRequiredParamNotSpecified = @"Required MTOM parameter '{0}' is not specified."; -public const string MtomMimePartReferencedMoreThanOnce = @"Specified MIME part '{0}' is referenced more than once."; -public const string MtomPartNotFound = @"MTOM part with URI '{0}' is not found."; -public const string MtomRootContentTypeNotFound = @"MTOM root content type is not found."; -public const string MtomRootNotApplicationXopXml = @"MTOM root should have media type '{0}' and subtype '{1}'."; -public const string MtomRootPartNotFound = @"MTOM root part is not found."; -public const string MtomRootRequiredParamNotSpecified = @"Required MTOM root parameter '{0}' is not specified."; -public const string MtomRootUnexpectedCharset = @"Unexpected charset on MTOM root. Expected '{1}', got '{0}' instead."; -public const string MtomRootUnexpectedType = @"Unexpected type on MTOM root. Expected '{1}', got '{0}' instead."; -public const string MtomXopIncludeHrefNotSpecified = @"xop Include element did not specify '{0}' attribute."; -public const string MtomXopIncludeInvalidXopAttributes = @"xop Include element has invalid attribute: '{0}' in '{1}' namespace."; -public const string MtomXopIncludeInvalidXopElement = @"xop Include element has invalid element: '{0}' in '{1}' namespace."; -public const string MustContainOnlyLocalElements = @"Only local elements can be imported."; -public const string NoAsyncWritePending = @"No async write operation is pending."; -public const string NonOptionalFieldMemberOnIsReferenceSerializableType = @"For type '{0}', non-optional field member '{1}' is on the Serializable type that has IsReference as {2}."; -public const string OnlyDataContractTypesCanHaveExtensionData = @"On '{0}' type, only DataContract types can have extension data."; -public const string PartialTrustISerializableNoPublicConstructor = @"Partial trust access required for the constructor on the ISerializable type '{0}'"; -public const string QueryGeneratorPathToMemberNotFound = @"The path to member was not found for XPath query generator."; -public const string ReadNotSupportedOnStream = @"Read operation is not supported on the Stream."; -public const string ReadOnlyClassDeserialization = @"Error on deserializing read-only members in the class: {0}"; -public const string ReadOnlyCollectionDeserialization = @"Error on deserializing read-only collection: {0}"; -public const string RecursiveCollectionType = @"Type '{0}' involves recursive collection."; -public const string RedefineNotSupported = @"XML Schema 'redefine' is not supported."; -public const string ReferencedBaseTypeDoesNotExist = @"Referenced base type does not exist. Data contract name: '{0}' in '{1}' namespace, expected type: '{2}' in '{3}' namespace. Collection can be '{4}' or '{5}'."; // is it the expected message? I'm quite unsure. -public const string ReferencedCollectionTypesCannotContainNull = @"Referenced collection types cannot contain null."; -public const string ReferencedTypeDoesNotMatch = @"Referenced type '{0}' does not match the expected type '{1}' in '{2}' namespace."; -public const string ReferencedTypeMatchingMessage = @"Reference type matches."; -public const string ReferencedTypeNotMatchingMessage = @"Reference type does not match."; -public const string ReferencedTypesCannotContainNull = @"Referenced types cannot contain null."; -public const string RequiresClassDataContractToSetIsISerializable = @"To set IsISerializable, class data cotnract is required."; -public const string RootParticleMustBeSequence = @"Root particle must be sequence to be imported."; -public const string RootSequenceMaxOccursMustBe = @"On root sequence, maxOccurs must be 1."; -public const string RootSequenceMustBeRequired = @"Root sequence must have an item and minOccurs must be 1."; -public const string SeekNotSupportedOnStream = @"Seek operation is not supported on this Stream."; -public const string SerializationInfo_ConstructorNotFound = @"Constructor that takes SerializationInfo and StreamingContext is not found for '{0}'."; -public const string SimpleContentNotSupported = @"Simple content is not supported."; -public const string SimpleTypeRestrictionDoesNotSpecifyBase = @"This simpleType restriction does not specify the base type."; -public const string SimpleTypeUnionNotSupported = @"simpleType union is not supported."; -public const string SpecifiedTypeNotFoundInSchema = @"Specified type '{0}' in '{1}' namespace is not found in the schemas."; -public const string SubstitutionGroupOnElementNotSupported = @"substitutionGroups on elements are not supported."; -public const string SurrogatesWithGetOnlyCollectionsNotSupported = @"Surrogates with get-only collections are not supported. Type '{1}' contains '{2}' which is of '{0}' type."; -public const string SurrogatesWithGetOnlyCollectionsNotSupportedSerDeser = @"Surrogates with get-only collections are not supported. Found on type '{0}'."; -public const string TopLevelElementRepresentsDifferentType = @"Top-level element represents a different type. Expected '{0}' type in '{1}' namespace."; -public const string TraceCodeElementIgnored = @"Element ignored"; -public const string TraceCodeFactoryTypeNotFound = @"Factory type not found"; -public const string TraceCodeObjectWithLargeDepth = @"Object with large depth"; -public const string TraceCodeReadObjectBegin = @"ReadObject begins"; -public const string TraceCodeReadObjectEnd = @"ReadObject ends"; -public const string TraceCodeWriteObjectBegin = @"WriteObject begins"; -public const string TraceCodeWriteObjectContentBegin = @"WriteObjectContent begins"; -public const string TraceCodeWriteObjectContentEnd = @"WriteObjectContent ends"; -public const string TraceCodeWriteObjectEnd = @"WriteObject ends"; -public const string TraceCodeXsdExportAnnotationFailed = @"XSD export annotation failed"; -public const string TraceCodeXsdExportBegin = @"XSD export begins"; -public const string TraceCodeXsdExportDupItems = @"XSD export duplicate items"; -public const string TraceCodeXsdExportEnd = @"XSD export ends"; -public const string TraceCodeXsdExportError = @"XSD export error"; -public const string TraceCodeXsdImportAnnotationFailed = @"XSD import annotation failed"; -public const string TraceCodeXsdImportBegin = @"XSD import begins"; -public const string TraceCodeXsdImportEnd = @"XSD import ends"; -public const string TraceCodeXsdImportError = @"XSD import error"; -public const string TypeCannotBeForwardedFrom = @"Type '{0}' in assembly '{1}' cannot be forwarded from assembly '{2}'."; -public const string TypeCannotBeImported = @"Type '{0}' in '{1}' namespace cannot be imported: {2}"; -public const string TypeCannotBeImportedHowToFix = @"Type cannot be imported: {0}"; // I cannot see where HowToFix is given from... -public const string TypeHasNotBeenImported = @"Type '{0}' in '{1}' namespace has not been imported."; -public const string TypeMustBeIXmlSerializable = @"Type '{0}' must be IXmlSerializable. Contract type: '{1}', contract name: '{2}' in '{3}' namespace."; -public const string TypeShouldNotContainAttributes = @"Type should not contain attributes. Serialization namespace: '{0}'."; -public const string UnknownXmlType = @"Unknown XML type: '{0}'."; -public const string WriteBufferOverflow = @"Write buffer overflow."; -public const string WriteNotSupportedOnStream = @"Write operation is not supported on this '{0}' Stream."; -public const string XmlCanonicalizationNotStarted = @"XML canonicalization was not started."; -public const string XmlCanonicalizationStarted = @"XML canonicalization started"; -public const string XmlMaxArrayLengthOrMaxItemsQuotaExceeded = @"XML max array length or max items quota exceeded. It must be less than {0}."; -public const string XmlMaxBytesPerReadExceeded = @"XML max bytes per read exceeded. It must be less than {0}."; -public const string XmlMaxDepthExceeded = @"XML max depth exceeded. It must be less than {0}."; -public const string XmlMaxStringContentLengthExceeded = @"XML max string content length exceeded. It must be less than {0}."; -public const string XmlObjectAssignedToIncompatibleInterface = @"Object of type '{0}' is assigned to an incompatible interface '{1}'."; - -#endregion - } -} diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization.dll.sources index 63c072d99e9..9e790d522b7 100644 --- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization.dll.sources +++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization.dll.sources @@ -5,7 +5,7 @@ Assembly/AssemblyInfo.cs ReferenceSources/DiagnosticUtility.cs ReferenceSources/FxTrace.cs ReferenceSources/SR.cs -ReferenceSources/SR_missing.cs +ReferenceSources/SR.missing.cs ReferenceSources/XmlExceptionHelper.cs ReferenceSources/BitFlagsGenerator.cs diff --git a/mcs/class/System.Security/Makefile b/mcs/class/System.Security/Makefile index 03e2493cc26..451a06e2f4c 100644 --- a/mcs/class/System.Security/Makefile +++ b/mcs/class/System.Security/Makefile @@ -3,10 +3,9 @@ SUBDIRS = include ../../build/rules.make LIBRARY = System.Security.dll -LIB_REFS = System System.Xml Mono.Security +LIB_REFS = secxml/System bare/System.Xml Mono.Security LIB_MCS_FLAGS = -nowarn:618 \ -d:SECURITY_DEP \ - -r:$(corlib) \ -nowarn:414 LOCAL_MCS_FLAGS = -lib:$(secxml_libdir) -lib:$(bare_libdir) diff --git a/mcs/class/System.ServiceModel.Activation/Makefile b/mcs/class/System.ServiceModel.Activation/Makefile index ad7f73f1b92..2be1563c1d7 100644 --- a/mcs/class/System.ServiceModel.Activation/Makefile +++ b/mcs/class/System.ServiceModel.Activation/Makefile @@ -4,14 +4,13 @@ include ../../build/rules.make LIBRARY = System.ServiceModel.Activation.dll -LIB_REFS = System.Core System System.ServiceModel +LIB_REFS = System.Core System plainservice/System.ServiceModel LIB_MCS_FLAGS = -TEST_MCS_FLAGS = -r:System.dll -r:System.Core.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System System.Core -plainservicemodel_dir = $(the_libdir_base)plainservice -servicemodel = $(plainservicemodel_dir)/System.ServiceModel.dll -LOCAL_MCS_FLAGS = -lib:$(plainservicemodel_dir) +servicemodel = $(the_libdir_base)plainservice/System.ServiceModel.dll include ../../build/library.make diff --git a/mcs/class/System.ServiceModel.Discovery/Makefile b/mcs/class/System.ServiceModel.Discovery/Makefile index 75422d19e74..d46df268454 100644 --- a/mcs/class/System.ServiceModel.Discovery/Makefile +++ b/mcs/class/System.ServiceModel.Discovery/Makefile @@ -8,8 +8,7 @@ LIB_MCS_FLAGS = ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_REFS += System.Configuration -LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0 \ - -r:System.Configuration.dll +LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0 endif TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) diff --git a/mcs/class/System.ServiceModel.Routing/Makefile b/mcs/class/System.ServiceModel.Routing/Makefile index ad9a78e6a60..f8d30f60025 100644 --- a/mcs/class/System.ServiceModel.Routing/Makefile +++ b/mcs/class/System.ServiceModel.Routing/Makefile @@ -8,8 +8,7 @@ LIB_MCS_FLAGS = ifneq (2.1, $(FRAMEWORK_VERSION)) LIB_REFS += System.Configuration -LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0 \ - -r:System.Configuration.dll +LIB_MCS_FLAGS += -d:NET_3_5 -d:NET_3_0 endif TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) diff --git a/mcs/class/System.ServiceModel/Makefile b/mcs/class/System.ServiceModel/Makefile index 03dbd5fd9e5..5f09e6a2329 100644 --- a/mcs/class/System.ServiceModel/Makefile +++ b/mcs/class/System.ServiceModel/Makefile @@ -34,7 +34,8 @@ activation = $(the_libdir_base)System.ServiceModel.Activation.dll servicemodel_deps = $(activation) ifneq (plainservice/,$(intermediate)) -LIB_MCS_FLAGS += -define:HAS_ACTIVATION -r:System.ServiceModel.Activation.dll +LIB_REFS += System.ServiceModel.Activation +LIB_MCS_FLAGS += -define:HAS_ACTIVATION endif endif # NO_SYSTEM_SERVICEMODEL_ACTIVATION_DEPENDENCY diff --git a/mcs/class/System.Threading.Tasks.Dataflow/Makefile b/mcs/class/System.Threading.Tasks.Dataflow/Makefile index 349e5c75754..017f1a880c8 100644 --- a/mcs/class/System.Threading.Tasks.Dataflow/Makefile +++ b/mcs/class/System.Threading.Tasks.Dataflow/Makefile @@ -7,8 +7,9 @@ LIBRARY = System.Threading.Tasks.Dataflow.dll include ../../build/library.make LIB_REFS += System.Core System -LIB_MCS_FLAGS += -r:$(corlib) -d:CONCURRENT_COLLECTIONS +LIB_MCS_FLAGS += -d:CONCURRENT_COLLECTIONS -TEST_MCS_FLAGS = -r:System.Core.dll -r:System.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System.Core System EXTRA_DISTFILES=README.md diff --git a/mcs/class/System.Transactions/Makefile b/mcs/class/System.Transactions/Makefile index 08e9bd68021..07672c10b06 100644 --- a/mcs/class/System.Transactions/Makefile +++ b/mcs/class/System.Transactions/Makefile @@ -5,10 +5,10 @@ include ../../build/rules.make LIBRARY = System.Transactions.dll ifdef MOBILE_PROFILE LIB_REFS = System -LIB_MCS_FLAGS = /r:$(corlib) /define:MOBILE +LIB_MCS_FLAGS = /define:MOBILE else LIB_REFS = System System.Configuration -LIB_MCS_FLAGS = /r:$(corlib) +LIB_MCS_FLAGS = endif TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) diff --git a/mcs/class/System.Web.DynamicData/Makefile b/mcs/class/System.Web.DynamicData/Makefile index 08cb7d04c2b..df81a3719ca 100644 --- a/mcs/class/System.Web.DynamicData/Makefile +++ b/mcs/class/System.Web.DynamicData/Makefile @@ -160,11 +160,11 @@ TEST_RESOURCE_FILES = \ NUNIT_RESOURCE_FILES = $(TEST_RESOURCE_FILES) -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:System.ComponentModel.DataAnnotations.dll -r:System.Configuration.dll \ - $(NUNIT_RESOURCE_FILES:%=/resource:%) -r:SystemWebTestShim.dll -r:System.Xml.dll +TEST_LIB_REFS = System.ComponentModel.DataAnnotations System.Configuration SystemWebTestShim System.Xml +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(NUNIT_RESOURCE_FILES:%=/resource:%) ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) -TEST_MCS_FLAGS += -r:System.Web.ApplicationServices.dll +TEST_LIB_REFS += System.Web.ApplicationServices endif EXTRA_DISTFILES = $(foreach resource,$(TEST_RESOURCE_FILES), $(shell echo $(subst \`,\\\`,$(resource)) | cut -d ',' -f 1)) diff --git a/mcs/class/System.Web.Extensions/Makefile b/mcs/class/System.Web.Extensions/Makefile index bf15f32944f..4a3f8a48970 100644 --- a/mcs/class/System.Web.Extensions/Makefile +++ b/mcs/class/System.Web.Extensions/Makefile @@ -39,7 +39,7 @@ NUNIT_RESOURCE_FILES= \ CLASSLIB_DIR = $(topdir)/class/lib/$(PROFILE) STANDALONE_RUNNER_SUPPORT_ASSEMBLY = $(CLASSLIB_DIR)/standalone-runner-support.dll -STANDALONE_TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(PROFILE_MCS_FLAGS) -debug:full -r:$(STANDALONE_RUNNER_SUPPORT_ASSEMBLY) -r:System.Web.dll -r:System.Web.Extensions.dll -r:nunit.framework.dll +STANDALONE_TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(PROFILE_MCS_FLAGS) -r:$(STANDALONE_RUNNER_SUPPORT_ASSEMBLY) -r:$(topdir)/class/lib/$(PROFILE)/System.Web.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Web.Extensions.dll -r:$(topdir)/class/lib/$(PROFILE)/nunit.framework.dll STANDALONE_TEST_ASSEMBLY = System.Web.Extensions_standalone_test_$(PROFILE).dll STANDALONE_TEST_MAKEFRAG = $(depsdir)/$(STANDALONE_TEST_ASSEMBLY).makefrag @@ -49,20 +49,20 @@ ifdef TESTNAME RUN_STANDALONE += --test=$(TESTNAME) endif -ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) -OTHER_LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll -endif - LIB_REFS = System System.Core System.Drawing System.Data System.Data.Linq System.Xml System.Web System.Web.Services System.Configuration System.EnterpriseServices System.ServiceModel LIB_MCS_FLAGS = \ -unsafe \ -define:NET_3_5 \ -define:SYSTEM_WEB_EXTENSIONS \ - -r:$(corlib) \ $(OTHER_LIB_MCS_FLAGS) \ $(RESOURCE_FILES:%=/resource:%) -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,1591 $(NUNIT_RESOURCE_FILES:%=/resource:%) -r:SystemWebTestShim.dll -define:SYSTEM_WEB_EXTENSIONS +ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) +LIB_REFS += System.Web.ApplicationServices +endif + +TEST_LIB_REFS = SystemWebTestShim +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,1591 $(NUNIT_RESOURCE_FILES:%=/resource:%) -define:SYSTEM_WEB_EXTENSIONS EXTRA_DISTFILES = $(RESOURCE_FILES_DIST) $(NUNIT_RESOURCE_FILES) \ System.Web.Extensions_standalone_test.dll.sources \ diff --git a/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs b/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs index 891b1ef66ce..29e6cfb92b8 100644 --- a/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs +++ b/mcs/class/System.Web.Extensions/System.Web.Script.Serialization/JsonDeserializer.cs @@ -473,22 +473,22 @@ namespace System.Web.Script.Serialization case JsonType.INTEGER: /* MS AJAX.NET JSON parser promotes big integers to double */ - if (Int32.TryParse (s, out intValue)) + if (Int32.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out intValue)) result = intValue; - else if (Int64.TryParse (s, out longValue)) + else if (Int64.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out longValue)) result = longValue; - else if (Decimal.TryParse (s, out decimalValue)) + else if (Decimal.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out decimalValue)) result = decimalValue; - else if (Double.TryParse (s, out doubleValue)) + else if (Double.TryParse (s, NumberStyles.Integer, CultureInfo.InvariantCulture, out doubleValue)) result = doubleValue; else converted = false; break; case JsonType.FLOAT: - if (Decimal.TryParse (s, out decimalValue)) + if (Decimal.TryParse (s, NumberStyles.Float, CultureInfo.InvariantCulture, out decimalValue)) result = decimalValue; - else if (Double.TryParse (s, out doubleValue)) + else if (Double.TryParse (s, NumberStyles.Float, CultureInfo.InvariantCulture, out doubleValue)) result = doubleValue; else converted = false; diff --git a/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs b/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs index 8dc9e38c43b..61e4b502d66 100644 --- a/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs +++ b/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs @@ -1439,5 +1439,43 @@ namespace MonoTests.System.Web.Script.Serialization Assert.AreEqual (1337.0, obj.d); Assert.AreEqual (null, obj.o); } + + [Test] + public void DeserializeInCultureWithCommaSeparator () + { + var origCulture = Thread.CurrentThread.CurrentCulture; + + try { + Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US"); + CommaSeparatorTest (); + + Thread.CurrentThread.CurrentCulture = new CultureInfo ("fi-FI"); + CommaSeparatorTest (); + } finally { + Thread.CurrentThread.CurrentCulture = origCulture; + } + } + + public class DoubleTest + { + public double[] value { get; set; } + } + + void CommaSeparatorTest() + { + JavaScriptSerializer serializer = new JavaScriptSerializer (); + + DoubleTest array = new DoubleTest (); + array.value = new[] { 123.345, 0.69 }; + + string arrayJson = serializer.Serialize (array); + Console.WriteLine (arrayJson); + + // This throwed incorrectly a "System.ArgumentException: Invalid JSON primitive: 123.345" with a CurrentThread.CultureInfo that has a comma as the number separator. + DoubleTest obj = serializer.Deserialize (arrayJson); + + Assert.AreEqual (123.345, obj.value[0], "#1"); + Assert.AreEqual (0.69, obj.value[1], "#2"); + } } } diff --git a/mcs/class/System.Web.Services/Makefile b/mcs/class/System.Web.Services/Makefile index c189f7963eb..0e8dd48092a 100644 --- a/mcs/class/System.Web.Services/Makefile +++ b/mcs/class/System.Web.Services/Makefile @@ -7,9 +7,6 @@ ifdef MOBILE_PROFILE LIB_REFS = System System.Xml LIB_MCS_FLAGS = \ -nowarn:649 -nowarn:169 \ - -r:$(corlib) \ - -r:System.dll \ - -r:System.Xml.dll \ -resource:System.Web.Services.Description/wsdl-1.1.xsd,wsdl-1.1.xsd \ -resource:System.Web.Services.Description/wsdl-1.1-soap.xsd,wsdl-1.1-soap.xsd \ -resource:System.Web.Services.Description/web-reference.xsd,web-reference.xsd @@ -18,19 +15,15 @@ LIB_REFS = System System.EnterpriseServices System.Xml System.Data LIB_MCS_FLAGS = -nowarn:168,169,219,414,612,649 -d:MONO_BROKEN_CONFIGURATION_DLL ifndef NO_SYSTEM_WEB_DEPENDENCY -LIB_REFS += System.Web -plainweb_dir = $(the_libdir_base)plainweb -plainweb = $(plainweb_dir)/System.Web.dll -system_web_services_deps = $(plainweb) -LOCAL_MCS_FLAGS += -lib:$(plainweb_dir) +plainweb = $(the_libdir_base)plainweb/System.Web.dll +system_web_deps = $(plainweb) +LIB_REFS += plainweb/System.Web endif ifndef NO_SYSTEM_DESIGN_DEPENDENCY -LIB_REFS += System.Design -plaindesign_dir = $(the_libdir_base)plaindesign -plaindesign = $(plaindesign_dir)/System.Design.dll +plaindesign = $(the_libdir_base)plaindesign/System.Design.dll system_design_deps = $(plaindesign) -LOCAL_MCS_FLAGS += -lib:$(plaindesign_dir) +LIB_REFS += plaindesign/System.Design endif ifndef NO_SYSTEM_DIRECTORY_SERVICES_DEPENDENCY @@ -63,7 +56,7 @@ EXTRA_DISTFILES = \ include ../../build/library.make -$(the_libdir_base)$(LIBRARY): $(system_web_services_deps) $(system_design_deps) +$(the_libdir_base)$(LIBRARY): $(system_web_deps) $(system_design_deps) $(plainweb): (cd ../System.Web; $(MAKE) $@) diff --git a/mcs/class/System.Web/Makefile b/mcs/class/System.Web/Makefile index 72f14d10577..9656cafa25b 100644 --- a/mcs/class/System.Web/Makefile +++ b/mcs/class/System.Web/Makefile @@ -233,33 +233,33 @@ NUNIT_APP_CODE_FILES = $(TEST_APP_CODE_FILES) NUNIT_APP_GLOBALRESOURCES_FILES = $(TEST_APP_GLOBALRESOURCES_FILES) OTHER_RES += $(RESOURCE_FILES_2) -OTHER_LIB_MCS_FLAGS = -d:INSIDE_SYSTEM_WEB -nowarn:618 -r:System.Configuration.dll -r:Mono.Data.Sqlite.dll +OTHER_LIB_MCS_FLAGS = -d:INSIDE_SYSTEM_WEB -nowarn:618 ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) -OTHER_LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll OTHER_RES += $(RESOURCE_FILES_4) endif TXT_RESOURCE_STRINGS = ../../../external/referencesource/System.Web/System.Web.txt -LIB_REFS = System System.Core System.Drawing System.Data System.Xml System.EnterpriseServices System.Runtime.Serialization.Formatters.Soap System.ComponentModel.DataAnnotations +LIB_REFS = System System.Core System.Drawing System.Data System.Xml System.EnterpriseServices System.Runtime.Serialization.Formatters.Soap \ + System.ComponentModel.DataAnnotations System.Web.ApplicationServices System.Configuration Mono.Data.Sqlite LIB_MCS_FLAGS = \ -unsafe \ -nowarn:612,618 \ - -r:$(corlib) \ $(OTHER_LIB_MCS_FLAGS) \ $(RESX_RES:%=/resource:%) \ $(OTHER_RES:%=/resource:%) ifneq (plainweb/,$(intermediate)) -LIB_REFS += System.Web.Services System.Design +LIB_REFS += System.Web.Services plaindesign/System.Design LIB_MCS_FLAGS += -define:WEBSERVICES_DEP -lib:$(the_libdir_base)plaindesign all-local: System.Web/UplevelHelper.cs resources/TranslationResources.resources endif -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,1591 -r:SystemWebTestShim.dll \ +TEST_LIB_REFS = SystemWebTestShim +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,1591 \ $(NUNIT_RESOURCE_FILES:%=/resource:%) \ $(foreach file,$(NUNIT_APP_CODE_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_Code/\2 ;g')) \ $(foreach file,$(NUNIT_APP_GLOBALRESOURCES_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_GlobalResources/\2 ;g')) @@ -322,11 +322,11 @@ endif CLASSLIB_DIR = $(topdir)/class/lib/$(PROFILE) -STANDALONE_RUNNER_SUPPORT_MCS_FLAGS = $(LIB_MCS_FLAGS) $(PROFILE_MCS_FLAGS) -d:STANDALONE_TEST -debug:full -r:System.Web.dll -r:nunit.framework.dll +STANDALONE_RUNNER_SUPPORT_MCS_FLAGS = $(LIB_MCS_FLAGS) $(PROFILE_MCS_FLAGS) -d:STANDALONE_TEST -r:$(topdir)/class/lib/$(PROFILE)/System.Web.dll -r:$(topdir)/class/lib/$(PROFILE)/nunit.framework.dll STANDALONE_RUNNER_SUPPORT_ASSEMBLY = $(CLASSLIB_DIR)/standalone-runner-support.dll STANDALONE_RUNNER_SUPPORT_MAKEFRAG = $(depsdir)/$(PROFILE)_standalone-runner-support.dll.makefrag -STANDALONE_TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(PROFILE_MCS_FLAGS) -debug:full -r:$(STANDALONE_RUNNER_SUPPORT_ASSEMBLY) -r:System.Web.dll -r:nunit.framework.dll +STANDALONE_TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) $(PROFILE_MCS_FLAGS) -r:$(STANDALONE_RUNNER_SUPPORT_ASSEMBLY) -r:$(topdir)/class/lib/$(PROFILE)/System.Web.dll -r:$(topdir)/class/lib/$(PROFILE)/nunit.framework.dll STANDALONE_TEST_ASSEMBLY = System.Web_standalone_test_$(PROFILE).dll STANDALONE_TEST_MAKEFRAG = $(depsdir)/$(STANDALONE_TEST_ASSEMBLY).makefrag diff --git a/mcs/class/System.Web/Test/tools/Makefile b/mcs/class/System.Web/Test/tools/Makefile index bfe9f95caa2..9cbb4159d00 100644 --- a/mcs/class/System.Web/Test/tools/Makefile +++ b/mcs/class/System.Web/Test/tools/Makefile @@ -10,9 +10,9 @@ STANDALONE_RUNNER_SOURCES = \ ../../../Mono.Options/Mono.Options/Options.cs \ STANDALONE_RUNNER_REFERENCES = \ - -lib:$(CLASSLIB_DIR) \ -r:$(STANDALONE_RUNNER_SUPPORT_ASSEMBLY) \ - -r:System.Web.dll + -r:$(CLASSLIB_DIR)/System.Web.dll \ + -r:$(CLASSLIB_DIR)/System.dll CACHE_PQ_TEST_GENERATOR_SOURCES = \ CachePQTestGenerator/CacheItemComparer.cs \ @@ -27,7 +27,6 @@ CACHE_PQ_TEST_GENERATOR_SOURCES = \ ../System.Web.Caching/CacheItemPriorityQueueTestSupport.cs CACHE_PQ_TEST_GENERATOR_REFERENCES = \ - -lib:$(CLASSLIB_DIR) \ -pkg:dotnet CACHE_PQ_TEST_SEQUENCES = $(wildcard ./CachePQTestGenerator/Sequences/*.seq) @@ -36,13 +35,13 @@ CACHE_PQ_TEST_PACKED_SEQUENCES = $(wildcard ./CachePQTestGenerator/Sequences/*.s all-local: HtmlWriter.dll standalone-runner.exe cache-pq-test-generator.exe HtmlWriter.dll: HtmlWriter.cs - $(MCS) -t:library -r:System.Web.dll $< + $(CSCOMPILE) -t:library -r:System.Web.dll $< standalone-runner.exe: deps $(STANDALONE_RUNNER_SOURCES) - $(MCS) -debug:full $(STANDALONE_RUNNER_REFERENCES) -out:$@ $(STANDALONE_RUNNER_SOURCES) + $(CSCOMPILE) $(STANDALONE_RUNNER_REFERENCES) -out:$@ $(STANDALONE_RUNNER_SOURCES) cache-pq-test-generator.exe: $(CACHE_PQ_TEST_GENERATOR_SOURCES) - $(MCS) -debug:full -d:DEBUG $(CACHE_PQ_TEST_GENERATOR_REFERENCES) -out:$@ $(CACHE_PQ_TEST_GENERATOR_SOURCES) + $(CSCOMPILE) -d:DEBUG $(CACHE_PQ_TEST_GENERATOR_REFERENCES) -out:$@ $(CACHE_PQ_TEST_GENERATOR_SOURCES) generate-cache-pq-tests: cache-pq-test-generator.exe for f in $(patsubst %.seq.gz,%.seq,$(CACHE_PQ_TEST_PACKED_SEQUENCES)); do \ diff --git a/mcs/class/System.Windows.Forms/Makefile b/mcs/class/System.Windows.Forms/Makefile index 3d8113656cf..06eacbcbcf7 100644 --- a/mcs/class/System.Windows.Forms/Makefile +++ b/mcs/class/System.Windows.Forms/Makefile @@ -5,7 +5,6 @@ LIBRARY = System.Windows.Forms.dll LIB_REFS = System System.Xml System.Drawing Accessibility System.Data Mono.Posix Mono.WebBrowser System.Configuration System.Runtime.Serialization.Formatters.Soap LIB_MCS_FLAGS = /unsafe \ - /r:$(corlib) \ @System.Windows.Forms.dll.resources \ -nowarn:618,612,809 @@ -100,13 +99,15 @@ EXTRA_DISTFILES = \ $(IMAGES_RESOURCES) \ $(TEST_DISTFILES) -TEST_MCS_FLAGS = /r:System.Data.dll /r:System.Drawing.dll /r:Accessibility.dll -r:System.dll -r:System.Xml.dll -r:System.Runtime.Serialization.Formatters.Soap\ +TEST_LIB_REFS = System.Data System.Drawing Accessibility System System.Xml System.Runtime.Serialization.Formatters.Soap +TEST_MCS_FLAGS = \ -resource:Test/resources/a.cur,a.cur \ -resource:Test/resources/32x32.ico,32x32.ico \ -nowarn:618,612 DummyAssembly.dll: - $(CSCOMPILE) /target:library /out:$@ Test/DummyAssembly/AnotherSerializable.cs Test/DummyAssembly/Convertable.cs Test/DummyAssembly/Properties/AssemblyInfo.cs + $(CSCOMPILE) /target:library /out:$@ Test/DummyAssembly/AnotherSerializable.cs Test/DummyAssembly/Convertable.cs Test/DummyAssembly/Properties/AssemblyInfo.cs \ + -r:$(topdir)/class/lib/$(PROFILE)/System.dll test-local: DummyAssembly.dll diff --git a/mcs/class/System.XML/Makefile b/mcs/class/System.XML/Makefile index 183612a1053..e66bd2e4635 100644 --- a/mcs/class/System.XML/Makefile +++ b/mcs/class/System.XML/Makefile @@ -17,23 +17,24 @@ TXT_RESOURCE_STRINGS = \ ../../../external/referencesource/System.Xml/System.Xml.txt \ ../../../external/referencesource/System.Data.SqlXml/System.Xml.Utils.txt -LIB_REFS = System -LIB_MCS_FLAGS = -r:$(corlib) -nowarn:219,414,649,1717 -unsafe -d:ASYNC +LIB_MCS_FLAGS = -nowarn:219,414,649,1717 -unsafe -d:ASYNC ifeq (2.1, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -d:AGCLR -d:NET_2_1_HACK -d:DISABLE_XSLT_COMPILER -d:DISABLE_XSLT_SCRIPT,MONO_HYBRID_SYSTEM_XML -d:DISABLE_CAS_USE endif -TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 -r:System.Data.dll -r:System.Core.dll -ifndef MOBILE_PROFILE -FINAL_MCS_FLAGS = -r:System.Configuration.dll -d:CONFIGURATION_DEP -endif +TEST_LIB_REFS = System.Data System.Core +TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 ifneq (bare/,$(intermediate)) -LIB_MCS_FLAGS += $(FINAL_MCS_FLAGS) +LIB_REFS += secxml/System +ifndef MOBILE_PROFILE +LIB_REFS += System.Configuration +LIB_MCS_FLAGS += -d:CONFIGURATION_DEP +endif +else +LIB_REFS += $(intermediate)System endif - -LOCAL_MCS_FLAGS += -lib:$(bare_libdir) nist_dom_files = \ ITest.cs readme.txt util.cs \ diff --git a/mcs/class/System/Assembly/AssemblyInfo.cs b/mcs/class/System/Assembly/AssemblyInfo.cs index a7651da891f..69456085a2b 100644 --- a/mcs/class/System/Assembly/AssemblyInfo.cs +++ b/mcs/class/System/Assembly/AssemblyInfo.cs @@ -83,3 +83,5 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("Mono.Security.Providers.NewTls, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Security.Providers.DotNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] + + [assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")] diff --git a/mcs/class/System/Makefile b/mcs/class/System/Makefile index 25031265acc..1e19b0dd5bc 100644 --- a/mcs/class/System/Makefile +++ b/mcs/class/System/Makefile @@ -19,7 +19,9 @@ TEST_RESOURCES = \ Test/System/test-uri-props-manual.txt \ Test/System/test-uri-relative-props.txt -TEST_MCS_FLAGS = -r:System.Drawing.dll -r:Mono.Security.dll -r:System.Data.dll -r:System.Xml.dll -r:System.Core.dll -nowarn:618,672,219,67,169,612 \ +TEST_LIB_REFS = System.Drawing Mono.Security System.Data System.Xml System.Core System.Configuration + +TEST_MCS_FLAGS = -nowarn:618,672,219,67,169,612 \ $(foreach f, $(TEST_RESOURCES), -resource:$(f),$(notdir $(f))) REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,SYSTEM_NAMESPACE,MONO,PLATFORM_UNIX @@ -29,7 +31,6 @@ TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START endif LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%) -TEST_MCS_FLAGS += -r:System.Configuration.dll ifndef NO_THREAD_ABORT REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT @@ -50,7 +51,6 @@ ifdef MOBILE_PROFILE LIB_MCS_FLAGS += -d:INSIDE_SYSTEM -d:SECURITY_DEP else EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS -d:MONO_X509_ALIAS -FINAL_MCS_FLAGS = -r:System.Configuration.dll -d:CONFIGURATION_DEP endif # @@ -58,7 +58,7 @@ endif # ifeq (secxml/, $(intermediate)) LOCAL_MCS_FLAGS = -lib:$(bare_libdir) -LIB_REFS += System.Xml MonoSecurity=Mono.Security +LIB_REFS += bare/System.Xml MonoSecurity=Mono.Security LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(bare_libdir)/System.dll $(EXTERN_ALIAS_FLAGS) endif @@ -67,7 +67,13 @@ endif # ifndef intermediate LIB_REFS += System.Xml MonoSecurity=Mono.Security -LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(secxml_libdir)/System.dll $(EXTERN_ALIAS_FLAGS) $(FINAL_MCS_FLAGS) +LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(secxml_libdir)/System.dll $(EXTERN_ALIAS_FLAGS) + +ifndef MOBILE_PROFILE +LIB_REFS += System.Configuration +LIB_MCS_FLAGS += -d:CONFIGURATION_DEP +endif + endif EXTRA_DISTFILES = \ diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs index 675d20f06d4..a4de75e853a 100644 --- a/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs +++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs @@ -366,6 +366,8 @@ namespace Mono.CSharp } } + args.Append ("/noconfig "); + args.Append (" -- "); foreach (string source in fileNames) args.AppendFormat("\"{0}\" ",source); diff --git a/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs b/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs index 617fbdefd53..9a5eab25ce6 100644 --- a/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs +++ b/mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs @@ -74,7 +74,7 @@ namespace Mono.Net.Security { internal delegate bool ServerCertValidationCallbackWrapper (ServerCertValidationCallback callback, X509Certificate certificate, X509Chain chain, MonoSslPolicyErrors sslPolicyErrors); - internal class ChainValidationHelper : ICertificateValidator + internal class ChainValidationHelper : ICertificateValidator2 { readonly object sender; readonly MonoTlsSettings settings; @@ -228,7 +228,7 @@ namespace Mono.Net.Security var certs = new XX509CertificateCollection (); certs.Add (new X509Certificate2 (certificate.GetRawCertData ())); - var result = ValidateChain (string.Empty, true, certs, (SslPolicyErrors)errors); + var result = ValidateChain (string.Empty, true, certificate, null, certs, (SslPolicyErrors)errors); if (result == null) return false; @@ -238,7 +238,27 @@ namespace Mono.Net.Security public ValidationResult ValidateCertificate (string host, bool serverMode, XX509CertificateCollection certs) { try { - var result = ValidateChain (host, serverMode, certs, 0); + X509Certificate leaf; + if (certs != null && certs.Count != 0) + leaf = certs [0]; + else + leaf = null; + var result = ValidateChain (host, serverMode, leaf, null, certs, 0); + if (tlsStream != null) + tlsStream.CertificateValidationFailed = result == null || !result.Trusted || result.UserDenied; + return result; + } catch { + if (tlsStream != null) + tlsStream.CertificateValidationFailed = true; + throw; + } + } + + public ValidationResult ValidateCertificate (string host, bool serverMode, X509Certificate leaf, XX509Chain xchain) + { + try { + var chain = (X509Chain)(object)xchain; + var result = ValidateChain (host, serverMode, leaf, chain, null, 0); if (tlsStream != null) tlsStream.CertificateValidationFailed = result == null || !result.Trusted || result.UserDenied; return result; @@ -249,7 +269,28 @@ namespace Mono.Net.Security } } - ValidationResult ValidateChain (string host, bool server, XX509CertificateCollection certs, SslPolicyErrors errors) + ValidationResult ValidateChain (string host, bool server, X509Certificate leaf, + X509Chain chain, XX509CertificateCollection certs, + SslPolicyErrors errors) + { + var oldChain = chain; + var ownsChain = chain == null; + try { + var result = ValidateChain (host, server, leaf, ref chain, certs, errors); + if (chain != oldChain) + ownsChain = true; + + return result; + } finally { + // If ValidateChain() changed the chain, then we need to free it. + if (ownsChain && chain != null) + chain.Dispose (); + } + } + + ValidationResult ValidateChain (string host, bool server, X509Certificate leaf, + ref X509Chain chain, XX509CertificateCollection certs, + SslPolicyErrors errors) { // user_denied is true if the user callback is called and returns false bool user_denied = false; @@ -257,12 +298,6 @@ namespace Mono.Net.Security var hasCallback = certValidationCallback != null || callbackWrapper != null; - X509Certificate leaf; - if (certs == null || certs.Count == 0) - leaf = null; - else - leaf = certs [0]; - if (tlsStream != null) request.ServicePoint.UpdateServerCertificate (leaf); @@ -281,7 +316,6 @@ namespace Mono.Net.Security ICertificatePolicy policy = ServicePointManager.GetLegacyCertificatePolicy (); int status11 = 0; // Error code passed to the obsolete ICertificatePolicy callback - X509Chain chain = null; bool wantsChain = SystemCertificateValidator.NeedsChain (settings); if (!wantsChain && hasCallback) { @@ -289,16 +323,15 @@ namespace Mono.Net.Security wantsChain = true; } - if (wantsChain) - chain = SystemCertificateValidator.CreateX509Chain (certs); - bool providerValidated = false; if (provider != null && provider.HasCustomSystemCertificateValidator) { var xerrors = (MonoSslPolicyErrors)errors; var xchain = (XX509Chain)(object)chain; - providerValidated = provider.InvokeSystemCertificateValidator (this, host, server, certs, ref xchain, out result, ref xerrors, ref status11); + providerValidated = provider.InvokeSystemCertificateValidator (this, host, server, certs, wantsChain, ref xchain, out result, ref xerrors, ref status11); chain = (X509Chain)(object)xchain; errors = (SslPolicyErrors)xerrors; + } else if (wantsChain) { + chain = SystemCertificateValidator.CreateX509Chain (certs); } if (!providerValidated) diff --git a/mcs/class/System/System.IO/KeventWatcher.cs b/mcs/class/System/System.IO/KeventWatcher.cs index b2d964ceb5e..f17eb58d28d 100644 --- a/mcs/class/System/System.IO/KeventWatcher.cs +++ b/mcs/class/System/System.IO/KeventWatcher.cs @@ -317,10 +317,17 @@ namespace System.IO { var eventBuffer = new kevent[0]; // we don't want to take any events from the queue at this point var changes = CreateChangeList (ref initialFds); - int numEvents = kevent (conn, changes, changes.Length, eventBuffer, eventBuffer.Length, ref immediate_timeout); + int numEvents; + int errno = 0; + do { + numEvents = kevent (conn, changes, changes.Length, eventBuffer, eventBuffer.Length, ref immediate_timeout); + if (numEvents == -1) { + errno = Marshal.GetLastWin32Error (); + } + } while (numEvents == -1 && errno == EINTR); if (numEvents == -1) { - var errMsg = String.Format ("kevent() error at initial event registration, error code = '{0}'", Marshal.GetLastWin32Error ()); + var errMsg = String.Format ("kevent() error at initial event registration, error code = '{0}'", errno); throw new IOException (errMsg); } } @@ -384,9 +391,10 @@ namespace System.IO { // Stop () signals us to stop by closing the connection if (requestStop) break; - if (++retries == 3) + int errno = Marshal.GetLastWin32Error (); + if (errno != EINTR && ++retries == 3) throw new IOException (String.Format ( - "persistent kevent() error, error code = '{0}'", Marshal.GetLastWin32Error ())); + "persistent kevent() error, error code = '{0}'", errno)); continue; } @@ -646,6 +654,7 @@ namespace System.IO { const int O_EVTONLY = 0x8000; const int F_GETPATH = 50; const int __DARWIN_MAXPATHLEN = 1024; + const int EINTR = 4; static readonly kevent[] emptyEventList = new System.IO.kevent[0]; int maxFds = Int32.MaxValue; @@ -665,19 +674,19 @@ namespace System.IO { string fixupPath = null; string fullPathNoLastSlash = null; - [DllImport ("libc", EntryPoint="fcntl", CharSet=CharSet.Auto, SetLastError=true)] + [DllImport ("libc", CharSet=CharSet.Auto, SetLastError=true)] static extern int fcntl (int file_names_by_descriptor, int cmd, StringBuilder sb); - [DllImport ("libc")] + [DllImport ("libc", SetLastError=true)] extern static int open (string path, int flags, int mode_t); [DllImport ("libc")] extern static int close (int fd); - [DllImport ("libc")] + [DllImport ("libc", SetLastError=true)] extern static int kqueue (); - [DllImport ("libc")] + [DllImport ("libc", SetLastError=true)] extern static int kevent (int kq, [In]kevent[] ev, int nchanges, [Out]kevent[] evtlist, int nevents, [In] ref timespec time); [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/mcs/class/System/System.Net/EndPointListener.cs b/mcs/class/System/System.Net/EndPointListener.cs index 9726b91358b..5400d73b87e 100644 --- a/mcs/class/System/System.Net/EndPointListener.cs +++ b/mcs/class/System/System.Net/EndPointListener.cs @@ -73,7 +73,7 @@ namespace System.Net { SocketAsyncEventArgs args = new SocketAsyncEventArgs (); args.UserToken = this; args.Completed += OnAccept; - sock.AcceptAsync (args); + Accept (sock, args); prefixes = new Hashtable (); unregistered = new Dictionary (); } @@ -82,28 +82,25 @@ namespace System.Net { get { return listener; } } - static void OnAccept (object sender, EventArgs e) + static void Accept (Socket socket, SocketAsyncEventArgs e) { + e.AcceptSocket = null; + var asyn = socket.AcceptAsync(e); + if (!asyn) { + ProcessAccept(e); + } + } + + + static void ProcessAccept (SocketAsyncEventArgs args) { - SocketAsyncEventArgs args = (SocketAsyncEventArgs) e; - EndPointListener epl = (EndPointListener) args.UserToken; Socket accepted = null; - if (args.SocketError == SocketError.Success) { + if (args.SocketError == SocketError.Success) accepted = args.AcceptSocket; - args.AcceptSocket = null; - } - try { - if (epl.sock != null) - epl.sock.AcceptAsync (args); - } catch { - if (accepted != null) { - try { - accepted.Close (); - } catch {} - accepted = null; - } - } + EndPointListener epl = (EndPointListener) args.UserToken; + + Accept (epl.sock, args); if (accepted == null) return; @@ -118,7 +115,12 @@ namespace System.Net { conn.BeginReadRequest (); } - internal void RemoveConnection (HttpConnection conn) + static void OnAccept (object sender, SocketAsyncEventArgs e) + { + ProcessAccept (e); + } + + internal void RemoveConnection (HttpConnection conn) { lock (unregistered) { unregistered.Remove (conn); diff --git a/mcs/class/WebMatrix.Data/Makefile b/mcs/class/WebMatrix.Data/Makefile index 476d3be7c22..2ee3b170c48 100644 --- a/mcs/class/WebMatrix.Data/Makefile +++ b/mcs/class/WebMatrix.Data/Makefile @@ -5,7 +5,8 @@ include ../../build/rules.make LIBRARY = WebMatrix.Data.dll LIB_REFS = System System.Data System.Core System.Configuration -LIB_MCS_FLAGS = -r:$(corlib) -TEST_MCS_FLAGS = -r:System.dll -r:System.Core.dll -r:System.Data.dll -r:Mono.Data.Sqlite.dll -r:Microsoft.CSharp.dll +LIB_MCS_FLAGS = +TEST_MCS_FLAGS = +TEST_LIB_REFS = System System.Core System.Data Mono.Data.Sqlite Microsoft.CSharp include ../../build/library.make diff --git a/mcs/class/WindowsBase/Makefile b/mcs/class/WindowsBase/Makefile index 172a501446e..842c1ed0ebe 100644 --- a/mcs/class/WindowsBase/Makefile +++ b/mcs/class/WindowsBase/Makefile @@ -5,14 +5,15 @@ LIBRARY = WindowsBase.dll LIB_REFS = System System.Xml LIB_MCS_FLAGS = -unsafe -TEST_MCS_FLAGS = -unsafe -r:WindowsBase.dll -r:System.dll -r:System.Xml.dll -r:System.Core.dll +TEST_MCS_FLAGS = -unsafe +TEST_LIB_REFS = WindowsBase System System.Xml System.Core ifeq (2.0, $(FRAMEWORK_VERSION)) LIB_MCS_FLAGS += -d:NET_3_0 endif ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) LIB_REFS += System.Xaml -TEST_MCS_FLAGS += -r:System.Xaml.dll +TEST_LIB_REFS += System.Xaml endif include ../../build/library.make diff --git a/mcs/class/corlib/Assembly/AssemblyInfo.cs b/mcs/class/corlib/Assembly/AssemblyInfo.cs index cf95aee80ea..3c68cceb82b 100644 --- a/mcs/class/corlib/Assembly/AssemblyInfo.cs +++ b/mcs/class/corlib/Assembly/AssemblyInfo.cs @@ -94,4 +94,5 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] #endif +[assembly: InternalsVisibleTo ("Xamarin.BoringTls, PublicKey=002400000480000094000000060200000024000052534131000400001100000099dd12eda85767ae6f06023ee28e711c7e5a212462095c83868c29db75eddf6d8e296e03824c14fedd5f55553fed0b6173be3cc985a4b7f9fb7c83ccff8ba3938563b3d1f45a81122f12a1bcb73edcaad61a8456c7595a6da5184b4dd9d10f011b949ef1391fccfeab1ba62aa51c267ef8bd57ef1b6ba5a4c515d0badb81a78f")] [assembly: Guid ("BED7F4EA-1A96-11D2-8F08-00A0C9A6186D")] diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index aff30966f5a..95b3bc8d337 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -61,14 +61,14 @@ WARNING_ABOUT_DISABLED_WARNING=1635 LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618,$(WARNING_ABOUT_DISABLED_WARNING) -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS) DEFAULT_REFERENCES = -ifdef MOBILE_STATIC -CORLIB_MONO_POSIX_REF = -else -CORLIB_MONO_POSIX_REF = -r:Mono.Posix.dll +TEST_LIB_REFS = System.Core System + +ifndef MOBILE_STATIC +TEST_LIB_REFS += Mono.Posix endif # System.IO/DirectoryInfoTest.cs needs Mono.Posix -TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll -r:System.dll \ +TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe \ -define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%) EXTRA_DISTFILES = \ @@ -108,11 +108,11 @@ $(test_lib): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) $(satellite_assembly1): Test/resources/culture-es-ES.cs Test/resources/Resources.es-ES.resources @mkdir -p es-ES - $(CSCOMPILE) -target:library -r:$(corlib) Test/resources/culture-es-ES.cs -resource:Test/resources/Resources.es-ES.resources -out:$@ + $(CSCOMPILE) -target:library -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll Test/resources/culture-es-ES.cs -resource:Test/resources/Resources.es-ES.resources -out:$@ $(satellite_assembly2): Test/resources/culture-nn-NO.cs Test/resources/Resources.nn-NO.resources @mkdir -p nn-NO - $(CSCOMPILE) -target:library -r:$(corlib) Test/resources/culture-nn-NO.cs -resource:Test/resources/Resources.nn-NO.resources -out:$@ + $(CSCOMPILE) -target:library -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll Test/resources/culture-nn-NO.cs -resource:Test/resources/Resources.nn-NO.resources -out:$@ vtsdir = Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization vtslibs = \ @@ -127,11 +127,13 @@ test-vts: $(vtslibs) $(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersion $(vtsdir)/$(PROFILE)_TestLib/%/Address.dll: $(vtsdir)/VersionTolerantSerializationTestLib/%/Address.cs @mkdir -p $(dir $@) - $(CSCOMPILE) -target:library -r:$(corlib) -warn:0 -out:$@ $^ + $(CSCOMPILE) -target:library -warn:0 -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -out:$@ $^ $(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersions.exe: $(vtsdir)/BinarySerializationOverVersions.cs $(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll $(test_nunit_dep) - $(CSCOMPILE) $(test_nunit_ref) -warn:0 -r:$(corlib) \ + $(CSCOMPILE) $(test_nunit_ref) -warn:0 \ -r:$(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll \ + -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll \ + -r:$(topdir)/class/lib/$(PROFILE)/System.dll \ $(vtsdir)/BinarySerializationOverVersions.cs -out:$@ @cp $(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll $(vtsdir)/$(PROFILE)_TestLib @@ -164,6 +166,9 @@ EXTRA_DISTFILES += \ $(vtsdir)/VersionTolerantSerializationTestLib/6.0/Address.cs \ $(vtsdir)/BinarySerializationOverVersions.cs +EXTRA_DISTFILES += \ + CommonCrypto/Makefile.include + # # Android TimeZoneInfo testing.... # diff --git a/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs b/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs index b97f416a83d..88d713ed8c2 100644 --- a/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs +++ b/mcs/class/corlib/Mono.Interop/ComInteropProxy.cs @@ -68,7 +68,7 @@ namespace Mono.Interop { // called from unmanaged code after .ctor is invoked // we need .ctor to create unmanaged object and thus IUnknown property value - if (FindProxy(com_object.IUnknown) == null) + if (FindProxy (com_object.IUnknown) == null) AddProxy (com_object.IUnknown, this); else System.Threading.Interlocked.Increment (ref ref_count); @@ -82,7 +82,7 @@ namespace Mono.Interop internal ComInteropProxy (IntPtr pUnk, Type t) : base (t) { - com_object = new __ComObject (pUnk); + com_object = new __ComObject (pUnk, this); CacheProxy (); } @@ -108,17 +108,20 @@ namespace Mono.Interop // already known, a cached proxy will be returned. internal static ComInteropProxy CreateProxy (Type t) { - ComInteropProxy proxy = new ComInteropProxy (t); - proxy.com_object.Initialize (t); - - ComInteropProxy cachedProxy = FindProxy (proxy.com_object.IUnknown); + IntPtr iunknown = __ComObject.CreateIUnknown (t); + ComInteropProxy proxy; + ComInteropProxy cachedProxy = FindProxy (iunknown); if (cachedProxy != null) { // check that the COM type of the cached proxy matches // the requested type. See 2nd part of bug #520437. Type cachedType = cachedProxy.com_object.GetType (); if (cachedType != t) throw new InvalidCastException (String.Format ("Unable to cast object of type '{0}' to type '{1}'.", cachedType, t)); - return cachedProxy; + proxy = cachedProxy; + Marshal.Release (iunknown); + } else { + proxy = new ComInteropProxy (t); + proxy.com_object.Initialize (iunknown, proxy); } return proxy; } diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs index bca51601728..c1fbac19528 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs @@ -52,7 +52,7 @@ namespace System.Security.Cryptography.X509Certificates } } - public override string GetSubjectSummary () + public string GetSubjectSummary () { ThrowIfContextInvalid (); IntPtr cfstr = SecCertificateCopySubjectSummary (handle); @@ -107,14 +107,14 @@ namespace System.Security.Cryptography.X509Certificates return FallbackImpl.GetIssuerName (legacyV1Mode); } - public override DateTime GetEffectiveDateString () + public override DateTime GetValidFrom () { - return FallbackImpl.GetEffectiveDateString (); + return FallbackImpl.GetValidFrom (); } - public override DateTime GetExpirationDateString () + public override DateTime GetValidUntil () { - return FallbackImpl.GetExpirationDateString (); + return FallbackImpl.GetValidUntil (); } public override string GetKeyAlgorithm () @@ -170,8 +170,8 @@ namespace System.Security.Cryptography.X509Certificates sb.AppendFormat ("[Subject]{0} {1}{0}{0}", nl, GetSubjectName (false)); sb.AppendFormat ("[Issuer]{0} {1}{0}{0}", nl, GetIssuerName (false)); - sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetEffectiveDateString ()); - sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetExpirationDateString ()); + sb.AppendFormat ("[Not Before]{0} {1}{0}{0}", nl, GetValidFrom ().ToLocalTime ()); + sb.AppendFormat ("[Not After]{0} {1}{0}{0}", nl, GetValidUntil ().ToLocalTime ()); sb.AppendFormat ("[Thumbprint]{0} {1}{0}", nl, X509Helper.ToHexString (GetCertHash ())); sb.Append (nl); diff --git a/mcs/class/corlib/System/TypeSpec.cs b/mcs/class/corlib/System/TypeSpec.cs index 9ad485e07cd..3cf08ae3520 100644 --- a/mcs/class/corlib/System/TypeSpec.cs +++ b/mcs/class/corlib/System/TypeSpec.cs @@ -218,7 +218,7 @@ namespace System { if (typeName == null) throw new ArgumentNullException ("typeName"); - TypeSpec res = Parse (typeName, ref pos, false, false); + TypeSpec res = Parse (typeName, ref pos, false, true); if (pos < typeName.Length) throw new ArgumentException ("Count not parse the whole type name", "typeName"); return res; @@ -287,7 +287,7 @@ namespace System { { Assembly asm = null; if (assemblyResolver == null && typeResolver == null) - return Type.GetType (name.DisplayName, throwOnError, ignoreCase); + return Type.GetType (DisplayFullName, throwOnError, ignoreCase); if (assembly_name != null) { if (assemblyResolver != null) @@ -376,6 +376,12 @@ namespace System { pos = p; } + static void BoundCheck (int idx, string s) + { + if (idx >= s.Length) + throw new ArgumentException ("Invalid generic arguments spec", "typeName"); + } + static TypeIdentifier ParsedTypeIdentifier (string displayName) { return TypeIdentifiers.FromDisplay(displayName); @@ -383,6 +389,17 @@ namespace System { static TypeSpec Parse (string name, ref int p, bool is_recurse, bool allow_aqn) { + // Invariants: + // - On exit p, is updated to pos the current unconsumed character. + // + // - The callee peeks at but does not consume delimiters following + // recurisve parse (so for a recursive call like the args of "Foo[P,Q]" + // we'll return with p either on ',' or on ']'. If the name was aqn'd + // "Foo[[P,assmblystuff],Q]" on return p with be on the ']' just + // after the "assmblystuff") + // + // - If allow_aqn is True, assembly qualification is optional. + // If allow_aqn is False, assembly qualification is prohibited. int pos = p; int name_start; bool in_modifiers = false; @@ -450,18 +467,24 @@ namespace System { data.AddModifier (new PointerSpec(pointer_level)); break; case ',': - if (is_recurse) { + if (is_recurse && allow_aqn) { int end = pos; while (end < name.Length && name [end] != ']') ++end; if (end >= name.Length) throw new ArgumentException ("Unmatched ']' while parsing generic argument assembly name"); data.assembly_name = name.Substring (pos + 1, end - pos - 1).Trim (); - p = end + 1; + p = end; return data; } - data.assembly_name = name.Substring (pos + 1).Trim (); - pos = name.Length; + if (is_recurse) { + p = pos; + return data; + } + if (allow_aqn) { + data.assembly_name = name.Substring (pos + 1).Trim (); + pos = name.Length; + } break; case '[': if (data.is_byref) @@ -482,11 +505,17 @@ namespace System { if (aqn) ++pos; //skip '[' to the start of the type args.Add (Parse (name, ref pos, true, aqn)); - if (pos >= name.Length) - throw new ArgumentException ("Invalid generic arguments spec", "typeName"); + BoundCheck (pos, name); + if (aqn) { + if (name [pos] == ']') + ++pos; + else + throw new ArgumentException ("Unclosed assembly-qualified type name at " + name[pos], "typeName"); + BoundCheck (pos, name); +} if (name [pos] == ']') - break; + break; if (name [pos] == ',') ++pos; // skip ',' to the start of the next arg else @@ -523,7 +552,7 @@ namespace System { break; case ']': if (is_recurse) { - p = pos + 1; + p = pos; return data; } throw new ArgumentException ("Unmatched ']'", "typeName"); diff --git a/mcs/class/corlib/System/__ComObject.cs b/mcs/class/corlib/System/__ComObject.cs index a772d0fef97..2e7e6066af5 100644 --- a/mcs/class/corlib/System/__ComObject.cs +++ b/mcs/class/corlib/System/__ComObject.cs @@ -63,6 +63,9 @@ namespace System #endregion #pragma warning restore 169 + // keep a reference to the proxy so it doesn't get garbage collected before the RCW + ComInteropProxy proxy; + [MethodImplAttribute (MethodImplOptions.InternalCall)] internal static extern __ComObject CreateRCW (Type t); @@ -71,10 +74,13 @@ namespace System ~__ComObject () { - if (synchronization_context != null) - synchronization_context.Post ((state) => ReleaseInterfaces (), this); - else - ReleaseInterfaces (); + if (hash_table != IntPtr.Zero) { + if (synchronization_context != null) + synchronization_context.Post ((state) => ReleaseInterfaces (), this); + else + ReleaseInterfaces (); + } + proxy = null; } public __ComObject () @@ -86,14 +92,22 @@ namespace System Initialize (t); } - internal __ComObject (IntPtr pItf) + internal __ComObject (IntPtr pItf, ComInteropProxy p) { + proxy = p; InitializeApartmentDetails (); Guid iid = IID_IUnknown; int hr = Marshal.QueryInterface (pItf, ref iid, out iunknown); Marshal.ThrowExceptionForHR (hr); } + internal void Initialize (IntPtr pUnk, ComInteropProxy p) + { + proxy = p; + InitializeApartmentDetails (); + iunknown = pUnk; + } + internal void Initialize (Type t) { InitializeApartmentDetails (); @@ -101,8 +115,14 @@ namespace System if (iunknown != IntPtr.Zero) return; + iunknown = CreateIUnknown (t); + } + + internal static IntPtr CreateIUnknown(Type t) + { System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (t.TypeHandle); - + + IntPtr iunknown; ObjectCreationDelegate ocd = ExtensibleClassFactory.GetObjectCreationCallback (t); if (ocd != null) { iunknown = ocd (IntPtr.Zero); @@ -113,6 +133,8 @@ namespace System int hr = CoCreateInstance (GetCLSID (t), IntPtr.Zero, 0x1 | 0x4 | 0x10, IID_IUnknown, out iunknown); Marshal.ThrowExceptionForHR (hr); } + + return iunknown; } private void InitializeApartmentDetails () diff --git a/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs b/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs index 9c566b4bafc..900ffec6e7c 100644 --- a/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs @@ -35,6 +35,7 @@ using System.Diagnostics; namespace MonoTests.System.Runtime.ExceptionServices { [TestFixture] + [Category ("BitcodeNotWorking")] public class ExceptionDispatchInfoTest { [Test] diff --git a/mcs/class/corlib/Test/System/TypeTest.cs b/mcs/class/corlib/Test/System/TypeTest.cs index 4279cee8ec9..cbf44c17f35 100644 --- a/mcs/class/corlib/Test/System/TypeTest.cs +++ b/mcs/class/corlib/Test/System/TypeTest.cs @@ -4059,17 +4059,27 @@ namespace MonoTests.System } catch (ArgumentNullException) {} } - void MustAE (string tname) { + void MustAE_general (string tname, Func getType) { try { - var res = Type.GetType (tname, name => { - return Assembly.Load (name); - },(asm,name,ignore) => { - return (object)asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore); - }, true, false); + var res = getType (tname); Assert.Fail (tname); } catch (ArgumentException) {} } + void MustAE (string typename) { + MustAE_general (typename, tname => { + return Type.GetType (tname, name => { + return Assembly.Load (name); + },(asm,name,ignore) => { + return (object)asm == null ? Type.GetType (name, false, ignore) : asm.GetType (name, false, ignore); + }, true, false); + }); + } + + void MustAEnn (string typename) { + MustAE_general (typename, tname => Type.GetType (tname, null, null)); + } + void MustFNFE (string tname) { try { var res = Type.GetType (tname, name => { @@ -4152,6 +4162,56 @@ namespace MonoTests.System Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32"), null, "#15"); } + [Test] + public void GetTypeNullDelegatesParseGenericCorrectly () { + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1", null, null), typeof (Foo<>), "#1"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32]", null, null), typeof (Foo), "#2"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[[System.Int32]]", null, null), typeof (Foo), "#3"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32][]", null, null), typeof (Foo[]), "#4"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32][,]", null, null), typeof (Foo[,]), "#5"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[]", null, null), typeof (Foo<>).MakeArrayType(), "#6"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[,]", null, null), typeof (Foo<>).MakeArrayType (2), "#7"); + Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[][]", null, null), typeof (Foo<>).MakeArrayType ().MakeArrayType (), "#8"); + + MustAEnn ("MonoTests.System.Foo`1[][System.Int32]"); + MustAEnn ("MonoTests.System.Foo`1["); + MustAEnn ("MonoTests.System.Foo`1[["); + MustAEnn ("MonoTests.System.Foo`1[[]"); + MustAEnn ("MonoTests.System.Foo`1[,"); + MustAEnn ("MonoTests.System.Foo`1[*"); + MustAEnn ("MonoTests.System.Foo`1[System.Int32"); + } + + Dictionary MakeDictHelper (T[] arr) { + return new Dictionary(); + } + + [Test] + public void GetTypeAnonymousParseCorrectly () { + var x = new { X = 1 }; + var a = new [] { x }; + var d = MakeDictHelper (a); + + var x_type = x.GetType (); + var a_type = a.GetType (); + var d_type = d.GetType (); + + Assert.AreEqual (Type.GetType (x_type.ToString ()), x_type, "#1"); + Assert.AreEqual (Type.GetType (x_type.ToString (), null, null), x_type, "#2"); + Assert.AreEqual (Type.GetType (a_type.ToString ()), a_type, "#3"); + Assert.AreEqual (Type.GetType (a_type.ToString (), null, null), a_type, "#4"); + Assert.AreEqual (Type.GetType (d_type.ToString ()), d_type, "#5"); + Assert.AreEqual (Type.GetType (d_type.ToString (), null, null), d_type, "#6"); + + Assert.AreEqual (Type.GetType (x_type.FullName), x_type, "#7"); + Assert.AreEqual (Type.GetType (x_type.FullName, null, null), x_type, "#8"); + Assert.AreEqual (Type.GetType (a_type.FullName), a_type, "#9"); + Assert.AreEqual (Type.GetType (a_type.FullName, null, null), a_type, "#10"); + Assert.AreEqual (Type.GetType (d_type.FullName), d_type, "#11"); + Assert.AreEqual (Type.GetType (d_type.FullName, null, null), d_type, "#12"); + + } + #if !MONOTOUCH && !MOBILE_STATIC [Test] [Category ("AndroidNotWorking")] // requires symbol writer diff --git a/mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources b/mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources index da77893bcc5..e802a034dd6 100644 --- a/mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources @@ -1 +1,27 @@ #include corlib.dll.sources +CommonCrypto/CommonCrypto.cs +CommonCrypto/CryptorTransform.cs +CommonCrypto/FastCryptorTransform.cs +CommonCrypto/CorlibExtras.cs +CommonCrypto/MD5CryptoServiceProvider.g.cs +CommonCrypto/SHA1CryptoServiceProvider.g.cs +CommonCrypto/SHA1CryptoServiceProvider.g.cs +CommonCrypto/SHA1Managed.g.cs +CommonCrypto/SHA256Managed.g.cs +CommonCrypto/SHA384Managed.g.cs +CommonCrypto/SHA512Managed.g.cs +CommonCrypto/TripleDESCryptoServiceProvider.g.cs +CommonCrypto/DESCryptoServiceProvider.g.cs +CommonCrypto/RC2CryptoServiceProvider.g.cs +CommonCrypto/RijndaelManaged.cs +CommonCrypto/SecRandom.cs +CommonCrypto/RC4CommonCrypto.cs +CommonCrypto/MD2Managed.g.cs +CommonCrypto/MD4Managed.g.cs +System/Environment.iOS.cs +System/Guid.MonoTouch.cs +System/NotSupportedException.iOS.cs +CoreFoundation/CFHelpers.cs +System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs +System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +System.Text/EncodingHelper.MonoTouch.cs diff --git a/mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources b/mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources index da77893bcc5..e802a034dd6 100644 --- a/mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources +++ b/mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources @@ -1 +1,27 @@ #include corlib.dll.sources +CommonCrypto/CommonCrypto.cs +CommonCrypto/CryptorTransform.cs +CommonCrypto/FastCryptorTransform.cs +CommonCrypto/CorlibExtras.cs +CommonCrypto/MD5CryptoServiceProvider.g.cs +CommonCrypto/SHA1CryptoServiceProvider.g.cs +CommonCrypto/SHA1CryptoServiceProvider.g.cs +CommonCrypto/SHA1Managed.g.cs +CommonCrypto/SHA256Managed.g.cs +CommonCrypto/SHA384Managed.g.cs +CommonCrypto/SHA512Managed.g.cs +CommonCrypto/TripleDESCryptoServiceProvider.g.cs +CommonCrypto/DESCryptoServiceProvider.g.cs +CommonCrypto/RC2CryptoServiceProvider.g.cs +CommonCrypto/RijndaelManaged.cs +CommonCrypto/SecRandom.cs +CommonCrypto/RC4CommonCrypto.cs +CommonCrypto/MD2Managed.g.cs +CommonCrypto/MD4Managed.g.cs +System/Environment.iOS.cs +System/Guid.MonoTouch.cs +System/NotSupportedException.iOS.cs +CoreFoundation/CFHelpers.cs +System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs +System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs +System.Text/EncodingHelper.MonoTouch.cs diff --git a/mcs/class/monodoc/Makefile b/mcs/class/monodoc/Makefile index 1c85d9abac6..50f84cfd617 100644 --- a/mcs/class/monodoc/Makefile +++ b/mcs/class/monodoc/Makefile @@ -111,11 +111,12 @@ LIB_MCS_FLAGS = \ /resource:Resources/mono-ecma.xsl,mono-ecma.xsl \ /resource:Resources/toc-html.xsl,toc-html.xsl \ $(IMAGE_RESOURCE_COMMAND) \ - /r:$(corlib) + /publicsign CLEAN_FILES += $(the_lib).config -TEST_MCS_FLAGS = /r:System.dll /r:System.Core.dll /r:System.Xml.dll +TEST_MCS_FLAGS = +TEST_LIB_REFS = System System.Core System.Xml DOC_SOURCE_DIRS = \ ../../docs \ diff --git a/mcs/errors/Makefile b/mcs/errors/Makefile index f30dae6f269..2c37329cd15 100644 --- a/mcs/errors/Makefile +++ b/mcs/errors/Makefile @@ -83,6 +83,36 @@ dist-local: dist-default csproj-local install-local uninstall-local: +CS0029-26-lib.dll : CS0029-26-lib.cs + $(CSCOMPILE) /target:library /publicsign /out:$@ $< + +CS0266-25-lib.dll: CS0266-25-lib.cs + $(CSCOMPILE) /target:library /r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll /out:$@ $< + +dlls/first/CS1701-lib.dll: dlls/first/CS1701-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/first/CS1702-lib.dll: dlls/first/CS1702-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/first/CS1703-lib.dll: dlls/first/CS1703-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/first/CS1705-lib.dll: dlls/first/CS1705-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/second/CS1701-lib.dll: dlls/second/CS1701-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/second/CS1702-lib.dll: dlls/second/CS1702-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/second/CS1703-lib.dll: dlls/second/CS1703-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + +dlls/second/CS1705-lib.dll: dlls/second/CS1705-lib.cs + $(CSCOMPILE) /target:library /warn:0 /publicsign /out:$@ $< + CS1701-lib.dll : CS1701-lib.cs $(CSCOMPILE) /target:library /warn:0 /r:dlls/first/CS1701-lib.dll /out:$@ $< diff --git a/mcs/mcs/Makefile b/mcs/mcs/Makefile index 3a3e789e0b0..01285712a2b 100644 --- a/mcs/mcs/Makefile +++ b/mcs/mcs/Makefile @@ -12,19 +12,21 @@ EXTRA_DISTFILES = \ cs-parser.jay \ mcs.exe.sources -LIB_REFS = System System.Core System.Xml - ifeq (basic, $(PROFILE)) +LOCAL_MCS_FLAGS += -r:System.dll -r:System.Core.dll -r:System.Xml.dll -debug + PROGRAM = basic.exe sourcefile = mcs.exe.sources else +LIB_REFS = System System.Core System.Xml + PROGRAM_USE_INTERMEDIATE_FILE = true PROGRAM = mcs.exe the_libdir = $(topdir)/class/lib/build/ -LOCAL_MCS_FLAGS += -lib:$(topdir)/class/lib/build -debug +LOCAL_MCS_FLAGS += -debug endif -LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE -r:System.Core.dll -r:System.Xml.dll +LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE ifndef NO_THREAD_ABORT REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_THREAD_ABORT diff --git a/mcs/nunit24/ClientUtilities/util/Makefile b/mcs/nunit24/ClientUtilities/util/Makefile index fe0910186fe..7a291b287a7 100644 --- a/mcs/nunit24/ClientUtilities/util/Makefile +++ b/mcs/nunit24/ClientUtilities/util/Makefile @@ -5,11 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit.util.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LOCAL_MCS_FLAGS= \ - /resource:Transform.resources,NUnit.Util.Transform.resources \ - -r:nunit.core.dll -r:nunit.core.interfaces.dll -r:System.dll \ - -r:System.Xml.dll -r:System.Runtime.Remoting.dll \ - /d:MONO /d:StronglyNamedAssembly -warn:1 +LOCAL_MCS_FLAGS= /resource:Transform.resources,NUnit.Util.Transform.resources /d:MONO /d:StronglyNamedAssembly /publicsign -warn:1 +LIB_REFS = nunit.core nunit.core.interfaces System System.Xml System.Runtime.Remoting NO_TEST = yo RESX_RES = Transform.resources diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile b/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile index b09931ffef6..72ce02dc429 100644 --- a/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile +++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile @@ -3,9 +3,9 @@ SUBDIRS = include ../../../build/rules.make PROGRAM = nunit-console.exe -LOCAL_MCS_FLAGS = \ - /r:nunit.framework.dll /r:nunit.util.dll /r:nunit.core.dll \ - /r:nunit-console-runner.dll +LOCAL_MCS_FLAGS = +LIB_REFS = nunit.framework nunit.util nunit.core nunit-console-runner + EXTRA_DISTFILES = App.ico \ nunit-console.exe.csproj \ nunit-console.exe_VS2005.csproj \ diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/Makefile b/mcs/nunit24/ConsoleRunner/nunit-console/Makefile index 52fe21bf61b..b72165aba26 100644 --- a/mcs/nunit24/ConsoleRunner/nunit-console/Makefile +++ b/mcs/nunit24/ConsoleRunner/nunit-console/Makefile @@ -5,10 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit-console-runner.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LOCAL_MCS_FLAGS= \ - -r:nunit.core.dll -r:nunit.core.interfaces.dll -r:nunit.util.dll \ - -r:System.dll -r:System.Xml.dll \ - /d:MONO /d:StronglyNamedAssembly +LOCAL_MCS_FLAGS= /d:MONO /d:StronglyNamedAssembly /publicsign +LIB_REFS = nunit.core nunit.core.interfaces nunit.util System System.Xml NO_TEST = yo EXTRA_DISTFILES = nunit-console.csproj nunit-console_VS2005.csproj diff --git a/mcs/nunit24/NUnitCore/core/Makefile b/mcs/nunit24/NUnitCore/core/Makefile index ac3b0146fbf..83a2e01bd0e 100644 --- a/mcs/nunit24/NUnitCore/core/Makefile +++ b/mcs/nunit24/NUnitCore/core/Makefile @@ -5,7 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit.core.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LOCAL_MCS_FLAGS= -r:nunit.framework.dll -r:nunit.core.interfaces.dll -r:System.dll /d:StronglyNamedAssembly -warn:1 +LOCAL_MCS_FLAGS = /d:StronglyNamedAssembly -warn:1 /publicsign +LIB_REFS = nunit.framework nunit.core.interfaces System NO_TEST = yo EXTRA_DISTFILES = nunit.core.dll.csproj nunit.core.dll_VS2005.csproj diff --git a/mcs/nunit24/NUnitCore/interfaces/Makefile b/mcs/nunit24/NUnitCore/interfaces/Makefile index e9ddcc79faf..592ce5bc160 100644 --- a/mcs/nunit24/NUnitCore/interfaces/Makefile +++ b/mcs/nunit24/NUnitCore/interfaces/Makefile @@ -5,7 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit.core.interfaces.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LOCAL_MCS_FLAGS= -debug -r:nunit.framework.dll -r:System.dll /d:StronglyNamedAssembly +LOCAL_MCS_FLAGS= /d:StronglyNamedAssembly /publicsign +LIB_REFS = nunit.framework System NO_TEST = yo EXTRA_DISTFILES = nunit.core.interfaces.dll.csproj nunit.core.interfaces.dll_VS2005.csproj diff --git a/mcs/nunit24/NUnitExtensions/core/Makefile b/mcs/nunit24/NUnitExtensions/core/Makefile index 48f8ccf8f6f..9e3ba945a67 100644 --- a/mcs/nunit24/NUnitExtensions/core/Makefile +++ b/mcs/nunit24/NUnitExtensions/core/Makefile @@ -5,10 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit.core.extensions.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LIB_MCS_FLAGS = \ - -debug \ - /r:nunit.core.dll /r:nunit.core.interfaces.dll \ - /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly +LIB_MCS_FLAGS = /d:StronglyNamedAssembly /publicsign +LIB_REFS = nunit.core nunit.core.interfaces System.Xml System NO_TEST = yo EXTRA_DISTFILES = \ diff --git a/mcs/nunit24/NUnitExtensions/framework/Makefile b/mcs/nunit24/NUnitExtensions/framework/Makefile index 81d6b15439d..7cd03514e37 100644 --- a/mcs/nunit24/NUnitExtensions/framework/Makefile +++ b/mcs/nunit24/NUnitExtensions/framework/Makefile @@ -5,7 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit.framework.extensions.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LIB_MCS_FLAGS = -debug /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly +LIB_MCS_FLAGS = /d:StronglyNamedAssembly /publicsign +LIB_REFS = System.Xml System NO_TEST = yo EXTRA_DISTFILES = \ diff --git a/mcs/nunit24/NUnitFramework/framework/Makefile b/mcs/nunit24/NUnitFramework/framework/Makefile index 157b0b4d578..43076d8c855 100644 --- a/mcs/nunit24/NUnitFramework/framework/Makefile +++ b/mcs/nunit24/NUnitFramework/framework/Makefile @@ -6,7 +6,8 @@ LIBRARY = NUnit.Framework.dll LIBRARY_NAME = nunit.framework.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LIB_MCS_FLAGS = /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly -warn:1 +LIB_MCS_FLAGS = /d:StronglyNamedAssembly -warn:1 /publicsign +LIB_REFS = System.Xml System NO_TEST = yo EXTRA_DISTFILES = \ diff --git a/mcs/nunit24/NUnitMocks/mocks/Makefile b/mcs/nunit24/NUnitMocks/mocks/Makefile index b9769c4777d..0c6ab3ca272 100644 --- a/mcs/nunit24/NUnitMocks/mocks/Makefile +++ b/mcs/nunit24/NUnitMocks/mocks/Makefile @@ -5,7 +5,8 @@ include ../../../build/rules.make LIBRARY = nunit.mocks.dll LIBRARY_SNK = $(topdir)/nunit24/nunit.snk -LOCAL_MCS_FLAGS= -debug -r:nunit.framework.dll -r:System.dll /d:StronglyNamedAssembly +LOCAL_MCS_FLAGS= /d:StronglyNamedAssembly /publicsign +LIB_REFS = nunit.framework System NO_TEST = yo EXTRA_DISTFILES = \ diff --git a/mcs/tools/Makefile b/mcs/tools/Makefile index 418bcdd85f5..d95558b3083 100644 --- a/mcs/tools/Makefile +++ b/mcs/tools/Makefile @@ -16,6 +16,7 @@ net_4_5_dirs := \ xbuild \ csharp \ corcompare \ + mono-api-html \ compiler-tester \ mono-xmltool \ mono-shlib-cop \ diff --git a/mcs/tools/al/Al.cs b/mcs/tools/al/Al.cs index caf1a67a5b2..bdc741144ea 100644 --- a/mcs/tools/al/Al.cs +++ b/mcs/tools/al/Al.cs @@ -12,6 +12,7 @@ using System; using System.Globalization; using System.IO; using System.Collections; +using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; using System.Security.Cryptography; @@ -19,6 +20,7 @@ using System.Text; using System.Configuration.Assemblies; using Mono.Security.Cryptography; +using IKR = IKVM.Reflection; namespace Mono.AssemblyLinker { @@ -591,46 +593,8 @@ namespace Mono.AssemblyLinker * Emit Manifest * */ - if (isTemplateFile) { - // LAMESPEC: according to MSDN, the template assembly must have a - // strong name but this is not enforced - Assembly assembly = Assembly.LoadFrom (templateFile); - - // inherit signing related settings from template, but do not - // override command-line options - object [] attrs = assembly.GetCustomAttributes (true); - foreach (object o in attrs) { - if (o is AssemblyKeyFileAttribute) { - if (keyfile != null) - // ignore if specified on command line - continue; - AssemblyKeyFileAttribute keyFileAttr = (AssemblyKeyFileAttribute) o; - // ignore null or zero-length keyfile - if (keyFileAttr.KeyFile == null || keyFileAttr.KeyFile.Length == 0) - continue; - keyfile = Path.Combine (Path.GetDirectoryName(templateFile), - keyFileAttr.KeyFile); - } else if (o is AssemblyDelaySignAttribute) { - if (delaysign != DelaySign.NotSet) - // ignore if specified on command line - continue; - AssemblyDelaySignAttribute delaySignAttr = (AssemblyDelaySignAttribute) o; - delaysign = delaySignAttr.DelaySign ? DelaySign.Yes : - DelaySign.No; - } else if (o is AssemblyKeyNameAttribute) { - if (keyname != null) - // ignore if specified on command line - continue; - AssemblyKeyNameAttribute keynameAttr = (AssemblyKeyNameAttribute) o; - // ignore null or zero-length keyname - if (keynameAttr.KeyName == null || keynameAttr.KeyName.Length == 0) - continue; - keyname = keynameAttr.KeyName; - } - } - aname.Version = assembly.GetName().Version; - aname.HashAlgorithm = assembly.GetName().HashAlgorithm; - } + if (isTemplateFile) + aname = ReadCustomAttributesFromTemplateFile (templateFile, aname); SetKeyPair (aname); @@ -765,6 +729,85 @@ namespace Mono.AssemblyLinker } } + private AssemblyName ReadCustomAttributesFromTemplateFile (string templateFile, AssemblyName aname) + { + // LAMESPEC: according to MSDN, the template assembly must have a + // strong name but this is not enforced + const IKR.UniverseOptions options = IKR.UniverseOptions.MetadataOnly; + + var universe = new IKR.Universe (options); + var asm = universe.LoadFile (templateFile); + + // Create missing assemblies, we don't want to load them! + // Code taken from ikdasm + var names = new HashSet (); + IKR.AssemblyName[] assembly_refs = asm.ManifestModule.__GetReferencedAssemblies (); + + var resolved_assemblies = new IKR.Assembly [assembly_refs.Length]; + for (int i = 0; i < resolved_assemblies.Length; i++) { + string name = assembly_refs [i].Name; + + while (names.Contains (name)) { + name = name + "_" + i; + } + names.Add (name); + resolved_assemblies [i] = universe.CreateMissingAssembly (assembly_refs [i].FullName); + } + asm.ManifestModule.__ResolveReferencedAssemblies (resolved_assemblies); + + foreach (var attr_data in asm.__GetCustomAttributes (null, false)) { + string asm_name = attr_data.AttributeType.Assembly.GetName ().Name; + if (asm_name != "mscorlib") + continue; + + switch (attr_data.AttributeType.FullName) { + case "System.Reflection.AssemblyKeyFileAttribute": { + if (keyfile != null) + // ignore if specified on command line + continue; + + // / AssemblyKeyFileAttribute .ctor(string keyFile) + string key_file_value = (string) attr_data.ConstructorArguments [0].Value; + + if (!String.IsNullOrEmpty (key_file_value)) + keyfile = Path.Combine (Path.GetDirectoryName (templateFile), key_file_value); + } + break; + + case "System.Reflection.AssemblyDelaySignAttribute": { + if (delaysign != DelaySign.NotSet) + // ignore if specified on command line + continue; + + // AssemblyDelaySignAttribute .ctor(bool delaySign) + bool delay_sign_value = (bool) attr_data.ConstructorArguments [0].Value; + delaysign = delay_sign_value ? DelaySign.Yes : DelaySign.No; + } + break; + + case "System.Reflection.AssemblyKeyNameAttribute": { + if (keyname != null) + // ignore if specified on command line + continue; + + // AssemblyKeyNameAttribute .ctor(string keyName) + string key_name_value = (string) attr_data.ConstructorArguments [0].Value; + + // ignore null or zero-length keyname + if (!String.IsNullOrEmpty (key_name_value)) + keyname = key_name_value; + } + break; + } + } + + var asm_name_for_template_file = asm.GetName (); + aname.Version = asm_name_for_template_file.Version; + aname.HashAlgorithm = asm_name_for_template_file.HashAlgorithm; + + return aname; + } + private void LoadArgs (string file, ArrayList args) { StreamReader f = null; string line; diff --git a/mcs/tools/al/Makefile b/mcs/tools/al/Makefile index a4505c123f5..d2cea54c02e 100644 --- a/mcs/tools/al/Makefile +++ b/mcs/tools/al/Makefile @@ -2,7 +2,8 @@ thisdir = tools/al SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:Mono.Security.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System System.Core Mono.Security System.Security Mono.CompilerServices.SymbolWriter PROGRAM = al.exe CLEAN_FILES = al.exe al.exe.mdb diff --git a/mcs/tools/al/al.exe.sources b/mcs/tools/al/al.exe.sources index 08f674c872a..96d3be17ba5 100644 --- a/mcs/tools/al/al.exe.sources +++ b/mcs/tools/al/al.exe.sources @@ -1,2 +1,9 @@ Al.cs ../../build/common/Consts.cs +../../../external/ikvm/reflect/*.cs +../../../external/ikvm/reflect/Emit/*.cs +../../../external/ikvm/reflect/Metadata/*.cs +../../../external/ikvm/reflect/Reader/*.cs +../../../external/ikvm/reflect/Writer/*.cs +../../../external/ikvm/reflect/Impl/*.cs +../../../external/ikvm/reflect/Properties/*.cs diff --git a/mcs/tools/browsercaps-updater/Makefile b/mcs/tools/browsercaps-updater/Makefile index a39c748e5e6..6d2df98702d 100644 --- a/mcs/tools/browsercaps-updater/Makefile +++ b/mcs/tools/browsercaps-updater/Makefile @@ -2,7 +2,8 @@ thisdir = tools/browsercaps-updater SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System PROGRAM = browsercaps-updater.exe diff --git a/mcs/tools/cccheck/Makefile b/mcs/tools/cccheck/Makefile index 71935aebb6c..52d624ffed4 100644 --- a/mcs/tools/cccheck/Makefile +++ b/mcs/tools/cccheck/Makefile @@ -4,6 +4,7 @@ include ../../build/rules.make PROGRAM = cccheck.exe -LOCAL_MCS_FLAGS = -r:Mono.CodeContracts.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = Mono.CodeContracts System include ../../build/executable.make diff --git a/mcs/tools/ccrewrite/Makefile b/mcs/tools/ccrewrite/Makefile index bac67d3de8a..00e711b2795 100644 --- a/mcs/tools/ccrewrite/Makefile +++ b/mcs/tools/ccrewrite/Makefile @@ -4,6 +4,7 @@ include ../../build/rules.make PROGRAM = ccrewrite.exe -LOCAL_MCS_FLAGS = -r:Mono.CodeContracts.dll -r:System.dll -r:System.Core.dll +LOCAL_MCS_FLAGS = +LIB_REFS = Mono.CodeContracts System System.Core include ../../build/executable.make diff --git a/mcs/tools/cil-stringreplacer/Makefile b/mcs/tools/cil-stringreplacer/Makefile index 9b07560ab39..a6708e2d371 100644 --- a/mcs/tools/cil-stringreplacer/Makefile +++ b/mcs/tools/cil-stringreplacer/Makefile @@ -5,6 +5,6 @@ include ../../build/rules.make PROGRAM = cil-stringreplacer.exe NO_INSTALL = yes -LOCAL_MCS_FLAGS = -r:System.dll -r:Mono.Cecil.dll +LIB_REFS = System Mono.Cecil include ../../build/executable.make diff --git a/mcs/tools/cil-strip/Makefile b/mcs/tools/cil-strip/Makefile index 6c3154589a6..e84d78325e6 100644 --- a/mcs/tools/cil-strip/Makefile +++ b/mcs/tools/cil-strip/Makefile @@ -2,7 +2,8 @@ thisdir = tools/cil-strip SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System PROGRAM = mono-cil-strip.exe diff --git a/mcs/tools/compiler-tester/Makefile b/mcs/tools/compiler-tester/Makefile index 2e0ec2bc8df..b3c2a5a450a 100644 --- a/mcs/tools/compiler-tester/Makefile +++ b/mcs/tools/compiler-tester/Makefile @@ -5,6 +5,7 @@ include ../../build/rules.make PROGRAM = compiler-tester.exe NO_INSTALL = yes -LOCAL_MCS_FLAGS = -r:System.dll -r:System.Core.dll -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System System.Core System.Xml include $(topdir)/build/executable.make diff --git a/mcs/tools/corcompare/Makefile b/mcs/tools/corcompare/Makefile index 760f9cf5045..2f4a664387a 100644 --- a/mcs/tools/corcompare/Makefile +++ b/mcs/tools/corcompare/Makefile @@ -2,63 +2,9 @@ thisdir = tools/corcompare SUBDIRS = include ../../build/rules.make -ALL_PROGRAMS = mono-api-info.exe mono-api-html.exe +LIB_REFS = Mono.Cecil System.Xml System.Core System +LOCAL_MCS_FLAGS = -PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION) +PROGRAM = mono-api-info.exe -APIINFO_SOURCES = \ - mono-api-info.cs \ - AssemblyResolver.cs \ - Util.cs \ - WellFormedXmlWriter.cs \ - ../../class/Mono.Options/Mono.Options/Options.cs - -APIHTML_SOURCES = \ - mono-api-html/ApiChange.cs \ - mono-api-html/ApiDiff.cs \ - mono-api-html/AssemblyComparer.cs \ - mono-api-html/ClassComparer.cs \ - mono-api-html/Comparer.cs \ - mono-api-html/ConstructorComparer.cs \ - mono-api-html/EventComparer.cs \ - mono-api-html/FieldComparer.cs \ - mono-api-html/Helpers.cs \ - mono-api-html/InterfaceComparer.cs \ - mono-api-html/MemberComparer.cs \ - mono-api-html/MethodComparer.cs \ - mono-api-html/NamespaceComparer.cs \ - mono-api-html/PropertyComparer.cs \ - ../../class/Mono.Options/Mono.Options/Options.cs - - -DISTFILES= $(APIINFO_SOURCES) $(APIHTML_SOURCES) - -all-local: $(ALL_PROGRAMS) - -csproj-local doc-update-local: - -install-local: $(ALL_PROGRAMS) - $(MKINSTALLDIRS) $(DESTDIR)$(PROGRAM_INSTALL_DIR) - for i in $(ALL_PROGRAMS) ; do \ - $(INSTALL_BIN) $$i $(DESTDIR)$(PROGRAM_INSTALL_DIR) ; \ - done - -uninstall-local: - for i in $(ALL_PROGRAMS) ; do \ - rm -f $(DESTDIR)$(PROGRAM_INSTALL_DIR)/`basename $$i` ; \ - done - -test-local: - -run-test-local run-test-ondotnet-local: - -clean-local: - rm -f *.exe *.pdb - -dist-local: dist-default - -mono-api-info.exe: $(APIINFO_SOURCES) - $(CSCOMPILE) -r:Mono.Cecil.dll -r:System.Xml.dll -r:System.Core.dll -r:System.dll -out:$@ $^ - -mono-api-html.exe: $(APIHTML_SOURCES) - $(CSCOMPILE) -r:Mono.Cecil.dll -r:System.Xml.dll -r:System.Core.dll -r:System.dll -r:System.Xml.Linq.dll -out:$@ $^ +include ../../build/executable.make diff --git a/mcs/tools/corcompare/mono-api-html/ApiChange.cs b/mcs/tools/corcompare/mono-api-html/ApiChange.cs deleted file mode 100644 index 1d902cacfad..00000000000 --- a/mcs/tools/corcompare/mono-api-html/ApiChange.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff -{ - public class ApiChange - { - public string Header; - public StringBuilder Member = new StringBuilder (); - public bool Breaking; - public bool AnyChange; - public bool HasIgnoredChanges; - - public ApiChange Append (string text) - { - Member.Append (text); - return this; - } - - public ApiChange AppendAdded (string text, bool breaking = false) - { - Member.Append (""); - Member.Append (text); - Member.Append (""); - Breaking |= breaking; - AnyChange = true; - return this; - } - - public ApiChange AppendRemoved (string text, bool breaking = true) - { - Member.Append (""); - Member.Append (text); - Member.Append (""); - Breaking |= breaking; - AnyChange = true; - return this; - } - - public ApiChange AppendModified (string old, string @new, bool breaking = true) - { - if (old.Length > 0) - AppendRemoved (old, breaking); - if (old.Length > 0 && @new.Length > 0) - Append (" "); - if (@new.Length > 0) - AppendAdded (@new); - Breaking |= breaking; - AnyChange = true; - return this; - } - } - - public class ApiChanges : Dictionary> { - public void Add (XElement source, XElement target, ApiChange change) - { - if (!change.AnyChange) { - // This is most likely because the rendering doesn't take into account something that's different (solution: fix rendering). - if (!change.HasIgnoredChanges) { - var isField = source.Name.LocalName == "field"; - if (isField) { - Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetFieldAttributes (), target.GetFieldAttributes ()); - } else { - Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetMethodAttributes (), target.GetMethodAttributes ()); - } - } - return; - } - - List list; - if (!TryGetValue (change.Header, out list)) { - list = new List (); - base.Add (change.Header, list); - } - list.Add (change); - } - } -} - diff --git a/mcs/tools/corcompare/mono-api-html/ApiDiff.cs b/mcs/tools/corcompare/mono-api-html/ApiDiff.cs deleted file mode 100644 index 8fe27844852..00000000000 --- a/mcs/tools/corcompare/mono-api-html/ApiDiff.cs +++ /dev/null @@ -1,277 +0,0 @@ -// -// The main differences with mono-api-diff are: -// * this tool directly produce HTML similar to gdiff.sh used for Xamarin.iOS -// * this tool reports changes in an "evolutionary" way, not in a breaking way, -// i.e. it does not assume the source assembly is right (but simply older) -// * the diff .xml output was not easy to convert back into the HTML format -// that gdiff.sh produced -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -using Mono.Options; - -namespace Xamarin.ApiDiff { - - public static class State { - static TextWriter output; - - public static TextWriter Output { - get { - if (output == null) - output = Console.Out; - return output; - } - set { output = value; } - } - - public static string Assembly { get; set; } - public static string Namespace { get; set; } - public static string Type { get; set; } - public static string BaseType { get; set; } - - public static int Indent { get; set; } - - static List ignoreAdded = new List (); - public static List IgnoreAdded { - get { return ignoreAdded; } - } - - static List ignoreNew = new List (); - public static List IgnoreNew { - get { return ignoreNew; } - } - - static List ignoreRemoved = new List (); - public static List IgnoreRemoved { - get { return ignoreRemoved; } - } - - public static bool IgnoreParameterNameChanges { get; set; } - public static bool IgnoreVirtualChanges { get; set; } - public static bool IgnoreAddedPropertySetters { get; set; } - - public static bool Lax; - public static bool Colorize = true; - } - - class Program { - - public static int Main (string[] args) - { - var showHelp = false; - string diff = null; - List extra = null; - - var options = new OptionSet { - { "h|help", "Show this help", v => showHelp = true }, - { "d|diff=", "HTML diff file out output (omit for stdout)", v => diff = v }, - { "i|ignore=", "Ignore new, added, and removed members whose description matches a given C# regular expression (see below).", - v => { - var r = new Regex (v); - State.IgnoreAdded.Add (r); - State.IgnoreRemoved.Add (r); - State.IgnoreNew.Add (r); - } - }, - { "a|ignore-added=", "Ignore added members whose description matches a given C# regular expression (see below).", - v => State.IgnoreAdded.Add (new Regex (v)) - }, - { "r|ignore-removed=", "Ignore removed members whose description matches a given C# regular expression (see below).", - v => State.IgnoreRemoved.Add (new Regex (v)) - }, - { "n|ignore-new=", "Ignore new namespaces and types whose description matches a given C# regular expression (see below).", - v => State.IgnoreNew.Add (new Regex (v)) - }, - { "ignore-changes-parameter-names", "Ignore changes to parameter names for identically prototyped methods.", - v => State.IgnoreParameterNameChanges = v != null - }, - { "ignore-changes-property-setters", "Ignore adding setters to properties.", - v => State.IgnoreAddedPropertySetters = v != null - }, - { "ignore-changes-virtual", "Ignore changing non-`virtual` to `virtual` or adding `override`.", - v => State.IgnoreVirtualChanges = v != null - }, - { "c|colorize:", "Colorize HTML output", v => State.Colorize = string.IsNullOrEmpty (v) ? true : bool.Parse (v) }, - { "x|lax", "Ignore duplicate XML entries", v => State.Lax = true } - }; - - try { - extra = options.Parse (args); - } catch (OptionException e) { - Console.WriteLine ("Option error: {0}", e.Message); - showHelp = true; - } - - if (showHelp || extra == null || extra.Count < 2 || extra.Count > 3) { - Console.WriteLine (@"Usage: mono-api-html [options] [diff.html]"); - Console.WriteLine (); - Console.WriteLine ("Available options:"); - options.WriteOptionDescriptions (Console.Out); - Console.WriteLine (); - Console.WriteLine ("Ignoring Members:"); - Console.WriteLine (); - Console.WriteLine (" Members that were added can be filtered out of the diff by using the"); - Console.WriteLine (" -i, --ignore-added option. The option takes a C# regular expression"); - Console.WriteLine (" to match against member descriptions. For example, to ignore the"); - Console.WriteLine (" introduction of the interfaces 'INSCopying' and 'INSCoding' on types"); - Console.WriteLine (" pass the following to mono-api-html:"); - Console.WriteLine (); - Console.WriteLine (" mono-api-html ... -i 'INSCopying$' -i 'INSCoding$'"); - Console.WriteLine (); - Console.WriteLine (" The regular expressions will match any member description ending with"); - Console.WriteLine (" 'INSCopying' or 'INSCoding'."); - Console.WriteLine (); - return 1; - } - - var input = extra [0]; - var output = extra [1]; - if (extra.Count == 3 && diff == null) - diff = extra [2]; - - try { - var ac = new AssemblyComparer (input, output); - if (diff != null) { - string diffHtml = String.Empty; - using (var writer = new StringWriter ()) { - State.Output = writer; - ac.Compare (); - diffHtml = State.Output.ToString (); - } - if (diffHtml.Length > 0) { - using (var file = new StreamWriter (diff)) { - file.WriteLine ("
"); - if (State.Colorize) { - file.WriteLine (""); - } - file.WriteLine ( -@""); - if (ac.SourceAssembly == ac.TargetAssembly) { - file.WriteLine ("

{0}.dll

", ac.SourceAssembly); - } else { - file.WriteLine ("

{0}.dll vs {1}.dll

", ac.SourceAssembly, ac.TargetAssembly); - } - file.WriteLine ("Hide non-breaking changes"); - file.WriteLine (""); - file.WriteLine ("
"); - file.WriteLine ("
"); - file.Write (diffHtml); - file.WriteLine ("
"); - file.WriteLine ("
"); - } - } - } else { - State.Output = Console.Out; - ac.Compare (); - } - } - catch (Exception e) { - Console.WriteLine (e); - return 1; - } - return 0; - } - } -} diff --git a/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs b/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs deleted file mode 100644 index adbd862eb92..00000000000 --- a/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs +++ /dev/null @@ -1,79 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class AssemblyComparer : Comparer { - - XDocument source; - XDocument target; - NamespaceComparer comparer; - - public AssemblyComparer (string sourceFile, string targetFile) - { - source = XDocument.Load (sourceFile); - target = XDocument.Load (targetFile); - comparer = new NamespaceComparer (); - } - - public string SourceAssembly { get; private set; } - public string TargetAssembly { get; private set; } - - public void Compare () - { - Compare (source.Element ("assemblies").Elements ("assembly"), - target.Element ("assemblies").Elements ("assembly")); - } - - public override void SetContext (XElement current) - { - State.Assembly = current.GetAttribute ("name"); - } - - public override void Added (XElement target, bool wasParentAdded) - { - // one assembly per xml file - } - - public override void Modified (XElement source, XElement target, ApiChanges diff) - { - SourceAssembly = source.GetAttribute ("name"); - TargetAssembly = target.GetAttribute ("name"); - // TODO: version - // ? custom attributes ? - comparer.Compare (source, target); - } - - public override void Removed (XElement source) - { - // one assembly per xml file - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/ClassComparer.cs b/mcs/tools/corcompare/mono-api-html/ClassComparer.cs deleted file mode 100644 index a3399fbef04..00000000000 --- a/mcs/tools/corcompare/mono-api-html/ClassComparer.cs +++ /dev/null @@ -1,261 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class ClassComparer : Comparer { - - InterfaceComparer icomparer; - ConstructorComparer ccomparer; - FieldComparer fcomparer; - PropertyComparer pcomparer; - EventComparer ecomparer; - MethodComparer mcomparer; - ClassComparer kcomparer; - - public ClassComparer () - { - icomparer = new InterfaceComparer (); - ccomparer = new ConstructorComparer (); - fcomparer = new FieldComparer (); - pcomparer = new PropertyComparer (); - ecomparer = new EventComparer (); - mcomparer = new MethodComparer (); - } - - public override void SetContext (XElement current) - { - State.Type = current.GetAttribute ("name"); - State.BaseType = current.GetAttribute ("base"); - } - - public void Compare (XElement source, XElement target) - { - var s = source.Element ("classes"); - var t = target.Element ("classes"); - if (XNode.DeepEquals (s, t)) - return; - Compare (s.Elements ("class"), t.Elements ("class")); - } - - public override void Added (XElement target, bool wasParentAdded) - { - string name = target.Attribute ("name").Value; - if (State.IgnoreNew.Any (re => re.IsMatch (name))) - return; - Output.WriteLine ("
", name); - Output.WriteLine ("

New Type {0}.{1}

", State.Namespace, name); - Output.WriteLine ("
");
-			State.Indent = 0;
-			AddedInner (target);
-			Output.WriteLine ("
"); - Output.WriteLine ("
", name); - } - - public void AddedInner (XElement target) - { - SetContext (target); - if (target.IsTrue ("serializable")) - Indent ().WriteLine ("[Serializable]"); - - var type = target.Attribute ("type").Value; - - if (type == "enum") { - // check if [Flags] is present - var cattrs = target.Element ("attributes"); - if (cattrs != null) { - foreach (var ca in cattrs.Elements ("attribute")) { - if (ca.GetAttribute ("name") == "System.FlagsAttribute") { - Indent ().WriteLine ("[Flags]"); - break; - } - } - } - } - - Indent ().Write ("public"); - - if (type != "enum") { - bool seal = target.IsTrue ("sealed"); - bool abst = target.IsTrue ("abstract"); - if (seal && abst) - Output.Write (" static"); - else if (seal && type != "struct") - Output.Write (" sealed"); - else if (abst && type != "interface") - Output.Write (" abstract"); - } - - Output.Write (' '); - Output.Write (type); - Output.Write (' '); - Output.Write (target.GetAttribute ("name")); - - var baseclass = target.GetAttribute ("base"); - if ((type != "enum") && (type != "struct")) { - if (baseclass != null) { - if (baseclass == "System.Object") { - // while true we do not need to be reminded every time... - baseclass = null; - } else { - Output.Write (" : "); - Output.Write (baseclass); - } - } - } - - // interfaces on enums are "standard" not user provided - so we do not want to show them - if (type != "enum") { - var i = target.Element ("interfaces"); - if (i != null) { - var interfaces = new List (); - foreach (var iface in i.Elements ("interface")) - interfaces.Add (icomparer.GetDescription (iface)); - Output.Write ((baseclass == null) ? " : " : ", "); - Output.Write (String.Join (", ", interfaces)); - } - } - - Output.WriteLine (" {"); - - var t = target.Element ("constructors"); - if (t != null) { - Indent ().WriteLine ("\t// constructors"); - foreach (var ctor in t.Elements ("constructor")) - ccomparer.Added (ctor, true); - } - - t = target.Element ("fields"); - if (t != null) { - if (type != "enum") - Indent ().WriteLine ("\t// fields"); - else - SetContext (target); - foreach (var field in t.Elements ("field")) - fcomparer.Added (field, true); - } - - t = target.Element ("properties"); - if (t != null) { - Indent ().WriteLine ("\t// properties"); - foreach (var property in t.Elements ("property")) - pcomparer.Added (property, true); - } - - t = target.Element ("events"); - if (t != null) { - Indent ().WriteLine ("\t// events"); - foreach (var evnt in t.Elements ("event")) - ecomparer.Added (evnt, true); - } - - t = target.Element ("methods"); - if (t != null) { - Indent ().WriteLine ("\t// methods"); - foreach (var method in t.Elements ("method")) - mcomparer.Added (method, true); - } - - t = target.Element ("classes"); - if (t != null) { - Output.WriteLine (); - Indent ().WriteLine ("\t// inner types"); - kcomparer = new NestedClassComparer (); - State.Indent++; - foreach (var inner in t.Elements ("class")) - kcomparer.AddedInner (inner); - State.Indent--; - } - Indent ().WriteLine ("}"); - } - - public override void Modified (XElement source, XElement target, ApiChanges diff) - { - // hack - there could be changes that we're not monitoring (e.g. attributes properties) - var output = Output; - State.Output = new StringWriter (); - - var sb = source.GetAttribute ("base"); - var tb = target.GetAttribute ("base"); - if (sb != tb) { - Output.Write ("Modified base type: "); - Output.WriteLine (new ApiChange ().AppendModified (sb, tb, true).Member.ToString ()); - } - - ccomparer.Compare (source, target); - icomparer.Compare (source, target); - fcomparer.Compare (source, target); - pcomparer.Compare (source, target); - ecomparer.Compare (source, target); - mcomparer.Compare (source, target); - - var si = source.Element ("classes"); - if (si != null) { - var ti = target.Element ("classes"); - kcomparer = new NestedClassComparer (); - kcomparer.Compare (si.Elements ("class"), ti == null ? null : ti.Elements ("class")); - } - - var s = (Output as StringWriter).ToString (); - State.Output = output; - if (s.Length > 0) { - var tn = GetTypeName (target); - Output.WriteLine ("
", tn); - Output.WriteLine ("

Type Changed: {0}.{1}

", State.Namespace, GetTypeName (target)); - Output.WriteLine (s); - Output.WriteLine ("
", tn); - } - } - - public override void Removed (XElement source) - { - Output.Write ("

Removed Type {0}.{1}

", State.Namespace, GetTypeName (source)); - } - - public virtual string GetTypeName (XElement type) - { - return type.GetAttribute ("name"); - } - } - - public class NestedClassComparer : ClassComparer { - - public override void SetContext (XElement current) - { - } - - public override string GetTypeName (XElement type) - { - return State.Type + "." + base.GetTypeName (type); - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/Comparer.cs b/mcs/tools/corcompare/mono-api-html/Comparer.cs deleted file mode 100644 index 4210b9b95fb..00000000000 --- a/mcs/tools/corcompare/mono-api-html/Comparer.cs +++ /dev/null @@ -1,98 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public abstract class Comparer { - - protected List removed = new List (); - protected ApiChanges modified = new ApiChanges (); - - public TextWriter Output { - get { return State.Output; } - } - - protected TextWriter Indent () - { - for (int i = 0; i < State.Indent; i++) - State.Output.Write ("\t"); - return State.Output; - } - - public abstract void Added (XElement target, bool wasParentAdded); - public abstract void Modified (XElement source, XElement target, ApiChanges changes); - public abstract void Removed (XElement source); - - public virtual bool Equals (XElement source, XElement target, ApiChanges changes) - { - return XNode.DeepEquals (source, target); - } - - public abstract void SetContext (XElement current); - - public virtual void Compare (IEnumerable source, IEnumerable target) - { - removed.Clear (); - modified.Clear (); - - foreach (var s in source) { - SetContext (s); - string sn = s.GetAttribute ("name"); - var t = target == null ? null : target.SingleOrDefault (x => x.GetAttribute ("name") == sn); - if (t == null) { - // not in target, it was removed - removed.Add (s); - } else { - t.Remove (); - // possibly modified - if (Equals (s, t, modified)) - continue; - - // still in target so will be part of Added - Modified (s, t, modified); - } - } - // delayed, that way we show "Modified", "Added" and then "Removed" - foreach (var item in removed) { - SetContext (item); - Removed (item); - } - // remaining == newly added in target - if (target != null) { - foreach (var item in target) { - SetContext (item); - Added (item, false); - } - } - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/ConstructorComparer.cs b/mcs/tools/corcompare/mono-api-html/ConstructorComparer.cs deleted file mode 100644 index 9bd837e241f..00000000000 --- a/mcs/tools/corcompare/mono-api-html/ConstructorComparer.cs +++ /dev/null @@ -1,148 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - // MethodComparer inherits from this one - public class ConstructorComparer : MemberComparer { - - public override string GroupName { - get { return "constructors"; } - } - - public override string ElementName { - get { return "constructor"; } - } - - public override bool Find (XElement e) - { - return (e.Attribute ("name").Value == Source.Attribute ("name").Value); - } - - void RenderReturnType (XElement source, XElement target, ApiChange change) - { - var srcType = source.GetTypeName ("returntype"); - var tgtType = target.GetTypeName ("returntype"); - - if (srcType != tgtType) { - change.AppendModified (srcType, tgtType, true); - change.Append (" "); - } else if (srcType != null) { - // ctor don't have a return type - change.Append (srcType); - change.Append (" "); - } - } - - public override bool Equals (XElement source, XElement target, ApiChanges changes) - { - if (base.Equals (source, target, changes)) - return true; - - var change = new ApiChange (); - change.Header = "Modified " + GroupName; - RenderMethodAttributes (source, target, change); - RenderReturnType (source, target, change); - RenderName (source, target, change); - RenderGenericParameters (source, target, change); - RenderParameters (source, target, change); - - changes.Add (source, target, change); - - return false; - } - - public override string GetDescription (XElement e) - { - var sb = new StringBuilder (); - - var attribs = e.Attribute ("attrib"); - if (attribs != null) { - var attr = (MethodAttributes) Int32.Parse (attribs.Value); - if ((attr & MethodAttributes.Public) != MethodAttributes.Public) { - sb.Append ("protected "); - } else { - sb.Append ("public "); - } - - if ((attr & MethodAttributes.Static) != 0) { - sb.Append ("static "); - } else if ((attr & MethodAttributes.Virtual) != 0) { - if ((attr & MethodAttributes.VtableLayoutMask) == 0) - sb.Append ("override "); - else - sb.Append ("virtual "); - } - } - - string name = e.GetAttribute ("name"); - - var r = e.GetTypeName ("returntype"); - if (r != null) { - // ctor dont' have a return type - sb.Append (r).Append (' '); - } else { - // show the constructor as it would be defined in C# - name = name.Replace (".ctor", State.Type); - } - - // the XML file `name` does not contain parameter names, so we must process them ourselves - // which gives us the opportunity to simplify type names - sb.Append (name.Substring (0, name.IndexOf ('('))); - - var genericp = e.Element ("generic-parameters"); - if (genericp != null) { - var list = new List (); - foreach (var p in genericp.Elements ("generic-parameter")) { - list.Add (p.GetTypeName ("name")); - } - sb.Append ("<").Append (String.Join (", ", list)).Append (">"); - } - - sb.Append (" ("); - var parameters = e.Element ("parameters"); - if (parameters != null) { - var list = new List (); - foreach (var p in parameters.Elements ("parameter")) { - var pTypeName = p.GetTypeName ("type"); - list.Add (State.IgnoreParameterNameChanges - ? pTypeName - : pTypeName + " " + p.GetAttribute ("name")); - } - sb.Append (String.Join (", ", list)); - } - sb.Append (");"); - - return sb.ToString (); - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/EventComparer.cs b/mcs/tools/corcompare/mono-api-html/EventComparer.cs deleted file mode 100644 index 693f16f5342..00000000000 --- a/mcs/tools/corcompare/mono-api-html/EventComparer.cs +++ /dev/null @@ -1,75 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Text; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class EventComparer : MemberComparer { - - public override string GroupName { - get { return "events"; } - } - - public override string ElementName { - get { return "event"; } - } - - public override bool Equals (XElement source, XElement target, ApiChanges changes) - { - if (base.Equals (source, target, changes)) - return true; - - var change = new ApiChange (); - change.Header = "Modified " + GroupName; - change.Append ("public event "); - - var srcEventType = source.GetTypeName ("eventtype"); - var tgtEventType = target.GetTypeName ("eventtype"); - - if (srcEventType != tgtEventType) { - change.AppendModified (srcEventType, tgtEventType, true); - } else { - change.Append (srcEventType); - } - change.Append (" "); - change.Append (source.GetAttribute ("name")).Append (";"); - return false; - } - - public override string GetDescription (XElement e) - { - StringBuilder sb = new StringBuilder (); - // TODO: attribs - sb.Append ("public event "); - sb.Append (e.GetTypeName ("eventtype")).Append (' '); - sb.Append (e.GetAttribute ("name")).Append (';'); - return sb.ToString (); - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/FieldComparer.cs b/mcs/tools/corcompare/mono-api-html/FieldComparer.cs deleted file mode 100644 index a2b0225b448..00000000000 --- a/mcs/tools/corcompare/mono-api-html/FieldComparer.cs +++ /dev/null @@ -1,211 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class FieldComparer : MemberComparer { - - public override string GroupName { - get { return "fields"; } - } - - public override string ElementName { - get { return "field"; } - } - - void RenderFieldAttributes (FieldAttributes source, FieldAttributes target, ApiChange change) - { - var srcNotSerialized = (source & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized; - var tgtNotSerialized = (target & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized; - if (srcNotSerialized != tgtNotSerialized) { - // this is not a breaking change, so only render it if it changed. - if (srcNotSerialized) { - change.AppendRemoved ("[NonSerialized]\n"); - } else { - change.AppendAdded ("[NonSerialized]\n"); - } - } - - // the visibility values are the same for MethodAttributes and FieldAttributes, so just use the same method. - RenderVisibility ((MethodAttributes) source, (MethodAttributes) target, change); - // same for the static flag - RenderStatic ((MethodAttributes) source, (MethodAttributes) target, change); - - var srcLiteral = (source & FieldAttributes.Literal) != 0; - var tgtLiteral = (target & FieldAttributes.Literal) != 0; - - if (srcLiteral) { - if (tgtLiteral) { - change.Append ("const "); - } else { - change.AppendRemoved ("const", true).Append (" "); - } - } else if (tgtLiteral) { - change.AppendAdded ("const", true).Append (" "); - } - - var srcInitOnly = (source & FieldAttributes.InitOnly) != 0; - var tgtInitOnly = (target & FieldAttributes.InitOnly) != 0; - if (srcInitOnly) { - if (tgtInitOnly) { - change.Append ("readonly "); - } else { - change.AppendRemoved ("readonly", false).Append (" "); - } - } else if (tgtInitOnly) { - change.AppendAdded ("readonly", true).Append (" "); - } - } - - public override bool Equals (XElement source, XElement target, ApiChanges changes) - { - if (base.Equals (source, target, changes)) - return true; - - var name = source.GetAttribute ("name"); - var srcValue = source.GetAttribute ("value"); - var tgtValue = target.GetAttribute ("value"); - var change = new ApiChange (); - change.Header = "Modified " + GroupName; - - if (State.BaseType == "System.Enum") { - change.Append (name).Append (" = "); - if (srcValue != tgtValue) { - change.AppendModified (srcValue, tgtValue, true); - } else { - change.Append (srcValue); - } - } else { - RenderFieldAttributes (source.GetFieldAttributes (), target.GetFieldAttributes (), change); - - var srcType = source.GetTypeName ("fieldtype"); - var tgtType = target.GetTypeName ("fieldtype"); - - if (srcType != tgtType) { - change.AppendModified (srcType, tgtType, true); - } else { - change.Append (srcType); - } - change.Append (" "); - change.Append (name); - - if (srcType == "string" && srcValue != null) - srcValue = "\"" + srcValue + "\""; - - if (tgtType == "string" && tgtValue != null) - tgtValue = "\"" + tgtValue + "\""; - - if (srcValue != tgtValue) { - change.Append (" = "); - if (srcValue == null) - srcValue = "null"; - if (tgtValue == null) - tgtValue = "null"; - change.AppendModified (srcValue, tgtValue, true); - } else if (srcValue != null) { - change.Append (" = "); - change.Append (srcValue); - } - change.Append (";"); - } - - changes.Add (source, target, change); - - return false; - } - - public override string GetDescription (XElement e) - { - var sb = new StringBuilder (); - - string name = e.GetAttribute ("name"); - string value = e.GetAttribute ("value"); - - if (State.BaseType == "System.Enum") { - sb.Append (name).Append (" = ").Append (value).Append (','); - } else { - var attribs = e.Attribute ("attrib"); - if (attribs != null) { - var attr = (FieldAttributes)Int32.Parse (attribs.Value); - if ((attr & FieldAttributes.Public) != FieldAttributes.Public) { - sb.Append ("protected "); - } else { - sb.Append ("public "); - } - - if ((attr & FieldAttributes.Static) != 0) - sb.Append ("static "); - - if ((attr & FieldAttributes.Literal) != 0) - sb.Append ("const "); - } - - string ftype = e.GetTypeName ("fieldtype"); - sb.Append (ftype).Append (' '); - sb.Append (name); - if (ftype == "string" && e.Attribute ("value") != null) { - if (value == null) - sb.Append (" = null"); - else - sb.Append (" = \"").Append (value).Append ('"'); - } - sb.Append (';'); - } - - return sb.ToString (); - } - - public override void BeforeAdding (IEnumerable list) - { - first = true; - if (State.BaseType == "System.Enum") { - Output.WriteLine ("
"); - Output.WriteLine ("

Added value{0}:

", list.Count () > 1 ? "s" : String.Empty); - Output.WriteLine ("
");
-			} else {
-				base.BeforeAdding (list);
-			}
-		}
-
-		public override void BeforeRemoving (IEnumerable list)
-		{
-			first = true;
-			if (State.BaseType == "System.Enum") {
-				Output.WriteLine ("

Removed value{0}:

", list.Count () > 1 ? "s" : String.Empty); - Output.WriteLine ("
");
-			} else {
-				base.BeforeRemoving (list);
-			}
-		}
-	}
-}
\ No newline at end of file
diff --git a/mcs/tools/corcompare/mono-api-html/Helpers.cs b/mcs/tools/corcompare/mono-api-html/Helpers.cs
deleted file mode 100644
index 8769785c478..00000000000
--- a/mcs/tools/corcompare/mono-api-html/Helpers.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-// 
-// Authors
-//    Sebastien Pouliot  
-//
-// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com
-// 
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Xml.Linq;
-
-namespace Xamarin.ApiDiff {
-
-	public static class Helper {
-		public static bool IsTrue (this XElement self, string name)
-		{
-			return (self.GetAttribute (name) == "true");
-		}
-
-		public static string GetAttribute (this XElement self, string name)
-		{
-			var n = self.Attribute (name);
-			if (n == null)
-				return null;
-			return n.Value;
-		}
-
-		// null == no obsolete, String.Empty == no description
-		public static string GetObsoleteMessage (this XElement self)
-		{
-			var cattrs = self.Element ("attributes");
-			if (cattrs == null)
-				return null;
-
-			foreach (var ca in cattrs.Elements ("attribute")) {
-				if (ca.GetAttribute ("name") != "System.ObsoleteAttribute")
-					continue;
-				var props = ca.Element ("properties");
-				if (props == null)
-					return String.Empty; // no description
-				foreach (var p in props.Elements ("property")) {
-					if (p.GetAttribute ("name") != "Message")
-						continue;
-					return p.GetAttribute ("value");
-				}
-			}
-			return null;
-		}
-
-		public static IEnumerable Descendants (this XElement self, params string[] names)
-		{
-			XElement el = self;
-			if (el == null)
-				return null;
-
-			for (int i = 0; i < names.Length - 1; i++) {
-				el = el.Element (names [i]);
-				if (el == null)
-					return null;
-			}
-			return el.Elements (names [names.Length - 1]);
-		}
-
-		public static List DescendantList (this XElement self, params string[] names)
-		{
-			var descendants = self.Descendants (names);
-			if (descendants == null)
-				return null;
-			return descendants.ToList ();
-		}
-
-		// make it beautiful (.NET -> C#)
-		public static string GetTypeName (this XElement self, string name)
-		{
-			string type = self.GetAttribute (name);
-			if (type == null)
-				return null;
-
-			StringBuilder sb = null;
-			bool is_nullable = false;
-			if (type.StartsWith ("System.Nullable`1[", StringComparison.Ordinal)) {
-				is_nullable = true;
-				sb = new StringBuilder (type, 18, type.Length - 19, 1024);
-			} else {
-				sb = new StringBuilder (type);
-			}
-
-			bool is_ref = (sb [sb.Length - 1] == '&');
-			if (is_ref)
-				sb.Remove (sb.Length - 1, 1);
-
-			int array = 0;
-			while ((sb [sb.Length - 1] == ']') && (sb [sb.Length - 2] == '[')) {
-				sb.Remove (sb.Length - 2, 2);
-				array++;
-			}
-
-			bool is_pointer = (sb [sb.Length - 1] == '*');
-			if (is_pointer)
-				sb.Remove (sb.Length - 1, 1);
-
-			type = GetTypeName (sb.Replace ('+', '.').ToString ());
-			sb.Length = 0;
-			if (is_ref)
-				sb.Append (self.GetAttribute ("direction")).Append (' ');
-
-			sb.Append (type);
-
-			while (array-- > 0)
-				sb.Append ("[]");
-			if (is_nullable)
-				sb.Append ('?');
-			if (is_pointer)
-				sb.Append ('*');
-			return sb.ToString ();
-		}
-
-		static string GetTypeName (string type)
-		{
-			int pos = type.IndexOf ('`');
-			if (pos >= 0) {
-				int end = type.LastIndexOf (']');
-				string subtype = type.Substring (pos + 3, end - pos - 3);
-				return type.Substring (0, pos) + "<" + GetTypeName (subtype) + ">";
-			}
-
-			switch (type) {
-			case "System.String":
-				return "string";
-			case "System.Int32":
-				return "int";
-			case "System.UInt32":
-				return "uint";
-			case "System.Int64":
-				return "long";
-			case "System.UInt64":
-				return "ulong";
-			case "System.Void":
-				return "void";
-			case "System.Boolean":
-				return "bool";
-			case "System.Object":
-				return "object";
-			case "System.Single":
-				return "float";
-			case "System.Double":
-				return "double";
-			case "System.Byte":
-				return "byte";
-			case "System.SByte":
-				return "sbyte";
-			case "System.Int16":
-				return "short";
-			case "System.UInt16":
-				return "ushort";
-			case "System.Char":
-				return "char";
-			case "System.nint":
-				return "nint";
-			case "System.nuint":
-				return "uint";
-			case "System.nfloat":
-				return "nfloat";
-			case "System.IntPtr":
-				return "IntPtr";
-			default:
-				if (type.StartsWith (State.Namespace, StringComparison.Ordinal))
-					type = type.Substring (State.Namespace.Length + 1);
-				return type;
-			}
-		}
-
-		public static MethodAttributes GetMethodAttributes (this XElement element)
-		{
-			var srcAttribs = element.Attribute ("attrib");
-			return (MethodAttributes) (srcAttribs != null ? Int32.Parse (srcAttribs.Value) : 0);
-		}
-
-		public static FieldAttributes GetFieldAttributes (this XElement element)
-		{
-			var srcAttribs = element.Attribute ("attrib");
-			return (FieldAttributes) (srcAttribs != null ? Int32.Parse (srcAttribs.Value) : 0);
-		}
-	}
-}
\ No newline at end of file
diff --git a/mcs/tools/corcompare/mono-api-html/InterfaceComparer.cs b/mcs/tools/corcompare/mono-api-html/InterfaceComparer.cs
deleted file mode 100644
index df52f162e49..00000000000
--- a/mcs/tools/corcompare/mono-api-html/InterfaceComparer.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-// 
-// Authors
-//    Sebastien Pouliot  
-//
-// Copyright 2013 Xamarin Inc. http://www.xamarin.com
-// 
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Xml.Linq;
-
-namespace Xamarin.ApiDiff {
-
-	public class InterfaceComparer : MemberComparer {
-
-		public override string GroupName {
-			get { return "interfaces"; }
-		}
-
-		public override string ElementName {
-			get { return "interface"; }
-		}
-
-		public override string GetDescription (XElement e)
-		{
-			return e.GetTypeName ("name");
-		}
-	}
-}
\ No newline at end of file
diff --git a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs
deleted file mode 100644
index d12d86625c2..00000000000
--- a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs
+++ /dev/null
@@ -1,608 +0,0 @@
-// 
-// Authors
-//    Sebastien Pouliot  
-//
-// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com
-// 
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Xml.Linq;
-
-namespace Xamarin.ApiDiff {
-
-	public abstract class MemberComparer : Comparer {
-
-		// true if this is the first element being added or removed in the group being rendered
-		protected bool first;
-
-		public abstract string GroupName { get; }
-		public abstract string ElementName { get; }
-
-		protected virtual bool IsBreakingRemoval (XElement e)
-		{
-			return true;
-		}
-
-		public void Compare (XElement source, XElement target)
-		{
-			var s = source.Element (GroupName);
-			var t = target.Element (GroupName);
-			if (XNode.DeepEquals (s, t))
-				return;
-
-			if (s == null) {
-				Add (t.Elements (ElementName));
-			} else if (t == null) {
-				Remove (s.Elements (ElementName));
-			} else {
-				Compare (s.Elements (ElementName), t.Elements (ElementName));
-			}
-		}
-
-		public override void SetContext (XElement current)
-		{
-		}
-
-		string GetContainingType (XElement el)
-		{
-			return el.Ancestors ("class").First ().Attribute ("type").Value;
-		}
-
-		bool IsInInterface (XElement el)
-		{
-			return GetContainingType (el) == "interface";
-		}
-
-		public XElement Source { get; set; }
-
-		public virtual bool Find (XElement e)
-		{
-			return e.GetAttribute ("name") == Source.GetAttribute ("name");
-		}
-
-		XElement Find (IEnumerable target)
-		{
-			return State.Lax ? target.FirstOrDefault (Find) : target.SingleOrDefault (Find);
-		}
-
-		public override void Compare (IEnumerable source, IEnumerable target)
-		{
-			removed.Clear ();
-			modified.Clear ();
-
-			foreach (var s in source) {
-				SetContext (s);
-				Source = s;
-				var t = Find (target);
-				if (t == null) {
-					// not in target, it was removed
-					removed.Add (s);
-				} else {
-					t.Remove ();
-					// possibly modified
-					if (Equals (s, t, modified))
-						continue;
-
-					Modified (s, t, modified);
-				}
-			}
-			// delayed, that way we show "Modified", "Added" and then "Removed"
-			Remove (removed);
-
-			Modify (modified);
-
-			// remaining == newly added in target
-			Add (target);
-		}
-
-		void Add (IEnumerable elements)
-		{
-			bool a = false;
-			foreach (var item in elements) {
-				SetContext (item);
-				if (State.IgnoreAdded.Any (re => re.IsMatch (GetDescription (item))))
-					continue;
-				if (!a) {
-					BeforeAdding (elements);
-					a = true;
-				}
-				Added (item, false);
-			}
-			if (a)
-				AfterAdding ();
-		}
-
-		void Modify (ApiChanges modified)
-		{
-			foreach (var changes in modified) {
-				Output.WriteLine ("

{0}:

", changes.Key); - Output.WriteLine ("
");
-				foreach (var element in changes.Value) {
-					Output.Write ("
", element.Breaking ? "data-is-breaking" : "data-is-non-breaking"); - foreach (var line in element.Member.ToString ().Split ('\n')) - Output.WriteLine ("\t{0}", line); - Output.Write ("
"); - - } - Output.WriteLine ("
"); - } - } - - void Remove (IEnumerable elements) - { - bool r = false; - foreach (var item in elements) { - if (State.IgnoreRemoved.Any (re => re.IsMatch (GetDescription (item)))) - continue; - SetContext (item); - if (!r) { - BeforeRemoving (elements); - r = true; - } - Removed (item); - } - if (r) - AfterRemoving (); - } - - public abstract string GetDescription (XElement e); - - protected StringBuilder GetObsoleteMessage (XElement e) - { - var sb = new StringBuilder (); - string o = e.GetObsoleteMessage (); - if (o != null) { - sb.Append ("[Obsolete"); - if (o.Length > 0) - sb.Append (" (\"").Append (o).Append ("\")"); - sb.AppendLine ("]"); - for (int i = 0; i < State.Indent + 1; i++) - sb.Append ('\t'); - } - return sb; - } - - public override bool Equals (XElement source, XElement target, ApiChanges changes) - { - RenderAttributes (source, target, changes); - - // We don't want to compare attributes. - RemoveAttributes (source); - RemoveAttributes (target); - - return base.Equals (source, target, changes); - } - - public virtual void BeforeAdding (IEnumerable list) - { - first = true; - Output.WriteLine ("
"); - Output.WriteLine ("

Added {0}:

", list.Count () > 1 ? GroupName : ElementName); - Output.WriteLine ("
");
-		}
-
-		public override void Added (XElement target, bool wasParentAdded)
-		{
-			var o = GetObsoleteMessage (target);
-			if (!first && (o.Length > 0))
-				Output.WriteLine ();
-			Indent ();
-			bool isInterfaceBreakingChange = !wasParentAdded && IsInInterface (target);
-			Output.Write ("\t", ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
-			Output.Write ("{0}{1}", o, GetDescription (target));
-			Output.WriteLine ("");
-			first = false;
-		}
-
-		public virtual void AfterAdding ()
-		{
-			Output.WriteLine ("
"); - Output.WriteLine ("
"); - } - - public override void Modified (XElement source, XElement target, ApiChanges change) - { - } - - public virtual void BeforeRemoving (IEnumerable list) - { - first = true; - Output.WriteLine ("

Removed {0}:

\n", list.Count () > 1 ? GroupName : ElementName); - Output.WriteLine ("
");
-		}
-
-		public override void Removed (XElement source)
-		{
-			var o = GetObsoleteMessage (source);
-			if (!first && (o.Length > 0))
-				Output.WriteLine ();
-
-			bool is_breaking = IsBreakingRemoval (source);
-
-			Indent ();
-			Output.Write ("\t", ElementName, is_breaking ? "data-is-breaking" : "data-is-non-breaking", is_breaking ? "breaking" : string.Empty);
-			Output.Write ("{0}{1}", o, GetDescription (source));
-			Output.WriteLine ("");
-			first = false;
-		}
-
-		public virtual void AfterRemoving ()
-		{
-			Output.WriteLine ("
");; - } - - string RenderGenericParameter (XElement gp) - { - var sb = new StringBuilder (); - sb.Append (gp.GetTypeName ("name")); - - var constraints = gp.DescendantList ("generic-parameter-constraints", "generic-parameter-constraint"); - if (constraints != null && constraints.Count > 0) { - sb.Append (" : "); - for (int i = 0; i < constraints.Count; i++) { - if (i > 0) - sb.Append (", "); - sb.Append (constraints [i].GetTypeName ("name")); - } - } - return sb.ToString (); - } - - protected void RenderGenericParameters (XElement source, XElement target, ApiChange change) - { - var src = source.DescendantList ("generic-parameters", "generic-parameter"); - var tgt = target.DescendantList ("generic-parameters", "generic-parameter"); - var srcCount = src == null ? 0 : src.Count; - var tgtCount = tgt == null ? 0 : tgt.Count; - - if (srcCount == 0 && tgtCount == 0) - return; - - change.Append ("<"); - for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { - if (i > 0) - change.Append (", "); - if (i >= srcCount) { - change.AppendAdded (RenderGenericParameter (tgt [i]), true); - } else if (i >= tgtCount) { - change.AppendRemoved (RenderGenericParameter (src [i]), true); - } else { - var srcName = RenderGenericParameter (src [i]); - var tgtName = RenderGenericParameter (tgt [i]); - - if (srcName != tgtName) { - change.AppendModified (srcName, tgtName, true); - } else { - change.Append (srcName); - } - } - } - change.Append (">"); - } - - protected string FormatValue (string type, string value) - { - if (value == null) - return "null"; - - if (type == "string") - return "\"" + value + "\""; - else if (type == "bool") { - switch (value) { - case "True": - return "true"; - case "False": - return "false"; - default: - return value; - } - } - - return value; - } - - protected void RenderParameters (XElement source, XElement target, ApiChange change) - { - var src = source.DescendantList ("parameters", "parameter"); - var tgt = target.DescendantList ("parameters", "parameter"); - var srcCount = src == null ? 0 : src.Count; - var tgtCount = tgt == null ? 0 : tgt.Count; - - change.Append (" ("); - for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { - if (i > 0) - change.Append (", "); - - if (i >= srcCount) { - change.AppendAdded (tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true); - } else if (i >= tgtCount) { - change.AppendRemoved (src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true); - } else { - var paramSourceType = src [i].GetTypeName ("type"); - var paramTargetType = tgt [i].GetTypeName ("type"); - - var paramSourceName = src [i].GetAttribute ("name"); - var paramTargetName = tgt [i].GetAttribute ("name"); - - if (paramSourceType != paramTargetType) { - change.AppendModified (paramSourceType, paramTargetType, true); - } else { - change.Append (paramSourceType); - } - change.Append (" "); - if (paramSourceName != paramTargetName) { - change.AppendModified (paramSourceName, paramTargetName, false); - } else { - change.Append (paramSourceName); - } - - var optSource = src [i].Attribute ("optional"); - var optTarget = tgt [i].Attribute ("optional"); - var srcValue = FormatValue (paramSourceType, src [i].GetAttribute ("defaultValue")); - var tgtValue = FormatValue (paramTargetType, tgt [i].GetAttribute ("defaultValue")); - - if (optSource != null) { - if (optTarget != null) { - change.Append (" = "); - if (srcValue != tgtValue) { - change.AppendModified (srcValue, tgtValue, false); - } else { - change.Append (tgtValue); - } - } else { - change.AppendRemoved (" = " + srcValue); - } - } else { - if (optTarget != null) - change.AppendAdded (" = " + tgtValue); - } - } - } - - change.Append (")"); - - // Ignore any parameter name changes if requested. - if (State.IgnoreParameterNameChanges && !change.Breaking) { - change.AnyChange = false; - change.HasIgnoredChanges = true; - } - } - - void RenderVTable (MethodAttributes source, MethodAttributes target, ApiChange change) - { - var srcAbstract = (source & MethodAttributes.Abstract) == MethodAttributes.Abstract; - var tgtAbstract = (target & MethodAttributes.Abstract) == MethodAttributes.Abstract; - var srcFinal = (source & MethodAttributes.Final) == MethodAttributes.Final; - var tgtFinal = (target & MethodAttributes.Final) == MethodAttributes.Final; - var srcVirtual = (source & MethodAttributes.Virtual) == MethodAttributes.Virtual; - var tgtVirtual = (target & MethodAttributes.Virtual) == MethodAttributes.Virtual; - var srcOverride = (source & MethodAttributes.VtableLayoutMask) != MethodAttributes.NewSlot; - var tgtOverride = (target & MethodAttributes.VtableLayoutMask) != MethodAttributes.NewSlot; - - var srcWord = srcVirtual ? (srcOverride ? "override" : "virtual") : string.Empty; - var tgtWord = tgtVirtual ? (tgtOverride ? "override" : "virtual") : string.Empty; - var breaking = srcWord.Length > 0 && tgtWord.Length == 0; - - if (srcAbstract) { - if (tgtAbstract) { - change.Append ("abstract "); - } else if (tgtVirtual) { - change.AppendModified ("abstract", tgtWord, false).Append (" "); - } else { - change.AppendRemoved ("abstract").Append (" "); - } - } else { - if (tgtAbstract) { - change.AppendAdded ("abstract", true).Append (" "); - } else if (srcWord != tgtWord) { - if (!tgtFinal) - change.AppendModified (srcWord, tgtWord, breaking).Append (" "); - } else if (tgtWord.Length > 0) { - change.Append (tgtWord).Append (" "); - } else if (srcWord.Length > 0) { - change.AppendRemoved (srcWord, breaking).Append (" "); - } - } - - if (srcFinal) { - if (tgtFinal) { - change.Append ("final "); - } else { - change.AppendRemoved ("final", false).Append (" "); // removing 'final' is not a breaking change. - } - } else { - if (tgtFinal && srcVirtual) { - change.AppendModified ("virtual", "final", true).Append (" "); // adding 'final' is a breaking change if the member was virtual - } - } - - if (!srcVirtual && !srcFinal && tgtVirtual && tgtFinal) { - // existing member implements a member from a new interface - // this would show up as 'virtual final', which is redundant, so show nothing at all. - change.HasIgnoredChanges = true; - } - - // Ignore non-breaking virtual changes. - if (State.IgnoreVirtualChanges && !change.Breaking) { - change.AnyChange = false; - change.HasIgnoredChanges = true; - } - - var tgtSecurity = (source & MethodAttributes.HasSecurity) == MethodAttributes.HasSecurity; - var srcSecurity = (target & MethodAttributes.HasSecurity) == MethodAttributes.HasSecurity; - - if (tgtSecurity != srcSecurity) - change.HasIgnoredChanges = true; - - var srcPInvoke = (source & MethodAttributes.PinvokeImpl) == MethodAttributes.PinvokeImpl; - var tgtPInvoke = (target & MethodAttributes.PinvokeImpl) == MethodAttributes.PinvokeImpl; - if (srcPInvoke != tgtPInvoke) - change.HasIgnoredChanges = true; - } - - protected string GetVisibility (MethodAttributes attr) - { - switch (attr) { - case MethodAttributes.Private: - case MethodAttributes.PrivateScope: - return "private"; - case MethodAttributes.Assembly: - return "internal"; - case MethodAttributes.FamANDAssem: - return "private internal"; - case MethodAttributes.FamORAssem: - return "protected"; // customers don't care about 'internal'; - case MethodAttributes.Family: - return "protected"; - case MethodAttributes.Public: - return "public"; - default: - throw new NotImplementedException (); - } - } - - protected void RenderVisibility (MethodAttributes source, MethodAttributes target, ApiChange diff) - { - source = source & MethodAttributes.MemberAccessMask; - target = target & MethodAttributes.MemberAccessMask; - - if (source == target) { - diff.Append (GetVisibility (target)); - } else { - var breaking = false; - switch (source) { - case MethodAttributes.Private: - case MethodAttributes.Assembly: - case MethodAttributes.FamANDAssem: - break; // these are not publicly visible, thus not breaking - case MethodAttributes.FamORAssem: - case MethodAttributes.Family: - switch (target) { - case MethodAttributes.Public: - // to public is not a breaking change - break; - case MethodAttributes.Family: - case MethodAttributes.FamORAssem: - // not a breaking change, but should still show up in diff - break; - default: - // anything else is a breaking change - breaking = true; - break; - } - break; - case MethodAttributes.Public: - default: - // any change from public is breaking. - breaking = true; - break; - } - - diff.AppendModified (GetVisibility (source), GetVisibility (target), breaking); - } - diff.Append (" "); - } - - protected void RenderStatic (MethodAttributes src, MethodAttributes tgt, ApiChange diff) - { - var srcStatic = (src & MethodAttributes.Static) == MethodAttributes.Static; - var tgtStatic = (tgt & MethodAttributes.Static) == MethodAttributes.Static; - - if (srcStatic != tgtStatic) { - if (srcStatic) { - diff.AppendRemoved ("static", true).Append (" "); - } else { - diff.AppendAdded ("static", true).Append (" "); - } - } - } - - protected void RenderMethodAttributes (MethodAttributes src, MethodAttributes tgt, ApiChange diff) - { - RenderStatic (src, tgt, diff); - RenderVisibility (src & MethodAttributes.MemberAccessMask, tgt & MethodAttributes.MemberAccessMask, diff); - RenderVTable (src, tgt, diff); - } - - protected void RenderMethodAttributes (XElement source, XElement target, ApiChange diff) - { - RenderMethodAttributes (source.GetMethodAttributes (), target.GetMethodAttributes (), diff); - } - - protected void RemoveAttributes (XElement element) - { - var srcAttributes = element.Element ("attributes"); - if (srcAttributes != null) - srcAttributes.Remove (); - - foreach (var el in element.Elements ()) - RemoveAttributes (el); - } - - protected void RenderAttributes (XElement source, XElement target, ApiChanges changes) - { - var srcObsolete = source.GetObsoleteMessage (); - var tgtObsolete = target.GetObsoleteMessage (); - - if (srcObsolete == tgtObsolete) - return; // nothing changed - - if (srcObsolete == null) { - if (tgtObsolete == null) - return; // neither is obsolete - var change = new ApiChange (); - change.Header = "Obsoleted " + GroupName; - change.Append (string.Format ("", ElementName)); - change.Append ("[Obsolete ("); - if (tgtObsolete != string.Empty) - change.Append ("\"").Append (tgtObsolete).Append ("\""); - change.Append (")]\n"); - change.Append (GetDescription (target)); - change.Append (""); - change.AnyChange = true; - changes.Add (source, target, change); - } else if (tgtObsolete == null) { - // Made non-obsolete. Do we care to report this? - } else { - // Obsolete message changed. Do we care to report this? - } - } - - protected void RenderName (XElement source, XElement target, ApiChange change) - { - var name = target.GetAttribute ("name"); - // show the constructor as it would be defined in C# - name = name.Replace (".ctor", State.Type); - - var p = name.IndexOf ('('); - if (p >= 0) - name = name.Substring (0, p); - - change.Append (name); - } - - } -} diff --git a/mcs/tools/corcompare/mono-api-html/MethodComparer.cs b/mcs/tools/corcompare/mono-api-html/MethodComparer.cs deleted file mode 100644 index 4c893e757ec..00000000000 --- a/mcs/tools/corcompare/mono-api-html/MethodComparer.cs +++ /dev/null @@ -1,77 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Linq; -using System.Reflection; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class MethodComparer : ConstructorComparer { - - public override string GroupName { - get { return "methods"; } - } - - public override string ElementName { - get { return "method"; } - } - - // operators have identical names but vary by return types - public override bool Find (XElement e) - { - if (e.GetAttribute ("name") != Source.GetAttribute ("name")) - return false; - - if (e.GetAttribute ("returntype") != Source.GetAttribute ("returntype")) - return false; - - var eGP = e.Element ("generic-parameters"); - var sGP = Source.Element ("generic-parameters"); - - if (eGP == null && sGP == null) - return true; - else if (eGP == null ^ sGP == null) - return false; - else { - var eGPs = eGP.Elements ("generic-parameter"); - var sGPs = sGP.Elements ("generic-parameter"); - return eGPs.Count () == sGPs.Count (); - } - } - - protected override bool IsBreakingRemoval (XElement e) - { - // Removing virtual methods that override another method is not a breaking change. - var is_override = e.Attribute ("is-override"); - if (is_override != null) - return is_override.Value != "true"; - - return true; // all other removals are breaking changes - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs b/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs deleted file mode 100644 index 063e34ecbf7..00000000000 --- a/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs +++ /dev/null @@ -1,104 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class NamespaceComparer : Comparer { - - ClassComparer comparer; - - public NamespaceComparer () - { - comparer = new ClassComparer (); - } - - public void Compare (XElement source, XElement target) - { - var s = source.Element ("namespaces"); - var t = target.Element ("namespaces"); - if (XNode.DeepEquals (s, t)) - return; - Compare (s.Elements ("namespace"), t.Elements ("namespace")); - } - - public override void SetContext (XElement current) - { - State.Namespace = current.Attribute ("name").Value; - } - - public override void Added (XElement target, bool wasParentAdded) - { - string name = target.Attribute ("name").Value; - if (State.IgnoreNew.Any (re => re.IsMatch (name))) - return; - - Output.WriteLine ("
", name); - Output.WriteLine ("

New Namespace {0}

", name); - Output.WriteLine (); - // list all new types - foreach (var addedType in target.Element ("classes").Elements ("class")) - comparer.Added (addedType, true); - Output.WriteLine ("
", name); - Output.WriteLine (); - } - - public override void Modified (XElement source, XElement target, ApiChanges differences) - { - var output = Output; - State.Output = new StringWriter (); - comparer.Compare (source, target); - - var s = Output.ToString (); - State.Output = output; - if (s.Length > 0) { - var name = target.Attribute ("name").Value; - Output.WriteLine ("
", name); - Output.WriteLine ("

Namespace {0}

", name); - Output.WriteLine (s); - Output.WriteLine ("
", name); - } - } - - public override void Removed (XElement source) - { - var name = source.Attribute ("name").Value; - Output.WriteLine ("
", name); - Output.WriteLine ("

Removed Namespace {0}

", name); - Output.WriteLine (); - // list all removed types - foreach (var removedType in source.Element ("classes").Elements ("class")) - comparer.Removed (removedType); - Output.WriteLine ("
", name); - Output.WriteLine (); - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/PropertyComparer.cs b/mcs/tools/corcompare/mono-api-html/PropertyComparer.cs deleted file mode 100644 index f51dd231bb9..00000000000 --- a/mcs/tools/corcompare/mono-api-html/PropertyComparer.cs +++ /dev/null @@ -1,254 +0,0 @@ -// -// Authors -// Sebastien Pouliot -// -// Copyright 2013 Xamarin Inc. http://www.xamarin.com -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Text; -using System.Xml.Linq; - -namespace Xamarin.ApiDiff { - - public class PropertyComparer : MemberComparer { - - public override string GroupName { - get { return "properties"; } - } - - public override string ElementName { - get { return "property"; } - } - - public override bool Find (XElement e) - { - if (!base.Find (e)) - return false; - // the same Item (indexer) property can have different parameters - return e.GetAttribute ("params") == Source.GetAttribute ("params"); - } - - void GetAccessors (XElement element, out XElement getter, out XElement setter) - { - var methods = element.Element ("methods"); - - getter = null; - setter = null; - - if (methods == null) - return; - - foreach (var m in methods.Elements ("method")) { - var n = m.GetAttribute ("name"); - if (n.StartsWith ("get_", StringComparison.Ordinal)) { - getter = m; - } else if (n.StartsWith ("set_", StringComparison.Ordinal)) { - setter = m; - } - } - } - - MethodAttributes GetMethodAttributes (XElement getter, XElement setter) - { - if (getter == null) - return setter.GetMethodAttributes (); - else if (setter == null) - return getter.GetMethodAttributes (); - - var gAttr = getter.GetMethodAttributes (); - var sAttr = setter.GetMethodAttributes (); - var g = gAttr & MethodAttributes.MemberAccessMask; - var s = sAttr & MethodAttributes.MemberAccessMask; - // Visibility is ordered numerically (higher value = more visible). - // We want the most visible. - var visibility = (MethodAttributes) Math.Max ((int) g, (int) s); - // Do a bitwise or with the rest of the flags - var g_no_visibility = gAttr & ~MethodAttributes.MemberAccessMask; - var s_no_visibility = sAttr & ~MethodAttributes.MemberAccessMask; - return g_no_visibility | s_no_visibility | visibility; - } - - void RenderPropertyType (XElement source, XElement target, ApiChange change) - { - var srcType = source.GetTypeName ("ptype"); - var tgtType = target.GetTypeName ("ptype"); - - if (srcType == tgtType) { - change.Append (tgtType); - } else { - change.AppendModified (srcType, tgtType, true); - } - change.Append (" "); - } - - void RenderAccessors (XElement srcGetter, XElement tgtGetter, XElement srcSetter, XElement tgtSetter, ApiChange change) - { - // FIXME: this doesn't render changes in the accessor visibility (a protected setter can become public for instance). - change.Append (" {"); - if (tgtGetter != null) { - if (srcGetter != null) { - change.Append (" ").Append ("get;"); - } else { - change.Append (" ").AppendAdded ("get;"); - } - } else if (srcGetter != null) { - change.Append (" ").AppendRemoved ("get;"); - } - - if (tgtSetter != null) { - if (srcSetter != null) { - change.Append (" ").Append ("set;"); - } else { - change.Append (" ").AppendAdded ("set;"); - } - } else if (srcSetter != null) { - change.Append (" ").AppendRemoved ("set;"); - } - - change.Append (" }"); - - // Ignore added property setters if asked to - if (srcSetter == null && tgtSetter != null && State.IgnoreAddedPropertySetters && !change.Breaking) { - change.AnyChange = false; - change.HasIgnoredChanges = true; - } - } - - void RenderIndexers (List srcIndexers, List tgtIndexers, ApiChange change) - { - change.Append ("this ["); - for (int i = 0; i < srcIndexers.Count; i++) { - var source = srcIndexers [i]; - var target = tgtIndexers [i]; - - if (i > 0) - change.Append (", "); - - var srcType = source.GetTypeName ("type"); - var tgtType = target.GetTypeName ("type"); - if (srcType == tgtType) { - change.Append (tgtType); - } else { - change.AppendModified (srcType, tgtType, true); - } - change.Append (" "); - - var srcName = source.GetAttribute ("name"); - var tgtName = target.GetAttribute ("name"); - if (srcName == tgtName) { - change.Append (tgtName); - } else { - change.AppendModified (srcName, tgtName, true); - } - } - change.Append ("]"); - } - - public override bool Equals (XElement source, XElement target, ApiChanges changes) - { - if (base.Equals (source, target, changes)) - return true; - - XElement srcGetter, srcSetter; - XElement tgtGetter, tgtSetter; - GetAccessors (source, out srcGetter, out srcSetter); - GetAccessors (target, out tgtGetter, out tgtSetter); - - List srcIndexers = null; - List tgtIndexers = null; - bool isIndexer = false; - if (srcGetter != null) { - srcIndexers = srcGetter.DescendantList ("parameters", "parameter"); - tgtIndexers = tgtGetter.DescendantList ("parameters", "parameter"); - isIndexer = srcIndexers != null && srcIndexers.Count > 0; - } - - var change = new ApiChange (); - change.Header = "Modified " + GroupName; - RenderMethodAttributes (GetMethodAttributes (srcGetter, srcSetter), GetMethodAttributes (tgtGetter, tgtSetter), change); - RenderPropertyType (source, target, change); - if (isIndexer) { - RenderIndexers (srcIndexers, tgtIndexers, change); - } else { - RenderName (source, target, change); - } - RenderGenericParameters (source, target, change); - RenderAccessors (srcGetter, tgtGetter, srcSetter, tgtSetter, change); - - changes.Add (source, target, change); - - return false; - } - - void GetProperties (XElement e, out bool @virtual, out bool @override, out bool @static, out bool getter, out bool setter, out bool family) - { - @virtual = @override = @static = getter = setter = family = false; - - var methods = e.Element ("methods"); - if (methods != null) { - foreach (var m in methods.Elements ("method")) { - @virtual |= m.IsTrue ("virtual"); - @static |= m.IsTrue ("static"); - var n = m.GetAttribute ("name"); - getter |= n.StartsWith ("get_", StringComparison.Ordinal); - setter |= n.StartsWith ("set_", StringComparison.Ordinal); - var attribs = (MethodAttributes) Int32.Parse (m.GetAttribute ("attrib")); - family = ((attribs & MethodAttributes.Public) != MethodAttributes.Public); - @override |= (attribs & MethodAttributes.NewSlot) == 0; - } - } - } - - public override string GetDescription (XElement e) - { - string name = e.Attribute ("name").Value; - string ptype = e.GetTypeName ("ptype"); - - bool virt = false; - bool over = false; - bool stat = false; - bool getter = false; - bool setter = false; - bool family = false; - GetProperties (e, out virt, out over, out stat, out getter, out setter, out family); - - var sb = new StringBuilder (); - - sb.Append (family ? "protected " : "public "); - if (virt && !State.IgnoreVirtualChanges) - sb.Append (over ? "override " : "virtual "); - else if (stat) - sb.Append ("static "); - sb.Append (ptype).Append (' ').Append (name).Append (" { "); - if (getter) - sb.Append ("get; "); - if (setter) - sb.Append ("set; "); - sb.Append ("}"); - - return sb.ToString (); - } - } -} \ No newline at end of file diff --git a/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj b/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj deleted file mode 100644 index 6ac0f241ade..00000000000 --- a/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj +++ /dev/null @@ -1,57 +0,0 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {D25986E2-7A41-4966-A26D-5614BAC7B8A7} - Exe - Xamarin.ApiDiff - mono-api-html - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - - - full - true - bin\Release - prompt - 4 - true - - - - - - - - - - - - - - - - - - - - - - - Options.cs - - - - - diff --git a/mcs/tools/corcompare/mono-api-info.exe.sources b/mcs/tools/corcompare/mono-api-info.exe.sources new file mode 100644 index 00000000000..9ae6cd0588b --- /dev/null +++ b/mcs/tools/corcompare/mono-api-info.exe.sources @@ -0,0 +1,5 @@ +AssemblyResolver.cs +Util.cs +WellFormedXmlWriter.cs +mono-api-info.cs +../../class/Mono.Options/Mono.Options/Options.cs diff --git a/mcs/tools/csharp/Makefile b/mcs/tools/csharp/Makefile index 7a03be5761c..1c3a80355ee 100644 --- a/mcs/tools/csharp/Makefile +++ b/mcs/tools/csharp/Makefile @@ -6,7 +6,8 @@ include ../../build/rules.make // 3021: CLS attribute not needed since assembly is not CLS compliant NOWARNS = -nowarn:3021 -LOCAL_MCS_FLAGS = -r:$(topdir)/class/lib/$(PROFILE)/Mono.CSharp.dll -r:$(topdir)/class/lib/$(PROFILE)/Mono.Posix.dll -r:Mono.Management.dll -r:System.dll -unsafe $(NOWARNS) +LOCAL_MCS_FLAGS = -unsafe $(NOWARNS) +LIB_REFS = Mono.CSharp Mono.Posix Mono.Management System PROGRAM = csharp.exe diff --git a/mcs/tools/culevel/Makefile b/mcs/tools/culevel/Makefile index cfc68da2310..c186b8e74a2 100644 --- a/mcs/tools/culevel/Makefile +++ b/mcs/tools/culevel/Makefile @@ -2,7 +2,7 @@ thisdir = tools/culevel SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.dll -r:System.Xml.dll +LIB_REFS = System System.Xml PROGRAM = culevel.exe CLEAN_FILES = culevel.exe culevel.exe.mdb diff --git a/mcs/tools/disco/Makefile b/mcs/tools/disco/Makefile index 12869f51ecf..77721fa1df1 100644 --- a/mcs/tools/disco/Makefile +++ b/mcs/tools/disco/Makefile @@ -2,7 +2,8 @@ thisdir = tools/disco SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:System.Web.Services.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml System.Web.Services System PROGRAM = disco.exe include ../../build/executable.make diff --git a/mcs/tools/dtd2rng/Makefile b/mcs/tools/dtd2rng/Makefile index 48e0059409c..14f8c2906b9 100644 --- a/mcs/tools/dtd2rng/Makefile +++ b/mcs/tools/dtd2rng/Makefile @@ -2,7 +2,8 @@ thisdir = tools/dtd2rng SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:Commons.Xml.Relaxng.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml Commons.Xml.Relaxng PROGRAM = dtd2rng.exe include ../../build/executable.make diff --git a/mcs/tools/dtd2xsd/Makefile b/mcs/tools/dtd2xsd/Makefile index 80431266b27..fa500c8c679 100755 --- a/mcs/tools/dtd2xsd/Makefile +++ b/mcs/tools/dtd2xsd/Makefile @@ -2,7 +2,8 @@ thisdir = tools/dtd2xsd SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml PROGRAM = dtd2xsd.exe include ../../build/executable.make diff --git a/mcs/tools/gacutil/Makefile b/mcs/tools/gacutil/Makefile index 878830f1248..f98314ecec7 100644 --- a/mcs/tools/gacutil/Makefile +++ b/mcs/tools/gacutil/Makefile @@ -2,7 +2,8 @@ thisdir = tools/gacutil SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:Mono.Security.dll -unsafe +LIB_REFS = Mono.Security +LOCAL_MCS_FLAGS = -unsafe PROGRAM = gacutil.exe diff --git a/mcs/tools/genxs/Makefile b/mcs/tools/genxs/Makefile index 21b38e8fd3c..71819a2eb52 100644 --- a/mcs/tools/genxs/Makefile +++ b/mcs/tools/genxs/Makefile @@ -2,7 +2,8 @@ thisdir = tools/genxs SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml PROGRAM = genxs.exe include ../../build/executable.make diff --git a/mcs/tools/ictool/Makefile b/mcs/tools/ictool/Makefile index 13ffb114c20..f34409878c3 100644 --- a/mcs/tools/ictool/Makefile +++ b/mcs/tools/ictool/Makefile @@ -2,7 +2,8 @@ thisdir = tools/ictool SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml PROGRAM = ictool.exe EXTRA_DISTFILES = ictool-config.xml diff --git a/mcs/tools/ikdasm/Makefile b/mcs/tools/ikdasm/Makefile index 6a6cb6fb544..1d0a78c83e0 100644 --- a/mcs/tools/ikdasm/Makefile +++ b/mcs/tools/ikdasm/Makefile @@ -3,9 +3,9 @@ SUBDIRS = include ../../build/rules.make PROGRAM = ikdasm.exe - +LIB_REFS = System System.Core System.Security LOCAL_MCS_FLAGS = \ - -d:NO_SYMBOL_WRITER /r:System.Security.dll /r:System.Core.dll /r:System.dll + -d:NO_SYMBOL_WRITER #EXTRA_DISTFILES = LICENSE diff --git a/mcs/tools/installutil/Makefile b/mcs/tools/installutil/Makefile index c545a4630eb..e7f4401169f 100644 --- a/mcs/tools/installutil/Makefile +++ b/mcs/tools/installutil/Makefile @@ -2,7 +2,8 @@ thisdir = tools/installutil SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Configuration.Install.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Configuration.Install System PROGRAM = installutil.exe diff --git a/mcs/tools/installvst/Makefile b/mcs/tools/installvst/Makefile index a5479c948dd..3ba67fe0d8f 100644 --- a/mcs/tools/installvst/Makefile +++ b/mcs/tools/installvst/Makefile @@ -2,7 +2,8 @@ thisdir = tools/installvst SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml PROGRAM = installvst.exe include ../../build/executable.make diff --git a/mcs/tools/lc/Makefile b/mcs/tools/lc/Makefile index d77c8ab6f73..905a75a488a 100644 --- a/mcs/tools/lc/Makefile +++ b/mcs/tools/lc/Makefile @@ -2,7 +2,8 @@ thisdir = tools/lc SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.dll -r:System.Core.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System System.Core PROGRAM = lc.exe CLEAN_FILES = lc.exe lc.exe.mdb diff --git a/mcs/tools/linker-analyzer/Makefile b/mcs/tools/linker-analyzer/Makefile index e68e7f6c39b..08a3fdc093a 100644 --- a/mcs/tools/linker-analyzer/Makefile +++ b/mcs/tools/linker-analyzer/Makefile @@ -4,6 +4,7 @@ include ../../build/rules.make PROGRAM = linkeranalyzer.exe -LOCAL_MCS_FLAGS = /r:System.dll /r:System.Xml.dll +LIB_REFS = System System.Xml +LOCAL_MCS_FLAGS = include ../../build/executable.make diff --git a/mcs/tools/linker/Makefile b/mcs/tools/linker/Makefile index 63c5eb6adce..3dd8398d2bc 100644 --- a/mcs/tools/linker/Makefile +++ b/mcs/tools/linker/Makefile @@ -2,10 +2,6 @@ thisdir = tools/linker SUBDIRS = include ../../build/rules.make -PROGRAM_SNK = ../../class/mono.snk - -CECIL = $(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll - RESOURCES = \ Descriptors/mscorlib.xml \ Descriptors/System.xml \ @@ -18,7 +14,8 @@ PROGRAM = monolinker.exe $(PROGRAM): $(RESOURCES) -LOCAL_MCS_FLAGS = /r:$(CECIL) /r:System.Xml.dll /r:System.Core.dll /r:System.dll $(RESOURCES:%=-resource:%) +LIB_REFS = System System.Core System.Xml Mono.Cecil +LOCAL_MCS_FLAGS = $(RESOURCES:%=-resource:%) EXTRA_DISTFILES = $(RESOURCES) diff --git a/mcs/tools/mconfig/Makefile b/mcs/tools/mconfig/Makefile index f7f8721adc1..92fc95c91f1 100644 --- a/mcs/tools/mconfig/Makefile +++ b/mcs/tools/mconfig/Makefile @@ -2,7 +2,8 @@ thisdir = tools/mconfig SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml System PROGRAM = mconfig.exe BUILT_SOURCES=Mono.MonoConfig/consts.cs diff --git a/mcs/tools/mdbdump/Makefile b/mcs/tools/mdbdump/Makefile index 9647a44d52f..55d4012a13a 100644 --- a/mcs/tools/mdbdump/Makefile +++ b/mcs/tools/mdbdump/Makefile @@ -4,9 +4,7 @@ include ../../build/rules.make PROGRAM = mdbdump.exe -LOCAL_MCS_FLAGS = \ - /r:System.Xml.dll \ - /r:Mono.Cecil.dll \ - /r:Mono.CompilerServices.SymbolWriter.dll +LIB_REFS = Mono.Cecil System.Xml Mono.CompilerServices.SymbolWriter +LOCAL_MCS_FLAGS = include ../../build/executable.make diff --git a/mcs/tools/mdbrebase/Makefile b/mcs/tools/mdbrebase/Makefile index e0432ef90a7..e0f6fe81956 100644 --- a/mcs/tools/mdbrebase/Makefile +++ b/mcs/tools/mdbrebase/Makefile @@ -4,7 +4,7 @@ include ../../build/rules.make PROGRAM = mdbrebase.exe -LOCAL_MCS_FLAGS = /r:Mono.CompilerServices.SymbolWriter.dll /r:System.dll - +LIB_REFS = System Mono.CompilerServices.SymbolWriter +LOCAL_MCS_FLAGS = include ../../build/executable.make diff --git a/mcs/tools/mdoc/Makefile b/mcs/tools/mdoc/Makefile index 3fb309b2273..efb76cbf9e0 100644 --- a/mcs/tools/mdoc/Makefile +++ b/mcs/tools/mdoc/Makefile @@ -12,16 +12,10 @@ MDOC_COMMON_FLAGS = \ /resource:Resources/msitomsx.xsl,msitomsx.xsl \ /resource:Resources/overview.xsl,overview.xsl \ /resource:Resources/stylesheet.xsl,stylesheet.xsl \ - /r:System.Web.dll \ - /r:System.Xml.Linq.dll \ - /r:ICSharpCode.SharpZipLib.dll \ - /r:Mono.Cecil.dll \ - /r:System.dll \ - /r:System.Xml.dll \ - /r:System.Core.dll - -LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS) \ - /r:monodoc.dll + +LIB_REFS = monodoc System System.Xml System.Core Mono.Cecil ICSharpCode.SharpZipLib System.Xml.Linq System.Web + +LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS) PROGRAM = mdoc.exe PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll @@ -98,51 +92,51 @@ cleanup: -rm -f monodocer1.exe* Test/DocTest-addNonGeneric.dll: - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-addNonGeneric.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-addNonGeneric.cs Test/DocTest-addNonGeneric-v2.dll: - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-addNonGeneric.cs /define:V2 + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-addNonGeneric.cs /define:V2 Test/DocTest-DropNS-classic-secondary.dll: @echo $(value @) - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic-secondary.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic-secondary.cs Test/DocTest-DropNS-classic.dll: @echo $(value @) - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs Test/DocTest-DropNS-unified.dll: - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs Test/DocTest-DropNS-unified-multitest.dll: rm -f $@ - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs /define:MULTITEST + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs /define:MULTITEST Test/DocTest-DropNS-classic-multitest.dll: rm -f $@ - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs /define:MULTITEST + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs /define:MULTITEST Test/DocTest-DropNS-unified-deletetest.dll: rm -f Test/DocTest-DropNS-unified-deletetest.dll - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs /define:DELETETEST + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs /define:DELETETEST Test/DocTest-DropNS-unified-deletetest-V2.dll: rm -f Test/DocTest-DropNS-unified-deletetest.dll - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:Test/DocTest-DropNS-unified-deletetest.dll Test/DocTest-DropNS-unified.cs /define:DELETETEST,V2 + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:Test/DocTest-DropNS-unified-deletetest.dll Test/DocTest-DropNS-unified.cs /define:DELETETEST,V2 Test/DocTest-DropNS-classic-deletetest.dll: rm -f Test/DocTest-DropNS-classic-deletetest.dll - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs /define:DELETETEST + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs /define:DELETETEST Test/DocTest-DropNS-classic-deletetest-V2.dll: rm -f Test/DocTest-DropNS-classic-deletetest.dll - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:Test/DocTest-DropNS-classic-deletetest.dll Test/DocTest-DropNS-classic.cs /define:DELETETEST,V2 + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:Test/DocTest-DropNS-classic-deletetest.dll Test/DocTest-DropNS-classic.cs /define:DELETETEST,V2 Test/DocTest.dll: - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/Microsoft.CSharp.dll Test/DocTest-InternalInterface.dll: - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-InternalInterface.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-InternalInterface.cs Test/DocTest.dll-v1: -rm -f Test/DocTest.cs @@ -158,7 +152,7 @@ Test/DocTest.dll-v2: $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll Test/DocTest-enumerations.dll: - $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-enumerations.cs + $(CSCOMPILE) $(TEST_CSCFLAGS) -unsafe -target:library -out:$@ Test/DocTest-enumerations.cs check-monodocer-addNonGeneric: $(PROGRAM) -rm -Rf Test/en.actual diff --git a/mcs/tools/mkbundle/Makefile b/mcs/tools/mkbundle/Makefile index 44620aacd1f..867c1d3e2df 100644 --- a/mcs/tools/mkbundle/Makefile +++ b/mcs/tools/mkbundle/Makefile @@ -10,7 +10,8 @@ RESOURCE_FILES = $(OTHER_RES) LOCAL_MCS_FLAGS= $(OTHER_RES:%=-resource:%) -LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE -r:System.Xml.dll -r:System.dll +LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE +LIB_REFS = System.Xml System EXTRA_DISTFILES = $(RESOURCE_FILES) diff --git a/mcs/tools/mod/Makefile b/mcs/tools/mod/Makefile index 90c9afcb026..35133d61dbe 100644 --- a/mcs/tools/mod/Makefile +++ b/mcs/tools/mod/Makefile @@ -2,7 +2,8 @@ thisdir = tools/mod SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = /r:monodoc.dll +LIB_REFS = monodoc +LOCAL_MCS_FLAGS = PROGRAM = mod.exe diff --git a/mcs/tools/mono-api-html/ApiChange.cs b/mcs/tools/mono-api-html/ApiChange.cs new file mode 100644 index 00000000000..1d902cacfad --- /dev/null +++ b/mcs/tools/mono-api-html/ApiChange.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff +{ + public class ApiChange + { + public string Header; + public StringBuilder Member = new StringBuilder (); + public bool Breaking; + public bool AnyChange; + public bool HasIgnoredChanges; + + public ApiChange Append (string text) + { + Member.Append (text); + return this; + } + + public ApiChange AppendAdded (string text, bool breaking = false) + { + Member.Append (""); + Member.Append (text); + Member.Append (""); + Breaking |= breaking; + AnyChange = true; + return this; + } + + public ApiChange AppendRemoved (string text, bool breaking = true) + { + Member.Append (""); + Member.Append (text); + Member.Append (""); + Breaking |= breaking; + AnyChange = true; + return this; + } + + public ApiChange AppendModified (string old, string @new, bool breaking = true) + { + if (old.Length > 0) + AppendRemoved (old, breaking); + if (old.Length > 0 && @new.Length > 0) + Append (" "); + if (@new.Length > 0) + AppendAdded (@new); + Breaking |= breaking; + AnyChange = true; + return this; + } + } + + public class ApiChanges : Dictionary> { + public void Add (XElement source, XElement target, ApiChange change) + { + if (!change.AnyChange) { + // This is most likely because the rendering doesn't take into account something that's different (solution: fix rendering). + if (!change.HasIgnoredChanges) { + var isField = source.Name.LocalName == "field"; + if (isField) { + Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetFieldAttributes (), target.GetFieldAttributes ()); + } else { + Console.WriteLine ("Comparison resulting in no changes (src: {2} dst: {3}) :\n{0}\n{1}\n\n", source.ToString (), target.ToString (), source.GetMethodAttributes (), target.GetMethodAttributes ()); + } + } + return; + } + + List list; + if (!TryGetValue (change.Header, out list)) { + list = new List (); + base.Add (change.Header, list); + } + list.Add (change); + } + } +} + diff --git a/mcs/tools/mono-api-html/ApiDiff.cs b/mcs/tools/mono-api-html/ApiDiff.cs new file mode 100644 index 00000000000..8fe27844852 --- /dev/null +++ b/mcs/tools/mono-api-html/ApiDiff.cs @@ -0,0 +1,277 @@ +// +// The main differences with mono-api-diff are: +// * this tool directly produce HTML similar to gdiff.sh used for Xamarin.iOS +// * this tool reports changes in an "evolutionary" way, not in a breaking way, +// i.e. it does not assume the source assembly is right (but simply older) +// * the diff .xml output was not easy to convert back into the HTML format +// that gdiff.sh produced +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.IO; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +using Mono.Options; + +namespace Xamarin.ApiDiff { + + public static class State { + static TextWriter output; + + public static TextWriter Output { + get { + if (output == null) + output = Console.Out; + return output; + } + set { output = value; } + } + + public static string Assembly { get; set; } + public static string Namespace { get; set; } + public static string Type { get; set; } + public static string BaseType { get; set; } + + public static int Indent { get; set; } + + static List ignoreAdded = new List (); + public static List IgnoreAdded { + get { return ignoreAdded; } + } + + static List ignoreNew = new List (); + public static List IgnoreNew { + get { return ignoreNew; } + } + + static List ignoreRemoved = new List (); + public static List IgnoreRemoved { + get { return ignoreRemoved; } + } + + public static bool IgnoreParameterNameChanges { get; set; } + public static bool IgnoreVirtualChanges { get; set; } + public static bool IgnoreAddedPropertySetters { get; set; } + + public static bool Lax; + public static bool Colorize = true; + } + + class Program { + + public static int Main (string[] args) + { + var showHelp = false; + string diff = null; + List extra = null; + + var options = new OptionSet { + { "h|help", "Show this help", v => showHelp = true }, + { "d|diff=", "HTML diff file out output (omit for stdout)", v => diff = v }, + { "i|ignore=", "Ignore new, added, and removed members whose description matches a given C# regular expression (see below).", + v => { + var r = new Regex (v); + State.IgnoreAdded.Add (r); + State.IgnoreRemoved.Add (r); + State.IgnoreNew.Add (r); + } + }, + { "a|ignore-added=", "Ignore added members whose description matches a given C# regular expression (see below).", + v => State.IgnoreAdded.Add (new Regex (v)) + }, + { "r|ignore-removed=", "Ignore removed members whose description matches a given C# regular expression (see below).", + v => State.IgnoreRemoved.Add (new Regex (v)) + }, + { "n|ignore-new=", "Ignore new namespaces and types whose description matches a given C# regular expression (see below).", + v => State.IgnoreNew.Add (new Regex (v)) + }, + { "ignore-changes-parameter-names", "Ignore changes to parameter names for identically prototyped methods.", + v => State.IgnoreParameterNameChanges = v != null + }, + { "ignore-changes-property-setters", "Ignore adding setters to properties.", + v => State.IgnoreAddedPropertySetters = v != null + }, + { "ignore-changes-virtual", "Ignore changing non-`virtual` to `virtual` or adding `override`.", + v => State.IgnoreVirtualChanges = v != null + }, + { "c|colorize:", "Colorize HTML output", v => State.Colorize = string.IsNullOrEmpty (v) ? true : bool.Parse (v) }, + { "x|lax", "Ignore duplicate XML entries", v => State.Lax = true } + }; + + try { + extra = options.Parse (args); + } catch (OptionException e) { + Console.WriteLine ("Option error: {0}", e.Message); + showHelp = true; + } + + if (showHelp || extra == null || extra.Count < 2 || extra.Count > 3) { + Console.WriteLine (@"Usage: mono-api-html [options] [diff.html]"); + Console.WriteLine (); + Console.WriteLine ("Available options:"); + options.WriteOptionDescriptions (Console.Out); + Console.WriteLine (); + Console.WriteLine ("Ignoring Members:"); + Console.WriteLine (); + Console.WriteLine (" Members that were added can be filtered out of the diff by using the"); + Console.WriteLine (" -i, --ignore-added option. The option takes a C# regular expression"); + Console.WriteLine (" to match against member descriptions. For example, to ignore the"); + Console.WriteLine (" introduction of the interfaces 'INSCopying' and 'INSCoding' on types"); + Console.WriteLine (" pass the following to mono-api-html:"); + Console.WriteLine (); + Console.WriteLine (" mono-api-html ... -i 'INSCopying$' -i 'INSCoding$'"); + Console.WriteLine (); + Console.WriteLine (" The regular expressions will match any member description ending with"); + Console.WriteLine (" 'INSCopying' or 'INSCoding'."); + Console.WriteLine (); + return 1; + } + + var input = extra [0]; + var output = extra [1]; + if (extra.Count == 3 && diff == null) + diff = extra [2]; + + try { + var ac = new AssemblyComparer (input, output); + if (diff != null) { + string diffHtml = String.Empty; + using (var writer = new StringWriter ()) { + State.Output = writer; + ac.Compare (); + diffHtml = State.Output.ToString (); + } + if (diffHtml.Length > 0) { + using (var file = new StreamWriter (diff)) { + file.WriteLine ("
"); + if (State.Colorize) { + file.WriteLine (""); + } + file.WriteLine ( +@""); + if (ac.SourceAssembly == ac.TargetAssembly) { + file.WriteLine ("

{0}.dll

", ac.SourceAssembly); + } else { + file.WriteLine ("

{0}.dll vs {1}.dll

", ac.SourceAssembly, ac.TargetAssembly); + } + file.WriteLine ("Hide non-breaking changes"); + file.WriteLine (""); + file.WriteLine ("
"); + file.WriteLine ("
"); + file.Write (diffHtml); + file.WriteLine ("
"); + file.WriteLine ("
"); + } + } + } else { + State.Output = Console.Out; + ac.Compare (); + } + } + catch (Exception e) { + Console.WriteLine (e); + return 1; + } + return 0; + } + } +} diff --git a/mcs/tools/mono-api-html/AssemblyComparer.cs b/mcs/tools/mono-api-html/AssemblyComparer.cs new file mode 100644 index 00000000000..adbd862eb92 --- /dev/null +++ b/mcs/tools/mono-api-html/AssemblyComparer.cs @@ -0,0 +1,79 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class AssemblyComparer : Comparer { + + XDocument source; + XDocument target; + NamespaceComparer comparer; + + public AssemblyComparer (string sourceFile, string targetFile) + { + source = XDocument.Load (sourceFile); + target = XDocument.Load (targetFile); + comparer = new NamespaceComparer (); + } + + public string SourceAssembly { get; private set; } + public string TargetAssembly { get; private set; } + + public void Compare () + { + Compare (source.Element ("assemblies").Elements ("assembly"), + target.Element ("assemblies").Elements ("assembly")); + } + + public override void SetContext (XElement current) + { + State.Assembly = current.GetAttribute ("name"); + } + + public override void Added (XElement target, bool wasParentAdded) + { + // one assembly per xml file + } + + public override void Modified (XElement source, XElement target, ApiChanges diff) + { + SourceAssembly = source.GetAttribute ("name"); + TargetAssembly = target.GetAttribute ("name"); + // TODO: version + // ? custom attributes ? + comparer.Compare (source, target); + } + + public override void Removed (XElement source) + { + // one assembly per xml file + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/ClassComparer.cs b/mcs/tools/mono-api-html/ClassComparer.cs new file mode 100644 index 00000000000..a3399fbef04 --- /dev/null +++ b/mcs/tools/mono-api-html/ClassComparer.cs @@ -0,0 +1,261 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class ClassComparer : Comparer { + + InterfaceComparer icomparer; + ConstructorComparer ccomparer; + FieldComparer fcomparer; + PropertyComparer pcomparer; + EventComparer ecomparer; + MethodComparer mcomparer; + ClassComparer kcomparer; + + public ClassComparer () + { + icomparer = new InterfaceComparer (); + ccomparer = new ConstructorComparer (); + fcomparer = new FieldComparer (); + pcomparer = new PropertyComparer (); + ecomparer = new EventComparer (); + mcomparer = new MethodComparer (); + } + + public override void SetContext (XElement current) + { + State.Type = current.GetAttribute ("name"); + State.BaseType = current.GetAttribute ("base"); + } + + public void Compare (XElement source, XElement target) + { + var s = source.Element ("classes"); + var t = target.Element ("classes"); + if (XNode.DeepEquals (s, t)) + return; + Compare (s.Elements ("class"), t.Elements ("class")); + } + + public override void Added (XElement target, bool wasParentAdded) + { + string name = target.Attribute ("name").Value; + if (State.IgnoreNew.Any (re => re.IsMatch (name))) + return; + Output.WriteLine ("
", name); + Output.WriteLine ("

New Type {0}.{1}

", State.Namespace, name); + Output.WriteLine ("
");
+			State.Indent = 0;
+			AddedInner (target);
+			Output.WriteLine ("
"); + Output.WriteLine ("
", name); + } + + public void AddedInner (XElement target) + { + SetContext (target); + if (target.IsTrue ("serializable")) + Indent ().WriteLine ("[Serializable]"); + + var type = target.Attribute ("type").Value; + + if (type == "enum") { + // check if [Flags] is present + var cattrs = target.Element ("attributes"); + if (cattrs != null) { + foreach (var ca in cattrs.Elements ("attribute")) { + if (ca.GetAttribute ("name") == "System.FlagsAttribute") { + Indent ().WriteLine ("[Flags]"); + break; + } + } + } + } + + Indent ().Write ("public"); + + if (type != "enum") { + bool seal = target.IsTrue ("sealed"); + bool abst = target.IsTrue ("abstract"); + if (seal && abst) + Output.Write (" static"); + else if (seal && type != "struct") + Output.Write (" sealed"); + else if (abst && type != "interface") + Output.Write (" abstract"); + } + + Output.Write (' '); + Output.Write (type); + Output.Write (' '); + Output.Write (target.GetAttribute ("name")); + + var baseclass = target.GetAttribute ("base"); + if ((type != "enum") && (type != "struct")) { + if (baseclass != null) { + if (baseclass == "System.Object") { + // while true we do not need to be reminded every time... + baseclass = null; + } else { + Output.Write (" : "); + Output.Write (baseclass); + } + } + } + + // interfaces on enums are "standard" not user provided - so we do not want to show them + if (type != "enum") { + var i = target.Element ("interfaces"); + if (i != null) { + var interfaces = new List (); + foreach (var iface in i.Elements ("interface")) + interfaces.Add (icomparer.GetDescription (iface)); + Output.Write ((baseclass == null) ? " : " : ", "); + Output.Write (String.Join (", ", interfaces)); + } + } + + Output.WriteLine (" {"); + + var t = target.Element ("constructors"); + if (t != null) { + Indent ().WriteLine ("\t// constructors"); + foreach (var ctor in t.Elements ("constructor")) + ccomparer.Added (ctor, true); + } + + t = target.Element ("fields"); + if (t != null) { + if (type != "enum") + Indent ().WriteLine ("\t// fields"); + else + SetContext (target); + foreach (var field in t.Elements ("field")) + fcomparer.Added (field, true); + } + + t = target.Element ("properties"); + if (t != null) { + Indent ().WriteLine ("\t// properties"); + foreach (var property in t.Elements ("property")) + pcomparer.Added (property, true); + } + + t = target.Element ("events"); + if (t != null) { + Indent ().WriteLine ("\t// events"); + foreach (var evnt in t.Elements ("event")) + ecomparer.Added (evnt, true); + } + + t = target.Element ("methods"); + if (t != null) { + Indent ().WriteLine ("\t// methods"); + foreach (var method in t.Elements ("method")) + mcomparer.Added (method, true); + } + + t = target.Element ("classes"); + if (t != null) { + Output.WriteLine (); + Indent ().WriteLine ("\t// inner types"); + kcomparer = new NestedClassComparer (); + State.Indent++; + foreach (var inner in t.Elements ("class")) + kcomparer.AddedInner (inner); + State.Indent--; + } + Indent ().WriteLine ("}"); + } + + public override void Modified (XElement source, XElement target, ApiChanges diff) + { + // hack - there could be changes that we're not monitoring (e.g. attributes properties) + var output = Output; + State.Output = new StringWriter (); + + var sb = source.GetAttribute ("base"); + var tb = target.GetAttribute ("base"); + if (sb != tb) { + Output.Write ("Modified base type: "); + Output.WriteLine (new ApiChange ().AppendModified (sb, tb, true).Member.ToString ()); + } + + ccomparer.Compare (source, target); + icomparer.Compare (source, target); + fcomparer.Compare (source, target); + pcomparer.Compare (source, target); + ecomparer.Compare (source, target); + mcomparer.Compare (source, target); + + var si = source.Element ("classes"); + if (si != null) { + var ti = target.Element ("classes"); + kcomparer = new NestedClassComparer (); + kcomparer.Compare (si.Elements ("class"), ti == null ? null : ti.Elements ("class")); + } + + var s = (Output as StringWriter).ToString (); + State.Output = output; + if (s.Length > 0) { + var tn = GetTypeName (target); + Output.WriteLine ("
", tn); + Output.WriteLine ("

Type Changed: {0}.{1}

", State.Namespace, GetTypeName (target)); + Output.WriteLine (s); + Output.WriteLine ("
", tn); + } + } + + public override void Removed (XElement source) + { + Output.Write ("

Removed Type {0}.{1}

", State.Namespace, GetTypeName (source)); + } + + public virtual string GetTypeName (XElement type) + { + return type.GetAttribute ("name"); + } + } + + public class NestedClassComparer : ClassComparer { + + public override void SetContext (XElement current) + { + } + + public override string GetTypeName (XElement type) + { + return State.Type + "." + base.GetTypeName (type); + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/Comparer.cs b/mcs/tools/mono-api-html/Comparer.cs new file mode 100644 index 00000000000..4210b9b95fb --- /dev/null +++ b/mcs/tools/mono-api-html/Comparer.cs @@ -0,0 +1,98 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public abstract class Comparer { + + protected List removed = new List (); + protected ApiChanges modified = new ApiChanges (); + + public TextWriter Output { + get { return State.Output; } + } + + protected TextWriter Indent () + { + for (int i = 0; i < State.Indent; i++) + State.Output.Write ("\t"); + return State.Output; + } + + public abstract void Added (XElement target, bool wasParentAdded); + public abstract void Modified (XElement source, XElement target, ApiChanges changes); + public abstract void Removed (XElement source); + + public virtual bool Equals (XElement source, XElement target, ApiChanges changes) + { + return XNode.DeepEquals (source, target); + } + + public abstract void SetContext (XElement current); + + public virtual void Compare (IEnumerable source, IEnumerable target) + { + removed.Clear (); + modified.Clear (); + + foreach (var s in source) { + SetContext (s); + string sn = s.GetAttribute ("name"); + var t = target == null ? null : target.SingleOrDefault (x => x.GetAttribute ("name") == sn); + if (t == null) { + // not in target, it was removed + removed.Add (s); + } else { + t.Remove (); + // possibly modified + if (Equals (s, t, modified)) + continue; + + // still in target so will be part of Added + Modified (s, t, modified); + } + } + // delayed, that way we show "Modified", "Added" and then "Removed" + foreach (var item in removed) { + SetContext (item); + Removed (item); + } + // remaining == newly added in target + if (target != null) { + foreach (var item in target) { + SetContext (item); + Added (item, false); + } + } + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/ConstructorComparer.cs b/mcs/tools/mono-api-html/ConstructorComparer.cs new file mode 100644 index 00000000000..9bd837e241f --- /dev/null +++ b/mcs/tools/mono-api-html/ConstructorComparer.cs @@ -0,0 +1,148 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + // MethodComparer inherits from this one + public class ConstructorComparer : MemberComparer { + + public override string GroupName { + get { return "constructors"; } + } + + public override string ElementName { + get { return "constructor"; } + } + + public override bool Find (XElement e) + { + return (e.Attribute ("name").Value == Source.Attribute ("name").Value); + } + + void RenderReturnType (XElement source, XElement target, ApiChange change) + { + var srcType = source.GetTypeName ("returntype"); + var tgtType = target.GetTypeName ("returntype"); + + if (srcType != tgtType) { + change.AppendModified (srcType, tgtType, true); + change.Append (" "); + } else if (srcType != null) { + // ctor don't have a return type + change.Append (srcType); + change.Append (" "); + } + } + + public override bool Equals (XElement source, XElement target, ApiChanges changes) + { + if (base.Equals (source, target, changes)) + return true; + + var change = new ApiChange (); + change.Header = "Modified " + GroupName; + RenderMethodAttributes (source, target, change); + RenderReturnType (source, target, change); + RenderName (source, target, change); + RenderGenericParameters (source, target, change); + RenderParameters (source, target, change); + + changes.Add (source, target, change); + + return false; + } + + public override string GetDescription (XElement e) + { + var sb = new StringBuilder (); + + var attribs = e.Attribute ("attrib"); + if (attribs != null) { + var attr = (MethodAttributes) Int32.Parse (attribs.Value); + if ((attr & MethodAttributes.Public) != MethodAttributes.Public) { + sb.Append ("protected "); + } else { + sb.Append ("public "); + } + + if ((attr & MethodAttributes.Static) != 0) { + sb.Append ("static "); + } else if ((attr & MethodAttributes.Virtual) != 0) { + if ((attr & MethodAttributes.VtableLayoutMask) == 0) + sb.Append ("override "); + else + sb.Append ("virtual "); + } + } + + string name = e.GetAttribute ("name"); + + var r = e.GetTypeName ("returntype"); + if (r != null) { + // ctor dont' have a return type + sb.Append (r).Append (' '); + } else { + // show the constructor as it would be defined in C# + name = name.Replace (".ctor", State.Type); + } + + // the XML file `name` does not contain parameter names, so we must process them ourselves + // which gives us the opportunity to simplify type names + sb.Append (name.Substring (0, name.IndexOf ('('))); + + var genericp = e.Element ("generic-parameters"); + if (genericp != null) { + var list = new List (); + foreach (var p in genericp.Elements ("generic-parameter")) { + list.Add (p.GetTypeName ("name")); + } + sb.Append ("<").Append (String.Join (", ", list)).Append (">"); + } + + sb.Append (" ("); + var parameters = e.Element ("parameters"); + if (parameters != null) { + var list = new List (); + foreach (var p in parameters.Elements ("parameter")) { + var pTypeName = p.GetTypeName ("type"); + list.Add (State.IgnoreParameterNameChanges + ? pTypeName + : pTypeName + " " + p.GetAttribute ("name")); + } + sb.Append (String.Join (", ", list)); + } + sb.Append (");"); + + return sb.ToString (); + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/EventComparer.cs b/mcs/tools/mono-api-html/EventComparer.cs new file mode 100644 index 00000000000..693f16f5342 --- /dev/null +++ b/mcs/tools/mono-api-html/EventComparer.cs @@ -0,0 +1,75 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Text; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class EventComparer : MemberComparer { + + public override string GroupName { + get { return "events"; } + } + + public override string ElementName { + get { return "event"; } + } + + public override bool Equals (XElement source, XElement target, ApiChanges changes) + { + if (base.Equals (source, target, changes)) + return true; + + var change = new ApiChange (); + change.Header = "Modified " + GroupName; + change.Append ("public event "); + + var srcEventType = source.GetTypeName ("eventtype"); + var tgtEventType = target.GetTypeName ("eventtype"); + + if (srcEventType != tgtEventType) { + change.AppendModified (srcEventType, tgtEventType, true); + } else { + change.Append (srcEventType); + } + change.Append (" "); + change.Append (source.GetAttribute ("name")).Append (";"); + return false; + } + + public override string GetDescription (XElement e) + { + StringBuilder sb = new StringBuilder (); + // TODO: attribs + sb.Append ("public event "); + sb.Append (e.GetTypeName ("eventtype")).Append (' '); + sb.Append (e.GetAttribute ("name")).Append (';'); + return sb.ToString (); + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/FieldComparer.cs b/mcs/tools/mono-api-html/FieldComparer.cs new file mode 100644 index 00000000000..a2b0225b448 --- /dev/null +++ b/mcs/tools/mono-api-html/FieldComparer.cs @@ -0,0 +1,211 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class FieldComparer : MemberComparer { + + public override string GroupName { + get { return "fields"; } + } + + public override string ElementName { + get { return "field"; } + } + + void RenderFieldAttributes (FieldAttributes source, FieldAttributes target, ApiChange change) + { + var srcNotSerialized = (source & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized; + var tgtNotSerialized = (target & FieldAttributes.NotSerialized) == FieldAttributes.NotSerialized; + if (srcNotSerialized != tgtNotSerialized) { + // this is not a breaking change, so only render it if it changed. + if (srcNotSerialized) { + change.AppendRemoved ("[NonSerialized]\n"); + } else { + change.AppendAdded ("[NonSerialized]\n"); + } + } + + // the visibility values are the same for MethodAttributes and FieldAttributes, so just use the same method. + RenderVisibility ((MethodAttributes) source, (MethodAttributes) target, change); + // same for the static flag + RenderStatic ((MethodAttributes) source, (MethodAttributes) target, change); + + var srcLiteral = (source & FieldAttributes.Literal) != 0; + var tgtLiteral = (target & FieldAttributes.Literal) != 0; + + if (srcLiteral) { + if (tgtLiteral) { + change.Append ("const "); + } else { + change.AppendRemoved ("const", true).Append (" "); + } + } else if (tgtLiteral) { + change.AppendAdded ("const", true).Append (" "); + } + + var srcInitOnly = (source & FieldAttributes.InitOnly) != 0; + var tgtInitOnly = (target & FieldAttributes.InitOnly) != 0; + if (srcInitOnly) { + if (tgtInitOnly) { + change.Append ("readonly "); + } else { + change.AppendRemoved ("readonly", false).Append (" "); + } + } else if (tgtInitOnly) { + change.AppendAdded ("readonly", true).Append (" "); + } + } + + public override bool Equals (XElement source, XElement target, ApiChanges changes) + { + if (base.Equals (source, target, changes)) + return true; + + var name = source.GetAttribute ("name"); + var srcValue = source.GetAttribute ("value"); + var tgtValue = target.GetAttribute ("value"); + var change = new ApiChange (); + change.Header = "Modified " + GroupName; + + if (State.BaseType == "System.Enum") { + change.Append (name).Append (" = "); + if (srcValue != tgtValue) { + change.AppendModified (srcValue, tgtValue, true); + } else { + change.Append (srcValue); + } + } else { + RenderFieldAttributes (source.GetFieldAttributes (), target.GetFieldAttributes (), change); + + var srcType = source.GetTypeName ("fieldtype"); + var tgtType = target.GetTypeName ("fieldtype"); + + if (srcType != tgtType) { + change.AppendModified (srcType, tgtType, true); + } else { + change.Append (srcType); + } + change.Append (" "); + change.Append (name); + + if (srcType == "string" && srcValue != null) + srcValue = "\"" + srcValue + "\""; + + if (tgtType == "string" && tgtValue != null) + tgtValue = "\"" + tgtValue + "\""; + + if (srcValue != tgtValue) { + change.Append (" = "); + if (srcValue == null) + srcValue = "null"; + if (tgtValue == null) + tgtValue = "null"; + change.AppendModified (srcValue, tgtValue, true); + } else if (srcValue != null) { + change.Append (" = "); + change.Append (srcValue); + } + change.Append (";"); + } + + changes.Add (source, target, change); + + return false; + } + + public override string GetDescription (XElement e) + { + var sb = new StringBuilder (); + + string name = e.GetAttribute ("name"); + string value = e.GetAttribute ("value"); + + if (State.BaseType == "System.Enum") { + sb.Append (name).Append (" = ").Append (value).Append (','); + } else { + var attribs = e.Attribute ("attrib"); + if (attribs != null) { + var attr = (FieldAttributes)Int32.Parse (attribs.Value); + if ((attr & FieldAttributes.Public) != FieldAttributes.Public) { + sb.Append ("protected "); + } else { + sb.Append ("public "); + } + + if ((attr & FieldAttributes.Static) != 0) + sb.Append ("static "); + + if ((attr & FieldAttributes.Literal) != 0) + sb.Append ("const "); + } + + string ftype = e.GetTypeName ("fieldtype"); + sb.Append (ftype).Append (' '); + sb.Append (name); + if (ftype == "string" && e.Attribute ("value") != null) { + if (value == null) + sb.Append (" = null"); + else + sb.Append (" = \"").Append (value).Append ('"'); + } + sb.Append (';'); + } + + return sb.ToString (); + } + + public override void BeforeAdding (IEnumerable list) + { + first = true; + if (State.BaseType == "System.Enum") { + Output.WriteLine ("
"); + Output.WriteLine ("

Added value{0}:

", list.Count () > 1 ? "s" : String.Empty); + Output.WriteLine ("
");
+			} else {
+				base.BeforeAdding (list);
+			}
+		}
+
+		public override void BeforeRemoving (IEnumerable list)
+		{
+			first = true;
+			if (State.BaseType == "System.Enum") {
+				Output.WriteLine ("

Removed value{0}:

", list.Count () > 1 ? "s" : String.Empty); + Output.WriteLine ("
");
+			} else {
+				base.BeforeRemoving (list);
+			}
+		}
+	}
+}
\ No newline at end of file
diff --git a/mcs/tools/mono-api-html/Helpers.cs b/mcs/tools/mono-api-html/Helpers.cs
new file mode 100644
index 00000000000..8769785c478
--- /dev/null
+++ b/mcs/tools/mono-api-html/Helpers.cs
@@ -0,0 +1,207 @@
+// 
+// Authors
+//    Sebastien Pouliot  
+//
+// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Xml.Linq;
+
+namespace Xamarin.ApiDiff {
+
+	public static class Helper {
+		public static bool IsTrue (this XElement self, string name)
+		{
+			return (self.GetAttribute (name) == "true");
+		}
+
+		public static string GetAttribute (this XElement self, string name)
+		{
+			var n = self.Attribute (name);
+			if (n == null)
+				return null;
+			return n.Value;
+		}
+
+		// null == no obsolete, String.Empty == no description
+		public static string GetObsoleteMessage (this XElement self)
+		{
+			var cattrs = self.Element ("attributes");
+			if (cattrs == null)
+				return null;
+
+			foreach (var ca in cattrs.Elements ("attribute")) {
+				if (ca.GetAttribute ("name") != "System.ObsoleteAttribute")
+					continue;
+				var props = ca.Element ("properties");
+				if (props == null)
+					return String.Empty; // no description
+				foreach (var p in props.Elements ("property")) {
+					if (p.GetAttribute ("name") != "Message")
+						continue;
+					return p.GetAttribute ("value");
+				}
+			}
+			return null;
+		}
+
+		public static IEnumerable Descendants (this XElement self, params string[] names)
+		{
+			XElement el = self;
+			if (el == null)
+				return null;
+
+			for (int i = 0; i < names.Length - 1; i++) {
+				el = el.Element (names [i]);
+				if (el == null)
+					return null;
+			}
+			return el.Elements (names [names.Length - 1]);
+		}
+
+		public static List DescendantList (this XElement self, params string[] names)
+		{
+			var descendants = self.Descendants (names);
+			if (descendants == null)
+				return null;
+			return descendants.ToList ();
+		}
+
+		// make it beautiful (.NET -> C#)
+		public static string GetTypeName (this XElement self, string name)
+		{
+			string type = self.GetAttribute (name);
+			if (type == null)
+				return null;
+
+			StringBuilder sb = null;
+			bool is_nullable = false;
+			if (type.StartsWith ("System.Nullable`1[", StringComparison.Ordinal)) {
+				is_nullable = true;
+				sb = new StringBuilder (type, 18, type.Length - 19, 1024);
+			} else {
+				sb = new StringBuilder (type);
+			}
+
+			bool is_ref = (sb [sb.Length - 1] == '&');
+			if (is_ref)
+				sb.Remove (sb.Length - 1, 1);
+
+			int array = 0;
+			while ((sb [sb.Length - 1] == ']') && (sb [sb.Length - 2] == '[')) {
+				sb.Remove (sb.Length - 2, 2);
+				array++;
+			}
+
+			bool is_pointer = (sb [sb.Length - 1] == '*');
+			if (is_pointer)
+				sb.Remove (sb.Length - 1, 1);
+
+			type = GetTypeName (sb.Replace ('+', '.').ToString ());
+			sb.Length = 0;
+			if (is_ref)
+				sb.Append (self.GetAttribute ("direction")).Append (' ');
+
+			sb.Append (type);
+
+			while (array-- > 0)
+				sb.Append ("[]");
+			if (is_nullable)
+				sb.Append ('?');
+			if (is_pointer)
+				sb.Append ('*');
+			return sb.ToString ();
+		}
+
+		static string GetTypeName (string type)
+		{
+			int pos = type.IndexOf ('`');
+			if (pos >= 0) {
+				int end = type.LastIndexOf (']');
+				string subtype = type.Substring (pos + 3, end - pos - 3);
+				return type.Substring (0, pos) + "<" + GetTypeName (subtype) + ">";
+			}
+
+			switch (type) {
+			case "System.String":
+				return "string";
+			case "System.Int32":
+				return "int";
+			case "System.UInt32":
+				return "uint";
+			case "System.Int64":
+				return "long";
+			case "System.UInt64":
+				return "ulong";
+			case "System.Void":
+				return "void";
+			case "System.Boolean":
+				return "bool";
+			case "System.Object":
+				return "object";
+			case "System.Single":
+				return "float";
+			case "System.Double":
+				return "double";
+			case "System.Byte":
+				return "byte";
+			case "System.SByte":
+				return "sbyte";
+			case "System.Int16":
+				return "short";
+			case "System.UInt16":
+				return "ushort";
+			case "System.Char":
+				return "char";
+			case "System.nint":
+				return "nint";
+			case "System.nuint":
+				return "uint";
+			case "System.nfloat":
+				return "nfloat";
+			case "System.IntPtr":
+				return "IntPtr";
+			default:
+				if (type.StartsWith (State.Namespace, StringComparison.Ordinal))
+					type = type.Substring (State.Namespace.Length + 1);
+				return type;
+			}
+		}
+
+		public static MethodAttributes GetMethodAttributes (this XElement element)
+		{
+			var srcAttribs = element.Attribute ("attrib");
+			return (MethodAttributes) (srcAttribs != null ? Int32.Parse (srcAttribs.Value) : 0);
+		}
+
+		public static FieldAttributes GetFieldAttributes (this XElement element)
+		{
+			var srcAttribs = element.Attribute ("attrib");
+			return (FieldAttributes) (srcAttribs != null ? Int32.Parse (srcAttribs.Value) : 0);
+		}
+	}
+}
\ No newline at end of file
diff --git a/mcs/tools/mono-api-html/InterfaceComparer.cs b/mcs/tools/mono-api-html/InterfaceComparer.cs
new file mode 100644
index 00000000000..df52f162e49
--- /dev/null
+++ b/mcs/tools/mono-api-html/InterfaceComparer.cs
@@ -0,0 +1,47 @@
+// 
+// Authors
+//    Sebastien Pouliot  
+//
+// Copyright 2013 Xamarin Inc. http://www.xamarin.com
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Xml.Linq;
+
+namespace Xamarin.ApiDiff {
+
+	public class InterfaceComparer : MemberComparer {
+
+		public override string GroupName {
+			get { return "interfaces"; }
+		}
+
+		public override string ElementName {
+			get { return "interface"; }
+		}
+
+		public override string GetDescription (XElement e)
+		{
+			return e.GetTypeName ("name");
+		}
+	}
+}
\ No newline at end of file
diff --git a/mcs/tools/mono-api-html/Makefile b/mcs/tools/mono-api-html/Makefile
new file mode 100644
index 00000000000..e1c55c1f0a5
--- /dev/null
+++ b/mcs/tools/mono-api-html/Makefile
@@ -0,0 +1,10 @@
+thisdir = tools/mono-api-html
+SUBDIRS =
+include ../../build/rules.make
+
+LIB_REFS = Mono.Cecil System.Xml System.Core System System.Xml.Linq
+LOCAL_MCS_FLAGS =
+
+PROGRAM = mono-api-html.exe
+
+include ../../build/executable.make
diff --git a/mcs/tools/mono-api-html/MemberComparer.cs b/mcs/tools/mono-api-html/MemberComparer.cs
new file mode 100644
index 00000000000..d12d86625c2
--- /dev/null
+++ b/mcs/tools/mono-api-html/MemberComparer.cs
@@ -0,0 +1,608 @@
+// 
+// Authors
+//    Sebastien Pouliot  
+//
+// Copyright 2013-2014 Xamarin Inc. http://www.xamarin.com
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Xml.Linq;
+
+namespace Xamarin.ApiDiff {
+
+	public abstract class MemberComparer : Comparer {
+
+		// true if this is the first element being added or removed in the group being rendered
+		protected bool first;
+
+		public abstract string GroupName { get; }
+		public abstract string ElementName { get; }
+
+		protected virtual bool IsBreakingRemoval (XElement e)
+		{
+			return true;
+		}
+
+		public void Compare (XElement source, XElement target)
+		{
+			var s = source.Element (GroupName);
+			var t = target.Element (GroupName);
+			if (XNode.DeepEquals (s, t))
+				return;
+
+			if (s == null) {
+				Add (t.Elements (ElementName));
+			} else if (t == null) {
+				Remove (s.Elements (ElementName));
+			} else {
+				Compare (s.Elements (ElementName), t.Elements (ElementName));
+			}
+		}
+
+		public override void SetContext (XElement current)
+		{
+		}
+
+		string GetContainingType (XElement el)
+		{
+			return el.Ancestors ("class").First ().Attribute ("type").Value;
+		}
+
+		bool IsInInterface (XElement el)
+		{
+			return GetContainingType (el) == "interface";
+		}
+
+		public XElement Source { get; set; }
+
+		public virtual bool Find (XElement e)
+		{
+			return e.GetAttribute ("name") == Source.GetAttribute ("name");
+		}
+
+		XElement Find (IEnumerable target)
+		{
+			return State.Lax ? target.FirstOrDefault (Find) : target.SingleOrDefault (Find);
+		}
+
+		public override void Compare (IEnumerable source, IEnumerable target)
+		{
+			removed.Clear ();
+			modified.Clear ();
+
+			foreach (var s in source) {
+				SetContext (s);
+				Source = s;
+				var t = Find (target);
+				if (t == null) {
+					// not in target, it was removed
+					removed.Add (s);
+				} else {
+					t.Remove ();
+					// possibly modified
+					if (Equals (s, t, modified))
+						continue;
+
+					Modified (s, t, modified);
+				}
+			}
+			// delayed, that way we show "Modified", "Added" and then "Removed"
+			Remove (removed);
+
+			Modify (modified);
+
+			// remaining == newly added in target
+			Add (target);
+		}
+
+		void Add (IEnumerable elements)
+		{
+			bool a = false;
+			foreach (var item in elements) {
+				SetContext (item);
+				if (State.IgnoreAdded.Any (re => re.IsMatch (GetDescription (item))))
+					continue;
+				if (!a) {
+					BeforeAdding (elements);
+					a = true;
+				}
+				Added (item, false);
+			}
+			if (a)
+				AfterAdding ();
+		}
+
+		void Modify (ApiChanges modified)
+		{
+			foreach (var changes in modified) {
+				Output.WriteLine ("

{0}:

", changes.Key); + Output.WriteLine ("
");
+				foreach (var element in changes.Value) {
+					Output.Write ("
", element.Breaking ? "data-is-breaking" : "data-is-non-breaking"); + foreach (var line in element.Member.ToString ().Split ('\n')) + Output.WriteLine ("\t{0}", line); + Output.Write ("
"); + + } + Output.WriteLine ("
"); + } + } + + void Remove (IEnumerable elements) + { + bool r = false; + foreach (var item in elements) { + if (State.IgnoreRemoved.Any (re => re.IsMatch (GetDescription (item)))) + continue; + SetContext (item); + if (!r) { + BeforeRemoving (elements); + r = true; + } + Removed (item); + } + if (r) + AfterRemoving (); + } + + public abstract string GetDescription (XElement e); + + protected StringBuilder GetObsoleteMessage (XElement e) + { + var sb = new StringBuilder (); + string o = e.GetObsoleteMessage (); + if (o != null) { + sb.Append ("[Obsolete"); + if (o.Length > 0) + sb.Append (" (\"").Append (o).Append ("\")"); + sb.AppendLine ("]"); + for (int i = 0; i < State.Indent + 1; i++) + sb.Append ('\t'); + } + return sb; + } + + public override bool Equals (XElement source, XElement target, ApiChanges changes) + { + RenderAttributes (source, target, changes); + + // We don't want to compare attributes. + RemoveAttributes (source); + RemoveAttributes (target); + + return base.Equals (source, target, changes); + } + + public virtual void BeforeAdding (IEnumerable list) + { + first = true; + Output.WriteLine ("
"); + Output.WriteLine ("

Added {0}:

", list.Count () > 1 ? GroupName : ElementName); + Output.WriteLine ("
");
+		}
+
+		public override void Added (XElement target, bool wasParentAdded)
+		{
+			var o = GetObsoleteMessage (target);
+			if (!first && (o.Length > 0))
+				Output.WriteLine ();
+			Indent ();
+			bool isInterfaceBreakingChange = !wasParentAdded && IsInInterface (target);
+			Output.Write ("\t", ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
+			Output.Write ("{0}{1}", o, GetDescription (target));
+			Output.WriteLine ("");
+			first = false;
+		}
+
+		public virtual void AfterAdding ()
+		{
+			Output.WriteLine ("
"); + Output.WriteLine ("
"); + } + + public override void Modified (XElement source, XElement target, ApiChanges change) + { + } + + public virtual void BeforeRemoving (IEnumerable list) + { + first = true; + Output.WriteLine ("

Removed {0}:

\n", list.Count () > 1 ? GroupName : ElementName); + Output.WriteLine ("
");
+		}
+
+		public override void Removed (XElement source)
+		{
+			var o = GetObsoleteMessage (source);
+			if (!first && (o.Length > 0))
+				Output.WriteLine ();
+
+			bool is_breaking = IsBreakingRemoval (source);
+
+			Indent ();
+			Output.Write ("\t", ElementName, is_breaking ? "data-is-breaking" : "data-is-non-breaking", is_breaking ? "breaking" : string.Empty);
+			Output.Write ("{0}{1}", o, GetDescription (source));
+			Output.WriteLine ("");
+			first = false;
+		}
+
+		public virtual void AfterRemoving ()
+		{
+			Output.WriteLine ("
");; + } + + string RenderGenericParameter (XElement gp) + { + var sb = new StringBuilder (); + sb.Append (gp.GetTypeName ("name")); + + var constraints = gp.DescendantList ("generic-parameter-constraints", "generic-parameter-constraint"); + if (constraints != null && constraints.Count > 0) { + sb.Append (" : "); + for (int i = 0; i < constraints.Count; i++) { + if (i > 0) + sb.Append (", "); + sb.Append (constraints [i].GetTypeName ("name")); + } + } + return sb.ToString (); + } + + protected void RenderGenericParameters (XElement source, XElement target, ApiChange change) + { + var src = source.DescendantList ("generic-parameters", "generic-parameter"); + var tgt = target.DescendantList ("generic-parameters", "generic-parameter"); + var srcCount = src == null ? 0 : src.Count; + var tgtCount = tgt == null ? 0 : tgt.Count; + + if (srcCount == 0 && tgtCount == 0) + return; + + change.Append ("<"); + for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { + if (i > 0) + change.Append (", "); + if (i >= srcCount) { + change.AppendAdded (RenderGenericParameter (tgt [i]), true); + } else if (i >= tgtCount) { + change.AppendRemoved (RenderGenericParameter (src [i]), true); + } else { + var srcName = RenderGenericParameter (src [i]); + var tgtName = RenderGenericParameter (tgt [i]); + + if (srcName != tgtName) { + change.AppendModified (srcName, tgtName, true); + } else { + change.Append (srcName); + } + } + } + change.Append (">"); + } + + protected string FormatValue (string type, string value) + { + if (value == null) + return "null"; + + if (type == "string") + return "\"" + value + "\""; + else if (type == "bool") { + switch (value) { + case "True": + return "true"; + case "False": + return "false"; + default: + return value; + } + } + + return value; + } + + protected void RenderParameters (XElement source, XElement target, ApiChange change) + { + var src = source.DescendantList ("parameters", "parameter"); + var tgt = target.DescendantList ("parameters", "parameter"); + var srcCount = src == null ? 0 : src.Count; + var tgtCount = tgt == null ? 0 : tgt.Count; + + change.Append (" ("); + for (int i = 0; i < Math.Max (srcCount, tgtCount); i++) { + if (i > 0) + change.Append (", "); + + if (i >= srcCount) { + change.AppendAdded (tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true); + } else if (i >= tgtCount) { + change.AppendRemoved (src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true); + } else { + var paramSourceType = src [i].GetTypeName ("type"); + var paramTargetType = tgt [i].GetTypeName ("type"); + + var paramSourceName = src [i].GetAttribute ("name"); + var paramTargetName = tgt [i].GetAttribute ("name"); + + if (paramSourceType != paramTargetType) { + change.AppendModified (paramSourceType, paramTargetType, true); + } else { + change.Append (paramSourceType); + } + change.Append (" "); + if (paramSourceName != paramTargetName) { + change.AppendModified (paramSourceName, paramTargetName, false); + } else { + change.Append (paramSourceName); + } + + var optSource = src [i].Attribute ("optional"); + var optTarget = tgt [i].Attribute ("optional"); + var srcValue = FormatValue (paramSourceType, src [i].GetAttribute ("defaultValue")); + var tgtValue = FormatValue (paramTargetType, tgt [i].GetAttribute ("defaultValue")); + + if (optSource != null) { + if (optTarget != null) { + change.Append (" = "); + if (srcValue != tgtValue) { + change.AppendModified (srcValue, tgtValue, false); + } else { + change.Append (tgtValue); + } + } else { + change.AppendRemoved (" = " + srcValue); + } + } else { + if (optTarget != null) + change.AppendAdded (" = " + tgtValue); + } + } + } + + change.Append (")"); + + // Ignore any parameter name changes if requested. + if (State.IgnoreParameterNameChanges && !change.Breaking) { + change.AnyChange = false; + change.HasIgnoredChanges = true; + } + } + + void RenderVTable (MethodAttributes source, MethodAttributes target, ApiChange change) + { + var srcAbstract = (source & MethodAttributes.Abstract) == MethodAttributes.Abstract; + var tgtAbstract = (target & MethodAttributes.Abstract) == MethodAttributes.Abstract; + var srcFinal = (source & MethodAttributes.Final) == MethodAttributes.Final; + var tgtFinal = (target & MethodAttributes.Final) == MethodAttributes.Final; + var srcVirtual = (source & MethodAttributes.Virtual) == MethodAttributes.Virtual; + var tgtVirtual = (target & MethodAttributes.Virtual) == MethodAttributes.Virtual; + var srcOverride = (source & MethodAttributes.VtableLayoutMask) != MethodAttributes.NewSlot; + var tgtOverride = (target & MethodAttributes.VtableLayoutMask) != MethodAttributes.NewSlot; + + var srcWord = srcVirtual ? (srcOverride ? "override" : "virtual") : string.Empty; + var tgtWord = tgtVirtual ? (tgtOverride ? "override" : "virtual") : string.Empty; + var breaking = srcWord.Length > 0 && tgtWord.Length == 0; + + if (srcAbstract) { + if (tgtAbstract) { + change.Append ("abstract "); + } else if (tgtVirtual) { + change.AppendModified ("abstract", tgtWord, false).Append (" "); + } else { + change.AppendRemoved ("abstract").Append (" "); + } + } else { + if (tgtAbstract) { + change.AppendAdded ("abstract", true).Append (" "); + } else if (srcWord != tgtWord) { + if (!tgtFinal) + change.AppendModified (srcWord, tgtWord, breaking).Append (" "); + } else if (tgtWord.Length > 0) { + change.Append (tgtWord).Append (" "); + } else if (srcWord.Length > 0) { + change.AppendRemoved (srcWord, breaking).Append (" "); + } + } + + if (srcFinal) { + if (tgtFinal) { + change.Append ("final "); + } else { + change.AppendRemoved ("final", false).Append (" "); // removing 'final' is not a breaking change. + } + } else { + if (tgtFinal && srcVirtual) { + change.AppendModified ("virtual", "final", true).Append (" "); // adding 'final' is a breaking change if the member was virtual + } + } + + if (!srcVirtual && !srcFinal && tgtVirtual && tgtFinal) { + // existing member implements a member from a new interface + // this would show up as 'virtual final', which is redundant, so show nothing at all. + change.HasIgnoredChanges = true; + } + + // Ignore non-breaking virtual changes. + if (State.IgnoreVirtualChanges && !change.Breaking) { + change.AnyChange = false; + change.HasIgnoredChanges = true; + } + + var tgtSecurity = (source & MethodAttributes.HasSecurity) == MethodAttributes.HasSecurity; + var srcSecurity = (target & MethodAttributes.HasSecurity) == MethodAttributes.HasSecurity; + + if (tgtSecurity != srcSecurity) + change.HasIgnoredChanges = true; + + var srcPInvoke = (source & MethodAttributes.PinvokeImpl) == MethodAttributes.PinvokeImpl; + var tgtPInvoke = (target & MethodAttributes.PinvokeImpl) == MethodAttributes.PinvokeImpl; + if (srcPInvoke != tgtPInvoke) + change.HasIgnoredChanges = true; + } + + protected string GetVisibility (MethodAttributes attr) + { + switch (attr) { + case MethodAttributes.Private: + case MethodAttributes.PrivateScope: + return "private"; + case MethodAttributes.Assembly: + return "internal"; + case MethodAttributes.FamANDAssem: + return "private internal"; + case MethodAttributes.FamORAssem: + return "protected"; // customers don't care about 'internal'; + case MethodAttributes.Family: + return "protected"; + case MethodAttributes.Public: + return "public"; + default: + throw new NotImplementedException (); + } + } + + protected void RenderVisibility (MethodAttributes source, MethodAttributes target, ApiChange diff) + { + source = source & MethodAttributes.MemberAccessMask; + target = target & MethodAttributes.MemberAccessMask; + + if (source == target) { + diff.Append (GetVisibility (target)); + } else { + var breaking = false; + switch (source) { + case MethodAttributes.Private: + case MethodAttributes.Assembly: + case MethodAttributes.FamANDAssem: + break; // these are not publicly visible, thus not breaking + case MethodAttributes.FamORAssem: + case MethodAttributes.Family: + switch (target) { + case MethodAttributes.Public: + // to public is not a breaking change + break; + case MethodAttributes.Family: + case MethodAttributes.FamORAssem: + // not a breaking change, but should still show up in diff + break; + default: + // anything else is a breaking change + breaking = true; + break; + } + break; + case MethodAttributes.Public: + default: + // any change from public is breaking. + breaking = true; + break; + } + + diff.AppendModified (GetVisibility (source), GetVisibility (target), breaking); + } + diff.Append (" "); + } + + protected void RenderStatic (MethodAttributes src, MethodAttributes tgt, ApiChange diff) + { + var srcStatic = (src & MethodAttributes.Static) == MethodAttributes.Static; + var tgtStatic = (tgt & MethodAttributes.Static) == MethodAttributes.Static; + + if (srcStatic != tgtStatic) { + if (srcStatic) { + diff.AppendRemoved ("static", true).Append (" "); + } else { + diff.AppendAdded ("static", true).Append (" "); + } + } + } + + protected void RenderMethodAttributes (MethodAttributes src, MethodAttributes tgt, ApiChange diff) + { + RenderStatic (src, tgt, diff); + RenderVisibility (src & MethodAttributes.MemberAccessMask, tgt & MethodAttributes.MemberAccessMask, diff); + RenderVTable (src, tgt, diff); + } + + protected void RenderMethodAttributes (XElement source, XElement target, ApiChange diff) + { + RenderMethodAttributes (source.GetMethodAttributes (), target.GetMethodAttributes (), diff); + } + + protected void RemoveAttributes (XElement element) + { + var srcAttributes = element.Element ("attributes"); + if (srcAttributes != null) + srcAttributes.Remove (); + + foreach (var el in element.Elements ()) + RemoveAttributes (el); + } + + protected void RenderAttributes (XElement source, XElement target, ApiChanges changes) + { + var srcObsolete = source.GetObsoleteMessage (); + var tgtObsolete = target.GetObsoleteMessage (); + + if (srcObsolete == tgtObsolete) + return; // nothing changed + + if (srcObsolete == null) { + if (tgtObsolete == null) + return; // neither is obsolete + var change = new ApiChange (); + change.Header = "Obsoleted " + GroupName; + change.Append (string.Format ("", ElementName)); + change.Append ("[Obsolete ("); + if (tgtObsolete != string.Empty) + change.Append ("\"").Append (tgtObsolete).Append ("\""); + change.Append (")]\n"); + change.Append (GetDescription (target)); + change.Append (""); + change.AnyChange = true; + changes.Add (source, target, change); + } else if (tgtObsolete == null) { + // Made non-obsolete. Do we care to report this? + } else { + // Obsolete message changed. Do we care to report this? + } + } + + protected void RenderName (XElement source, XElement target, ApiChange change) + { + var name = target.GetAttribute ("name"); + // show the constructor as it would be defined in C# + name = name.Replace (".ctor", State.Type); + + var p = name.IndexOf ('('); + if (p >= 0) + name = name.Substring (0, p); + + change.Append (name); + } + + } +} diff --git a/mcs/tools/mono-api-html/MethodComparer.cs b/mcs/tools/mono-api-html/MethodComparer.cs new file mode 100644 index 00000000000..4c893e757ec --- /dev/null +++ b/mcs/tools/mono-api-html/MethodComparer.cs @@ -0,0 +1,77 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Linq; +using System.Reflection; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class MethodComparer : ConstructorComparer { + + public override string GroupName { + get { return "methods"; } + } + + public override string ElementName { + get { return "method"; } + } + + // operators have identical names but vary by return types + public override bool Find (XElement e) + { + if (e.GetAttribute ("name") != Source.GetAttribute ("name")) + return false; + + if (e.GetAttribute ("returntype") != Source.GetAttribute ("returntype")) + return false; + + var eGP = e.Element ("generic-parameters"); + var sGP = Source.Element ("generic-parameters"); + + if (eGP == null && sGP == null) + return true; + else if (eGP == null ^ sGP == null) + return false; + else { + var eGPs = eGP.Elements ("generic-parameter"); + var sGPs = sGP.Elements ("generic-parameter"); + return eGPs.Count () == sGPs.Count (); + } + } + + protected override bool IsBreakingRemoval (XElement e) + { + // Removing virtual methods that override another method is not a breaking change. + var is_override = e.Attribute ("is-override"); + if (is_override != null) + return is_override.Value != "true"; + + return true; // all other removals are breaking changes + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/NamespaceComparer.cs b/mcs/tools/mono-api-html/NamespaceComparer.cs new file mode 100644 index 00000000000..063e34ecbf7 --- /dev/null +++ b/mcs/tools/mono-api-html/NamespaceComparer.cs @@ -0,0 +1,104 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class NamespaceComparer : Comparer { + + ClassComparer comparer; + + public NamespaceComparer () + { + comparer = new ClassComparer (); + } + + public void Compare (XElement source, XElement target) + { + var s = source.Element ("namespaces"); + var t = target.Element ("namespaces"); + if (XNode.DeepEquals (s, t)) + return; + Compare (s.Elements ("namespace"), t.Elements ("namespace")); + } + + public override void SetContext (XElement current) + { + State.Namespace = current.Attribute ("name").Value; + } + + public override void Added (XElement target, bool wasParentAdded) + { + string name = target.Attribute ("name").Value; + if (State.IgnoreNew.Any (re => re.IsMatch (name))) + return; + + Output.WriteLine ("
", name); + Output.WriteLine ("

New Namespace {0}

", name); + Output.WriteLine (); + // list all new types + foreach (var addedType in target.Element ("classes").Elements ("class")) + comparer.Added (addedType, true); + Output.WriteLine ("
", name); + Output.WriteLine (); + } + + public override void Modified (XElement source, XElement target, ApiChanges differences) + { + var output = Output; + State.Output = new StringWriter (); + comparer.Compare (source, target); + + var s = Output.ToString (); + State.Output = output; + if (s.Length > 0) { + var name = target.Attribute ("name").Value; + Output.WriteLine ("
", name); + Output.WriteLine ("

Namespace {0}

", name); + Output.WriteLine (s); + Output.WriteLine ("
", name); + } + } + + public override void Removed (XElement source) + { + var name = source.Attribute ("name").Value; + Output.WriteLine ("
", name); + Output.WriteLine ("

Removed Namespace {0}

", name); + Output.WriteLine (); + // list all removed types + foreach (var removedType in source.Element ("classes").Elements ("class")) + comparer.Removed (removedType); + Output.WriteLine ("
", name); + Output.WriteLine (); + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/PropertyComparer.cs b/mcs/tools/mono-api-html/PropertyComparer.cs new file mode 100644 index 00000000000..f51dd231bb9 --- /dev/null +++ b/mcs/tools/mono-api-html/PropertyComparer.cs @@ -0,0 +1,254 @@ +// +// Authors +// Sebastien Pouliot +// +// Copyright 2013 Xamarin Inc. http://www.xamarin.com +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Xml.Linq; + +namespace Xamarin.ApiDiff { + + public class PropertyComparer : MemberComparer { + + public override string GroupName { + get { return "properties"; } + } + + public override string ElementName { + get { return "property"; } + } + + public override bool Find (XElement e) + { + if (!base.Find (e)) + return false; + // the same Item (indexer) property can have different parameters + return e.GetAttribute ("params") == Source.GetAttribute ("params"); + } + + void GetAccessors (XElement element, out XElement getter, out XElement setter) + { + var methods = element.Element ("methods"); + + getter = null; + setter = null; + + if (methods == null) + return; + + foreach (var m in methods.Elements ("method")) { + var n = m.GetAttribute ("name"); + if (n.StartsWith ("get_", StringComparison.Ordinal)) { + getter = m; + } else if (n.StartsWith ("set_", StringComparison.Ordinal)) { + setter = m; + } + } + } + + MethodAttributes GetMethodAttributes (XElement getter, XElement setter) + { + if (getter == null) + return setter.GetMethodAttributes (); + else if (setter == null) + return getter.GetMethodAttributes (); + + var gAttr = getter.GetMethodAttributes (); + var sAttr = setter.GetMethodAttributes (); + var g = gAttr & MethodAttributes.MemberAccessMask; + var s = sAttr & MethodAttributes.MemberAccessMask; + // Visibility is ordered numerically (higher value = more visible). + // We want the most visible. + var visibility = (MethodAttributes) Math.Max ((int) g, (int) s); + // Do a bitwise or with the rest of the flags + var g_no_visibility = gAttr & ~MethodAttributes.MemberAccessMask; + var s_no_visibility = sAttr & ~MethodAttributes.MemberAccessMask; + return g_no_visibility | s_no_visibility | visibility; + } + + void RenderPropertyType (XElement source, XElement target, ApiChange change) + { + var srcType = source.GetTypeName ("ptype"); + var tgtType = target.GetTypeName ("ptype"); + + if (srcType == tgtType) { + change.Append (tgtType); + } else { + change.AppendModified (srcType, tgtType, true); + } + change.Append (" "); + } + + void RenderAccessors (XElement srcGetter, XElement tgtGetter, XElement srcSetter, XElement tgtSetter, ApiChange change) + { + // FIXME: this doesn't render changes in the accessor visibility (a protected setter can become public for instance). + change.Append (" {"); + if (tgtGetter != null) { + if (srcGetter != null) { + change.Append (" ").Append ("get;"); + } else { + change.Append (" ").AppendAdded ("get;"); + } + } else if (srcGetter != null) { + change.Append (" ").AppendRemoved ("get;"); + } + + if (tgtSetter != null) { + if (srcSetter != null) { + change.Append (" ").Append ("set;"); + } else { + change.Append (" ").AppendAdded ("set;"); + } + } else if (srcSetter != null) { + change.Append (" ").AppendRemoved ("set;"); + } + + change.Append (" }"); + + // Ignore added property setters if asked to + if (srcSetter == null && tgtSetter != null && State.IgnoreAddedPropertySetters && !change.Breaking) { + change.AnyChange = false; + change.HasIgnoredChanges = true; + } + } + + void RenderIndexers (List srcIndexers, List tgtIndexers, ApiChange change) + { + change.Append ("this ["); + for (int i = 0; i < srcIndexers.Count; i++) { + var source = srcIndexers [i]; + var target = tgtIndexers [i]; + + if (i > 0) + change.Append (", "); + + var srcType = source.GetTypeName ("type"); + var tgtType = target.GetTypeName ("type"); + if (srcType == tgtType) { + change.Append (tgtType); + } else { + change.AppendModified (srcType, tgtType, true); + } + change.Append (" "); + + var srcName = source.GetAttribute ("name"); + var tgtName = target.GetAttribute ("name"); + if (srcName == tgtName) { + change.Append (tgtName); + } else { + change.AppendModified (srcName, tgtName, true); + } + } + change.Append ("]"); + } + + public override bool Equals (XElement source, XElement target, ApiChanges changes) + { + if (base.Equals (source, target, changes)) + return true; + + XElement srcGetter, srcSetter; + XElement tgtGetter, tgtSetter; + GetAccessors (source, out srcGetter, out srcSetter); + GetAccessors (target, out tgtGetter, out tgtSetter); + + List srcIndexers = null; + List tgtIndexers = null; + bool isIndexer = false; + if (srcGetter != null) { + srcIndexers = srcGetter.DescendantList ("parameters", "parameter"); + tgtIndexers = tgtGetter.DescendantList ("parameters", "parameter"); + isIndexer = srcIndexers != null && srcIndexers.Count > 0; + } + + var change = new ApiChange (); + change.Header = "Modified " + GroupName; + RenderMethodAttributes (GetMethodAttributes (srcGetter, srcSetter), GetMethodAttributes (tgtGetter, tgtSetter), change); + RenderPropertyType (source, target, change); + if (isIndexer) { + RenderIndexers (srcIndexers, tgtIndexers, change); + } else { + RenderName (source, target, change); + } + RenderGenericParameters (source, target, change); + RenderAccessors (srcGetter, tgtGetter, srcSetter, tgtSetter, change); + + changes.Add (source, target, change); + + return false; + } + + void GetProperties (XElement e, out bool @virtual, out bool @override, out bool @static, out bool getter, out bool setter, out bool family) + { + @virtual = @override = @static = getter = setter = family = false; + + var methods = e.Element ("methods"); + if (methods != null) { + foreach (var m in methods.Elements ("method")) { + @virtual |= m.IsTrue ("virtual"); + @static |= m.IsTrue ("static"); + var n = m.GetAttribute ("name"); + getter |= n.StartsWith ("get_", StringComparison.Ordinal); + setter |= n.StartsWith ("set_", StringComparison.Ordinal); + var attribs = (MethodAttributes) Int32.Parse (m.GetAttribute ("attrib")); + family = ((attribs & MethodAttributes.Public) != MethodAttributes.Public); + @override |= (attribs & MethodAttributes.NewSlot) == 0; + } + } + } + + public override string GetDescription (XElement e) + { + string name = e.Attribute ("name").Value; + string ptype = e.GetTypeName ("ptype"); + + bool virt = false; + bool over = false; + bool stat = false; + bool getter = false; + bool setter = false; + bool family = false; + GetProperties (e, out virt, out over, out stat, out getter, out setter, out family); + + var sb = new StringBuilder (); + + sb.Append (family ? "protected " : "public "); + if (virt && !State.IgnoreVirtualChanges) + sb.Append (over ? "override " : "virtual "); + else if (stat) + sb.Append ("static "); + sb.Append (ptype).Append (' ').Append (name).Append (" { "); + if (getter) + sb.Append ("get; "); + if (setter) + sb.Append ("set; "); + sb.Append ("}"); + + return sb.ToString (); + } + } +} \ No newline at end of file diff --git a/mcs/tools/mono-api-html/mono-api-html.csproj b/mcs/tools/mono-api-html/mono-api-html.csproj new file mode 100644 index 00000000000..6ac0f241ade --- /dev/null +++ b/mcs/tools/mono-api-html/mono-api-html.csproj @@ -0,0 +1,57 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {D25986E2-7A41-4966-A26D-5614BAC7B8A7} + Exe + Xamarin.ApiDiff + mono-api-html + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + + + full + true + bin\Release + prompt + 4 + true + + + + + + + + + + + + + + + + + + + + + + + Options.cs + + + + + diff --git a/mcs/tools/mono-api-html/mono-api-html.exe.sources b/mcs/tools/mono-api-html/mono-api-html.exe.sources new file mode 100644 index 00000000000..69a26798dbf --- /dev/null +++ b/mcs/tools/mono-api-html/mono-api-html.exe.sources @@ -0,0 +1,15 @@ +ApiChange.cs +ApiDiff.cs +AssemblyComparer.cs +ClassComparer.cs +Comparer.cs +ConstructorComparer.cs +EventComparer.cs +FieldComparer.cs +Helpers.cs +InterfaceComparer.cs +MemberComparer.cs +MethodComparer.cs +NamespaceComparer.cs +PropertyComparer.cs +../../class/Mono.Options/Mono.Options/Options.cs diff --git a/mcs/tools/mono-configuration-crypto/cli/Makefile b/mcs/tools/mono-configuration-crypto/cli/Makefile index 36d7feb5946..fe3b52f8d21 100644 --- a/mcs/tools/mono-configuration-crypto/cli/Makefile +++ b/mcs/tools/mono-configuration-crypto/cli/Makefile @@ -2,11 +2,8 @@ thisdir = tools/mono-configuration-crypto/cli SUBDIRS = include ../../../build/rules.make -LOCAL_MCS_FLAGS = -r:Mono.Security.dll \ - -r:System.Security.dll \ - -r:System.Configuration.dll \ - -r:System.dll \ - -r:$(topdir)/class/lib/$(PROFILE)/Mono.Configuration.Crypto.dll +LOCAL_MCS_FLAGS = +LIB_REFS = Mono.Security System.Security System.Configuration System Mono.Configuration.Crypto PROGRAM = mono-configuration-crypto.exe PROGRAM_INSTALL_DIR = $(mono_libdir)/mono/mono-configuration-crypto/$(FRAMEWORK_VERSION) diff --git a/mcs/tools/mono-configuration-crypto/lib/Makefile b/mcs/tools/mono-configuration-crypto/lib/Makefile index 06351749f74..d06b52ae235 100644 --- a/mcs/tools/mono-configuration-crypto/lib/Makefile +++ b/mcs/tools/mono-configuration-crypto/lib/Makefile @@ -2,7 +2,8 @@ thisdir = tools/mono-configuration-crypto/lib SUBDIRS = include ../../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.dll -r:Mono.Security.dll -r:System.Security.dll -r:System.Configuration.dll -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System Mono.Security System.Security System.Configuration System.Xml LIBRARY = Mono.Configuration.Crypto.dll LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/mono-configuration-crypto/$(FRAMEWORK_VERSION) diff --git a/mcs/tools/mono-service/Makefile b/mcs/tools/mono-service/Makefile index 7e8331eb46a..84286e7f95f 100644 --- a/mcs/tools/mono-service/Makefile +++ b/mcs/tools/mono-service/Makefile @@ -4,9 +4,12 @@ include ../../build/rules.make PROGRAM = mono-service.exe +PROGRAM_SNK = ../../class/mono.snk + include ../../build/executable.make -LOCAL_MCS_FLAGS = -r:System.ServiceProcess.dll -r:Mono.Posix.dll -r:System.dll -unsafe +LOCAL_MCS_FLAGS = -unsafe -publicsign +LIB_REFS = System.ServiceProcess Mono.Posix System # Copied from library.make diff --git a/mcs/tools/mono-shlib-cop/Makefile b/mcs/tools/mono-shlib-cop/Makefile index e4e4b557eb4..2bfc65599d9 100644 --- a/mcs/tools/mono-shlib-cop/Makefile +++ b/mcs/tools/mono-shlib-cop/Makefile @@ -2,7 +2,8 @@ thisdir = tools/mono-shlib-cop SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:Mono.Posix.dll -r:System.dll -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = Mono.Posix System System.Xml PROGRAM = mono-shlib-cop.exe diff --git a/mcs/tools/mono-symbolicate/Makefile b/mcs/tools/mono-symbolicate/Makefile index 35cdfd88a39..1a621f6f825 100644 --- a/mcs/tools/mono-symbolicate/Makefile +++ b/mcs/tools/mono-symbolicate/Makefile @@ -4,12 +4,9 @@ include ../../build/rules.make PROGRAM = mono-symbolicate.exe -LOCAL_MCS_FLAGS = \ - /r:Mono.Cecil.dll \ - /r:Mono.CompilerServices.SymbolWriter.dll \ - /r:System.Xml.dll \ - /r:System.Core.dll \ - /r:System.dll +LOCAL_MCS_FLAGS = + +LIB_REFS = Mono.Cecil Mono.CompilerServices.SymbolWriter System.Xml System.Core System include ../../build/executable.make @@ -36,10 +33,10 @@ CHECK_DIFF = @\ exit 1; \ fi -BUILD_TEST_EXE = @\ +BUILD_TEST_EXE = \ rm -rf $(OUT_DIR); \ mkdir -p $(OUT_DIR); \ - $(MCS) -debug $(TEST_CS) -out:$(TEST_EXE) + $(CSCOMPILE) $(TEST_CS) -out:$(TEST_EXE) check: test-local diff --git a/mcs/tools/mono-xmltool/Makefile b/mcs/tools/mono-xmltool/Makefile index fc39f8298ab..7439a2eb9dd 100644 --- a/mcs/tools/mono-xmltool/Makefile +++ b/mcs/tools/mono-xmltool/Makefile @@ -2,7 +2,8 @@ thisdir = tools/mono-xmltool SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:Commons.Xml.Relaxng.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml Commons.Xml.Relaxng PROGRAM = mono-xmltool.exe include ../../build/executable.make diff --git a/mcs/tools/mono-xsd/Makefile b/mcs/tools/mono-xsd/Makefile index 85a08599fa7..d9e77ac8251 100644 --- a/mcs/tools/mono-xsd/Makefile +++ b/mcs/tools/mono-xsd/Makefile @@ -2,7 +2,8 @@ thisdir = tools/mono-xsd SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:System.Data.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml System.Data System PROGRAM = xsd.exe include ../../build/executable.make diff --git a/mcs/tools/monop/Makefile b/mcs/tools/monop/Makefile index 28012279369..4e84d9916fa 100644 --- a/mcs/tools/monop/Makefile +++ b/mcs/tools/monop/Makefile @@ -3,7 +3,8 @@ SUBDIRS = include ../../build/rules.make PROGRAM = monop.exe -LOCAL_MCS_FLAGS += -d:NO_AUTHENTICODE,STATIC,NO_SYMBOL_WRITER -r:System.dll +LOCAL_MCS_FLAGS += -d:NO_AUTHENTICODE,STATIC,NO_SYMBOL_WRITER +LIB_REFS = System CLEAN_FILES = monop.exe monop2.exe *.mdb diff --git a/mcs/tools/msbuild/Makefile b/mcs/tools/msbuild/Makefile index 61339b1a5cc..6e78792b586 100644 --- a/mcs/tools/msbuild/Makefile +++ b/mcs/tools/msbuild/Makefile @@ -3,8 +3,8 @@ SUBDIRS = include ../../build/rules.make NO_TESTS = yes -BUILD_FRAMEWORK = Microsoft.Build.Framework.dll -BUILD_NEW_ENGINE = Microsoft.Build.dll +BUILD_FRAMEWORK = Microsoft.Build.Framework +BUILD_NEW_ENGINE = Microsoft.Build INSTALL_FRAMEWORK_VERSION = $(FRAMEWORK_VERSION) include ../xbuild/xbuild.make @@ -16,13 +16,12 @@ else ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) NAME_SUFFIX = .v4.0 ASSEMBLY_VERSION = 4.0.0.0 -BUILD_FRAMEWORK := $(topdir)/class/lib/$(PROFILE)/$(BUILD_FRAMEWORK) -BUILD_NEW_ENGINE := $(topdir)/class/lib/$(PROFILE)/$(BUILD_NEW_ENGINE) INSTALL_FRAMEWORK_VERSION = 4.0 endif endif -LOCAL_MCS_FLAGS = -r:$(BUILD_FRAMEWORK) -r:$(BUILD_NEW_ENGINE) +LOCAL_MCS_FLAGS = +LIB_REFS = $(BUILD_FRAMEWORK) $(BUILD_NEW_ENGINE) PROGRAM = msbuild.exe include ../../build/executable.make diff --git a/mcs/tools/nunit-lite/NUnitLite/Makefile b/mcs/tools/nunit-lite/NUnitLite/Makefile index 9dd062fe9c1..1d448c2915a 100644 --- a/mcs/tools/nunit-lite/NUnitLite/Makefile +++ b/mcs/tools/nunit-lite/NUnitLite/Makefile @@ -5,7 +5,8 @@ include ../../../build/rules.make LIBRARY = nunitlite.dll LIBRARY_SNK = ../../../../external/nunit-lite/NUnitLite-1.0.0/src/framework/nunit.snk -LOCAL_MCS_FLAGS= /target:library /define:"__MOBILE__;TRACE;DEBUG;NET_4_0;CLR_4_0,NUNITLITE" /nostdlib -r:System.dll -r:System.Xml.dll -r:System.Core.dll -r:mscorlib.dll /warn:4 /noconfig /debug:full /debug+ /keyfile:$(LIBRARY_SNK) /optimize +LOCAL_MCS_FLAGS= /target:library /define:"__MOBILE__;TRACE;DEBUG;NET_4_0;CLR_4_0,NUNITLITE" /warn:4 /keyfile:$(LIBRARY_SNK) +LIB_REFS = System System.Xml System.Core NO_TEST = yes diff --git a/mcs/tools/nunit-lite/nunit-lite-console/Makefile b/mcs/tools/nunit-lite/nunit-lite-console/Makefile index 920f74d29a5..c3697e420fc 100644 --- a/mcs/tools/nunit-lite/nunit-lite-console/Makefile +++ b/mcs/tools/nunit-lite/nunit-lite-console/Makefile @@ -3,7 +3,8 @@ SUBDIRS = include ../../../build/rules.make PROGRAM = nunit-lite-console.exe -LOCAL_MCS_FLAGS = /r:nunitlite.dll +LIB_REFS = nunitlite +LOCAL_MCS_FLAGS = include ../../../build/executable.make diff --git a/mcs/tools/nunitreport/Makefile b/mcs/tools/nunitreport/Makefile index 057ddabea69..3d3f647bc3c 100644 --- a/mcs/tools/nunitreport/Makefile +++ b/mcs/tools/nunitreport/Makefile @@ -3,7 +3,8 @@ SUBDIRS = NO_INSTALL = 1 include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml EXTRA_DISTFILES = \ Media/*.png \ diff --git a/mcs/tools/pdb2mdb/Makefile b/mcs/tools/pdb2mdb/Makefile index 8de09cc43e9..0d2f377310c 100644 --- a/mcs/tools/pdb2mdb/Makefile +++ b/mcs/tools/pdb2mdb/Makefile @@ -4,10 +4,8 @@ include ../../build/rules.make PROGRAM = pdb2mdb.exe -LOCAL_MCS_FLAGS = \ - /r:Mono.Cecil.dll \ - /r:Mono.CompilerServices.SymbolWriter.dll \ - /r:System.Core.dll +LOCAL_MCS_FLAGS = +LIB_REFS = Mono.Cecil Mono.CompilerServices.SymbolWriter System.Core EXTRA_DISTFILES = LICENSE diff --git a/mcs/tools/resgen/Makefile b/mcs/tools/resgen/Makefile index 117f99231d7..2ccbf5869c7 100644 --- a/mcs/tools/resgen/Makefile +++ b/mcs/tools/resgen/Makefile @@ -6,7 +6,7 @@ PROGRAM = resgen.exe CLEAN_FILES = resgen.exe -LOCAL_MCS_FLAGS = -r:System.dll -r:System.Xml.dll -r:System.Core.dll +LIB_REFS = System System.Xml System.Core INSTALL_PROFILE := $(filter $(DEFAULT_PROFILE), $(PROFILE)) ifndef INSTALL_PROFILE diff --git a/mcs/tools/security/Makefile b/mcs/tools/security/Makefile index d75599dcee5..e4bfbb4d315 100644 --- a/mcs/tools/security/Makefile +++ b/mcs/tools/security/Makefile @@ -3,7 +3,8 @@ SUBDIRS = DIST_ONLY_SUBDIRS = certview include ../../build/rules.make -LOCAL_MCS_FLAGS = /lib:$(topdir)/class/lib/$(PROFILE) -r:Mono.Security.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = Mono.Security System SECURITY_PROGRAMS = secutil.exe cert2spc.exe sn.exe makecert.exe chktrust.exe crlupdate.exe \ signcode.exe setreg.exe certmgr.exe caspol.exe permview.exe mozroots.exe cert-sync.exe @@ -58,10 +59,10 @@ clean-local: dist-local: dist-default sn.exe $(topdir)/class/lib/$(PROFILE)/sn.exe: $(SN_SOURCES) - $(CSCOMPILE) /out:$@ $(SN_SOURCES) + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/Mono.Security.dll /out:$@ $(SN_SOURCES) permview.exe: permview.cs - $(CSCOMPILE) $^ $(HELPER_SOURCES) -r:Mono.Cecil.dll + $(CSCOMPILE) $^ $(HELPER_SOURCES) -r:$(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll %.exe: %.cs $(HELPER_SOURCES) - $(CSCOMPILE) $^ + $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/Mono.Security.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll $^ diff --git a/mcs/tools/security/certview/Makefile b/mcs/tools/security/certview/Makefile index 377d396f015..aaa92049f4b 100644 --- a/mcs/tools/security/certview/Makefile +++ b/mcs/tools/security/certview/Makefile @@ -3,7 +3,8 @@ SUBDIRS = include ../../../build/rules.make RESGEN = resgen -LOCAL_MCS_FLAGS = /lib:$(topdir)/class/lib /r:Mono.Security.dll /r:System.Xml.dll /win32icon:mono.ico +LIB_REFS = Mono.Security System.Xml +LOCAL_MCS_FLAGS = /win32icon:mono.ico # SWF isn't quite good enough to build this yet. diff --git a/mcs/tools/sgen/Makefile b/mcs/tools/sgen/Makefile index bf5bd1c904e..e7750a2c11b 100644 --- a/mcs/tools/sgen/Makefile +++ b/mcs/tools/sgen/Makefile @@ -2,7 +2,8 @@ thisdir = tools/sgen SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml System PROGRAM = sgen.exe include ../../build/executable.make diff --git a/mcs/tools/soapsuds/Makefile b/mcs/tools/soapsuds/Makefile index 2fccb32ad59..1fc6cb2763e 100644 --- a/mcs/tools/soapsuds/Makefile +++ b/mcs/tools/soapsuds/Makefile @@ -2,7 +2,8 @@ thisdir = tools/soapsuds SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Runtime.Remoting.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Runtime.Remoting System PROGRAM = soapsuds.exe include ../../build/executable.make diff --git a/mcs/tools/sqlmetal/Makefile b/mcs/tools/sqlmetal/Makefile index 7bd68482312..6be257edd22 100644 --- a/mcs/tools/sqlmetal/Makefile +++ b/mcs/tools/sqlmetal/Makefile @@ -11,30 +11,21 @@ LOCAL_MCS_FLAGS = \ -resource:$(dbmetal_src)/Language/EnglishWords.txt,$(ns).EnglishWords.txt \ -resource:$(dbmetal_src)/Language/FrenchWords.txt,$(ns).FrenchWords.txt \ -resource:$(dbmetal_src)/Language/GermanWords.txt,$(ns).GermanWords.txt \ - -r:System.Configuration.dll \ - -r:System.Core.dll \ - -r:System.Data.dll \ - -r:System.Data.Linq.dll \ - -r:System.Xml.dll \ - -r:System.dll + -publicsign +LIB_REFS = System.Configuration System.Core System.Data System.Data.Linq System.Xml System + SQLMETAL_RESOURCES = \ $(dbmetal_src)/Language/EnglishWords.txt \ $(dbmetal_src)/Language/FrenchWords.txt \ $(dbmetal_src)/Language/GermanWords.txt -SQLMETAL_TEST_FILES = \ - Test/AssemblyInfo.cs - EXTRA_DISTFILES = \ - $(SQLMETAL_RESOURCES) \ - $(SQLMETAL_TEST_FILES) + $(SQLMETAL_RESOURCES) PROGRAM = sqlmetal.exe $(PROGRAM) : Makefile $(SQLMETAL_RESOURCES) -HAS_NUNIT_TEST = yes - include ../../build/executable.make diff --git a/mcs/tools/sqlmetal/Test/.gitattributes b/mcs/tools/sqlmetal/Test/.gitattributes deleted file mode 100644 index f7d8287f511..00000000000 --- a/mcs/tools/sqlmetal/Test/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/AssemblyInfo.cs -crlf diff --git a/mcs/tools/sqlmetal/Test/AssemblyInfo.cs b/mcs/tools/sqlmetal/Test/AssemblyInfo.cs deleted file mode 100644 index 5ff26a54266..00000000000 --- a/mcs/tools/sqlmetal/Test/AssemblyInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// AssemblyInfo.cs -// -// Author: -// Jonathan Pryor -// -// Copyright (C) 2009 Novell, Inc. -// - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle ("sqlmetal_test")] -[assembly: AssemblyDescription ("sqlmetal.exe Unit Tests")] -[assembly: AssemblyDefaultAlias ("SqlMetal_test.dll")] - -[assembly: CLSCompliant (true)] - -// Unit tests needs access to the DbLinq internals - diff --git a/mcs/tools/sqlsharp/Makefile b/mcs/tools/sqlsharp/Makefile index 042e97b92a3..88ad1f8d9b5 100644 --- a/mcs/tools/sqlsharp/Makefile +++ b/mcs/tools/sqlsharp/Makefile @@ -2,7 +2,8 @@ thisdir = tools/SqlSharp SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.dll -r:System.Xml.dll -r:System.Data.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System System.Xml System.Data PROGRAM = sqlsharp.exe EXTRA_DISTFILES = README diff --git a/mcs/tools/svcutil/Makefile b/mcs/tools/svcutil/Makefile index cf174fe3979..b194a5b144d 100644 --- a/mcs/tools/svcutil/Makefile +++ b/mcs/tools/svcutil/Makefile @@ -2,14 +2,8 @@ thisdir = tools/svcutil SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = \ - -r:System.Core.dll \ - -r:System.Runtime.Serialization.dll \ - -r:System.ServiceModel.dll \ - -r:System.Web.Services.dll \ - -r:System.Configuration.dll \ - -r:System.dll \ - -r:System.Xml.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Core System.Runtime.Serialization System.ServiceModel System.Web.Services System.Configuration System System.Xml PROGRAM = svcutil.exe diff --git a/mcs/tools/tuner/Makefile b/mcs/tools/tuner/Makefile index bfc24a16c45..c364223deb0 100644 --- a/mcs/tools/tuner/Makefile +++ b/mcs/tools/tuner/Makefile @@ -3,10 +3,8 @@ SUBDIRS = DEP_DIRS = linker include ../../build/rules.make -CECIL = $(topdir)/class/lib/$(PROFILE)/Mono.Cecil.dll -LINKER = $(topdir)/class/lib/$(PROFILE)/monolinker.exe - -LOCAL_MCS_FLAGS = -r:System.dll -r:System.Core.dll -r:System.Xml.dll -r:$(LINKER) -r:$(CECIL) +LOCAL_MCS_FLAGS = -r:$(topdir)/class/lib/$(PROFILE)/monolinker.exe +LIB_REFS = System System.Core System.Xml Mono.Cecil LIBRARY = Mono.Tuner.dll diff --git a/mcs/tools/txt2sr/Makefile b/mcs/tools/txt2sr/Makefile index f60bd4dc20d..8291f0b21c9 100644 --- a/mcs/tools/txt2sr/Makefile +++ b/mcs/tools/txt2sr/Makefile @@ -4,6 +4,7 @@ include ../../build/rules.make PROGRAM = txt2sr.exe +LIB_REFS = System LOCAL_MCS_FLAGS = include ../../build/executable.make diff --git a/mcs/tools/txt2sr/txt2sr.cs b/mcs/tools/txt2sr/txt2sr.cs index bf30b54e865..7a103203f23 100644 --- a/mcs/tools/txt2sr/txt2sr.cs +++ b/mcs/tools/txt2sr/txt2sr.cs @@ -38,6 +38,7 @@ public class Program public bool ShowHelp { get; set; } public bool Verbose { get; set; } public List ResourcesStrings { get; } + public bool IgnoreSemicolon { get; set; } public CmdOptions () { @@ -55,7 +56,9 @@ public class Program { "h|help", "Display available options", v => options.ShowHelp = v != null }, { "v|verbose", "Use verbose output", - v => options.Verbose = v != null }, + v => options.Verbose = v != null }, + { "ignore-semicolon", "Reads lines starting with semicolon", + v => options.IgnoreSemicolon = v != null }, }; List extra; @@ -142,14 +145,22 @@ public class Program foreach (var l in File.ReadLines (fileName)) { var line = l.Trim (); - if (line.Length == 0 || line [0] == '#' || line [0] == ';') + if (line.Length == 0 || line [0] == '#') continue; + int start = 0; + if (line [0] == ';') { + if (!options.IgnoreSemicolon) + continue; + + start = 1; + } + var epos = line.IndexOf ('='); if (epos < 0) continue; - var key = line.Substring (0, epos).Trim (); + var key = line.Substring (start, epos - start).Trim (); if (key.Contains (" ")) continue; diff --git a/mcs/tools/wsdl/Makefile b/mcs/tools/wsdl/Makefile index 786c81885f0..293cf9d2811 100644 --- a/mcs/tools/wsdl/Makefile +++ b/mcs/tools/wsdl/Makefile @@ -2,7 +2,8 @@ thisdir = tools/wsdl SUBDIRS = include ../../build/rules.make -LOCAL_MCS_FLAGS = -r:System.Xml.dll -r:System.Web.Services.dll -r:System.dll +LOCAL_MCS_FLAGS = +LIB_REFS = System.Xml System.Web.Services System PROGRAM = wsdl.exe diff --git a/mcs/tools/xbuild/Makefile b/mcs/tools/xbuild/Makefile index 0ca5126a6d4..70457756436 100644 --- a/mcs/tools/xbuild/Makefile +++ b/mcs/tools/xbuild/Makefile @@ -5,7 +5,8 @@ NO_TESTS = yes include xbuild.make -LOCAL_MCS_FLAGS = -r:$(XBUILD_FRAMEWORK) -r:$(XBUILD_UTILITIES) -r:$(XBUILD_ENGINE) -r:$(XBUILD_MSTASKS) -r:System.dll -r:System.Core.dll +LOCAL_MCS_FLAGS = +LIB_REFS = $(XBUILD_FRAMEWORK) $(XBUILD_UTILITIES) $(XBUILD_ENGINE) $(XBUILD_MSTASKS) $(PARENT_PROFILE)System $(PARENT_PROFILE)System.Core PROGRAM = xbuild.exe include ../../build/executable.make diff --git a/mcs/tools/xbuild/SolutionParser.cs b/mcs/tools/xbuild/SolutionParser.cs index bf44c515970..44ac70d2f96 100644 --- a/mcs/tools/xbuild/SolutionParser.cs +++ b/mcs/tools/xbuild/SolutionParser.cs @@ -510,8 +510,8 @@ namespace Mono.XBuild.CommandLine { if (solutionTarget.Configuration == targetInfo.Key.Configuration && solutionTarget.Platform == targetInfo.Key.Platform) { solutionConfigurationContents.AppendFormat ( - "{1}|{2}", - guid.ToString ("B").ToUpper (), targetInfo.Value.Configuration, targetInfo.Value.Platform); + "{2}|{3}", + guid.ToString ("B").ToUpper (), projectInfo.FileName, targetInfo.Value.Configuration, targetInfo.Value.Platform); } } } diff --git a/mcs/tools/xbuild/xbuild.make b/mcs/tools/xbuild/xbuild.make index 7247c7f8b0d..cda9d9b0e61 100644 --- a/mcs/tools/xbuild/xbuild.make +++ b/mcs/tools/xbuild/xbuild.make @@ -6,13 +6,13 @@ ifeq (14.0, $(XBUILD_VERSION)) NAME_SUFFIX = .Core endif -XBUILD_FRAMEWORK := $(topdir)/class/lib/$(PROFILE)/Microsoft.Build.Framework.dll -XBUILD_ENGINE := $(topdir)/class/lib/$(PROFILE)/Microsoft.Build.Engine.dll -XBUILD_UTILITIES := $(topdir)/class/lib/$(PROFILE)/Microsoft.Build.Utilities$(NAME_SUFFIX).dll -XBUILD_TASKS := $(topdir)/class/lib/$(PROFILE)/Mono.XBuild.Tasks.dll -XBUILD_MSTASKS := $(topdir)/class/lib/$(PROFILE)/Microsoft.Build.Tasks$(NAME_SUFFIX).dll +XBUILD_FRAMEWORK := Microsoft.Build.Framework +XBUILD_ENGINE := Microsoft.Build.Engine +XBUILD_UTILITIES := Microsoft.Build.Utilities$(NAME_SUFFIX) +XBUILD_TASKS := Mono.XBuild.Tasks +XBUILD_MSTASKS := Microsoft.Build.Tasks$(NAME_SUFFIX) ifeq (14.0, $(XBUILD_VERSION)) -XBUILD_MSTASKS := $(topdir)/class/lib/$(PROFILE)/Microsoft.Build.Tasks.Core.dll +XBUILD_MSTASKS := Microsoft.Build.Tasks.Core endif XBUILD_ASSEMBLY_VERSION = $(XBUILD_VERSION).0.0 diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 93169cda59d..71bfc07952f 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -2431,6 +2431,8 @@ unload_thread_main (void *arg) /* Force it to be attached to avoid racing during shutdown. */ thread = mono_thread_attach_full (mono_get_root_domain (), TRUE, &error); mono_error_raise_exception (&error); /* FIXME don't raise here */ + mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Domain unloader"), TRUE, &error); + mono_error_raise_exception (&error); /* FIXME don't raise here */ /* * FIXME: Abort our parent thread last, so we can return a failure diff --git a/mono/metadata/attach.c b/mono/metadata/attach.c index 9e54462633c..6b65259b962 100644 --- a/mono/metadata/attach.c +++ b/mono/metadata/attach.c @@ -475,11 +475,14 @@ transport_start_receive (void) static guint32 WINAPI receiver_thread (void *arg) { + MonoError error; int res, content_len; guint8 buffer [256]; guint8 *p, *p_end; MonoObject *exc; + mono_thread_info_set_name (mono_native_thread_id_get (), "Attach receiver"); + printf ("attach: Listening on '%s'...\n", server_uri); while (TRUE) { @@ -490,11 +493,13 @@ receiver_thread (void *arg) printf ("attach: Connected.\n"); - mono_thread_attach (mono_get_root_domain ()); + MonoThread *thread = mono_thread_attach (mono_get_root_domain ()); + mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "Attach receiver"), TRUE, &error); + mono_error_assert_ok (&error); /* Ask the runtime to not abort this thread */ //mono_thread_current ()->flags |= MONO_THREAD_FLAG_DONT_MANAGE; /* Ask the runtime to not wait for this thread */ - mono_thread_internal_current ()->state |= ThreadState_Background; + thread->internal_thread->state |= ThreadState_Background; while (TRUE) { char *cmd, *agent_name, *agent_args; diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h index b86e7eda40e..bff89986c37 100644 --- a/mono/metadata/class-internals.h +++ b/mono/metadata/class-internals.h @@ -721,16 +721,6 @@ typedef struct { gboolean no_raise; } MonoJitICallInfo; -typedef struct { - guint8 exception_type; - char *class_name; /* If kind == TYPE */ - char *assembly_name; /* If kind == TYPE or ASSEMBLY */ - MonoClass *klass; /* If kind != TYPE */ - const char *member_name; /* If kind != TYPE */ - gboolean ref_only; /* If kind == ASSEMBLY */ - char *msg; /* If kind == BAD_IMAGE */ -} MonoLoaderError; - void mono_class_setup_supertypes (MonoClass *klass); @@ -1234,32 +1224,6 @@ mono_loader_lock_if_inited (void); void mono_loader_unlock_if_inited (void); -void -mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only); - -void -mono_loader_set_error_type_load (const char *class_name, const char *assembly_name); - -void -mono_loader_set_error_method_load (const char *class_name, const char *member_name); - -void -mono_loader_set_error_field_load (MonoClass *klass, const char *member_name); -void -mono_loader_set_error_bad_image (char *msg); - -MonoException * -mono_loader_error_prepare_exception (MonoLoaderError *error); - -MonoLoaderError * -mono_loader_get_last_error (void); - -void -mono_loader_clear_error (void); - -void -mono_loader_assert_no_error (void); - void mono_reflection_init (void); diff --git a/mono/metadata/class.c b/mono/metadata/class.c index f7b36279f4a..355d09916f8 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -286,15 +286,10 @@ mono_class_from_typeref_checked (MonoImage *image, guint32 type_token, MonoError done: /* Generic case, should be avoided for when a better error is possible. */ if (!res && mono_error_ok (error)) { - if (mono_loader_get_last_error ()) { /*FIXME plug the above to not leak errors*/ - mono_error_set_from_loader_error (error); - } else { - char *name = mono_class_name_from_token (image, type_token); - char *assembly = mono_assembly_name_from_token (image, type_token); - mono_error_set_type_load_name (error, name, assembly, "Could not resolve type with token %08x", type_token); - } + char *name = mono_class_name_from_token (image, type_token); + char *assembly = mono_assembly_name_from_token (image, type_token); + mono_error_set_type_load_name (error, name, assembly, "Could not resolve type with token %08x", type_token); } - mono_loader_assert_no_error (); return res; } @@ -1351,7 +1346,6 @@ mono_class_find_enum_basetype (MonoClass *klass, MonoError *error) mono_error_set_type_load_class (error, klass, "Could not find base type"); fail: - mono_loader_assert_no_error (); return NULL; } @@ -5035,59 +5029,6 @@ concat_two_strings_with_zero (MonoImage *image, const char *s1, const char *s2) return s; } -static void -set_failure_from_loader_error (MonoClass *klass, MonoLoaderError *error) -{ - gpointer exception_data = NULL; - - switch (error->exception_type) { - case MONO_EXCEPTION_TYPE_LOAD: - exception_data = concat_two_strings_with_zero (klass->image, error->class_name, error->assembly_name); - break; - - case MONO_EXCEPTION_MISSING_METHOD: - exception_data = concat_two_strings_with_zero (klass->image, error->class_name, error->member_name); - break; - - case MONO_EXCEPTION_MISSING_FIELD: { - const char *name_space = error->klass->name_space ? error->klass->name_space : NULL; - const char *class_name; - - if (name_space) - class_name = g_strdup_printf ("%s.%s", name_space, error->klass->name); - else - class_name = error->klass->name; - - exception_data = concat_two_strings_with_zero (klass->image, class_name, error->member_name); - - if (name_space) - g_free ((void*)class_name); - break; - } - - case MONO_EXCEPTION_FILE_NOT_FOUND: { - const char *msg; - - if (error->ref_only) - msg = "Cannot resolve dependency to assembly '%s' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event."; - else - msg = "Could not load file or assembly '%s' or one of its dependencies."; - - exception_data = concat_two_strings_with_zero (klass->image, msg, error->assembly_name); - break; - } - - case MONO_EXCEPTION_BAD_IMAGE: - exception_data = error->msg; - break; - - default : - g_assert_not_reached (); - } - - mono_class_set_failure (klass, error->exception_type, exception_data); -} - /** * mono_class_init: * @class: the class to initialize @@ -5193,7 +5134,7 @@ mono_class_init (MonoClass *klass) else if (!klass->size_inited){ mono_class_setup_fields (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) + if (mono_class_has_failure (klass)) goto leave; } @@ -5302,8 +5243,6 @@ mono_class_init (MonoClass *klass) mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL); goto leave; } - if (mono_loader_get_last_error ()) - goto leave; if (!klass->parent->vtable_size) { /* FIXME: Get rid of this somehow */ mono_class_setup_vtable (klass->parent); @@ -5311,8 +5250,6 @@ mono_class_init (MonoClass *klass) mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, NULL); goto leave; } - if (mono_loader_get_last_error ()) - goto leave; } first_iface_slot = klass->parent->vtable_size; if (mono_class_need_stelemref_method (klass)) @@ -5325,13 +5262,6 @@ mono_class_init (MonoClass *klass) if (mono_security_core_clr_enabled ()) mono_security_core_clr_check_inheritance (klass); - if (mono_loader_get_last_error ()) { - if (!mono_class_has_failure (klass)) { - set_failure_from_loader_error (klass, mono_loader_get_last_error ()); - } - mono_loader_clear_error (); - } - if (klass->generic_class && !mono_verifier_class_is_valid_generic_instantiation (klass)) mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup ("Invalid generic instantiation")); @@ -5380,7 +5310,7 @@ mono_class_has_finalizer (MonoClass *klass) * ignores overrides. */ mono_class_setup_vtable (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) + if (mono_class_has_failure (klass)) cmethod = NULL; else cmethod = klass->vtable [finalize_slot]; @@ -5765,7 +5695,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError if (mono_metadata_token_table (type_token) != MONO_TABLE_TYPEDEF || tidx > tt->rows) { mono_error_set_bad_image (error, image, "Invalid typedef token %x", type_token); - mono_loader_assert_no_error (); return NULL; } @@ -5773,7 +5702,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError if ((klass = (MonoClass *)mono_internal_hash_table_lookup (&image->class_cache, GUINT_TO_POINTER (type_token)))) { mono_loader_unlock (); - mono_loader_assert_no_error (); return klass; } @@ -5863,7 +5791,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error))); mono_loader_unlock (); mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED); - mono_loader_assert_no_error (); return NULL; } } @@ -5935,7 +5862,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup (mono_error_get_message (error))); mono_loader_unlock (); mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED); - mono_loader_assert_no_error (); return NULL; } klass->cast_class = klass->element_class = mono_class_from_mono_type (enum_basetype); @@ -5950,7 +5876,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError mono_class_set_failure (klass, MONO_EXCEPTION_TYPE_LOAD, g_strdup_printf ("Could not load generic parameter constrains due to %s", mono_error_get_message (error))); mono_loader_unlock (); mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED); - mono_loader_assert_no_error (); return NULL; } @@ -5962,7 +5887,6 @@ mono_class_create_from_typedef (MonoImage *image, guint32 type_token, MonoError mono_loader_unlock (); mono_profiler_class_loaded (klass, MONO_PROFILE_OK); - mono_loader_assert_no_error (); return klass; @@ -5970,7 +5894,6 @@ parent_failure: mono_class_setup_mono_type (klass); mono_loader_unlock (); mono_profiler_class_loaded (klass, MONO_PROFILE_FAILED); - mono_loader_assert_no_error (); return NULL; } @@ -6635,7 +6558,6 @@ mono_type_retrieve_from_typespec (MonoImage *image, guint32 type_spec, MonoGener MonoType *inflated = inflate_generic_type (NULL, t, context, error); if (!mono_error_ok (error)) { - mono_loader_assert_no_error (); return NULL; } @@ -7518,7 +7440,6 @@ mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext MonoClass *klass = mono_class_get_checked (image, type_token, error); if (!klass) { - mono_loader_assert_no_error (); return NULL; } @@ -7529,7 +7450,6 @@ mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext type = mono_type_retrieve_from_typespec (image, type_token, context, &inflated, error); if (!type) { - mono_loader_assert_no_error (); return NULL; } @@ -10078,17 +9998,8 @@ mono_class_get_exception_for_failure (MonoClass *klass) return mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", ""); } default: { - MonoLoaderError *error; - MonoException *ex; - - error = mono_loader_get_last_error (); - if (error != NULL){ - ex = mono_loader_error_prepare_exception (error); - return ex; - } - /* TODO - handle other class related failures */ - return NULL; + return mono_get_exception_execution_engine ("Unknown class failure"); } } } diff --git a/mono/metadata/cominterop.c b/mono/metadata/cominterop.c index 88f1ea21b19..08450558d9d 100644 --- a/mono/metadata/cominterop.c +++ b/mono/metadata/cominterop.c @@ -97,7 +97,6 @@ GENERATE_GET_CLASS_WITH_CACHE (variant, System, Variant) static GENERATE_GET_CLASS_WITH_CACHE (interface_type_attribute, System.Runtime.InteropServices, InterfaceTypeAttribute) static GENERATE_GET_CLASS_WITH_CACHE (guid_attribute, System.Runtime.InteropServices, GuidAttribute) -static GENERATE_GET_CLASS_WITH_CACHE (com_visible_attribute, System.Runtime.InteropServices, ComVisibleAttribute) /* Upon creation of a CCW, only allocate a weak handle and set the * reference count to 0. If the unmanaged client code decides to addref and diff --git a/mono/metadata/exception.c b/mono/metadata/exception.c index 332ac557d1e..e2e162f702a 100644 --- a/mono/metadata/exception.c +++ b/mono/metadata/exception.c @@ -940,8 +940,10 @@ ves_icall_Mono_Runtime_GetNativeStackTrace (MonoException *exc) { char *trace; MonoString *res; - if (!exc) - mono_raise_exception (mono_get_exception_argument_null ("exception")); + if (!exc) { + mono_set_pending_exception (mono_get_exception_argument_null ("exception")); + return NULL; + } trace = mono_exception_get_native_backtrace (exc); res = mono_string_new (mono_domain_get (), trace); diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index 148bbedee64..bf02f2892b2 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -748,6 +748,10 @@ finalize_domain_objects (DomainFinalizationReq *req) static guint32 finalizer_thread (gpointer unused) { + MonoError error; + mono_thread_set_name_internal (mono_thread_internal_current (), mono_string_new (mono_get_root_domain (), "Finalizer"), FALSE, &error); + mono_error_assert_ok (&error); + gboolean wait = TRUE; /* Register a hazard free queue pump callback */ @@ -823,7 +827,6 @@ void mono_gc_init_finalizer_thread (void) { gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, FALSE, 0); - ves_icall_System_Threading_Thread_SetName_internal (gc_thread, mono_string_new (mono_domain_get (), "Finalizer")); } void diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index 8e2fbdf3b65..e1572c3f559 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -1280,7 +1280,7 @@ ves_icall_System_Reflection_Emit_CustomAttributeBuilder_GetBlob (MonoReflectionA } static gboolean -get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) +get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) { MonoMethod **dest = (MonoMethod **)data; @@ -1288,11 +1288,9 @@ get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer dat if (!managed) return FALSE; - if (m == *dest) { - *dest = NULL; - return FALSE; - } if (!(*dest)) { + if (!strcmp (m->klass->name_space, "System.Reflection")) + return FALSE; *dest = m; return TRUE; } @@ -1300,7 +1298,7 @@ get_caller (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer dat } static gboolean -get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) +get_caller_no_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) { MonoMethod **dest = (MonoMethod **)data; @@ -1308,9 +1306,18 @@ get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer if (!managed) return FALSE; + if (m->wrapper_type != MONO_WRAPPER_NONE) + return FALSE; + + if (m == *dest) { + *dest = NULL; + return FALSE; + } + + if (m->klass->image == mono_defaults.corlib && !strcmp (m->klass->name_space, "System.Reflection")) + return FALSE; + if (!(*dest)) { - if (!strcmp (m->klass->name_space, "System.Reflection")) - return FALSE; *dest = m; return TRUE; } @@ -1318,7 +1325,7 @@ get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer } static gboolean -get_caller_no_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) +get_caller_no_system_or_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data) { MonoMethod **dest = (MonoMethod **)data; @@ -1329,13 +1336,15 @@ get_caller_no_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed if (m->wrapper_type != MONO_WRAPPER_NONE) return FALSE; - if (m->klass->image == mono_defaults.corlib && !strcmp (m->klass->name_space, "System.Reflection")) - return FALSE; - if (m == *dest) { *dest = NULL; return FALSE; } + + if (m->klass->image == mono_defaults.corlib && ((!strcmp (m->klass->name_space, "System.Reflection")) + || (!strcmp (m->klass->name_space, "System")))) + return FALSE; + if (!(*dest)) { *dest = m; return TRUE; @@ -1351,6 +1360,7 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoErro MonoType *type = NULL; MonoAssembly *assembly = NULL; gboolean type_resolve = FALSE; + MonoImage *rootimage = NULL; mono_error_init (error); @@ -1361,10 +1371,23 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoErro */ m = mono_method_get_last_managed (); dest = m; - - mono_stack_walk_no_il (get_caller_no_reflection, &dest); - if (!dest) - dest = m; + if (m && m->klass->image != mono_defaults.corlib) { + /* Happens with inlining */ + } else { + /* Ugly hack: type_from_parsed_name is called from + * System.Type.internal_from_name, which is called most + * directly from System.Type.GetType(string,bool,bool) but + * also indirectly from places such as + * System.Type.GetType(string,func,func) (via + * System.TypeNameParser.GetType and System.TypeSpec.Resolve) + * so we need to skip over all of those to find the true caller. + * + * It would be nice if we had stack marks. + */ + mono_stack_walk_no_il (get_caller_no_system_or_reflection, &dest); + if (!dest) + dest = m; + } /* * FIXME: mono_method_get_last_managed() sometimes returns NULL, thus @@ -1377,6 +1400,7 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoErro if (dest) { assembly = dest->klass->image->assembly; type_resolve = TRUE; + rootimage = assembly->image; } else { g_warning (G_STRLOC); } @@ -1384,21 +1408,28 @@ type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoErro if (info->assembly.name) assembly = mono_assembly_load (&info->assembly, assembly ? assembly->basedir : NULL, NULL); - if (assembly) { /* When loading from the current assembly, AppDomain.TypeResolve will not be called yet */ - type = mono_reflection_get_type_checked (assembly->image, info, ignoreCase, &type_resolve, error); + type = mono_reflection_get_type_checked (rootimage, assembly->image, info, ignoreCase, &type_resolve, error); return_val_if_nok (error, NULL); } + // XXXX - aleksey - + // Say we're looking for System.Generic.Dict + // we FAIL the get type above, because S.G.Dict isn't in assembly->image. So we drop down here. + // but then we FAIL AGAIN because now we pass null as the image and the rootimage and everything + // is messed up when we go to construct the Local as the type arg... + // + // By contrast, if we started with Mine> we'd go in with assembly->image + // as the root and then even the detour into generics would still not screw us when we went to load Local. if (!info->assembly.name && !type) { /* try mscorlib */ - type = mono_reflection_get_type_checked (NULL, info, ignoreCase, &type_resolve, error); + type = mono_reflection_get_type_checked (rootimage, NULL, info, ignoreCase, &type_resolve, error); return_val_if_nok (error, NULL); } if (assembly && !type && type_resolve) { type_resolve = FALSE; /* This will invoke TypeResolve if not done in the first 'if' */ - type = mono_reflection_get_type_checked (assembly->image, info, ignoreCase, &type_resolve, error); + type = mono_reflection_get_type_checked (rootimage, assembly->image, info, ignoreCase, &type_resolve, error); return_val_if_nok (error, NULL); } @@ -1424,10 +1455,12 @@ ves_icall_System_Type_internal_from_name (MonoString *name, /* mono_reflection_parse_type() mangles the string */ if (!parsedOk) { mono_reflection_free_type_info (&info); - g_free (str); if (throwOnError) { - mono_set_pending_exception (mono_get_exception_argument("typeName", "failed parse")); + mono_error_init (&error); + mono_error_set_argument (&error, "typeName", "failed parse: %s", str); + mono_error_set_pending_exception (&error); } + g_free (str); return NULL; } @@ -1450,7 +1483,6 @@ ves_icall_System_Type_internal_from_name (MonoString *name, if (throwOnError) e = mono_get_exception_type_load (name, NULL); - mono_loader_clear_error (); if (e) { mono_set_pending_exception (e); return NULL; @@ -3803,8 +3835,7 @@ mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bfla /* An optimization for calls made from Delegate:CreateDelegate () */ if (klass->delegate && name && !strcmp (name, "Invoke") && (bflags == (BFLAGS_Public | BFLAGS_Static | BFLAGS_Instance))) { method = mono_get_delegate_invoke (klass); - if (mono_loader_get_last_error ()) - goto loader_error; + g_assert (method); g_ptr_array_add (array, method); return array; @@ -3812,7 +3843,7 @@ mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bfla mono_class_setup_methods (klass); mono_class_setup_vtable (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) + if (mono_class_has_failure (klass)) goto loader_error; if (is_generic_parameter (&klass->byval_arg)) @@ -3828,7 +3859,7 @@ mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bfla handle_parent: mono_class_setup_methods (klass); mono_class_setup_vtable (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) + if (mono_class_has_failure (klass)) goto loader_error; iter = NULL; @@ -3888,8 +3919,7 @@ loader_error: if (mono_class_has_failure (klass)) { *ex = mono_class_get_exception_for_failure (klass); } else { - *ex = mono_loader_error_prepare_exception (mono_loader_get_last_error ()); - mono_loader_clear_error (); + *ex = mono_get_exception_execution_engine ("Unknown error"); } return NULL; } @@ -4127,7 +4157,7 @@ ves_icall_Type_GetPropertiesByName (MonoReflectionType *type, MonoString *name, handle_parent: mono_class_setup_methods (klass); mono_class_setup_vtable (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) + if (mono_class_has_failure (klass)) goto loader_error; iter = NULL; @@ -4200,9 +4230,6 @@ handle_parent: loader_error: if (mono_class_has_failure (klass)) { mono_error_set_exception_instance (&error, mono_class_get_exception_for_failure (klass)); - } else { - mono_error_set_from_loader_error (&error); - mono_loader_clear_error (); } failure: @@ -4261,7 +4288,7 @@ ves_icall_Type_GetEvents_internal (MonoReflectionType *type, MonoString *name, g handle_parent: mono_class_setup_methods (klass); mono_class_setup_vtable (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) + if (mono_class_has_failure (klass)) goto loader_error; iter = NULL; @@ -4344,9 +4371,6 @@ handle_parent: loader_error: if (mono_class_has_failure (klass)) { mono_error_set_exception_instance (&error, mono_class_get_exception_for_failure (klass)); - } else { - mono_error_set_from_loader_error (&error); - mono_loader_clear_error (); } failure: @@ -4481,7 +4505,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as if (module != NULL) { if (module->image) { - type = mono_reflection_get_type_checked (module->image, &info, ignoreCase, &type_resolve, &error); + type = mono_reflection_get_type_checked (module->image, module->image, &info, ignoreCase, &type_resolve, &error); if (!is_ok (&error)) { g_free (str); mono_reflection_free_type_info (&info); @@ -4501,7 +4525,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as if (abuilder->modules) { for (i = 0; i < mono_array_length (abuilder->modules); ++i) { MonoReflectionModuleBuilder *mb = mono_array_get (abuilder->modules, MonoReflectionModuleBuilder*, i); - type = mono_reflection_get_type_checked (&mb->dynamic_image->image, &info, ignoreCase, &type_resolve, &error); + type = mono_reflection_get_type_checked (&mb->dynamic_image->image, &mb->dynamic_image->image, &info, ignoreCase, &type_resolve, &error); if (!is_ok (&error)) { g_free (str); mono_reflection_free_type_info (&info); @@ -4516,7 +4540,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as if (!type && abuilder->loaded_modules) { for (i = 0; i < mono_array_length (abuilder->loaded_modules); ++i) { MonoReflectionModule *mod = mono_array_get (abuilder->loaded_modules, MonoReflectionModule*, i); - type = mono_reflection_get_type_checked (mod->image, &info, ignoreCase, &type_resolve, &error); + type = mono_reflection_get_type_checked (mod->image, mod->image, &info, ignoreCase, &type_resolve, &error); if (!is_ok (&error)) { g_free (str); mono_reflection_free_type_info (&info); @@ -4529,7 +4553,7 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as } } else { - type = mono_reflection_get_type_checked (assembly->assembly->image, &info, ignoreCase, &type_resolve, &error); + type = mono_reflection_get_type_checked (assembly->assembly->image, assembly->assembly->image, &info, ignoreCase, &type_resolve, &error); if (!is_ok (&error)) { g_free (str); mono_reflection_free_type_info (&info); @@ -4545,20 +4569,9 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as if (throwOnError) e = mono_get_exception_type_load (name, NULL); - if (mono_loader_get_last_error () && mono_defaults.generic_ilist_class) - e = mono_loader_error_prepare_exception (mono_loader_get_last_error ()); - - mono_loader_clear_error (); - if (e != NULL) mono_set_pending_exception (e); return NULL; - } else if (mono_loader_get_last_error ()) { - if (throwOnError) { - mono_set_pending_exception (mono_loader_error_prepare_exception (mono_loader_get_last_error ())); - return NULL; - } - mono_loader_clear_error (); } if (type->type == MONO_TYPE_CLASS) { @@ -4568,7 +4581,6 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssembly *as if (throwOnError && mono_class_has_failure (klass)) { /* report SecurityException (or others) that occured when loading the assembly */ MonoException *exc = mono_class_get_exception_for_failure (klass); - mono_loader_clear_error (); mono_set_pending_exception (exc); return NULL; } @@ -5603,7 +5615,6 @@ mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **excepti for (i = 1; i < tdef->rows; ++i) { if (!exportedOnly || mono_module_type_is_visible (tdef, image, i + 1)) { klass = mono_class_get_checked (image, (i + 1) | MONO_TOKEN_TYPE_DEF, error); - mono_loader_assert_no_error (); /* Plug any leaks */ if (klass) { rt = mono_type_get_object_checked (domain, &klass->byval_arg, error); @@ -5708,8 +5719,6 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoArray *exl = NULL; int j, length = g_list_length (list) + ex_count; - mono_loader_clear_error (); - exl = mono_array_new (domain, mono_defaults.exception_class, length); /* Types for which mono_class_get_checked () succeeded */ for (i = 0, tmp = list; tmp; i++, tmp = tmp->next) { @@ -5733,7 +5742,6 @@ ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, mono_error_set_pending_exception (&error); return NULL; } - mono_loader_clear_error (); mono_set_pending_exception (exc); return NULL; } @@ -8054,12 +8062,7 @@ custom_attrs_get_by_type (MonoObject *obj, MonoReflectionType *attr_type) return NULL; } - if (mono_loader_get_last_error ()) { - mono_set_pending_exception (mono_loader_error_prepare_exception (mono_loader_get_last_error ())); - return NULL; - } else { - return res; - } + return res; } ICALL_EXPORT MonoArray* diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 56992b36127..2922234965a 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -67,11 +67,6 @@ static guint32 memberref_sig_cache_size; static guint32 methods_size; static guint32 signatures_size; -/* - * This TLS variable contains the last type load error encountered by the loader. - */ -MonoNativeTlsKey loader_error_thread_id; - /* * This TLS variable holds how many times the current thread has acquired the loader * lock. @@ -103,7 +98,6 @@ mono_loader_init () mono_os_mutex_init_recursive (&global_loader_data_mutex); loader_lock_inited = TRUE; - mono_native_tls_alloc (&loader_error_thread_id, NULL); mono_native_tls_alloc (&loader_lock_nest_id, NULL); mono_counters_init (); @@ -125,7 +119,6 @@ mono_loader_cleanup (void) { dllmap_cleanup (); - mono_native_tls_free (loader_error_thread_id); mono_native_tls_free (loader_lock_nest_id); mono_coop_mutex_destroy (&loader_mutex); @@ -133,281 +126,6 @@ mono_loader_cleanup (void) loader_lock_inited = FALSE; } -/* - * Handling of type load errors should be done as follows: - * - * If something could not be loaded, the loader should call one of the - * mono_loader_set_error_XXX functions () - * with the appropriate arguments, then return NULL to report the failure. The error - * should be propagated until it reaches code which can throw managed exceptions. At that - * point, an exception should be thrown based on the information returned by - * mono_loader_get_last_error (). Then the error should be cleared by calling - * mono_loader_clear_error (). - */ - -static void -set_loader_error (MonoLoaderError *error) -{ - mono_loader_clear_error (); - mono_native_tls_set_value (loader_error_thread_id, error); -} - -/** - * mono_loader_set_error_assembly_load: - * - * Set the loader error for this thread. - */ -void -mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only) -{ - MonoLoaderError *error; - - if (mono_loader_get_last_error ()) - return; - - error = g_new0 (MonoLoaderError, 1); - error->exception_type = MONO_EXCEPTION_FILE_NOT_FOUND; - error->assembly_name = g_strdup (assembly_name); - error->ref_only = ref_only; - - /* - * This is not strictly needed, but some (most) of the loader code still - * can't deal with load errors, and this message is more helpful than an - * assert. - */ - if (ref_only) - mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY, "Cannot resolve dependency to assembly '%s' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.", assembly_name); - else - mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_ASSEMBLY, "Could not load file or assembly '%s' or one of its dependencies.", assembly_name); - - set_loader_error (error); -} - -/** - * mono_loader_set_error_type_load: - * - * Set the loader error for this thread. - */ -void -mono_loader_set_error_type_load (const char *class_name, const char *assembly_name) -{ - MonoLoaderError *error; - - if (mono_loader_get_last_error ()) - return; - - error = g_new0 (MonoLoaderError, 1); - error->exception_type = MONO_EXCEPTION_TYPE_LOAD; - error->class_name = g_strdup (class_name); - error->assembly_name = g_strdup (assembly_name); - - /* - * This is not strictly needed, but some (most) of the loader code still - * can't deal with load errors, and this message is more helpful than an - * assert. - */ - mono_trace_warning (MONO_TRACE_TYPE, "The class %s could not be loaded, used in %s", class_name, assembly_name); - - set_loader_error (error); -} - -/* - * mono_loader_set_error_method_load: - * - * Set the loader error for this thread. MEMBER_NAME should point to a string - * inside metadata. - */ -void -mono_loader_set_error_method_load (const char *class_name, const char *member_name) -{ - MonoLoaderError *error; - - /* FIXME: Store the signature as well */ - if (mono_loader_get_last_error ()) - return; - - error = g_new0 (MonoLoaderError, 1); - error->exception_type = MONO_EXCEPTION_MISSING_METHOD; - error->class_name = g_strdup (class_name); - error->member_name = member_name; - - set_loader_error (error); -} - -/* - * mono_loader_set_error_field_load: - * - * Set the loader error for this thread. MEMBER_NAME should point to a string - * inside metadata. - */ -void -mono_loader_set_error_field_load (MonoClass *klass, const char *member_name) -{ - MonoLoaderError *error; - - /* FIXME: Store the signature as well */ - if (mono_loader_get_last_error ()) - return; - - error = g_new0 (MonoLoaderError, 1); - error->exception_type = MONO_EXCEPTION_MISSING_FIELD; - error->klass = klass; - error->member_name = member_name; - - set_loader_error (error); -} - -/* - * mono_loader_set_error_bad_image: - * - * Set the loader error for this thread. - */ -void -mono_loader_set_error_bad_image (char *msg) -{ - MonoLoaderError *error; - - if (mono_loader_get_last_error ()) - return; - - error = g_new0 (MonoLoaderError, 1); - error->exception_type = MONO_EXCEPTION_BAD_IMAGE; - error->msg = msg; - - set_loader_error (error); -} - - -/* - * mono_loader_get_last_error: - * - * Returns information about the last type load exception encountered by the loader, or - * NULL. After use, the exception should be cleared by calling mono_loader_clear_error. - */ -MonoLoaderError* -mono_loader_get_last_error (void) -{ - return (MonoLoaderError*)mono_native_tls_get_value (loader_error_thread_id); -} - -void -mono_loader_assert_no_error (void) -{ - MonoLoaderError *error = mono_loader_get_last_error (); - - if (error) { - g_print ("Unhandled loader error: %x, %s %s %s\n", error->exception_type, error->msg, error->assembly_name, error->class_name); - g_assert_not_reached (); - } -} - -/** - * mono_loader_clear_error: - * - * Disposes any loader error messages on this thread - */ -void -mono_loader_clear_error (void) -{ - MonoLoaderError *ex = (MonoLoaderError*)mono_native_tls_get_value (loader_error_thread_id); - - if (ex) { - g_free (ex->class_name); - g_free (ex->assembly_name); - g_free (ex->msg); - g_free (ex); - - mono_native_tls_set_value (loader_error_thread_id, NULL); - } -} - -/** - * mono_loader_error_prepare_exception: - * @error: The MonoLoaderError to turn into an exception - * - * This turns a MonoLoaderError into an exception that can be thrown - * and resets the Mono Loader Error state during this process. - * - */ -MonoException * -mono_loader_error_prepare_exception (MonoLoaderError *error) -{ - MonoException *ex = NULL; - - switch (error->exception_type) { - case MONO_EXCEPTION_TYPE_LOAD: { - char *cname = g_strdup (error->class_name); - char *aname = g_strdup (error->assembly_name); - MonoString *class_name; - - mono_loader_clear_error (); - - class_name = mono_string_new (mono_domain_get (), cname); - - ex = mono_get_exception_type_load (class_name, aname); - g_free (cname); - g_free (aname); - break; - } - case MONO_EXCEPTION_MISSING_METHOD: { - char *cname = g_strdup (error->class_name); - char *aname = g_strdup (error->member_name); - - mono_loader_clear_error (); - ex = mono_get_exception_missing_method (cname, aname); - g_free (cname); - g_free (aname); - break; - } - - case MONO_EXCEPTION_MISSING_FIELD: { - char *class_name; - char *cmembername = g_strdup (error->member_name); - if (error->klass) - class_name = mono_type_get_full_name (error->klass); - else - class_name = g_strdup (""); - - mono_loader_clear_error (); - - ex = mono_get_exception_missing_field (class_name, cmembername); - g_free (class_name); - g_free (cmembername); - break; - } - - case MONO_EXCEPTION_FILE_NOT_FOUND: { - char *msg; - char *filename; - - if (error->ref_only) - msg = g_strdup_printf ("Cannot resolve dependency to assembly '%s' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.", error->assembly_name); - else - msg = g_strdup_printf ("Could not load file or assembly '%s' or one of its dependencies.", error->assembly_name); - filename = g_strdup (error->assembly_name); - /* Has to call this before calling anything which might call mono_class_init () */ - mono_loader_clear_error (); - ex = mono_get_exception_file_not_found2 (msg, mono_string_new (mono_domain_get (), filename)); - g_free (msg); - g_free (filename); - break; - } - - case MONO_EXCEPTION_BAD_IMAGE: { - char *msg = g_strdup (error->msg); - mono_loader_clear_error (); - ex = mono_get_exception_bad_image_format (msg); - g_free (msg); - break; - } - - default: - g_assert_not_reached (); - } - - return ex; -} - /* * find_cached_memberref_sig: * @@ -529,7 +247,6 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass, field = mono_class_get_field_from_name_full (klass, fname, sig_type); if (!field) { - mono_loader_assert_no_error (); mono_error_set_field_load (error, klass, fname, "Could not find field '%s'", fname); } @@ -583,7 +300,6 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk if (mono_metadata_token_table (token) == MONO_TABLE_MEMBERREF) { field = field_from_memberref (image, token, retklass, context, error); - mono_loader_assert_no_error (); } else { type = mono_metadata_typedef_from_field (image, mono_metadata_token_index (token)); if (!type) { @@ -599,10 +315,7 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk *retklass = k; field = mono_class_get_field (k, token); if (!field) { - if (mono_loader_get_last_error ()) - mono_error_set_from_loader_error (error); - else - mono_error_set_bad_image (error, image, "Could not resolve field token 0x%08x", token); + mono_error_set_bad_image (error, image, "Could not resolve field token 0x%08x", token); } } @@ -612,7 +325,6 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk mono_image_unlock (image); } - mono_loader_assert_no_error (); return field; } @@ -1165,19 +877,14 @@ method_from_memberref (MonoImage *image, guint32 idx, MonoGenericContext *typesp g_free (msig); msig = g_string_free (s, FALSE); - if (mono_loader_get_last_error ()) /* FIXME find_method and mono_method_search_in_array_class can leak a loader error */ - mono_error_set_from_loader_error (error); - else - mono_error_set_method_load (error, klass, mname, "Could not find method %s", msig); + mono_error_set_method_load (error, klass, mname, "Could not find method %s", msig); g_free (msig); } - mono_loader_assert_no_error (); return method; fail: - mono_loader_assert_no_error (); g_assert (!mono_error_ok (error)); return NULL; } @@ -1243,7 +950,6 @@ method_from_methodspec (MonoImage *image, MonoGenericContext *context, guint32 i new_context.method_inst = inst; method = mono_class_inflate_generic_method_full_checked (method, klass, &new_context, error); - mono_loader_assert_no_error (); return method; } @@ -1882,7 +1588,6 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass, result = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, TRUE, &handle_class, context, error); mono_error_assert_ok (error); - mono_loader_assert_no_error (); // This checks the memberref type as well if (result && handle_class != mono_defaults.methodhandle_class) { @@ -1953,7 +1658,6 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass, */ if (*sig & 0x10) { generic_container = mono_metadata_load_generic_params (image, token, container); - mono_loader_assert_no_error (); /* FIXME don't swallow this error. */ } if (generic_container) { result->is_generic = TRUE; @@ -1988,7 +1692,6 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass, if (generic_container) mono_method_set_generic_container (result, generic_container); - mono_loader_assert_no_error (); return result; } diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index 18f93d260e3..a847b0f5862 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -2346,7 +2346,7 @@ mono_marshal_get_string_to_ptr_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec case MONO_NATIVE_BSTR: return MONO_MARSHAL_CONV_STR_BSTR; default: - return (MonoMarshalConv)-1; + return MONO_MARSHAL_CONV_INVALID; } } @@ -2366,7 +2366,7 @@ mono_marshal_get_stringbuilder_to_ptr_conv (MonoMethodPInvoke *piinfo, MonoMarsh return MONO_MARSHAL_CONV_SB_LPTSTR; break; default: - return (MonoMarshalConv)-1; + return MONO_MARSHAL_CONV_INVALID; } } @@ -2389,7 +2389,7 @@ mono_marshal_get_ptr_to_string_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec case MONO_NATIVE_BSTR: return MONO_MARSHAL_CONV_BSTR_STR; default: - return (MonoMarshalConv)-1; + return MONO_MARSHAL_CONV_INVALID; } } @@ -2415,7 +2415,7 @@ mono_marshal_get_ptr_to_stringbuilder_conv (MonoMethodPInvoke *piinfo, MonoMarsh return MONO_MARSHAL_CONV_LPTSTR_SB; break; default: - return (MonoMarshalConv)-1; + return MONO_MARSHAL_CONV_INVALID; } } @@ -5105,7 +5105,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t, mono_mb_emit_ldarg (mb, argnum); } - if (conv == -1) { + if (conv == MONO_MARSHAL_CONV_INVALID) { char *msg = g_strdup_printf ("string marshalling conversion %d not implemented", encoding); mono_mb_emit_exception_marshal_directive (mb, msg); } else { @@ -5117,7 +5117,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t, case MARSHAL_ACTION_CONV_OUT: conv = mono_marshal_get_ptr_to_string_conv (m->piinfo, spec, &need_free); - if (conv == -1) { + if (conv == MONO_MARSHAL_CONV_INVALID) { char *msg = g_strdup_printf ("string marshalling conversion %d not implemented", encoding); mono_mb_emit_exception_marshal_directive (mb, msg); break; @@ -5177,7 +5177,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t, mono_mb_emit_stloc (mb, 0); conv = mono_marshal_get_ptr_to_string_conv (m->piinfo, spec, &need_free); - if (conv == -1) { + if (conv == MONO_MARSHAL_CONV_INVALID) { char *msg = g_strdup_printf ("string marshalling conversion %d not implemented", encoding); mono_mb_emit_exception_marshal_directive (mb, msg); break; @@ -5206,7 +5206,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t, } conv = mono_marshal_get_ptr_to_string_conv (m->piinfo, spec, &need_free); - if (conv == -1) { + if (conv == MONO_MARSHAL_CONV_INVALID) { char *msg = g_strdup_printf ("string marshalling conversion %d not implemented", encoding); mono_mb_emit_exception_marshal_directive (mb, msg); break; @@ -5534,7 +5534,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t, if (t->byref && !(t->attrs & PARAM_ATTRIBUTE_IN) && (t->attrs & PARAM_ATTRIBUTE_OUT)) break; - if (conv == -1) { + if (conv == MONO_MARSHAL_CONV_INVALID) { char *msg = g_strdup_printf ("stringbuilder marshalling conversion %d not implemented", encoding); mono_mb_emit_exception_marshal_directive (mb, msg); break; @@ -6170,9 +6170,9 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, conv = mono_marshal_get_stringbuilder_to_ptr_conv (m->piinfo, spec); } else - conv = (MonoMarshalConv)-1; + conv = MONO_MARSHAL_CONV_INVALID; - if (is_string && conv == -1) { + if (is_string && conv == MONO_MARSHAL_CONV_INVALID) { char *msg = g_strdup_printf ("string/stringbuilder marshalling conversion %d not implemented", encoding); mono_mb_emit_exception_marshal_directive (mb, msg); break; @@ -6344,7 +6344,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, gboolean need_free2; MonoMarshalConv conv = mono_marshal_get_ptr_to_stringbuilder_conv (m->piinfo, spec, &need_free2); - g_assert (conv != -1); + g_assert (conv != MONO_MARSHAL_CONV_INVALID); /* dest */ mono_mb_emit_ldarg (mb, argnum); @@ -6491,7 +6491,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, conv = mono_marshal_get_ptr_to_stringbuilder_conv (m->piinfo, spec, &need_free); } else - conv = (MonoMarshalConv)-1; + conv = MONO_MARSHAL_CONV_INVALID; mono_marshal_load_type_info (eklass); @@ -6586,7 +6586,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, /* Emit marshalling code */ if (is_string) { - g_assert (conv != -1); + g_assert (conv != MONO_MARSHAL_CONV_INVALID); mono_mb_emit_ldloc (mb, conv_arg); mono_mb_emit_ldloc (mb, index_var); @@ -6654,7 +6654,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, conv = mono_marshal_get_stringbuilder_to_ptr_conv (m->piinfo, spec); } else - conv = (MonoMarshalConv)-1; + conv = MONO_MARSHAL_CONV_INVALID; mono_marshal_load_type_info (eklass); @@ -6702,7 +6702,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, /* Emit marshalling code */ if (is_string) { - g_assert (conv != -1); + g_assert (conv != MONO_MARSHAL_CONV_INVALID); /* dest */ mono_mb_emit_ldloc (mb, dest_ptr); @@ -6736,7 +6736,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, MonoClass *eklass; guint32 label1, label2, label3; int index_var, src, dest, esize; - MonoMarshalConv conv = (MonoMarshalConv)-1; + MonoMarshalConv conv = MONO_MARSHAL_CONV_INVALID; gboolean is_string = FALSE; g_assert (!t->byref); @@ -6799,7 +6799,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t, /* Emit marshalling code */ if (is_string) { - g_assert (conv != -1); + g_assert (conv != MONO_MARSHAL_CONV_INVALID); /* dest */ mono_mb_emit_ldloc (mb, dest); diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index 57fc425083e..6b8fdcb44ca 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -774,7 +774,7 @@ gboolean mono_metadata_generic_param_equal (MonoGenericParam *p1, MonoGenericParam *p2); void mono_dynamic_stream_reset (MonoDynamicStream* stream); -void mono_assembly_addref (MonoAssembly *assembly); +MONO_API void mono_assembly_addref (MonoAssembly *assembly); void mono_assembly_load_friends (MonoAssembly* ass); gboolean mono_assembly_has_skip_verification (MonoAssembly* ass); diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 5a19ef2d17d..d278a7487ee 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -2049,13 +2049,11 @@ mono_metadata_parse_method_signature_full (MonoImage *m, MonoGenericContainer *c for (i = 0; i < method->param_count; ++i) { if (*ptr == MONO_TYPE_SENTINEL) { if (method->call_convention != MONO_CALL_VARARG || def) { - mono_loader_assert_no_error (); mono_error_set_bad_image (error, m, "Found sentinel for methoddef or no vararg"); g_free (pattrs); return NULL; } if (method->sentinelpos >= 0) { - mono_loader_assert_no_error (); mono_error_set_bad_image (error, m, "Found sentinel twice in the same signature."); g_free (pattrs); return NULL; @@ -2090,7 +2088,6 @@ mono_metadata_parse_method_signature_full (MonoImage *m, MonoGenericContainer *c * Add signature to a cache and increase ref count... */ - mono_loader_assert_no_error (); return method; } @@ -6163,7 +6160,6 @@ mono_metadata_load_generic_param_constraints_checked (MonoImage *image, guint32 return TRUE; for (i = 0; i < container->type_argc; i++) { if (!get_constraints (image, start_row + i, &mono_generic_container_get_param_info (container, i)->constraints, container, error)) { - mono_loader_assert_no_error (); return FALSE; } } diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h index afc21d48e66..35afec7e3ea 100644 --- a/mono/metadata/metadata.h +++ b/mono/metadata/metadata.h @@ -10,19 +10,6 @@ MONO_BEGIN_DECLS -/* - * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any - * other Mono header file if you use a different compiler from the one used to - * build Mono. - */ -#ifndef MONO_ZERO_LEN_ARRAY -#ifdef __GNUC__ -#define MONO_ZERO_LEN_ARRAY 0 -#else -#define MONO_ZERO_LEN_ARRAY 1 -#endif -#endif - #define MONO_TYPE_ISSTRUCT(t) mono_type_is_struct (t) #define MONO_TYPE_IS_VOID(t) mono_type_is_void (t) #define MONO_TYPE_IS_POINTER(t) mono_type_is_pointer (t) @@ -178,6 +165,8 @@ typedef enum { MONO_MARSHAL_CONV_HANDLEREF } MonoMarshalConv; +#define MONO_MARSHAL_CONV_INVALID ((MonoMarshalConv)-1) + typedef struct { MonoMarshalNative native; union { diff --git a/mono/metadata/method-builder.c b/mono/metadata/method-builder.c index 98431f7d64a..4f6eb93ba60 100644 --- a/mono/metadata/method-builder.c +++ b/mono/metadata/method-builder.c @@ -98,6 +98,12 @@ void mono_mb_free (MonoMethodBuilder *mb) { #ifndef DISABLE_JIT + GList *l; + + for (l = mb->locals_list; l; l = l->next) { + /* Allocated in mono_mb_add_local () */ + g_free (l->data); + } g_list_free (mb->locals_list); if (!mb->dynamic) { g_free (mb->method); @@ -150,7 +156,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in header->code = mb->code; for (i = 0, l = mb->locals_list; l; l = l->next, i++) { - header->locals [i] = mono_metadata_type_dup (NULL, (MonoType*)l->data); + header->locals [i] = (MonoType*)l->data; } } else #endif @@ -174,11 +180,15 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in memcpy ((char*)header->code, mb->code, mb->pos); for (i = 0, l = mb->locals_list; l; l = l->next, i++) { - header->locals [i] = mono_metadata_type_dup (NULL, (MonoType*)l->data); + header->locals [i] = (MonoType*)l->data; } #endif } + /* Free the locals list so mono_mb_free () doesn't free the types twice */ + g_list_free (mb->locals_list); + mb->locals_list = NULL; + method->signature = signature; if (!signature->hasthis) method->flags |= METHOD_ATTRIBUTE_STATIC; @@ -270,12 +280,19 @@ int mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type) { int res; + MonoType *t; + + /* + * Have to make a copy early since type might be sig->ret, + * which is transient, see mono_metadata_signature_dup_internal_with_padding (). + */ + t = mono_metadata_type_dup (NULL, type); g_assert (mb != NULL); g_assert (type != NULL); res = mb->locals; - mb->locals_list = g_list_append (mb->locals_list, type); + mb->locals_list = g_list_append (mb->locals_list, t); mb->locals++; return res; diff --git a/mono/metadata/mono-basic-block.c b/mono/metadata/mono-basic-block.c index 564c83a6151..5ccb938df9b 100644 --- a/mono/metadata/mono-basic-block.c +++ b/mono/metadata/mono-basic-block.c @@ -240,6 +240,8 @@ bb_split (MonoSimpleBasicBlock *first, MonoSimpleBasicBlock *hint, MonoSimpleBas { MonoSimpleBasicBlock *res, *bb = first; + mono_error_init (error); + if (bb_idx_is_contained (hint, target)) { first = hint; } else if (hint->next && bb_idx_is_contained (hint->next, target)) { @@ -336,6 +338,8 @@ bb_formation_il_pass (const unsigned char *start, const unsigned char *end, Mono MonoSimpleBasicBlock *branch, *next, *current; const MonoOpcode *opcode; + mono_error_init (error); + current = bb; while (ip < end) { @@ -464,6 +468,9 @@ bb_formation_eh_pass (MonoMethodHeader *header, MonoSimpleBasicBlock *bb, MonoSi { int i; int end = header->code_size; + + mono_error_init (error); + /*We must split at all points to verify for targets in the middle of an instruction*/ for (i = 0; i < header->num_clauses; ++i) { MonoExceptionClause *clause = header->clauses + i; @@ -520,6 +527,8 @@ mono_basic_block_split (MonoMethod *method, MonoError *error, MonoMethodHeader * MonoSimpleBasicBlock *bb, *root; const unsigned char *start, *end; + mono_error_init (error); + start = header->code; end = start + header->code_size; diff --git a/mono/metadata/object-offsets.h b/mono/metadata/object-offsets.h index 36763dd311c..c032bc0ff58 100644 --- a/mono/metadata/object-offsets.h +++ b/mono/metadata/object-offsets.h @@ -185,10 +185,6 @@ DECL_OFFSET(MonoLMF, eip) DECL_OFFSET(MonoContext, gregs) DECL_OFFSET(MonoContext, fregs) -#ifdef TARGET_WIN32 -DECL_OFFSET(MonoLMF, lmf_addr) -#endif - DECL_OFFSET(MonoLMF, rsp) DECL_OFFSET(MonoLMF, rbp) DECL_OFFSET(MonoLMF, rip) diff --git a/mono/metadata/pedump.c b/mono/metadata/pedump.c index 3af4153a867..eac9bfba360 100644 --- a/mono/metadata/pedump.c +++ b/mono/metadata/pedump.c @@ -362,7 +362,6 @@ dump_verify_info (MonoImage *image, int flags) for (i = 0; i < m->rows; ++i) { MonoMethod *method; MonoError error; - mono_loader_clear_error (); method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL, NULL, &error); if (!method) { @@ -487,16 +486,14 @@ verify_image_file (const char *fname) continue; } mono_class_init (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) { + if (mono_class_has_failure (klass)) { printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name); - mono_loader_clear_error (); ++count; } mono_class_setup_vtable (klass); - if (mono_class_has_failure (klass) || mono_loader_get_last_error ()) { + if (mono_class_has_failure (klass)) { printf ("Error verifying class(0x%08x) %s.%s a type load error happened\n", token, klass->name_space, klass->name); - mono_loader_clear_error (); ++count; } } diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c index d74a273d085..bb8579e7ad9 100644 --- a/mono/metadata/profiler.c +++ b/mono/metadata/profiler.c @@ -1161,6 +1161,7 @@ load_embedded_profiler (const char *desc, const char *name) return result; } +// TODO: Much of the library loading code here is custom. It would be better to merge this with mono-dl static gboolean load_profiler_from_directory (const char *directory, const char *libname, const char *desc) { @@ -1169,13 +1170,13 @@ load_profiler_from_directory (const char *directory, const char *libname, const char *err; void *iter; - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Attempting to load profiler %s from %s (desc %s)", libname, directory, desc); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "Attempting to load profiler %s from %s (desc %s)", libname, directory, desc); iter = NULL; err = NULL; while ((path = mono_dl_build_path (directory, libname, &iter))) { pmodule = mono_dl_open (path, MONO_DL_LAZY, &err); - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Attempting to load profiler: %s %ssuccessful, err: %s", path, pmodule?"":"not ", err); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "Attempting to load profiler: %s, %ssuccessful, err: %s", path, pmodule?"":"not ", err); g_free (path); g_free (err); if (pmodule) @@ -1186,10 +1187,11 @@ load_profiler_from_directory (const char *directory, const char *libname, const } static gboolean -load_profiler_from_mono_instalation (const char *libname, const char *desc) +load_profiler_from_mono_installation (const char *libname, const char *desc) { char *err = NULL; MonoDl *pmodule = mono_dl_open_runtime_lib (libname, MONO_DL_LAZY, &err); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT, "Attempting to load profiler from runtime libs: %s, %ssuccessful, err: %s", libname, pmodule?"":"not ", err); g_free (err); if (pmodule) return load_profiler (pmodule, desc, INITIALIZER_NAME); @@ -1254,15 +1256,11 @@ mono_profiler_load (const char *desc) } if (!load_embedded_profiler (desc, mname)) { libname = g_strdup_printf ("mono-profiler-%s", mname); - char *profiler_lib_dir = getenv ("MONO_PROFILER_LIB_DIR"); - if (profiler_lib_dir) - res = load_profiler_from_directory (profiler_lib_dir, libname, desc); + res = load_profiler_from_mono_installation (libname, desc); if (!res && mono_config_get_assemblies_dir ()) res = load_profiler_from_directory (mono_assembly_getrootdir (), libname, desc); if (!res) res = load_profiler_from_directory (NULL, libname, desc); - if (!res) - res = load_profiler_from_mono_instalation (libname, desc); if (!res) g_warning ("The '%s' profiler wasn't found in the main executable nor could it be loaded from '%s'.", mname, libname); g_free (libname); diff --git a/mono/metadata/reflection-internals.h b/mono/metadata/reflection-internals.h index 600f2c6d268..327bb93142c 100644 --- a/mono/metadata/reflection-internals.h +++ b/mono/metadata/reflection-internals.h @@ -10,7 +10,7 @@ #include MonoType* -mono_reflection_get_type_checked (MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve, MonoError *error); +mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, mono_bool ignorecase, mono_bool *type_resolve, MonoError *error); MonoType* mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError *error); diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 47b228175ad..d477f51c245 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -8629,6 +8629,7 @@ mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ig /** * mono_reflection_get_type_checked: + * @rootimage: the image of the currently active managed caller * @image: a metadata context * @info: type description structure * @ignorecase: flag for case-insensitive string compares @@ -8639,9 +8640,9 @@ mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ig * */ MonoType* -mono_reflection_get_type_checked (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error) { +mono_reflection_get_type_checked (MonoImage *rootimage, MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve, MonoError *error) { mono_error_init (error); - return mono_reflection_get_type_with_rootimage (image, image, info, ignorecase, type_resolve, error); + return mono_reflection_get_type_with_rootimage (rootimage, image, info, ignorecase, type_resolve, error); } @@ -9702,11 +9703,6 @@ mono_reflection_resolve_custom_attribute_data (MonoReflectionMethod *ref_method, if (!mono_error_ok (&error)) goto leave; - if (mono_loader_get_last_error ()) { - mono_error_set_from_loader_error (&error); - goto leave; - } - if (!typedargs || !namedargs) goto leave; @@ -10433,7 +10429,6 @@ mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass if (!result) return NULL; } else { - mono_loader_assert_no_error (); result = mono_array_new_cached (mono_domain_get (), mono_defaults.attribute_class, 0); } @@ -10501,9 +10496,6 @@ mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error } else result = mono_array_new (mono_domain_get (), mono_defaults.customattribute_data_class, 0); - if (mono_loader_get_last_error ()) - mono_error_set_from_loader_error (error); - return result; } diff --git a/mono/metadata/reflection.h b/mono/metadata/reflection.h index af85ac1b3c3..ad28290bcc9 100644 --- a/mono/metadata/reflection.h +++ b/mono/metadata/reflection.h @@ -1,6 +1,7 @@ #ifndef __METADATA_REFLECTION_H__ #define __METADATA_REFLECTION_H__ +#include #include MONO_BEGIN_DECLS diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index 2956d95420a..cadd83f30fd 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -2298,6 +2298,7 @@ void sgen_client_thread_register_worker (void) { mono_thread_info_register_small_id (); + mono_thread_info_set_name (mono_native_thread_id_get (), "SGen worker"); } /* Variables holding start/end nursery so it won't have to be passed at every call */ @@ -2938,9 +2939,14 @@ sgen_client_describe_invalid_pointer (GCObject *ptr) sgen_bridge_describe_pointer (ptr); } +static gboolean gc_inited; + void mono_gc_base_init (void) { + if (gc_inited) + return; + mono_counters_init (); #ifdef HEAVY_STATISTICS @@ -2963,6 +2969,8 @@ mono_gc_base_init (void) if (mono_tls_key_get_offset (TLS_KEY_SGEN_TLAB_NEXT_ADDR) == -1) sgen_set_use_managed_allocator (FALSE); #endif + + gc_inited = TRUE; } void diff --git a/mono/metadata/threadpool-ms-io.c b/mono/metadata/threadpool-ms-io.c index 5f4f36a193f..b479fb1bd35 100644 --- a/mono/metadata/threadpool-ms-io.c +++ b/mono/metadata/threadpool-ms-io.c @@ -584,7 +584,7 @@ ves_icall_System_IOSelector_Add (gpointer handle, MonoIOSelectorJob *job) g_assert (handle >= 0); - g_assert (job->operation == EVENT_IN ^ job->operation == EVENT_OUT); + g_assert ((job->operation == EVENT_IN) ^ (job->operation == EVENT_OUT)); g_assert (job->callback); if (mono_runtime_is_shutting_down ()) diff --git a/mono/metadata/threadpool-ms.c b/mono/metadata/threadpool-ms.c index 62fc34aef3f..14ebdf648ce 100644 --- a/mono/metadata/threadpool-ms.c +++ b/mono/metadata/threadpool-ms.c @@ -592,7 +592,8 @@ worker_thread (gpointer data) thread = mono_thread_internal_current (); g_assert (thread); - mono_thread_set_name_internal (thread, mono_string_new (mono_domain_get (), "Threadpool worker"), FALSE); + mono_thread_set_name_internal (thread, mono_string_new (mono_get_root_domain (), "Threadpool worker"), FALSE, &error); + mono_error_assert_ok (&error); mono_coop_mutex_lock (&threadpool->active_threads_lock); g_ptr_array_add (threadpool->working_threads, thread); diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h index b970e96e038..f767247435a 100644 --- a/mono/metadata/threads-types.h +++ b/mono/metadata/threads-types.h @@ -218,7 +218,7 @@ MONO_API MonoException* mono_thread_get_undeniable_exception (void); MonoException* mono_thread_get_and_clear_pending_exception (void); -void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed); +void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed, MonoError *error); void mono_runtime_set_has_tls_get (gboolean val); gboolean mono_runtime_has_tls_get (void); diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 5884d0270e5..856f0abf879 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -454,7 +454,9 @@ static void thread_cleanup (MonoInternalThread *thread) } mono_release_type_locks (thread); - mono_profiler_thread_end (thread->tid); + /* Can happen when we attach the profiler helper thread in order to heapshot. */ + if (!mono_thread_info_lookup (thread->tid)->tools_thread) + mono_profiler_thread_end (thread->tid); if (thread == mono_thread_internal_current ()) { /* @@ -616,23 +618,25 @@ create_internal_thread (MonoError *error) return thread; } -static void -init_root_domain_thread (MonoInternalThread *thread, MonoThread *candidate) +static gboolean +init_root_domain_thread (MonoInternalThread *thread, MonoThread *candidate, MonoError *error) { - MonoError error; MonoDomain *domain = mono_get_root_domain (); + mono_error_init (error); if (!candidate || candidate->obj.vtable->domain != domain) { - candidate = new_thread_with_internal (domain, thread, &error); - mono_error_raise_exception (&error); /* FIXME don't raise here */ + candidate = new_thread_with_internal (domain, thread, error); + return_val_if_nok (error, FALSE); } set_current_thread_for_domain (domain, thread, candidate); g_assert (!thread->root_domain_thread); MONO_OBJECT_SETREF (thread, root_domain_thread, candidate); + return TRUE; } static guint32 WINAPI start_wrapper_internal(void *data) { + MonoError error; MonoThreadInfo *info; StartInfo *start_info = (StartInfo *)data; guint32 (*start_func)(void *); @@ -681,7 +685,8 @@ static guint32 WINAPI start_wrapper_internal(void *data) /* We have to do this here because mono_thread_new_init() requires that root_domain_thread is set up. */ thread_adjust_static_data (internal); - init_root_domain_thread (internal, start_info->obj); + init_root_domain_thread (internal, start_info->obj, &error); + mono_error_raise_exception (&error); /* FIXME don't raise here */ /* This MUST be called before any managed code can be * executed, as it calls the callback function that (for the @@ -725,6 +730,7 @@ static guint32 WINAPI start_wrapper_internal(void *data) if (internal->name && (internal->flags & MONO_THREAD_FLAG_NAME_SET)) { char *tname = g_utf16_to_utf8 (internal->name, internal->name_len, NULL, NULL, NULL); mono_profiler_thread_name (internal->tid, tname); + mono_thread_info_set_name (internal->tid, tname); g_free (tname); } /* start_func is set only for unmanaged start functions */ @@ -787,7 +793,7 @@ static guint32 WINAPI start_wrapper(void *data) */ static gboolean create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *start_info, gboolean threadpool_thread, guint32 stack_size, - gboolean throw_on_failure) + MonoError *error) { HANDLE thread_handle; MonoNativeThreadId tid; @@ -799,6 +805,8 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star */ mono_threads_join_threads (); + mono_error_init (error); + mono_threads_lock (); if (shutting_down) { g_free (start_info); @@ -834,15 +842,12 @@ create_thread (MonoThread *thread, MonoInternalThread *internal, StartInfo *star stack_size, create_flags, &tid); if (thread_handle == NULL) { - /* The thread couldn't be created, so throw an exception */ + /* The thread couldn't be created, so set an exception */ mono_threads_lock (); mono_g_hash_table_remove (threads_starting_up, thread); mono_threads_unlock (); g_free (start_info); - if (throw_on_failure) - mono_raise_exception (mono_get_exception_execution_engine ("Couldn't create thread")); - else - g_warning ("%s: CreateThread error 0x%x", __func__, GetLastError ()); + mono_error_set_execution_engine (error, "Couldn't create thread. Error 0x%x", GetLastError()); return FALSE; } THREAD_DEBUG (g_message ("%s: Started thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread_handle)); @@ -931,9 +936,11 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gb start_info->obj = thread; start_info->start_arg = arg; - res = create_thread (thread, internal, start_info, threadpool_thread, stack_size, TRUE); - if (!res) + res = create_thread (thread, internal, start_info, threadpool_thread, stack_size, &error); + if (!res) { + mono_error_raise_exception (&error); /* FIXME don't raise here */ return NULL; + } /* Check that the managed and unmanaged layout of MonoInternalThread matches */ #ifndef MONO_CROSS_COMPILE @@ -1019,7 +1026,9 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach, MonoError *e thread_adjust_static_data (thread); - init_root_domain_thread (thread, current_thread); + init_root_domain_thread (thread, current_thread, error); + return_val_if_nok (error, NULL); + if (domain != mono_get_root_domain ()) set_current_thread_for_domain (domain, thread, current_thread); @@ -1036,8 +1045,10 @@ mono_thread_attach_full (MonoDomain *domain, gboolean force_attach, MonoError *e mono_thread_attach_cb (MONO_NATIVE_THREAD_ID_TO_UINT (tid), staddr + stsize); } - // FIXME: Need a separate callback - mono_profiler_thread_start (MONO_NATIVE_THREAD_ID_TO_UINT (tid)); + /* Can happen when we attach the profiler helper thread in order to heapshot. */ + if (!info->tools_thread) + // FIXME: Need a separate callback + mono_profiler_thread_start (MONO_NATIVE_THREAD_ID_TO_UINT (tid)); return current_thread; } @@ -1123,6 +1134,7 @@ HANDLE ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj, MonoObject *start) { + MonoError error; StartInfo *start_info; MonoInternalThread *internal; gboolean res; @@ -1153,8 +1165,9 @@ ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj, start_info->obj = this_obj; g_assert (this_obj->obj.vtable->domain == mono_domain_get ()); - res = create_thread (this_obj, internal, start_info, FALSE, 0, FALSE); + res = create_thread (this_obj, internal, start_info, FALSE, 0, &error); if (!res) { + mono_error_cleanup (&error); UNLOCK_THREAD (internal); return NULL; } @@ -1345,14 +1358,16 @@ ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThread *this_obj } void -mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed) +mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed, MonoError *error) { LOCK_THREAD (this_obj); + mono_error_init (error); + if ((this_obj->flags & MONO_THREAD_FLAG_NAME_SET) && !this_obj->threadpool_thread) { UNLOCK_THREAD (this_obj); - mono_raise_exception (mono_get_exception_invalid_operation ("Thread.Name can only be set once.")); + mono_error_set_invalid_operation (error, "Thread.Name can only be set once."); return; } if (this_obj->name) { @@ -1383,7 +1398,9 @@ mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, g void ves_icall_System_Threading_Thread_SetName_internal (MonoInternalThread *this_obj, MonoString *name) { - mono_thread_set_name_internal (this_obj, name, TRUE); + MonoError error; + mono_thread_set_name_internal (this_obj, name, TRUE, &error); + mono_error_set_pending_exception (&error); } /* diff --git a/mono/metadata/verify.c b/mono/metadata/verify.c index 1d291ddb459..c3da0227e3c 100644 --- a/mono/metadata/verify.c +++ b/mono/metadata/verify.c @@ -885,12 +885,11 @@ mono_type_is_valid_in_context (VerifyContext *ctx, MonoType *type) klass = mono_class_from_mono_type (type); mono_class_init (klass); - if (mono_loader_get_last_error () || mono_class_has_failure (klass)) { + if (mono_class_has_failure (klass)) { if (klass->generic_class && !mono_class_is_valid_generic_instantiation (NULL, klass)) ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Invalid generic instantiation of type %s.%s at 0x%04x", klass->name_space, klass->name, ctx->ip_offset), MONO_EXCEPTION_TYPE_LOAD); else ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Could not load type %s.%s at 0x%04x", klass->name_space, klass->name, ctx->ip_offset), MONO_EXCEPTION_TYPE_LOAD); - mono_loader_clear_error (); return FALSE; } @@ -1021,9 +1020,8 @@ verifier_load_type (VerifyContext *ctx, int token, const char *opcode) { mono_error_cleanup (&error); /*FIXME don't swallow the error */ } - if (!type || mono_loader_get_last_error ()) { + if (!type) { ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Cannot load type from token 0x%08x for %s at 0x%04x", token, opcode, ctx->ip_offset), MONO_EXCEPTION_BAD_IMAGE); - mono_loader_clear_error (); return NULL; } diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index 8fc453350cd..39752cdf079 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -48,7 +48,8 @@ RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_bu MINI_RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE) RUNTIME_AOTCHECK = MONO_PATH="$(CLASS)$(PLATFORM_PATH_SEPARATOR)." $(RUNTIME_EXECUTABLE) -MCS = $(MINI_RUNTIME) $(mcs_topdir)/class/lib/build/mcs.exe -unsafe -nowarn:0162 +CSC = $(mcs_topdir)/class/lib/build/mcs.exe +MCS = CSC_SDK_PATH_DISABLED= $(MINI_RUNTIME) $(CSC) -unsafe -nowarn:0162 -nologo -noconfig -r:$(CLASS)/mscorlib.dll -r:$(CLASS)/System.dll ILASM = $(MINI_RUNTIME) $(CLASS)/ilasm.exe AM_CFLAGS = \ @@ -602,13 +603,13 @@ libmonoinclude_HEADERS = jit.h CSFLAGS = -unsafe -nowarn:0219,0169,0414,0649 basic-simd.exe: basic-simd.cs TestDriver.dll - $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll + $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll nacl.exe: nacl.cs TestDriver.dll - $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:Mono.Simd.dll + $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll generics.exe: generics.cs TestDriver.dll generics-variant-types.dll - $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll + $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:generics-variant-types.dll -r:$(CLASS)/System.Core.dll %.exe: %.cs TestDriver.dll $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c index dd2780edac9..f65b3a6ee68 100644 --- a/mono/mini/aot-compiler.c +++ b/mono/mini/aot-compiler.c @@ -1120,8 +1120,7 @@ arm64_emit_static_rgctx_trampoline (MonoAotCompile *acfg, int offset, int *tramp /* Similar to the specific trampolines, but use the rgctx reg instead of ip1 */ /* Load argument from first GOT slot */ - g_assert (MONO_ARCH_RGCTX_REG == 27); - arm64_emit_load_got_slot (acfg, ARMREG_R27, offset); + arm64_emit_load_got_slot (acfg, MONO_ARCH_RGCTX_REG, offset); /* Load generic trampoline address from second GOT slot */ arm64_emit_load_got_slot (acfg, ARMREG_R16, offset + 1); fprintf (acfg->fp, "br x16\n"); @@ -7548,8 +7547,6 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method) cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), flags, 0, index); mono_time_track_end (&mono_jit_stats.jit_time, jit_timer); - mono_loader_clear_error (); - if (cfg->exception_type == MONO_EXCEPTION_GENERIC_SHARING_FAILED) { if (acfg->aot_opts.print_skipped_methods) printf ("Skip (gshared failure): %s (%s)\n", mono_method_get_full_name (method), cfg->exception_message); @@ -7868,7 +7865,10 @@ compile_thread_main (gpointer *user_data) GPtrArray *methods = (GPtrArray *)user_data [2]; int i; - mono_thread_attach (domain); + MonoError error; + MonoThread *thread = mono_thread_attach (domain); + mono_thread_set_name_internal (thread->internal_thread, mono_string_new (mono_get_root_domain (), "AOT compiler"), TRUE, &error); + mono_error_assert_ok (&error); for (i = 0; i < methods->len; ++i) compile_method (acfg, (MonoMethod *)g_ptr_array_index (methods, i)); diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index b2712b486eb..c7e18a0f0d9 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -7258,7 +7258,7 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf) MonoError error; type_resolve = TRUE; /* FIXME really okay to call while holding locks? */ - t = mono_reflection_get_type_checked (ass->image, &info, ignore_case, &type_resolve, &error); + t = mono_reflection_get_type_checked (ass->image, ass->image, &info, ignore_case, &type_resolve, &error); mono_error_cleanup (&error); if (t) { g_ptr_array_add (res_classes, mono_type_get_class (t)); @@ -7692,7 +7692,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) } else { if (info.assembly.name) NOT_IMPLEMENTED; - t = mono_reflection_get_type_checked (ass->image, &info, ignorecase, &type_resolve, &error); + t = mono_reflection_get_type_checked (ass->image, ass->image, &info, ignorecase, &type_resolve, &error); if (!is_ok (&error)) { mono_error_cleanup (&error); /* FIXME don't swallow the error */ mono_reflection_free_type_info (&info); @@ -9675,6 +9675,7 @@ wait_for_attach (void) static guint32 WINAPI debugger_thread (void *arg) { + MonoError error; int res, len, id, flags, command = 0; CommandSet command_set = (CommandSet)0; guint8 header [HEADER_LENGTH]; @@ -9690,8 +9691,11 @@ debugger_thread (void *arg) debugger_thread_id = mono_native_thread_id_get (); attach_cookie = mono_jit_thread_attach (mono_get_root_domain (), &attach_dummy); + MonoInternalThread *thread = mono_thread_internal_current (); + mono_thread_set_name_internal (thread, mono_string_new (mono_get_root_domain (), "Debugger agent"), TRUE, &error); + mono_error_assert_ok (&error); - mono_thread_internal_current ()->flags |= MONO_THREAD_FLAG_DONT_MANAGE; + thread->flags |= MONO_THREAD_FLAG_DONT_MANAGE; mono_set_is_debugger_attached (TRUE); diff --git a/mono/mini/driver.c b/mono/mini/driver.c index a84cd2f6ab0..f1c27d7dc40 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -1191,6 +1191,8 @@ mini_usage_jitdeveloper (void) " --agent=ASSEMBLY[:ARG] Loads the specific agent assembly and executes its Main method with the given argument before loading the main assembly.\n" " --no-x86-stack-align Don't align stack on x86\n" "\n" + "The options supported by MONO_DEBUG can also be passed on the command line.\n" + "\n" "Other options:\n" " --graph[=TYPE] METHOD Draws a graph of the specified method:\n"); @@ -1440,6 +1442,7 @@ mono_jit_parse_options (int argc, char * argv[]) #else mono_use_llvm = TRUE; #endif + } else if (argv [i][0] == '-' && argv [i][1] == '-' && mini_parse_debug_option (argv [i] + 2)) { } else { fprintf (stderr, "Unsupported command line option: '%s'\n", argv [i]); exit (1); @@ -1912,6 +1915,7 @@ mono_main (int argc, char* argv[]) } else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){ nacl_null_checks_off = TRUE; #endif + } else if (argv [i][0] == '-' && argv [i][1] == '-' && mini_parse_debug_option (argv [i] + 2)) { } else { fprintf (stderr, "Unknown command line option: '%s'\n", argv [i]); return 1; @@ -1983,8 +1987,16 @@ mono_main (int argc, char* argv[]) /* Set rootdir before loading config */ mono_set_rootdir (); - if (enable_profile) + /* + * We only set the native name of the thread since MS.NET leaves the + * managed thread name for the main thread as null. + */ + mono_thread_info_set_name (mono_native_thread_id_get (), "Main"); + + if (enable_profile) { mono_profiler_load (profile_options); + mono_profiler_thread_name (mono_native_thread_id_get (), "Main"); + } mono_attach_parse_options (attach_options); diff --git a/mono/mini/dwarfwriter.c b/mono/mini/dwarfwriter.c index b53661e519b..ad25f58728e 100644 --- a/mono/mini/dwarfwriter.c +++ b/mono/mini/dwarfwriter.c @@ -572,71 +572,6 @@ static DwarfBasicType basic_types [] = { #define LINE_BASE -5 #define LINE_RANGE 14 -/* Subsections of the .debug_line section */ -#define LINE_SUBSECTION_HEADER 1 -#define LINE_SUBSECTION_INCLUDES 2 -#define LINE_SUBSECTION_FILES 3 -#define LINE_SUBSECTION_DATA 4 -#define LINE_SUBSECTION_END 5 - -static int -emit_line_number_file_name (MonoDwarfWriter *w, const char *name, - gint64 last_mod_time, gint64 file_size) -{ - int index; - int dir_index; - char *basename = NULL; - - if (!w->file_to_index) - w->file_to_index = g_hash_table_new (g_str_hash, g_str_equal); - - index = GPOINTER_TO_UINT (g_hash_table_lookup (w->file_to_index, name)); - if (index > 0) - return index; - - if (g_path_is_absolute (name)) { - char *dir = g_path_get_dirname (name); - - if (!w->dir_to_index) - w->dir_to_index = g_hash_table_new (g_str_hash, g_str_equal); - - dir_index = GPOINTER_TO_UINT (g_hash_table_lookup (w->dir_to_index, dir)); - if (dir_index == 0) { - emit_section_change (w, ".debug_line", LINE_SUBSECTION_INCLUDES); - emit_string (w, dir); - - dir_index = ++ w->line_number_dir_index; - g_hash_table_insert (w->dir_to_index, g_strdup (dir), GUINT_TO_POINTER (dir_index)); - } - - g_free (dir); - - basename = g_path_get_basename (name); - } else { - dir_index = 0; - } - - emit_section_change (w, ".debug_line", LINE_SUBSECTION_FILES); - - if (basename) - emit_string (w, basename); - else - emit_string (w, name); - emit_uleb128 (w, dir_index); - emit_byte (w, 0); - emit_byte (w, 0); - - emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA); - - if (basename) - g_free (basename); - - index = ++ w->line_number_file_index; - g_hash_table_insert (w->file_to_index, g_strdup (name), GUINT_TO_POINTER (index)); - - return index; -} - static int get_line_number_file_name (MonoDwarfWriter *w, const char *name) { @@ -1658,7 +1593,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, addr_diff = i - prev_native_offset; if (first) { - emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA); + emit_section_change (w, ".debug_line", 0); emit_byte (w, 0); emit_byte (w, sizeof (gpointer) + 1); @@ -1732,7 +1667,7 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, il_to_line = g_new0 (int, header->code_size); - emit_section_change (w, ".debug_line", LINE_SUBSECTION_DATA); + emit_section_change (w, ".debug_line", 0); emit_byte (w, 0); emit_byte (w, sizeof (gpointer) + 1); emit_byte (w, DW_LNE_set_address); diff --git a/mono/mini/exceptions-arm64.c b/mono/mini/exceptions-arm64.c index 717443c9a67..fe210faa3a2 100644 --- a/mono/mini/exceptions-arm64.c +++ b/mono/mini/exceptions-arm64.c @@ -378,8 +378,10 @@ mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble * if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { MonoException *mono_ex = (MonoException*)exc; - if (!rethrow) + if (!rethrow) { mono_ex->stack_trace = NULL; + mono_ex->trace_ips = NULL; + } } mono_error_assert_ok (&error); @@ -500,18 +502,6 @@ mono_arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, return FALSE; } -void -mono_arch_sigctx_to_monoctx (void *sigctx, MonoContext *mctx) -{ - mono_sigctx_to_monoctx (sigctx, mctx); -} - -void -mono_arch_monoctx_to_sigctx (MonoContext *mctx, void *sigctx) -{ - mono_monoctx_to_sigctx (mctx, sigctx); -} - /* * handle_exception: * @@ -548,7 +538,7 @@ mono_arch_handle_exception (void *ctx, gpointer obj) jit_tls = mono_native_tls_get_value (mono_jit_tls_id); /* Pass the ctx parameter in TLS */ - mono_arch_sigctx_to_monoctx (sigctx, &jit_tls->ex_ctx); + mono_sigctx_to_monoctx (sigctx, &jit_tls->ex_ctx); /* The others in registers */ UCONTEXT_REG_R0 (sigctx) = (gsize)obj; diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index aed8309edf6..587d08254e5 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -7261,7 +7261,6 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, if (cfg->verbose_level > 2) printf ("INLINE ABORTED %s (cost %d)\n", mono_method_full_name (cmethod, TRUE), costs); cfg->exception_type = MONO_EXCEPTION_NONE; - mono_loader_clear_error (); /* This gets rid of the newly added bblocks */ cfg->cbb = prev_cbb; diff --git a/mono/mini/mini-amd64-gsharedvt.c b/mono/mini/mini-amd64-gsharedvt.c index c3e2e99bc86..dffa9370f27 100644 --- a/mono/mini/mini-amd64-gsharedvt.c +++ b/mono/mini/mini-amd64-gsharedvt.c @@ -274,7 +274,7 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si DEBUG_AMD64_GSHAREDVT_PRINT ("source sig: (%s) return (%s)\n", mono_signature_get_desc (caller_sig, FALSE), mono_type_full_name (mono_signature_get_return_type (caller_sig))); // Leak DEBUG_AMD64_GSHAREDVT_PRINT ("dest sig: (%s) return (%s)\n", mono_signature_get_desc (callee_sig, FALSE), mono_type_full_name (mono_signature_get_return_type (callee_sig))); - if (gcinfo->ret.is_gsharedvt_return_value) { + if (gcinfo->ret.storage == ArgGsharedvtVariableInReg) { /* * The return type is gsharedvt */ @@ -357,7 +357,7 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si if (cinfo->ret.storage == ArgValuetypeAddrInIReg) { /* Both the caller and the callee pass the vtype ret address in r8 */ - g_assert (cinfo->ret.storage == gcinfo->ret.storage); + g_assert (gcinfo->ret.storage == ArgValuetypeAddrInIReg || gcinfo->ret.storage == ArgGsharedvtVariableInReg); add_to_map (map, map_reg (cinfo->ret.reg), map_reg (cinfo->ret.reg)); } @@ -370,7 +370,7 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si info->calli = calli; if (var_ret) { - g_assert (gcinfo->ret.is_gsharedvt_return_value); + g_assert (gcinfo->ret.storage == ArgGsharedvtVariableInReg); info->vret_arg_reg = map_reg (gcinfo->ret.reg); DEBUG_AMD64_GSHAREDVT_PRINT ("mapping vreg_arg_reg to %d in reg %s\n", info->vret_arg_reg, mono_arch_regname (gcinfo->ret.reg)); } else { @@ -475,4 +475,4 @@ mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_si return info; } -#endif \ No newline at end of file +#endif diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index 18e48283d95..901a6c99d76 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -1108,6 +1108,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) cinfo = (CallInfo *)g_malloc0 (sizeof (CallInfo) + (sizeof (ArgInfo) * n)); cinfo->nargs = n; + cinfo->gsharedvt = mini_is_gsharedvt_variable_signature (sig); gr = 0; fr = 0; @@ -1158,8 +1159,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) break; } if (mini_is_gsharedvt_type (ret_type)) { - cinfo->ret.storage = ArgValuetypeAddrInIReg; - cinfo->ret.is_gsharedvt_return_value = 1; + cinfo->ret.storage = ArgGsharedvtVariableInReg; break; } /* fall through */ @@ -1174,8 +1174,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) case MONO_TYPE_VAR: case MONO_TYPE_MVAR: g_assert (mini_is_gsharedvt_type (ret_type)); - cinfo->ret.storage = ArgValuetypeAddrInIReg; - cinfo->ret.is_gsharedvt_return_value = 1; + cinfo->ret.storage = ArgGsharedvtVariableInReg; break; case MONO_TYPE_VOID: break; @@ -1191,7 +1190,8 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) * are sometimes made using calli without sig->hasthis set, like in the delegate * invoke wrappers. */ - if (cinfo->ret.storage == ArgValuetypeAddrInIReg && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_get_underlying_type (sig->params [0]))))) { + ArgStorage ret_storage = cinfo->ret.storage; + if ((ret_storage == ArgValuetypeAddrInIReg || ret_storage == ArgGsharedvtVariableInReg) && !is_pinvoke && (sig->hasthis || (sig->param_count > 0 && MONO_TYPE_IS_REFERENCE (mini_get_underlying_type (sig->params [0]))))) { if (sig->hasthis) { add_general (&gr, &stack_size, cinfo->args + 0); } else { @@ -1199,16 +1199,16 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) pstart = 1; } add_general (&gr, &stack_size, &cinfo->ret); - cinfo->ret.storage = ArgValuetypeAddrInIReg; + cinfo->ret.storage = ret_storage; cinfo->vret_arg_index = 1; } else { /* this */ if (sig->hasthis) add_general (&gr, &stack_size, cinfo->args + 0); - if (cinfo->ret.storage == ArgValuetypeAddrInIReg) { + if (ret_storage == ArgValuetypeAddrInIReg || ret_storage == ArgGsharedvtVariableInReg) { add_general (&gr, &stack_size, &cinfo->ret); - cinfo->ret.storage = ArgValuetypeAddrInIReg; + cinfo->ret.storage = ret_storage; } } @@ -1865,6 +1865,7 @@ mono_arch_allocate_vars (MonoCompile *cfg) cfg->ret->dreg = cinfo->ret.reg; break; case ArgValuetypeAddrInIReg: + case ArgGsharedvtVariableInReg: /* The register is volatile */ cfg->vret_addr->opcode = OP_REGOFFSET; cfg->vret_addr->inst_basereg = cfg->frame_reg; @@ -2042,7 +2043,7 @@ mono_arch_create_vars (MonoCompile *cfg) cfg->ret_var_is_local = TRUE; sig_ret = mini_get_underlying_type (sig->ret); - if (cinfo->ret.storage == ArgValuetypeAddrInIReg) { + if (cinfo->ret.storage == ArgValuetypeAddrInIReg || cinfo->ret.storage == ArgGsharedvtVariableInReg) { cfg->vret_addr = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_ARG); if (G_UNLIKELY (cfg->verbose_level > 1)) { printf ("vret_addr = "); @@ -2230,6 +2231,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) break; } case ArgValuetypeAddrInIReg: + case ArgGsharedvtVariableInReg: /* Vtype returned using a hidden argument */ linfo->ret.storage = LLVMArgVtypeRetAddr; linfo->vret_arg_index = cinfo->vret_arg_index; @@ -2479,7 +2481,8 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call) MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, ((MonoInst*)cfg->arch.vret_addr_loc)->dreg, call->vret_var->dreg); } break; - case ArgValuetypeAddrInIReg: { + case ArgValuetypeAddrInIReg: + case ArgGsharedvtVariableInReg: { MonoInst *vtarg; MONO_INST_NEW (cfg, vtarg, OP_MOVE); vtarg->sreg1 = call->vret_var->dreg; @@ -2770,7 +2773,7 @@ mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, g pindex = 1; } - if (dinfo->cinfo->ret.storage == ArgValuetypeAddrInIReg) + if (dinfo->cinfo->ret.storage == ArgValuetypeAddrInIReg || dinfo->cinfo->ret.storage == ArgGsharedvtVariableInReg) p->regs [greg ++] = PTR_TO_GREG(ret); for (i = pindex; i < sig->param_count; i++) { @@ -2951,7 +2954,7 @@ mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf) /* Fall through */ } case MONO_TYPE_VALUETYPE: - if (dinfo->cinfo->ret.storage == ArgValuetypeAddrInIReg) { + if (dinfo->cinfo->ret.storage == ArgValuetypeAddrInIReg || dinfo->cinfo->ret.storage == ArgGsharedvtVariableInReg) { /* Nothing to do */ } else { ArgInfo *ainfo = &dinfo->cinfo->ret; diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h index c22c9be0fd0..1d04234c178 100644 --- a/mono/mini/mini-amd64.h +++ b/mono/mini/mini-amd64.h @@ -275,6 +275,8 @@ typedef enum { /* gsharedvt argument passed by addr */ ArgGSharedVtInReg, ArgGSharedVtOnStack, + /* Variable sized gsharedvt argument passed/returned by addr */ + ArgGsharedvtVariableInReg, ArgNone /* only in pair_storage */ } ArgStorage; @@ -282,7 +284,6 @@ typedef struct { gint16 offset; gint8 reg; ArgStorage storage : 8; - gboolean is_gsharedvt_return_value : 1; /* Only if storage == ArgValuetypeInReg */ ArgStorage pair_storage [2]; @@ -300,6 +301,7 @@ typedef struct { guint32 reg_usage; guint32 freg_usage; gboolean need_stack_align; + gboolean gsharedvt; /* The index of the vret arg in the argument list */ int vret_arg_index; ArgInfo ret; diff --git a/mono/mini/mini-arm-tls.S b/mono/mini/mini-arm-tls.S index 47a6dbb5ba2..c8fa1c9519b 100644 --- a/mono/mini/mini-arm-tls.S +++ b/mono/mini/mini-arm-tls.S @@ -130,7 +130,7 @@ DECLARE_GLOBAL_SYMBOL mono_fallback_set_tls_key .align 4 DECLARE_GLOBAL_SYMBOL mono_fast_get_tls_key2 bic r0, r0, #0x80000000 - mrc 15, 0, r1, cr13, cr0, #3 + mrc p15, 0, r1, cr13, cr0, #3 lsls r0, r0, #3 ldr r1, [r1, #4] add r0, r1 @@ -146,7 +146,7 @@ DECLARE_GLOBAL_SYMBOL mono_fast_get_tls_key2_end .align 4 DECLARE_GLOBAL_SYMBOL mono_fast_set_tls_key2 bic r0, r0, #0x80000000 - mrc 15, 0, r2, cr13, cr0, #3 + mrc p15, 0, r2, cr13, cr0, #3 lsls r0, r0, #3 ldr r2, [r2, #4] add r0, r2 diff --git a/mono/mini/mini-arm64-gsharedvt.c b/mono/mini/mini-arm64-gsharedvt.c index 3d9664b56bf..df24c53c658 100644 --- a/mono/mini/mini-arm64-gsharedvt.c +++ b/mono/mini/mini-arm64-gsharedvt.c @@ -14,7 +14,7 @@ /* * GSHAREDVT */ -#ifdef MONO_ARCH_GSHARED_SUPPORTED +#ifdef MONO_ARCH_GSHAREDVT_SUPPORTED #define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) @@ -415,4 +415,4 @@ mono_arm_gsharedvt_init (void) { } -#endif /* MONO_ARCH_GSHARED_SUPPORTED */ \ No newline at end of file +#endif /* MONO_ARCH_GSHAREDVT_SUPPORTED */ diff --git a/mono/mini/mini-arm64.c b/mono/mini/mini-arm64.c index 83fe015daa5..cb75bdf7a74 100644 --- a/mono/mini/mini-arm64.c +++ b/mono/mini/mini-arm64.c @@ -1165,10 +1165,10 @@ add_valuetype (CallInfo *cinfo, ArgInfo *ainfo, MonoType *t) int field_offsets [16]; guint32 align; - size = mini_type_stack_size_full (t, &align, FALSE); + size = mini_type_stack_size_full (t, &align, cinfo->pinvoke); align_size = ALIGN_TO (size, 8); - nregs = size / 8; + nregs = align_size / 8; if (is_hfa (t, &nfields, &esize, field_offsets)) { /* * The struct might include nested float structs aligned at 8, @@ -1318,6 +1318,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) cinfo = g_malloc0 (sizeof (CallInfo) + (sizeof (ArgInfo) * n)); cinfo->nargs = n; + cinfo->pinvoke = sig->pinvoke; /* Return value */ add_param (cinfo, &cinfo->ret, sig->ret); @@ -5215,3 +5216,22 @@ mono_arch_get_call_info (MonoMemPool *mp, MonoMethodSignature *sig) return get_call_info (mp, sig); } +gpointer +mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value) +{ + gpointer *lr_loc; + char *old_value; + char *bp; + + /*Load the spvar*/ + bp = MONO_CONTEXT_GET_BP (ctx); + lr_loc = (gpointer*)(bp + clause->exvar_offset); + + old_value = *lr_loc; + if ((char*)old_value < (char*)ji->code_start || (char*)old_value > ((char*)ji->code_start + ji->code_size)) + return old_value; + + *lr_loc = new_value; + + return old_value; +} diff --git a/mono/mini/mini-arm64.h b/mono/mini/mini-arm64.h index 154859e7165..e3e90eb6ea5 100644 --- a/mono/mini/mini-arm64.h +++ b/mono/mini/mini-arm64.h @@ -159,6 +159,7 @@ typedef struct { #define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1 #define MONO_ARCH_HAVE_OPCODE_NEEDS_EMULATION 1 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1 +#define MONO_ARCH_HAVE_HANDLER_BLOCK_GUARD 1 #ifdef TARGET_IOS @@ -174,7 +175,7 @@ typedef struct { #endif -#if defined(TARGET_APPLETVOS) +#if defined(TARGET_APPLETVOS) || defined(TARGET_IOS) #define MONO_ARCH_HAVE_UNWIND_BACKTRACE 1 #endif @@ -232,6 +233,7 @@ typedef struct { typedef struct { int nargs; int gr, fr, stack_usage; + gboolean pinvoke; ArgInfo ret; ArgInfo sig_cookie; ArgInfo args [1]; diff --git a/mono/mini/mini-exceptions-native-unwinder.c b/mono/mini/mini-exceptions-native-unwinder.c index 64e0e39eae4..08fa26bb1ab 100644 --- a/mono/mini/mini-exceptions-native-unwinder.c +++ b/mono/mini/mini-exceptions-native-unwinder.c @@ -9,6 +9,8 @@ */ #include +#include + /* * Attempt to handle native SIGSEGVs with libunwind or libcorkscrew. */ @@ -28,7 +30,7 @@ #define UNW_LOCAL_ONLY #undef _U /* ctype.h apparently defines this and it screws up the libunwind headers. */ -#include "android-libunwind/libunwind.h" +#include "../../external/android-libunwind/include/libunwind.h" #define _U 0x01 #define FUNC_NAME_LENGTH 512 diff --git a/mono/mini/mini-generic-sharing.c b/mono/mini/mini-generic-sharing.c index 928763b2349..1c37f38d726 100644 --- a/mono/mini/mini-generic-sharing.c +++ b/mono/mini/mini-generic-sharing.c @@ -2639,8 +2639,6 @@ mini_method_is_open (MonoMethod *method) /* Lazy class loading functions */ static GENERATE_TRY_GET_CLASS_WITH_CACHE (iasync_state_machine, System.Runtime.CompilerServices, IAsyncStateMachine) -static GENERATE_TRY_GET_CLASS_WITH_CACHE (async_state_machine_attribute, System.Runtime.CompilerServices, AsyncStateMachineAttribute) - static G_GNUC_UNUSED gboolean is_async_state_machine_class (MonoClass *klass) diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index adec297e3c3..d6e2677cd23 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -3148,7 +3148,7 @@ process_call (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef *builder_ref, gboolean is_virtual, calli, preserveall; LLVMBuilderRef builder = *builder_ref; - if (call->signature->call_convention != MONO_CALL_DEFAULT) { + if ((call->signature->call_convention != MONO_CALL_DEFAULT) && !((call->signature->call_convention == MONO_CALL_C) && ctx->llvm_only)) { set_failure (ctx, "non-default callconv"); return; } diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index 7be84488f58..d5787acf13b 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -27,7 +27,7 @@ #include #endif #include - +#include #include #include @@ -59,6 +59,7 @@ #include #include #include +#include #include "mini.h" #include @@ -69,6 +70,12 @@ #include "jit-icalls.h" +#ifdef PLATFORM_MACOSX +#include +#include +#include +#endif + #if defined(__native_client__) || defined(HOST_WATCHOS) void @@ -235,21 +242,11 @@ MONO_SIG_HANDLER_FUNC (static, sigabrt_signal_handler) #define FULL_STAT_PROFILER_BACKTRACE 0 #endif -#ifdef SIGPROF - -static int profiling_signal_in_use; - -#if defined(__ia64__) || defined(__sparc__) || defined(sparc) - -MONO_SIG_HANDLER_FUNC (static, sigprof_signal_handler) -{ - if (mono_chain_signal (MONO_SIG_HANDLER_PARAMS)) - return; - - NOT_IMPLEMENTED; -} +#if (defined (USE_POSIX_BACKEND) && defined (SIGRTMIN)) || defined (SIGPROF) +#define HAVE_PROFILER_SIGNAL +#endif -#else +#ifdef HAVE_PROFILER_SIGNAL static void per_thread_profiler_hit (void *ctx) @@ -325,7 +322,7 @@ per_thread_profiler_hit (void *ctx) } } -MONO_SIG_HANDLER_FUNC (static, sigprof_signal_handler) +MONO_SIG_HANDLER_FUNC (static, profiler_signal_handler) { int old_errno = errno; int hp_save_index; @@ -339,18 +336,6 @@ MONO_SIG_HANDLER_FUNC (static, sigprof_signal_handler) hp_save_index = mono_hazard_pointer_save_for_signal_handler (); - /* If we can't consume a profiling request it means we're the initiator. */ - if (!(mono_threads_consume_async_jobs () & MONO_SERVICE_REQUEST_SAMPLE)) { - FOREACH_THREAD_SAFE (info) { - if (mono_thread_info_get_tid (info) == mono_native_thread_id_get () || - !mono_thread_info_is_live (info)) - continue; - - mono_threads_add_async_job (info, MONO_SERVICE_REQUEST_SAMPLE); - mono_threads_pthread_kill (info, profiling_signal_in_use); - } FOREACH_THREAD_SAFE_END - } - mono_thread_info_set_is_async_context (TRUE); per_thread_profiler_hit (ctx); mono_thread_info_set_is_async_context (FALSE); @@ -361,7 +346,6 @@ MONO_SIG_HANDLER_FUNC (static, sigprof_signal_handler) mono_chain_signal (MONO_SIG_HANDLER_PARAMS); } -#endif #endif MONO_SIG_HANDLER_FUNC (static, sigquit_signal_handler) @@ -522,123 +506,274 @@ mono_runtime_cleanup_handlers (void) free_saved_signal_handlers (); } -#ifdef HAVE_LINUX_RTC_H -#include -#include -#include -static int rtc_fd = -1; +#ifdef HAVE_PROFILER_SIGNAL + +#ifdef PLATFORM_MACOSX + +static clock_serv_t sampling_clock_service; -static int -enable_rtc_timer (gboolean enable) +static void +clock_init (void) { - int flags; - flags = fcntl (rtc_fd, F_GETFL); - if (flags < 0) { - perror ("getflags"); - return 0; - } - if (enable) - flags |= FASYNC; - else - flags &= ~FASYNC; - if (fcntl (rtc_fd, F_SETFL, flags) == -1) { - perror ("setflags"); - return 0; - } - return 1; + kern_return_t ret; + + if ((ret = host_get_clock_service (mach_host_self (), SYSTEM_CLOCK, &sampling_clock_service)) != KERN_SUCCESS) + g_error ("%s: host_get_clock_service () returned %d", __func__, ret); } -#endif -void -mono_runtime_shutdown_stat_profiler (void) +static void +clock_cleanup (void) { -#ifdef HAVE_LINUX_RTC_H - if (rtc_fd >= 0) - enable_rtc_timer (FALSE); -#endif + kern_return_t ret; + + if ((ret = mach_port_deallocate (mach_task_self (), sampling_clock_service)) != KERN_SUCCESS) + g_error ("%s: mach_port_deallocate () returned %d", __func__, ret); } -#ifdef ITIMER_PROF -static int -get_itimer_mode (void) +static guint64 +clock_get_time_ns (void) { - switch (mono_profiler_get_sampling_mode ()) { - case MONO_PROFILER_STAT_MODE_PROCESS: return ITIMER_PROF; - case MONO_PROFILER_STAT_MODE_REAL: return ITIMER_REAL; - } - g_assert_not_reached (); - return 0; + kern_return_t ret; + mach_timespec_t mach_ts; + + if ((ret = clock_get_time (sampling_clock_service, &mach_ts)) != KERN_SUCCESS) + g_error ("%s: clock_get_time () returned %d", __func__, ret); + + return ((guint64) mach_ts.tv_sec * 1000000000) + (guint64) mach_ts.tv_nsec; } -static int -get_itimer_signal (void) +static void +clock_sleep_ns_abs (guint64 ns_abs) +{ + kern_return_t ret; + mach_timespec_t then, remain_unused; + + then.tv_sec = ns_abs / 1000000000; + then.tv_nsec = ns_abs % 1000000000; + + do { + ret = clock_sleep (sampling_clock_service, TIME_ABSOLUTE, then, &remain_unused); + + if (ret != KERN_SUCCESS && ret != KERN_ABORTED) + g_error ("%s: clock_sleep () returned %d", __func__, ret); + } while (ret == KERN_ABORTED); +} + +#else + +clockid_t sampling_posix_clock; + +static void +clock_init (void) { switch (mono_profiler_get_sampling_mode ()) { - case MONO_PROFILER_STAT_MODE_PROCESS: return SIGPROF; - case MONO_PROFILER_STAT_MODE_REAL: return SIGALRM; + case MONO_PROFILER_STAT_MODE_PROCESS: +#ifdef HAVE_CLOCK_NANOSLEEP + /* + * If we don't have clock_nanosleep (), measuring the process time + * makes very little sense as we can only use nanosleep () to sleep on + * real time. + */ + sampling_posix_clock = CLOCK_PROCESS_CPUTIME_ID; + break; +#endif + case MONO_PROFILER_STAT_MODE_REAL: sampling_posix_clock = CLOCK_MONOTONIC; break; + default: g_assert_not_reached (); break; } - g_assert_not_reached (); - return 0; } + +static void +clock_cleanup (void) +{ +} + +static guint64 +clock_get_time_ns (void) +{ + struct timespec ts; + + if (clock_gettime (sampling_posix_clock, &ts) == -1) + g_error ("%s: clock_gettime () returned -1, errno = %d", __func__, errno); + + return ((guint64) ts.tv_sec * 1000000000) + (guint64) ts.tv_nsec; +} + +static void +clock_sleep_ns_abs (guint64 ns_abs) +{ +#ifdef HAVE_CLOCK_NANOSLEEP + int ret; + struct timespec then; + + then.tv_sec = ns_abs / 1000000000; + then.tv_nsec = ns_abs % 1000000000; + + do { + ret = clock_nanosleep (sampling_posix_clock, TIMER_ABSTIME, &then, NULL); + + if (ret != 0 && ret != EINTR) + g_error ("%s: clock_nanosleep () returned %d", __func__, ret); + } while (ret == EINTR); +#else + int ret; + gint64 diff; + struct timespec req; + + /* + * What follows is a crude attempt at emulating clock_nanosleep () on OSs + * which don't provide it (e.g. FreeBSD). + * + * The problem with nanosleep () is that if it is interrupted by a signal, + * time will drift as a result of having to restart the call after the + * signal handler has finished. For this reason, we avoid using the rem + * argument of nanosleep (). Instead, before every nanosleep () call, we + * check if enough time has passed to satisfy the sleep request. If yes, we + * simply return. If not, we calculate the difference and do another sleep. + * + * This should reduce the amount of drift that happens because we account + * for the time spent executing the signal handler, which nanosleep () is + * not guaranteed to do for the rem argument. + * + * The downside to this approach is that it is slightly expensive: We have + * to make an extra system call to retrieve the current time whenever we're + * going to restart a nanosleep () call. This is unlikely to be a problem + * in practice since the sampling thread won't be receiving many signals in + * the first place (it's a tools thread, so no STW), and because typical + * sleep periods for the thread are many orders of magnitude bigger than + * the time it takes to actually perform that system call (just a few + * nanoseconds). + */ + do { + diff = (gint64) ns_abs - (gint64) clock_get_time_ns (); + + if (diff <= 0) + break; + + req.tv_sec = diff / 1000000000; + req.tv_nsec = diff % 1000000000; + + if ((ret = nanosleep (&req, NULL)) == -1 && errno != EINTR) + g_error ("%s: nanosleep () returned -1, errno = %d", __func__, errno); + } while (ret == -1); +#endif +} + #endif +static int profiler_signal; +static MonoNativeThreadId sampling_thread; +static volatile gint32 sampling_thread_running; + +static mono_native_thread_return_t +sampling_thread_func (void *data) +{ + mono_threads_attach_tools_thread (); + mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler sampler"); + + gint64 rate = 1000000000 / mono_profiler_get_sampling_rate (); + + int old_policy; + struct sched_param old_sched; + pthread_getschedparam (pthread_self (), &old_policy, &old_sched); + + /* + * Attempt to switch the thread to real time scheduling. This will not + * necessarily work on all OSs; for example, most Linux systems will give + * us EPERM here unless configured to allow this. + * + * TODO: This does not work on Mac (and maybe some other OSs). On Mac, we + * have to use the Mach thread policy routines to switch to real-time + * scheduling. This is quite tricky as we need to specify how often we'll + * be doing work (easy), the normal processing time needed (also easy), + * and the maximum amount of processing time needed (hard). This is + * further complicated by the fact that if we misbehave and take too long + * to do our work, the kernel may knock us back down to the normal thread + * scheduling policy without telling us. + */ + struct sched_param sched = { .sched_priority = sched_get_priority_max (SCHED_FIFO) }; + pthread_setschedparam (pthread_self (), SCHED_FIFO, &sched); + + clock_init (); + + guint64 sleep = clock_get_time_ns (); + + while (InterlockedRead (&sampling_thread_running)) { + sleep += rate; + + FOREACH_THREAD_SAFE (info) { + /* info should never be this thread as we're a tools thread. */ + g_assert (mono_thread_info_get_tid (info) != mono_native_thread_id_get ()); + + mono_threads_pthread_kill (info, profiler_signal); + } FOREACH_THREAD_SAFE_END + + clock_sleep_ns_abs (sleep); + } + + clock_cleanup (); + + pthread_setschedparam (pthread_self (), old_policy, &old_sched); + + mono_thread_info_detach (); + + return NULL; +} + +void +mono_runtime_shutdown_stat_profiler (void) +{ + InterlockedWrite (&sampling_thread_running, 0); + pthread_join (sampling_thread, NULL); + + /* + * We can't safely remove the signal handler because we have no guarantee + * that all pending signals have been delivered at this point. This should + * not really be a problem anyway. + */ + //remove_signal_handler (profiler_signal); +} + void mono_runtime_setup_stat_profiler (void) { -#ifdef ITIMER_PROF - struct itimerval itval; - static int inited = 0; -#ifdef HAVE_LINUX_RTC_H - const char *rtc_freq; - if (!inited && (rtc_freq = g_getenv ("MONO_RTC"))) { - int freq = 0; - inited = 1; - if (*rtc_freq) - freq = atoi (rtc_freq); - if (!freq) - freq = 1024; - rtc_fd = open ("/dev/rtc", O_RDONLY); - if (rtc_fd == -1) { - perror ("open /dev/rtc"); - return; - } - profiling_signal_in_use = SIGPROF; - add_signal_handler (profiling_signal_in_use, sigprof_signal_handler, SA_RESTART); - if (ioctl (rtc_fd, RTC_IRQP_SET, freq) == -1) { - perror ("set rtc freq"); - return; - } - if (ioctl (rtc_fd, RTC_PIE_ON, 0) == -1) { - perror ("start rtc"); - return; - } - if (fcntl (rtc_fd, F_SETSIG, SIGPROF) == -1) { - perror ("setsig"); - return; - } - if (fcntl (rtc_fd, F_SETOWN, getpid ()) == -1) { - perror ("setown"); - return; - } - enable_rtc_timer (TRUE); - return; - } - if (rtc_fd >= 0) - return; + /* + * Use a real-time signal when possible. This gives us roughly a 99% signal + * delivery rate in all cases. On the other hand, using a regular signal + * tends to result in awful delivery rates when the application is heavily + * loaded. + * + * TODO: On Mac, we should explore using the Mach thread suspend/resume + * functions and doing the stack walk from the sampling thread. This would + * get us a 100% sampling rate. However, this may interfere with the GC's + * STW logic. Could perhaps be solved by taking the suspend lock. + */ +#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) + /* Just take the first real-time signal we can get. */ + profiler_signal = mono_threads_posix_signal_search_alternative (-1); +#else + profiler_signal = SIGPROF; #endif - itval.it_interval.tv_usec = (1000000 / mono_profiler_get_sampling_rate ()) - 1; - itval.it_interval.tv_sec = 0; - itval.it_value = itval.it_interval; - if (inited) - return; - inited = 1; - profiling_signal_in_use = get_itimer_signal (); - add_signal_handler (profiling_signal_in_use, sigprof_signal_handler, SA_RESTART); - setitimer (get_itimer_mode (), &itval, NULL); -#endif + add_signal_handler (profiler_signal, profiler_signal_handler, SA_RESTART); + + InterlockedWrite (&sampling_thread_running, 1); + mono_native_thread_create (&sampling_thread, sampling_thread_func, NULL); +} + +#else + +void +mono_runtime_shutdown_stat_profiler (void) +{ +} + +void +mono_runtime_setup_stat_profiler (void) +{ } +#endif + #if !defined(PLATFORM_MACOSX) pid_t mono_runtime_syscall_fork () diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index 06238b4d688..795bab9e41d 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -3065,13 +3065,13 @@ mono_jit_create_remoting_trampoline (MonoDomain *domain, MonoMethod *method, Mon } #endif -static void +static G_GNUC_UNUSED void no_imt_trampoline (void) { g_assert_not_reached (); } -static void +static G_GNUC_UNUSED void no_vcall_trampoline (void) { g_assert_not_reached (); @@ -4164,7 +4164,8 @@ print_jit_stats (void) void mini_cleanup (MonoDomain *domain) { - mono_runtime_shutdown_stat_profiler (); + if (mono_profiler_get_events () & MONO_PROFILE_STATISTICAL) + mono_runtime_shutdown_stat_profiler (); #ifndef DISABLE_COM cominterop_release_all_rcws (); @@ -4181,12 +4182,12 @@ mini_cleanup (MonoDomain *domain) /* This accesses metadata so needs to be called before runtime shutdown */ print_jit_stats (); - mono_profiler_shutdown (); - #ifndef MONO_CROSS_COMPILE mono_runtime_cleanup (domain); #endif + mono_profiler_shutdown (); + free_jit_tls_data ((MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id)); mono_icall_cleanup (); diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 7101e69b33c..1865ee98caf 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -1230,18 +1230,6 @@ mini_method_verify (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile) res = mono_method_verify_with_current_settings (method, cfg->skip_visibility, is_fulltrust); - if (mono_loader_get_last_error ()) { - if (fail_compile) { - mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); - mono_error_set_from_loader_error (&cfg->error); - } else { - mono_loader_clear_error (); - } - if (res) - mono_free_verify_list (res); - return TRUE; - } - if (res) { for (tmp = res; tmp; tmp = tmp->next) { MonoVerifyInfoExtended *info = (MonoVerifyInfoExtended *)tmp->data; @@ -4375,7 +4363,8 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in case MONO_EXCEPTION_MISSING_FIELD: case MONO_EXCEPTION_MISSING_METHOD: case MONO_EXCEPTION_FILE_NOT_FOUND: - case MONO_EXCEPTION_BAD_IMAGE: { + case MONO_EXCEPTION_BAD_IMAGE: + case MONO_EXCEPTION_INVALID_PROGRAM: { /* Throw a type load exception if needed */ if (cfg->exception_ptr) { ex = mono_class_get_exception_for_failure ((MonoClass *)cfg->exception_ptr); @@ -4390,6 +4379,8 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in ex = mono_exception_from_name_msg (mono_defaults.corlib, "System.IO", "FileNotFoundException", cfg->exception_message); else if (cfg->exception_type == MONO_EXCEPTION_BAD_IMAGE) ex = mono_get_exception_bad_image_format (cfg->exception_message); + else if (cfg->exception_type == MONO_EXCEPTION_INVALID_PROGRAM) + ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", cfg->exception_message); else g_assert_not_reached (); } diff --git a/mono/mini/tramp-amd64-gsharedvt.c b/mono/mini/tramp-amd64-gsharedvt.c index 0b28eebbf69..1be75933c8e 100644 --- a/mono/mini/tramp-amd64-gsharedvt.c +++ b/mono/mini/tramp-amd64-gsharedvt.c @@ -439,22 +439,6 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) return buf; } -#else - -gpointer -mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr) -{ - g_assert_not_reached (); - return NULL; -} - -gpointer -mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) -{ - g_assert_not_reached (); - return NULL; -} - #endif #else @@ -466,18 +450,4 @@ mono_amd64_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoi return NULL; } -gpointer -mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr) -{ - g_assert_not_reached (); - return NULL; -} - -gpointer -mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) -{ - *info = NULL; - return NULL; -} - #endif \ No newline at end of file diff --git a/mono/mini/tramp-arm64-gsharedvt.c b/mono/mini/tramp-arm64-gsharedvt.c index 13f73d9983b..175f75ddaab 100644 --- a/mono/mini/tramp-arm64-gsharedvt.c +++ b/mono/mini/tramp-arm64-gsharedvt.c @@ -16,7 +16,7 @@ /* * GSHAREDVT */ -#ifdef MONO_ARCH_GSHARED_SUPPORTED +#ifdef MONO_ARCH_GSHAREDVT_SUPPORTED /* * mono_arch_get_gsharedvt_arg_trampoline: @@ -562,21 +562,4 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) #endif -#else - -gpointer -mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) -{ - if (info) - *info = NULL; - return NULL; -} - -gpointer -mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr) -{ - g_assert_not_reached (); - return NULL; -} - -#endif /* MONO_ARCH_GSHARED_SUPPORTED */ \ No newline at end of file +#endif /* MONO_ARCH_GSHAREDVT_SUPPORTED */ diff --git a/mono/mini/tramp-arm64.c b/mono/mini/tramp-arm64.c index 5088fea2297..1f447139765 100644 --- a/mono/mini/tramp-arm64.c +++ b/mono/mini/tramp-arm64.c @@ -97,9 +97,9 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) guchar* mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot) { - guint8 *code, *buf, *tramp; + guint8 *code, *buf, *tramp, *labels [16]; int i, buf_len, imm; - int frame_size, offset, gregs_offset, num_fregs, fregs_offset, arg_offset, lmf_offset; + int frame_size, offset, gregs_offset, num_fregs, fregs_offset, arg_offset, lmf_offset, res_offset; guint64 gregs_regset; GSList *unwind_ops = NULL; MonoJumpInfo *ji = NULL; @@ -128,6 +128,9 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf /* arg */ arg_offset = offset; offset += 8; + /* result */ + res_offset = offset; + offset += 8; /* LMF */ lmf_offset = offset; offset += sizeof (MonoLMF); @@ -222,6 +225,9 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf } arm_blrx (code, ARMREG_IP0); + /* Save the result */ + arm_strx (code, ARMREG_R0, ARMREG_FP, res_offset); + /* Restore LMF */ /* Similar to emit_restore_lmf () */ /* Clobbers ip0/ip1 */ @@ -234,8 +240,19 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf /* *lmf_addr = previous_lmf */ arm_strx (code, ARMREG_IP1, ARMREG_IP0, 0); - /* Save the result to ip1 */ - arm_movx (code, ARMREG_IP1, ARMREG_R0); + /* Check for thread interruption */ + /* This is not perf critical code so no need to check the interrupt flag */ + if (aot) { + code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "mono_thread_force_interruption_checkpoint_noraise"); + } else { + code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)mono_thread_force_interruption_checkpoint_noraise); + } + arm_blrx (code, ARMREG_IP0); + /* Check whenever there is an exception to be thrown */ + labels [0] = code; + arm_cbnzx (code, ARMREG_R0, 0); + + /* Normal case */ /* Restore gregs */ /* Only have to load the argument regs (r0..r8) and the rgctx reg */ @@ -244,6 +261,9 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf for (i = 0; i < num_fregs; ++i) arm_ldrfpx (code, i, ARMREG_FP, fregs_offset + (i * 8)); + /* Load the result */ + arm_ldrx (code, ARMREG_IP1, ARMREG_FP, res_offset); + /* These trampolines return a value */ if (tramp_type == MONO_TRAMPOLINE_RGCTX_LAZY_FETCH) arm_movx (code, ARMREG_R0, ARMREG_IP1); @@ -256,6 +276,29 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf else arm_brx (code, ARMREG_IP1); + /* Exception case */ + mono_arm_patch (labels [0], code, MONO_R_ARM64_CBZ); + + /* + * We have an exception we want to throw in the caller's frame, so pop + * the trampoline frame and throw from the caller. + */ + code = mono_arm_emit_destroy_frame (code, frame_size, ((1 << ARMREG_IP0))); + /* We are in the parent frame, the exception is in x0 */ + /* + * EH is initialized after trampolines, so get the address of the variable + * which contains throw_exception, and load it from there. + */ + if (aot) { + /* Not really a jit icall */ + code = mono_arm_emit_aotconst (&ji, code, buf, ARMREG_IP0, MONO_PATCH_INFO_JIT_ICALL_ADDR, "throw_exception_addr"); + } else { + code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)mono_get_throw_exception_addr ()); + } + arm_ldrx (code, ARMREG_IP0, ARMREG_IP0, 0); + /* lr contains the return address, the trampoline will use it as the throw site */ + arm_brx (code, ARMREG_IP0); + g_assert ((code - buf) < buf_len); mono_arch_flush_icache (buf, code - buf); @@ -464,6 +507,54 @@ mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboo return buf; } +static gpointer +handler_block_trampoline_helper (gpointer *ptr) +{ + MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id); + return jit_tls->handler_block_return_address; +} + +gpointer +mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot) +{ + guint8 *tramp; + guint8 *code, *buf; + int tramp_size = 64; + MonoJumpInfo *ji = NULL; + GSList *unwind_ops = NULL; + + g_assert (!aot); + + code = buf = mono_global_codeman_reserve (tramp_size); + + unwind_ops = NULL; + + tramp = mono_arch_create_specific_trampoline (NULL, MONO_TRAMPOLINE_HANDLER_BLOCK_GUARD, NULL, NULL); + + /* + This trampoline restore the call chain of the handler block then jumps into the code that deals with it. + */ + + /* + * We are in a method frame after the call emitted by OP_CALL_HANDLER. + */ + code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)handler_block_trampoline_helper); + /* Set it as the return address so the trampoline will return to it */ + arm_movx (code, ARMREG_LR, ARMREG_IP0); + + /* Call the trampoline */ + code = mono_arm_emit_imm64 (code, ARMREG_IP0, (guint64)tramp); + arm_brx (code, ARMREG_IP0); + + mono_arch_flush_icache (buf, code - buf); + mono_profiler_code_buffer_new (buf, code - buf, MONO_PROFILER_CODE_BUFFER_HELPER, NULL); + g_assert (code - buf <= tramp_size); + + *info = mono_tramp_info_create ("handler_block_trampoline", buf, code - buf, ji, unwind_ops); + + return buf; +} + /* * mono_arch_create_sdb_trampoline: * diff --git a/mono/mini/tramp-x86-gsharedvt.c b/mono/mini/tramp-x86-gsharedvt.c index 757325c27f0..5482504beac 100644 --- a/mono/mini/tramp-x86-gsharedvt.c +++ b/mono/mini/tramp-x86-gsharedvt.c @@ -357,13 +357,4 @@ mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) return buf; } -#else - -gpointer -mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) -{ - *info = NULL; - return NULL; -} - #endif /* MONO_ARCH_GSHAREDVT_SUPPORTED */ diff --git a/mono/profiler/decode.c b/mono/profiler/decode.c index d88694d198e..10eaba51c6c 100644 --- a/mono/profiler/decode.c +++ b/mono/profiler/decode.c @@ -2256,8 +2256,6 @@ decode_buffer (ProfContext *ctx) time_from += startup_time; time_to += startup_time; } - if (!thread->name) - thread->name = pstrdup ("Main"); } for (i = 0; i < thread->stack_id; ++i) thread->stack [i]->recurse_count++; @@ -3152,7 +3150,9 @@ dump_threads (ProfContext *ctx) ThreadContext *thread; fprintf (outfile, "\nThread summary\n"); for (thread = ctx->threads; thread; thread = thread->next) { - fprintf (outfile, "\tThread: %p, name: \"%s\"\n", (void*)thread->thread_id, thread->name? thread->name: ""); + if (thread->thread_id) { + fprintf (outfile, "\tThread: %p, name: \"%s\"\n", (void*)thread->thread_id, thread->name? thread->name: ""); + } } } diff --git a/mono/profiler/proflog.c b/mono/profiler/proflog.c index c32f40c62d3..3d9079f45f7 100644 --- a/mono/profiler/proflog.c +++ b/mono/profiler/proflog.c @@ -12,6 +12,7 @@ #include #include "../mini/jit.h" +#include "../metadata/metadata-internals.h" #include #include #include @@ -514,6 +515,7 @@ struct _MonoProfiler { #endif volatile gint32 run_writer_thread; MonoLockFreeQueue writer_queue; + MonoSemType writer_queue_sem; MonoConcurrentHashTable *method_table; mono_mutex_t method_table_mutex; BinaryObject *binary_objects; @@ -893,6 +895,7 @@ send_buffer (MonoProfiler *prof, GPtrArray *methods, LogBuffer *buffer) entry->methods = methods; entry->buffer = buffer; mono_lock_free_queue_enqueue (&prof->writer_queue, &entry->node); + mono_os_sem_post (&prof->writer_queue_sem); } static void @@ -932,7 +935,7 @@ process_requests (MonoProfiler *profiler) } static void counters_init (MonoProfiler *profiler); -static void counters_sample (MonoProfiler *profiler, uint64_t timestamp); +static void counters_sample (MonoProfiler *profiler, uint64_t timestamp, gboolean threadless); /* * Can be called only at safe callback locations. @@ -962,6 +965,15 @@ safe_send (MonoProfiler *profiler, LogBuffer *logbuffer) TLS_GET (LogBuffer, tlsbuffer)->call_depth = cd; } +static void +safe_send_threadless (MonoProfiler *prof, LogBuffer *buf) +{ + for (LogBuffer *iter = buf; iter; iter = iter->next) + iter->thread_id = 0; + + safe_send (prof, buf); +} + static int gc_reference (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data) { @@ -2910,7 +2922,7 @@ counters_init (MonoProfiler *profiler) } static void -counters_emit (MonoProfiler *profiler) +counters_emit (MonoProfiler *profiler, gboolean threadless) { MonoCounterAgent *agent; LogBuffer *logbuffer; @@ -2969,13 +2981,16 @@ counters_emit (MonoProfiler *profiler) } EXIT_LOG (logbuffer); - safe_send (profiler, logbuffer); + if (threadless) + safe_send_threadless (profiler, logbuffer); + else + safe_send (profiler, logbuffer); mono_os_mutex_unlock (&counters_mutex); } static void -counters_sample (MonoProfiler *profiler, uint64_t timestamp) +counters_sample (MonoProfiler *profiler, uint64_t timestamp, gboolean threadless) { MonoCounterAgent *agent; MonoCounter *counter; @@ -2988,7 +3003,7 @@ counters_sample (MonoProfiler *profiler, uint64_t timestamp) if (!counters_initialized) return; - counters_emit (profiler); + counters_emit (profiler, threadless); buffer_size = 8; buffer = calloc (1, buffer_size); @@ -3100,7 +3115,10 @@ counters_sample (MonoProfiler *profiler, uint64_t timestamp) emit_value (logbuffer, 0); EXIT_LOG (logbuffer); - safe_send (profiler, logbuffer); + if (threadless) + safe_send_threadless (profiler, logbuffer); + else + safe_send (profiler, logbuffer); mono_os_mutex_unlock (&counters_mutex); } @@ -3121,7 +3139,7 @@ struct _PerfCounterAgent { static PerfCounterAgent *perfcounters = NULL; static void -perfcounters_emit (MonoProfiler *profiler) +perfcounters_emit (MonoProfiler *profiler, gboolean threadless) { PerfCounterAgent *pcagent; LogBuffer *logbuffer; @@ -3172,7 +3190,10 @@ perfcounters_emit (MonoProfiler *profiler) } EXIT_LOG (logbuffer); - safe_send (profiler, logbuffer); + if (threadless) + safe_send_threadless (profiler, logbuffer); + else + safe_send (profiler, logbuffer); } static gboolean @@ -3209,7 +3230,7 @@ perfcounters_foreach (char *category_name, char *name, unsigned char type, gint6 } static void -perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp) +perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp, gboolean threadless) { PerfCounterAgent *pcagent; LogBuffer *logbuffer; @@ -3226,7 +3247,7 @@ perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp) mono_perfcounter_foreach (perfcounters_foreach, perfcounters); - perfcounters_emit (profiler); + perfcounters_emit (profiler, threadless); size = EVENT_SIZE /* event */ + @@ -3266,13 +3287,16 @@ perfcounters_sample (MonoProfiler *profiler, uint64_t timestamp) emit_value (logbuffer, 0); EXIT_LOG (logbuffer); - safe_send (profiler, logbuffer); + if (threadless) + safe_send_threadless (profiler, logbuffer); + else + safe_send (profiler, logbuffer); mono_os_mutex_unlock (&counters_mutex); } static void -counters_and_perfcounters_sample (MonoProfiler *prof) +counters_and_perfcounters_sample (MonoProfiler *prof, gboolean threadless) { static uint64_t start = -1; uint64_t now; @@ -3281,8 +3305,8 @@ counters_and_perfcounters_sample (MonoProfiler *prof) start = current_time (); now = current_time (); - counters_sample (prof, (now - start) / 1000/ 1000); - perfcounters_sample (prof, (now - start) / 1000/ 1000); + counters_sample (prof, (now - start) / 1000/ 1000, threadless); + perfcounters_sample (prof, (now - start) / 1000/ 1000, threadless); } #define COVERAGE_DEBUG(x) if (debug_coverage) {x} @@ -3772,6 +3796,11 @@ coverage_filter (MonoProfiler *prof, MonoMethod *method) assembly = mono_image_get_assembly (image); + // Need to keep the assemblies around for as long as they are kept in the hashtable + // Nunit, for example, has a habit of unloading them before the coverage statistics are + // generated causing a crash. See https://bugzilla.xamarin.com/show_bug.cgi?id=39325 + mono_assembly_addref (assembly); + mono_os_mutex_lock (&coverage_mutex); mono_conc_hashtable_insert (coverage_methods, method, method); mono_conc_hashtable_insert (coverage_assemblies, assembly, assembly); @@ -3913,6 +3942,13 @@ coverage_init (MonoProfiler *prof) #endif /* DISABLE_HELPER_THREAD */ } +static void +unref_coverage_assemblies (gpointer key, gpointer value, gpointer userdata) +{ + MonoAssembly *assembly = (MonoAssembly *)value; + mono_assembly_close (assembly); +} + static void log_shutdown (MonoProfiler *prof) { @@ -3920,7 +3956,7 @@ log_shutdown (MonoProfiler *prof) in_shutdown = 1; #ifndef DISABLE_HELPER_THREAD - counters_and_perfcounters_sample (prof); + counters_and_perfcounters_sample (prof, FALSE); dump_coverage (prof); @@ -3947,8 +3983,11 @@ log_shutdown (MonoProfiler *prof) TLS_SET (tlsmethodlist, NULL); InterlockedWrite (&prof->run_writer_thread, 0); + mono_os_sem_post (&prof->writer_queue_sem); pthread_join (prof->writer_thread, &res); + mono_os_sem_destroy (&prof->writer_queue_sem); + #if defined (HAVE_SYS_ZLIB) if (prof->gzfile) gzclose (prof->gzfile); @@ -3962,6 +4001,10 @@ log_shutdown (MonoProfiler *prof) mono_os_mutex_destroy (&prof->method_table_mutex); if (coverage_initialized) { + mono_os_mutex_lock (&coverage_mutex); + mono_conc_hashtable_foreach (coverage_assemblies, unref_coverage_assemblies, prof); + mono_os_mutex_unlock (&coverage_mutex); + mono_conc_hashtable_destroy (coverage_methods); mono_conc_hashtable_destroy (coverage_assemblies); mono_conc_hashtable_destroy (coverage_classes); @@ -4050,6 +4093,8 @@ helper_thread (void* arg) MonoThread *thread = NULL; mono_threads_attach_tools_thread (); + mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler helper"); + //fprintf (stderr, "Server listening\n"); command_socket = -1; while (1) { @@ -4080,7 +4125,7 @@ helper_thread (void* arg) } #endif - counters_and_perfcounters_sample (prof); + counters_and_perfcounters_sample (prof, TRUE); tv.tv_sec = 1; tv.tv_usec = 0; @@ -4109,7 +4154,7 @@ helper_thread (void* arg) if (sbuf) { dump_sample_hits (prof, sbuf); free_buffer (sbuf, sbuf->size); - safe_send (prof, ensure_logbuf (0)); + safe_send_threadless (prof, ensure_logbuf (0)); } continue; } @@ -4130,7 +4175,7 @@ helper_thread (void* arg) } } #endif - safe_send (prof, ensure_logbuf (0)); + safe_send_threadless (prof, ensure_logbuf (0)); return NULL; } #if USE_PERF_EVENTS @@ -4141,7 +4186,7 @@ helper_thread (void* arg) continue; if (FD_ISSET (perf_data [i].perf_fd, &rfds)) { read_perf_mmap (prof, i); - safe_send (prof, ensure_logbuf (0)); + safe_send_threadless (prof, ensure_logbuf (0)); } } } @@ -4179,6 +4224,9 @@ helper_thread (void* arg) continue; //fprintf (stderr, "Accepted connection\n"); } + + mono_thread_info_detach (); + return NULL; } @@ -4226,92 +4274,113 @@ start_helper_thread (MonoProfiler* prof) } #endif -static void * -writer_thread (void *arg) +static gboolean +handle_writer_queue_entry (MonoProfiler *prof) { - MonoProfiler *prof = (MonoProfiler *)arg; + WriterQueueEntry *entry; - mono_threads_attach_tools_thread (); + if ((entry = (WriterQueueEntry *) mono_lock_free_queue_dequeue (&prof->writer_queue))) { + LogBuffer *method_buffer = NULL; + gboolean new_methods = FALSE; - dump_header (prof); + if (entry->methods->len) + method_buffer = create_buffer (); - while (InterlockedRead (&prof->run_writer_thread)) { - WriterQueueEntry *entry; + /* + * Encode the method events in a temporary log buffer that we + * flush to disk before the main buffer, ensuring that all + * methods have metadata emitted before they're referenced. + */ + for (guint i = 0; i < entry->methods->len; i++) { + MethodInfo *info = (MethodInfo *)g_ptr_array_index (entry->methods, i); - while ((entry = (WriterQueueEntry *) mono_lock_free_queue_dequeue (&prof->writer_queue))) { - LogBuffer *method_buffer = NULL; - gboolean new_methods = FALSE; + if (mono_conc_hashtable_lookup (prof->method_table, info->method)) + continue; - if (entry->methods->len) - method_buffer = create_buffer (); + new_methods = TRUE; /* - * Encode the method events in a temporary log buffer that we - * flush to disk before the main buffer, ensuring that all - * methods have metadata emitted before they're referenced. + * Other threads use this hash table to get a general + * idea of whether a method has already been emitted to + * the stream. Due to the way we add to this table, it + * can easily happen that multiple threads queue up the + * same methods, but that's OK since eventually all + * methods will be in this table and the thread-local + * method lists will just be empty for the rest of the + * app's lifetime. */ - for (guint i = 0; i < entry->methods->len; i++) { - MethodInfo *info = (MethodInfo *)g_ptr_array_index (entry->methods, i); + mono_os_mutex_lock (&prof->method_table_mutex); + mono_conc_hashtable_insert (prof->method_table, info->method, info->method); + mono_os_mutex_unlock (&prof->method_table_mutex); + + char *name = mono_method_full_name (info->method, 1); + int nlen = strlen (name) + 1; + void *cstart = info->ji ? mono_jit_info_get_code_start (info->ji) : NULL; + int csize = info->ji ? mono_jit_info_get_code_size (info->ji) : 0; + + method_buffer = ensure_logbuf_inner (method_buffer, + EVENT_SIZE /* event */ + + LEB128_SIZE /* time */ + + LEB128_SIZE /* method */ + + LEB128_SIZE /* start */ + + LEB128_SIZE /* size */ + + nlen /* name */ + ); + + emit_byte (method_buffer, TYPE_JIT | TYPE_METHOD); + emit_time (method_buffer, info->time); + emit_method_inner (method_buffer, info->method); + emit_ptr (method_buffer, cstart); + emit_value (method_buffer, csize); + + memcpy (method_buffer->cursor, name, nlen); + method_buffer->cursor += nlen; + + mono_free (name); + free (info); + } - if (mono_conc_hashtable_lookup (prof->method_table, info->method)) - continue; + g_ptr_array_free (entry->methods, TRUE); - new_methods = TRUE; - - /* - * Other threads use this hash table to get a general - * idea of whether a method has already been emitted to - * the stream. Due to the way we add to this table, it - * can easily happen that multiple threads queue up the - * same methods, but that's OK since eventually all - * methods will be in this table and the thread-local - * method lists will just be empty for the rest of the - * app's lifetime. - */ - mono_os_mutex_lock (&prof->method_table_mutex); - mono_conc_hashtable_insert (prof->method_table, info->method, info->method); - mono_os_mutex_unlock (&prof->method_table_mutex); - - char *name = mono_method_full_name (info->method, 1); - int nlen = strlen (name) + 1; - void *cstart = info->ji ? mono_jit_info_get_code_start (info->ji) : NULL; - int csize = info->ji ? mono_jit_info_get_code_size (info->ji) : 0; - - method_buffer = ensure_logbuf_inner (method_buffer, - EVENT_SIZE /* event */ + - LEB128_SIZE /* time */ + - LEB128_SIZE /* method */ + - LEB128_SIZE /* start */ + - LEB128_SIZE /* size */ + - nlen /* name */ - ); - - emit_byte (method_buffer, TYPE_JIT | TYPE_METHOD); - emit_time (method_buffer, info->time); - emit_method_inner (method_buffer, info->method); - emit_ptr (method_buffer, cstart); - emit_value (method_buffer, csize); - - memcpy (method_buffer->cursor, name, nlen); - method_buffer->cursor += nlen; - - mono_free (name); - free (info); - } + if (new_methods) { + for (LogBuffer *iter = method_buffer; iter; iter = iter->next) + iter->thread_id = 0; - g_ptr_array_free (entry->methods, TRUE); + dump_buffer (prof, method_buffer); + } else if (method_buffer) + free_buffer (method_buffer, method_buffer->size); - if (new_methods) - dump_buffer (prof, method_buffer); - else if (method_buffer) - free_buffer (method_buffer, method_buffer->size); + dump_buffer (prof, entry->buffer); - dump_buffer (prof, entry->buffer); + free (entry); - free (entry); - } + return TRUE; } + return FALSE; +} + +static void * +writer_thread (void *arg) +{ + MonoProfiler *prof = (MonoProfiler *)arg; + WriterQueueEntry *entry; + + mono_threads_attach_tools_thread (); + mono_thread_info_set_name (mono_native_thread_id_get (), "Profiler writer"); + + dump_header (prof); + + while (InterlockedRead (&prof->run_writer_thread)) { + mono_os_sem_wait (&prof->writer_queue_sem, MONO_SEM_FLAGS_NONE); + handle_writer_queue_entry (prof); + } + + /* Drain any remaining entries on shutdown. */ + while (handle_writer_queue_entry (prof)); + + mono_thread_info_detach (); + return NULL; } @@ -4338,7 +4407,7 @@ runtime_initialized (MonoProfiler *profiler) InterlockedWrite (&runtime_inited, 1); #ifndef DISABLE_HELPER_THREAD counters_init (profiler); - counters_sample (profiler, 0); + counters_sample (profiler, 0, FALSE); #endif /* ensure the main thread data and startup are available soon */ safe_send (profiler, ensure_logbuf (0)); @@ -4420,6 +4489,8 @@ create_profiler (const char *filename, GPtrArray *filters) #endif mono_lock_free_queue_init (&prof->writer_queue); + mono_os_sem_init (&prof->writer_queue_sem, 1); + mono_os_mutex_init (&prof->method_table_mutex); prof->method_table = mono_conc_hashtable_new (NULL, NULL); diff --git a/mono/profiler/ptestrunner.pl b/mono/profiler/ptestrunner.pl index 5215621c2fd..e6323460651 100755 --- a/mono/profiler/ptestrunner.pl +++ b/mono/profiler/ptestrunner.pl @@ -15,7 +15,6 @@ my $minibuilddir = $builddir . "/mono/mini"; # Setup the execution environment # for the profiler module -append_path ("MONO_PROFILER_LIB_DIR", $profbuilddir . "/.libs"); append_path ("DYLD_LIBRARY_PATH", $minibuilddir . "/.libs"); # for mprof-report append_path ("PATH", $profbuilddir); diff --git a/mono/sgen/sgen-gc.c b/mono/sgen/sgen-gc.c index 57e6f6931fc..e6b8d672dce 100644 --- a/mono/sgen/sgen-gc.c +++ b/mono/sgen/sgen-gc.c @@ -1074,6 +1074,12 @@ finish_gray_stack (int generation, ScanCopyContext ctx) if (sgen_client_bridge_need_processing ()) sgen_client_bridge_reset_data (); + /* + * Mark all strong toggleref objects. This must be done before we walk ephemerons or finalizers + * to ensure they see the full set of live objects. + */ + sgen_client_mark_togglerefs (start_addr, end_addr, ctx); + /* * Walk the ephemeron tables marking all values with reachable keys. This must be completely done * before processing finalizable objects and non-tracking weak links to avoid finalizing/clearing @@ -1086,8 +1092,6 @@ finish_gray_stack (int generation, ScanCopyContext ctx) ++ephemeron_rounds; } while (!done_with_ephemerons); - sgen_client_mark_togglerefs (start_addr, end_addr, ctx); - if (sgen_client_bridge_need_processing ()) { /*Make sure the gray stack is empty before we process bridge objects so we get liveness right*/ sgen_drain_gray_stack (ctx); diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 83b7d196cbd..965b148ec74 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -877,7 +877,7 @@ runtest: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQS runtest-managed: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \ - $(RUNTIME) --debug ./test-runner.exe -j a --testsuite-name "runtime" --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL) + $(RUNTIME) --debug ./test-runner.exe -j a --testsuite-name "runtime" --timeout 300 --disabled "$${disabled_tests}" $(TESTSI_CS) $(TESTBS) $(TESTSI_IL) runtest-managed-serial: test-runner.exe $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) @if [ "x$$CI" = "x1" ]; then disabled_tests="$(DISABLED_TESTS_WRENCH)"; else disabled_tests="$(DISABLED_TESTS)"; fi; \ diff --git a/mono/tests/sgen-toggleref.cs b/mono/tests/sgen-toggleref.cs index d604294fee0..f4f2df11555 100644 --- a/mono/tests/sgen-toggleref.cs +++ b/mono/tests/sgen-toggleref.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Threading; using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; public class Toggleref { public int __test; @@ -42,23 +43,23 @@ class Driver { mono_gc_toggleref_add (Helper.ObjToPtr (obj), true); } + static Toggleref a, b; + static void SetupLinks () { - var a = new Toggleref () { id = "root" }; - var b = new Toggleref () { id = "child" }; - a.link.Add (b); - a.__test = Toggleref.STRONG; - b.__test = Toggleref.WEAK; - Register (a); - Register (b); - root = new WeakReference (a, false); - child = new WeakReference (b, false); + var r = new Toggleref () { id = "root" }; + var c = new Toggleref () { id = "child" }; + r.link.Add (c); + r.__test = Toggleref.STRONG; + c.__test = Toggleref.WEAK; + Register (r); + Register (c); + root = new WeakReference (r, false); + child = new WeakReference (c, false); } - static Toggleref a, b; - - static int Main () + static int test_0_root_keeps_child () { - + Console.WriteLine ("test_0_root_keeps_child"); var t = new Thread (SetupLinks); t.Start (); t.Join (); @@ -94,6 +95,116 @@ class Driver { return 0; + } + + static void SetupLinks2 () { + var r = new Toggleref () { id = "root" }; + var c = new Toggleref () { id = "child" }; + + r.__test = Toggleref.STRONG; + c.__test = Toggleref.WEAK; + Register (r); + Register (c); + root = new WeakReference (r, false); + child = new WeakReference (c, false); + } + + static int test_0_child_goes_away () + { + Console.WriteLine ("test_0_child_goes_away"); + + var t = new Thread (SetupLinks2); + t.Start (); + t.Join (); + + GC.Collect (); + GC.WaitForPendingFinalizers (); + + Console.WriteLine ("try get A {0}", root.TryGetTarget (out a)); + Console.WriteLine ("try get B {0}", child.TryGetTarget (out b)); + Console.WriteLine ("a is null {0}", a == null); + Console.WriteLine ("b is null {0}", b == null); + if (a == null || b != null) + return 1; + Console.WriteLine ("a test {0}", a.__test); + + return 0; + } + + static ConditionalWeakTable cwt = new ConditionalWeakTable (); + static WeakReference root_value, child_value; + static object a_val, b_val; + + + static void SetupLinks3 () { + var r = new Toggleref () { id = "root" }; + var c = new Toggleref () { id = "child" }; + + r.__test = Toggleref.STRONG; + c.__test = Toggleref.WEAK; + Register (r); + Register (c); + root = new WeakReference (r, false); + child = new WeakReference (c, false); + + var root_val = new object (); + var child_val = new object (); + + cwt.Add (r, root_val); + cwt.Add (c, child_val); + + root_value = new WeakReference (root_val, false); + child_value = new WeakReference (child_val, false); + } + + static int test_0_CWT_keep_child_alive () + { + Console.WriteLine ("test_0_CWT_keep_child_alive"); + + var t = new Thread (SetupLinks3); + t.Start (); + t.Join (); + + GC.Collect (); + GC.WaitForPendingFinalizers (); + + Console.WriteLine ("try get A {0}", root.TryGetTarget (out a)); + Console.WriteLine ("try get B {0}", child.TryGetTarget (out b)); + Console.WriteLine ("a is null {0}", a == null); + Console.WriteLine ("b is null {0}", b == null); + if (a == null || b != null) + return 1; + Console.WriteLine ("a test {0}", a.__test); + + Console.WriteLine ("try get a_val {0}", root_value.TryGetTarget (out a_val)); + Console.WriteLine ("try get v_val {0}", child_value.TryGetTarget (out b_val)); + + //the strong toggleref must keep the CWT value to remains alive + if (a_val == null) + return 2; + + //the weak toggleref should allow the CWT value to go away + if (b_val != null) + return 3; + + object res_value = null; + bool res = cwt.TryGetValue (a, out res_value); + Console.WriteLine ("CWT result {0} -> {1}", res, res_value == a_val); + + //the strong val is not on the CWT + if (!res) + return 4; + + //for some reason the value is not the right one + if (res_value != a_val) + return 5; + + return 0; + } + static int Main (string[] args) + { + return TestDriver.RunTests (typeof (Driver), args); } + } \ No newline at end of file diff --git a/mono/tests/test-runner.cs b/mono/tests/test-runner.cs index ae52220e335..95011edf2c9 100644 --- a/mono/tests/test-runner.cs +++ b/mono/tests/test-runner.cs @@ -261,7 +261,10 @@ public class TestRunner output.Write ("timed out"); - p.Kill (); + try { + p.Kill (); + } catch { + } } else if (p.ExitCode != expectedExitCode) { var end = DateTime.UtcNow; diff --git a/mono/utils/atomic.c b/mono/utils/atomic.c index b6d1e5f2055..86afad502ff 100644 --- a/mono/utils/atomic.c +++ b/mono/utils/atomic.c @@ -503,7 +503,7 @@ InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp) return __sync_val_compare_and_swap (dest, comp, exch); } -#elif defined (HAVE_64BIT_CMPXCHG_FALLBACK) +#elif defined (__arm__) && defined (HAVE_ARMV7) && (defined(TARGET_IOS) || defined(TARGET_WATCHOS) || defined(TARGET_ANDROID)) #if defined (TARGET_IOS) || defined (TARGET_WATCHOS) diff --git a/mono/utils/atomic.h b/mono/utils/atomic.h index 78ab036a22b..4f5f010afd3 100755 --- a/mono/utils/atomic.h +++ b/mono/utils/atomic.h @@ -22,10 +22,6 @@ F/MonoDroid( 1568): shared runtime initialization error: Cannot load library: re Apple targets have historically being problematic, xcode 4.6 would miscompile the intrinsic. */ -#if defined (__arm__) && defined (HAVE_ARMV7) -#define HAVE_64BIT_CMPXCHG_FALLBACK /* See atomic.c in this directory. */ -#endif - /* On Windows, we always use the functions provided by the Windows API. */ #if defined(__WIN32__) || defined(_WIN32) diff --git a/mono/utils/mono-compiler.h b/mono/utils/mono-compiler.h index 2b3b86e2ef2..04bc26e4f53 100644 --- a/mono/utils/mono-compiler.h +++ b/mono/utils/mono-compiler.h @@ -7,6 +7,19 @@ */ #include +/* + * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any + * other Mono header file if you use a different compiler from the one used to + * build Mono. + */ +#ifndef MONO_ZERO_LEN_ARRAY +#ifdef __GNUC__ +#define MONO_ZERO_LEN_ARRAY 0 +#else +#define MONO_ZERO_LEN_ARRAY 1 +#endif +#endif + #ifdef __GNUC__ #define MONO_ATTR_USED __attribute__ ((used)) #else diff --git a/mono/utils/mono-dl.c b/mono/utils/mono-dl.c index 62493555a30..43116130309 100644 --- a/mono/utils/mono-dl.c +++ b/mono/utils/mono-dl.c @@ -402,28 +402,35 @@ mono_dl_open_runtime_lib (const char* lib_name, int flags, char **error_msg) if (binl != -1) { char *base; char *resolvedname, *name; + char *baseparent = NULL; buf [binl] = 0; resolvedname = mono_path_resolve_symlinks (buf); base = g_path_get_dirname (resolvedname); name = g_strdup_printf ("%s/.libs", base); runtime_lib = try_load (lib_name, name, flags, error_msg); g_free (name); + if (!runtime_lib) + baseparent = g_path_get_dirname (base); if (!runtime_lib) { - char *newbase = g_path_get_dirname (base); - name = g_strdup_printf ("%s/lib", newbase); + name = g_strdup_printf ("%s/lib", baseparent); runtime_lib = try_load (lib_name, name, flags, error_msg); g_free (name); } #ifdef __MACH__ if (!runtime_lib) { - char *newbase = g_path_get_dirname (base); - name = g_strdup_printf ("%s/Libraries", newbase); + name = g_strdup_printf ("%s/Libraries", baseparent); runtime_lib = try_load (lib_name, name, flags, error_msg); g_free (name); } #endif + if (!runtime_lib) { + name = g_strdup_printf ("%s/profiler/.libs", baseparent); + runtime_lib = try_load (lib_name, name, flags, error_msg); + g_free (name); + } g_free (base); g_free (resolvedname); + g_free (baseparent); } if (!runtime_lib) runtime_lib = try_load (lib_name, NULL, flags, error_msg); diff --git a/mono/utils/mono-error-internals.h b/mono/utils/mono-error-internals.h index 55999825566..71498c0d99b 100644 --- a/mono/utils/mono-error-internals.h +++ b/mono/utils/mono-error-internals.h @@ -2,7 +2,7 @@ #define __MONO_ERROR_INTERNALS_H__ #include "mono/utils/mono-compiler.h" -#include "mono/metadata/object-internals.h" +#include "mono/metadata/class-internals.h" /*Keep in sync with MonoError*/ typedef struct { @@ -103,10 +103,10 @@ void mono_error_set_not_supported (MonoError *error, const char *msg_format, ...); void -mono_error_set_exception_instance (MonoError *error, MonoException *exc); +mono_error_set_invalid_operation (MonoError *error, const char *msg_format, ...); void -mono_error_set_from_loader_error (MonoError *error); +mono_error_set_exception_instance (MonoError *error, MonoException *exc); MonoException* mono_error_prepare_exception (MonoError *error, MonoError *error_out); @@ -117,9 +117,6 @@ mono_error_convert_to_exception (MonoError *error); void mono_error_raise_exception (MonoError *error); -void -mono_loader_set_error_from_mono_error (MonoError *oerror); - void mono_error_move (MonoError *dest, MonoError *src); diff --git a/mono/utils/mono-error.c b/mono/utils/mono-error.c index 94c0c4fd35a..84d04781e70 100644 --- a/mono/utils/mono-error.c +++ b/mono/utils/mono-error.c @@ -12,9 +12,7 @@ #include "mono-error-internals.h" #include -#include #include -#include #include #define set_error_messagev() do { \ @@ -91,6 +89,13 @@ mono_error_init_flags (MonoError *oerror, unsigned short flags) error->flags = flags; } +/** + * mono_error_init: + * @error: Pointer to MonoError struct to initialize + * + * Any function which takes a MonoError for purposes of reporting an error + * is required to call either this or mono_error_init_flags on entry. + */ void mono_error_init (MonoError *error) { @@ -388,7 +393,7 @@ mono_error_set_execution_engine (MonoError *oerror, const char *msg_format, ...) } /** - * mono_error_set_execution_engine: + * mono_error_set_not_supported: * * System.NotSupportedException */ @@ -401,120 +406,28 @@ mono_error_set_not_supported (MonoError *oerror, const char *msg_format, ...) va_end (args); } +/** + * mono_error_set_invalid_operation: + * + * System.InvalidOperationException + */ void -mono_error_set_exception_instance (MonoError *oerror, MonoException *exc) +mono_error_set_invalid_operation (MonoError *oerror, const char *msg_format, ...) { - MonoErrorInternal *error = (MonoErrorInternal*)oerror; - - mono_error_prepare (error); - error->error_code = MONO_ERROR_EXCEPTION_INSTANCE; - error->exn.instance_handle = mono_gchandle_new (exc ? &exc->object : NULL, FALSE); + va_list args; + va_start (args, msg_format); + mono_error_set_generic_errorv (oerror, "System", "InvalidOperationException", msg_format, args); + va_end (args); } void -mono_error_set_from_loader_error (MonoError *oerror) +mono_error_set_exception_instance (MonoError *oerror, MonoException *exc) { - MonoLoaderError *loader_error = mono_loader_get_last_error (); MonoErrorInternal *error = (MonoErrorInternal*)oerror; - gboolean dup_strings = TRUE; mono_error_prepare (error); - - if (!loader_error) { - mono_error_set_execution_engine (oerror, "Runtime tried to produce a mono-error from an empty loader-error"); - return; - } - - switch (loader_error->exception_type) { - case MONO_EXCEPTION_NONE: - mono_error_set_execution_engine (oerror, "Runtime tried to produce a mono-error from a non-error loader-error"); - break; - - case MONO_EXCEPTION_INVALID_PROGRAM: - mono_error_set_generic_error (oerror, "System", "InvalidProgramException", "Failed for unknown reasons."); - break; - - case MONO_EXCEPTION_UNVERIFIABLE_IL: - mono_error_set_generic_error (oerror, "System.Security", "VerificationException", "Failed for unknown reasons."); - break; - - case MONO_EXCEPTION_MISSING_METHOD: - error->error_code = MONO_ERROR_MISSING_METHOD; - mono_error_set_type_name (oerror, loader_error->class_name); - mono_error_set_member_name (oerror, loader_error->member_name); - error->full_message = g_strdup ("Failed for unknown reasons."); - break; - - case MONO_EXCEPTION_MISSING_FIELD: - mono_error_set_field_load (oerror, loader_error->klass, loader_error->member_name, "Failed for unknown reasons."); - break; - - case MONO_EXCEPTION_TYPE_LOAD: - mono_error_set_type_load_name (oerror, g_strdup (loader_error->class_name), g_strdup (loader_error->assembly_name), "Failed for unknown reasons."); - dup_strings = FALSE; - break; - - case MONO_EXCEPTION_FILE_NOT_FOUND: - mono_error_set_assembly_load_simple (oerror, loader_error->assembly_name, loader_error->ref_only); - break; - - case MONO_EXCEPTION_METHOD_ACCESS: - mono_error_set_generic_error (oerror, "System", "MethodAccessException", "Failed for unknown reasons."); - break; - - case MONO_EXCEPTION_FIELD_ACCESS: - mono_error_set_generic_error (oerror, "System", "FieldAccessException", "Failed for unknown reasons."); - break; - - case MONO_EXCEPTION_OBJECT_SUPPLIED: - case MONO_EXCEPTION_GENERIC_SHARING_FAILED: - mono_error_set_execution_engine (oerror, "Runtime tried to produce a mono-error from JIT internal error %d", loader_error->exception_type); - break; - - case MONO_EXCEPTION_BAD_IMAGE: - mono_error_set_bad_image_name (oerror, "", "%s", loader_error->msg); - break; - - case MONO_EXCEPTION_OUT_OF_MEMORY: - mono_error_set_out_of_memory (oerror, "Failed for unknown reasons."); - break; - - default: - mono_error_set_execution_engine (oerror, "Runtime tried to produce an unknown loader-error %d", loader_error->exception_type); - break; - } - - mono_error_dup_strings (oerror, dup_strings); - mono_loader_clear_error (); -} - -void -mono_loader_set_error_from_mono_error (MonoError *oerror) -{ - MonoErrorInternal *error = (MonoErrorInternal*)oerror; - - switch (error->error_code) { - case MONO_ERROR_MISSING_METHOD: - mono_loader_set_error_method_load (get_type_name (error), error->member_name); - break; - case MONO_ERROR_MISSING_FIELD: - mono_loader_set_error_field_load (error->exn.klass, error->member_name); - break; - case MONO_ERROR_TYPE_LOAD: - mono_loader_set_error_type_load (get_type_name (error), get_assembly_name (error)); - break; - case MONO_ERROR_FILE_NOT_FOUND: - /* XXX can't recover if it's ref only or not */ - mono_loader_set_error_assembly_load (get_assembly_name (error), FALSE); - break; - case MONO_ERROR_BAD_IMAGE: - mono_loader_set_error_bad_image (g_strdup (error->full_message)); - break; - case MONO_ERROR_EXCEPTION_INSTANCE: - mono_loader_set_error_bad_image (g_strdup_printf ("Non translatable error")); - default: - mono_loader_set_error_bad_image (g_strdup_printf ("Non translatable error: %s", error->full_message)); - } + error->error_code = MONO_ERROR_EXCEPTION_INSTANCE; + error->exn.instance_handle = mono_gchandle_new (exc ? &exc->object : NULL, FALSE); } void diff --git a/mono/utils/mono-threads-posix-signals.c b/mono/utils/mono-threads-posix-signals.c index 39caeb54d65..8200b101913 100644 --- a/mono/utils/mono-threads-posix-signals.c +++ b/mono/utils/mono-threads-posix-signals.c @@ -36,8 +36,8 @@ static sigset_t suspend_ack_signal_mask; //Can't avoid the circular dep on this. Will be gone pretty soon extern int mono_gc_get_suspend_signal (void); -static int -signal_search_alternative (int min_signal) +int +mono_threads_posix_signal_search_alternative (int min_signal) { #if !defined (SIGRTMIN) g_error ("signal search only works with RTMIN"); @@ -88,7 +88,7 @@ suspend_signal_get (void) #else static int suspend_signum = -1; if (suspend_signum == -1) - suspend_signum = signal_search_alternative (-1); + suspend_signum = mono_threads_posix_signal_search_alternative (-1); return suspend_signum; #endif /* SIGRTMIN */ } @@ -107,7 +107,7 @@ restart_signal_get (void) #else static int resume_signum = -1; if (resume_signum == -1) - resume_signum = signal_search_alternative (suspend_signal_get () + 1); + resume_signum = mono_threads_posix_signal_search_alternative (suspend_signal_get () + 1); return resume_signum; #endif /* SIGRTMIN */ } @@ -127,7 +127,7 @@ abort_signal_get (void) #else static int abort_signum = -1; if (abort_signum == -1) - abort_signum = signal_search_alternative (restart_signal_get () + 1); + abort_signum = mono_threads_posix_signal_search_alternative (restart_signal_get () + 1); return abort_signum; #endif /* SIGRTMIN */ } diff --git a/mono/utils/mono-threads-posix-signals.h b/mono/utils/mono-threads-posix-signals.h index 2bdcf8e789a..59a38c1ceb2 100644 --- a/mono/utils/mono-threads-posix-signals.h +++ b/mono/utils/mono-threads-posix-signals.h @@ -14,6 +14,9 @@ typedef enum { MONO_THREADS_POSIX_INIT_SIGNALS_ABORT, } MonoThreadPosixInitSignals; +int +mono_threads_posix_signal_search_alternative (int min_signal); + void mono_threads_posix_init_signals (MonoThreadPosixInitSignals signals); @@ -28,4 +31,4 @@ mono_threads_posix_get_abort_signal (void); #endif /* defined(USE_POSIX_BACKEND) || defined(USE_POSIX_SYSCALL_ABORT) */ -#endif /* __MONO_THREADS_POSIX_SIGNALS_H__ */ \ No newline at end of file +#endif /* __MONO_THREADS_POSIX_SIGNALS_H__ */ diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c index 54f183e58f0..7fe86b96273 100644 --- a/mono/utils/mono-threads-posix.c +++ b/mono/utils/mono-threads-posix.c @@ -279,7 +279,24 @@ mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg) void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name) { -#if defined (HAVE_PTHREAD_SETNAME_NP) && !defined (__MACH__) +#ifdef __MACH__ + /* + * We can't set the thread name for other threads, but we can at least make + * it work for threads that try to change their own name. + */ + if (tid != mono_native_thread_id_get ()) + return; + + if (!name) { + pthread_setname_np (""); + } else { + char n [63]; + + strncpy (n, name, 63); + n [62] = '\0'; + pthread_setname_np (n); + } +#elif defined (HAVE_PTHREAD_SETNAME_NP) if (!name) { pthread_setname_np (tid, ""); } else { diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index 0b142ee1c3f..b6e70329c96 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -1519,27 +1519,3 @@ mono_thread_info_describe_interrupt_token (MonoThreadInfo *info, GString *text) else g_string_append_printf (text, "waiting"); } - -/* info must be self or be held in a hazard pointer. */ -gboolean -mono_threads_add_async_job (MonoThreadInfo *info, MonoAsyncJob job) -{ - MonoAsyncJob old_job; - do { - old_job = (MonoAsyncJob) info->service_requests; - if (old_job & job) - return FALSE; - } while (InterlockedCompareExchange (&info->service_requests, old_job | job, old_job) != old_job); - return TRUE; -} - -MonoAsyncJob -mono_threads_consume_async_jobs (void) -{ - MonoThreadInfo *info = (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key); - - if (!info) - return (MonoAsyncJob) 0; - - return (MonoAsyncJob) InterlockedExchange (&info->service_requests, 0); -} diff --git a/mono/utils/mono-threads.h b/mono/utils/mono-threads.h index 1019dda1884..97c77de6e7d 100644 --- a/mono/utils/mono-threads.h +++ b/mono/utils/mono-threads.h @@ -164,13 +164,6 @@ enum { ASYNC_SUSPEND_STATE_INDEX = 1, }; -/* - * This enum tells which async thread service corresponds to which bit. - */ -typedef enum { - MONO_SERVICE_REQUEST_SAMPLE = 1, -} MonoAsyncJob; - typedef struct _MonoThreadInfoInterruptToken MonoThreadInfoInterruptToken; typedef struct { @@ -241,12 +234,6 @@ typedef struct { /* Set when the thread is started, or in _wapi_thread_duplicate () */ HANDLE handle; - /* Asynchronous service request. This flag is meant to be consumed by the multiplexing signal handlers to discover what sort of work they need to do. - * Use the mono_threads_add_async_job and mono_threads_consume_async_jobs APIs to modify this flag. - * In the future the signaling should be part of the API, but for now, it's only for massaging the bits. - */ - volatile gint32 service_requests; - void *jit_data; MonoThreadInfoInterruptToken *interrupt_token; @@ -346,7 +333,7 @@ mono_thread_info_register_small_id (void); THREAD_INFO_TYPE * mono_thread_info_attach (void *baseptr); -void +MONO_API void mono_thread_info_detach (void); gboolean @@ -370,7 +357,7 @@ mono_thread_info_lookup (MonoNativeThreadId id); gboolean mono_thread_info_resume (MonoNativeThreadId tid); -void +MONO_API void mono_thread_info_set_name (MonoNativeThreadId tid, const char *name); void @@ -466,17 +453,6 @@ mono_threads_get_max_stack_size (void); HANDLE mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid); -/* -This is the async job submission/consumption API. -XXX: This is a PROVISIONAL API only meant to be used by the statistical profiler. -If you want to use/extend it anywhere else, understand that you'll have to do some API design work to better fit this puppy. -*/ -gboolean -mono_threads_add_async_job (THREAD_INFO_TYPE *info, MonoAsyncJob job); - -MonoAsyncJob -mono_threads_consume_async_jobs (void); - MONO_API void mono_threads_attach_tools_thread (void); @@ -547,7 +523,7 @@ void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name); void mono_threads_coop_begin_global_suspend (void); void mono_threads_coop_end_global_suspend (void); -MonoNativeThreadId +MONO_API MonoNativeThreadId mono_native_thread_id_get (void); gboolean diff --git a/mono/utils/monobitset.h b/mono/utils/monobitset.h index 8abe83907ce..e95f4847e6c 100644 --- a/mono/utils/monobitset.h +++ b/mono/utils/monobitset.h @@ -2,26 +2,14 @@ #define __MONO_BITSET_H__ #include +#include + #ifdef SGEN_WITHOUT_MONO -#include "mono/utils/mono-compiler.h" #define MONO_API #else #include #endif -/* - * When embedding, you have to define MONO_ZERO_LEN_ARRAY before including any - * other Mono header file if you use a different compiler from the one used to - * build Mono. - */ -#ifndef MONO_ZERO_LEN_ARRAY -#ifdef __GNUC__ -#define MONO_ZERO_LEN_ARRAY 0 -#else -#define MONO_ZERO_LEN_ARRAY 1 -#endif -#endif - #define MONO_BITSET_BITS_PER_CHUNK (8 * sizeof (gsize)) typedef struct { diff --git a/msvc/libmono.vcxproj b/msvc/libmono.vcxproj index 1a541ddea20..bcf1f7a7ab5 100644 --- a/msvc/libmono.vcxproj +++ b/msvc/libmono.vcxproj @@ -57,6 +57,12 @@ true true + + true + true + true + true + @@ -65,6 +71,12 @@ true true + + true + true + true + true + @@ -76,6 +88,12 @@ true true + + true + true + true + true + true true @@ -110,7 +128,9 @@ + + true @@ -118,12 +138,24 @@ true true + + true + true + true + true + true true true true + + true + true + true + true + diff --git a/msvc/libmonoruntime.vcxproj b/msvc/libmonoruntime.vcxproj index 8bcf5315282..d8f354b7607 100644 --- a/msvc/libmonoruntime.vcxproj +++ b/msvc/libmonoruntime.vcxproj @@ -67,6 +67,7 @@ + @@ -132,7 +133,6 @@ - diff --git a/scripts/babysitter b/scripts/babysitter deleted file mode 100755 index f8b5a6c345c..00000000000 --- a/scripts/babysitter +++ /dev/null @@ -1,409 +0,0 @@ -#!/usr/bin/env python - -# Mimics GNU timeout, but does some fancy tracking based on custom features in mono nunit24. - -import argparse -import subprocess -import re -import signal -import time -import sys -import os.path -import copy -import tempfile -import calendar -import json - -### Constants - -# Here is how the communication with nunit works. It has to work with two constraints: -# - We don't invoke nunit directly. We invoke some Makefile which invokes some other Makefile -# and at some point down the line someone calls nunit. -# - nunit has to be able to report back to us even if (especially if) it terminates improperly. -# To deal with all this, communication babysitter->nunit is done by environment variables, -# and communication nunit->babysitter is done by leaving behind files in known locations. - -# Filenames - -CURRENT_TEST_FILE = "babysitter_report_current_test_file.txt" -RAN_TEST_FILE = "babysitter_report_ran_test_file.txt" -FAILED_TEST_FILE = "babysitter_report_failed_test_file.txt" -LOGGING_FILE = "babysitter_report.json_lines" - -# Environment keys - -# Keys used for Babysitter<->Nunit IPC -CURRENT_TEST_KEY = 'MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE' # Tell nunit where to leave files -RAN_TEST_KEY = 'MONO_BABYSITTER_NUNIT_RAN_TEST_FILE' -FAILED_TEST_KEY = 'MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE' -RUN_KEY = 'MONO_BABYSITTER_NUNIT_RUN_TEST' # Semicolon-separated list of test names -RUN_MODE_KEY = 'MONO_BABYSITTER_NUNIT_RUN_MODE' # Equal to either RUN or AFTER - -# Keys used for script configuration (see --help text) -LOG_FILE_KEY = 'MONO_BABYSITTER_LOG_FILE' # Path -RETRY_KEY = 'MONO_BABYSITTER_RETRY' # Equal to an integer -VERBOSE_KEY = 'MONO_BABYSITTER_VERBOSE' # "Undocumented"-- used for debugging babysitter - -# JSON keys - -DATE_JSON = 'date' # POSIX timestamp of test suite run -INVOKE_JSON = 'invocation' -COUNT_JSON = 'iteration' # How many times was command executed? -LIMIT_JSON = 'failure_max' -SUPPORT_JSON = 'babysitter_protocol' # Was the test suite running with a babysitter-aware nunit? -FINAL_CODE_JSON = 'final_code' -TESTS_JSON = 'tests' # Holds dictionary of (test case name)->(dict with TEST_ keys below) -TEST_FAILURES = 'normal_failures' -TEST_CRASH_FAILURES = 'crash_failures' -TEST_TIMEOUT_FAILURES = 'timeout_failures' - -### Interpret arguments - -scriptname = sys.argv[0] - -# This is very silly: This program needs to switch from argparse to manual parsing -# after the second positional argument, but argparse doesn't let you do this. -# I work around this with a custom subclass which can selectively swallow errors: -class Hesitate(Exception): - pass -class HesitantParser(argparse.ArgumentParser): - def __init__(s, *args, **kwargs): - s.hesitating = True # Errors will be swallowed until this is set false - argparse.ArgumentParser.__init__(s, *args, **kwargs) - def error(s, *args, **kwargs): - if s.hesitating: - raise Hesitate() # Bail out before errors are printed. - argparse.ArgumentParser.error(s, *args, **kwargs) - -# Define args -argparser = HesitantParser(description="""\ -Run a test suite with a timeout.\n -Durations are floating point numbers followed by an optional unit:\n -'s' for seconds (the default) -'m' for minutes -'h' for hours -'d' for days\n -supported environment variables: - %s: File to write logs to (as line-delimited JSON) - %s: If set to a number, failed test cases will be rerun this many times (NUnit test suites only)""" % - (LOG_FILE_KEY, RETRY_KEY), - formatter_class=argparse.RawTextHelpFormatter) -argparser.add_argument('-s', '--signal', dest='signal', metavar='signal', default='TERM', - help="Send this signal to the command on timeout, instead of TERM.") -argparser.add_argument('-k', '--kill-after-duration', dest='kill_after', metavar='duration', - help="If process continues running after signal, send KILL after this duration.") -argparser.add_argument('duration', - help="Time to run before sending signal.") -argparser.add_argument('command', nargs="+", help="Command+args to run.") - -# Repeatedly parse the given args until we find the shortest prefix for which parsing succeeds. -argc = len(sys.argv) -extra_args = [] -for limit in range(1,argc+1): - try: - if limit == argc: # On the final pass, parse for real - argparser.hesitating = False - args = argparser.parse_args(sys.argv[1:limit]) - # If we're still here, parse_args succeeded. - # The final parsed arg is the command; remaining argv items are its args. - extra_args = sys.argv[limit:] - break - except Hesitate: # Before the final pass, if parse_args fails, skip - pass - -argparser.hesitating = False # Just act like a normal argparser from here - -durationre = re.compile(r'(\d+)([smhd]?)') -def parse_duration(duration): # Accept units - match = durationre.match(duration) - if not match: - argparser.error("Could not understand duration %s" % duration) - time, units = match.group(1), match.group(2) - time = int(time) - if units == 'm': - time *= 60 - elif units == 'h': - time *= 60*60 - elif units == 'd': - time *= 60*60*24 - return time - -def parse_signal(sig): # Accept names - if sig.isdigit(): - return int(sig) - for k,v in signal.__dict__.iteritems(): - if k == ("SIG%s" % sig): - return v - argparser.error("Could not understand signal name %s" % sig) - -# Final interpretation of arguments -duration = parse_duration(args.duration) -kill_after = parse_duration(args.kill_after) if args.kill_after is not None else None -timeout_signal = parse_signal(args.signal) -command = args.command + extra_args - -# Process environment -global_env = copy.deepcopy( os.environ ) - -verbose = VERBOSE_KEY in global_env -logging = LOG_FILE_KEY in global_env -logfile = global_env[LOG_FILE_KEY] if logging else None -crash_resuming = True # TODO: Consider exposing this option, or adding a retry_on_crash option. -failmax = int(global_env[RETRY_KEY]) if RETRY_KEY in global_env else 0 -babysitting = True # If false, babysitter becomes a timeout clone with no env manipulation or anything. -if babysitting: - babysitter_dir = tempfile.mkdtemp() - global_env[CURRENT_TEST_KEY] = os.path.join(babysitter_dir, CURRENT_TEST_FILE) - global_env[RAN_TEST_KEY] = os.path.join(babysitter_dir, RAN_TEST_FILE) - global_env[FAILED_TEST_KEY] = os.path.join(babysitter_dir, FAILED_TEST_FILE) - -have_unix_process_groups = 'killpg' in os.__dict__ -have_windows_process_groups = 'CREATE_NEW_PROCESS_GROUP' in subprocess.__dict__ - -### Timeout implementation - -def wait(proc, duration): - # TODO: If we detect Python 3.3, Popen objects have a wait(timeout) method we can use - start = time.time() - while True: - code = proc.poll() - if code is not None: - return code - if time.time()-start > duration: - return None - time.sleep(0.05) - -# Popen and send_signal can't be called in their basic forms because we want to -# send signals to all children, not just to the immediately spawned process. -# Unfortunately the way to do this varies by operating system. -def popen(*args, **kwargs): - if have_unix_process_groups: # Call function on spawn to become process group leader - kwargs['preexec_fn'] = os.setsid - elif have_windows_process_groups: # Set magic flag for Windows process groups - kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP - return subprocess.Popen(*args, **kwargs) - -def send_signal(proc, sig): - if have_unix_process_groups: # UNIX - # For compatibility with GNU timeout, pre-send the signal to just the monitored process - os.kill(proc.pid, sig) - # Send signal to entire group - os.killpg(proc.pid, sig) - # For compatibility with GNU Timeout, send a SIGCONT after the signal - # (so delivery has a chance to occur even for stopped processes) - if sig != signal.SIGKILL and sig != signal.SIGCONT: - os.kill(proc.pid, signal.SIGCONT) - elif have_windows_process_groups: # Windows with Python 2.7 or better - os.kill(proc.pid, sig) # Becuase CREATE_NEW_PROCESS_GROUP, will go to entire group - else: # Windows with Python 2.6-- CREATE_NEW_PROCESS_GROUP not supported - proc.send_signal(sig) # No way to contact group, just kill process - -### Utility functions - -def attemptDelete(path): - try: - os.remove(path) - except OSError: - pass - -def attemptLines(path): - try: - with open(path) as f: - return map(lambda s: s.strip('\r\n'), f.readlines()) - except (OSError, IOError): - return [] - -def attemptFirstLine(path): - lines = attemptLines(path) - if lines: - return lines[0] - return None - -def posixtime(): # Amazingly, time.time() does not guarantee an epoch in the docs. However this does: - return calendar.timegm(time.gmtime()) - -failcount = {} -def failure_may_retry(test): - if test not in failcount: - failcount[test] = 0 - failcount[test] += 1 - return failcount[test] < failmax - -def verbose_print(arg): - if (verbose): - print(arg) - -def failure_annotate(test): - return "%s (failure #%d of %d allowed)" % (test, failcount[test], failmax) - -def pluralize(lst): - return "s" if len(lst) > 1 else "" - -### Run command - -def run(): # Returns exit code - resume_after = [] - retry_these = [] - ever_completed = False - died_politely = False - proc = None - code = None - - # Set up logging - log = {DATE_JSON: posixtime(), COUNT_JSON:0, LIMIT_JSON:failmax, SUPPORT_JSON:False, - INVOKE_JSON: " ".join(command)} - - def log_value(key, set=None, add=None, target=log): # Call to add toplevel value to log - if add is not None: - if key not in target: - target[key] = 0 - target[key] += add - else: - target[key] = set - - def log_test(testname, key, set=None, add=None): # Call to add test-case-level value to log - if TESTS_JSON not in log: - log[TESTS_JSON] = {} - if testname not in log[TESTS_JSON]: - log[TESTS_JSON][testname] = {} - log_value(key, set=set, add=add, target=log[TESTS_JSON][testname]) - - # Ready to run tests - try: - while True: - env = copy.copy(global_env) - if ever_completed: - retry_next = [] - else: # Persist reported failures list until first non-crash run - retry_next = retry_these - - log_value(COUNT_JSON, add=1) - - # Prepare environment/filesystem - if babysitting: - for key in [CURRENT_TEST_KEY, RAN_TEST_KEY, FAILED_TEST_KEY]: - attemptDelete(env[key]) - if resume_after: - env[RUN_KEY] = ";".join(resume_after) - env[RUN_MODE_KEY] = "EXCLUDE" - elif retry_these: - env[RUN_KEY] = ";".join(retry_these) - env[RUN_MODE_KEY] = "RUN" - - # Run test suite - try: - proc = popen(command, env=env) - except OSError: - died_politely = True - sys.stderr.write("%s: Could not execute command `%s`\n" % (scriptname, command[0])) - sys.exit(127) - - code = wait(proc, duration) - timed_out = code is None - if timed_out: # Initial timeout - send_signal(proc, timeout_signal) - if kill_after is not None: # Kill-after timeout - code = wait(proc, kill_after) - if code is None: - send_signal(proc, signal.SIGKILL) - code = proc.wait() # Waits forever - sys.stderr.write("%s: Command `%s` timed out\n" % (scriptname, command[0])) - died_politely = True - - # The test suite has now run, and what happens next varies: - # 1. The suite either completed fully without failures, or timed out: Just quit. - # 2. The suite crashed (halted without completing): - # Remember any failures for later and rerun, using a blacklist of testcases we have completed. - # 3. The suite completed, but there were failures reported: - # Rerun, using a whitelist of only reported-failed testcases. - # 4. The suite crashed partway through a run with a whitelist: - # Rerun, using a whitelist consisting of the previous whitelist minus successful testcases. - - crashed_at = attemptFirstLine(env[CURRENT_TEST_KEY]) - failed_tests = attemptLines(env[FAILED_TEST_KEY]) - ran_tests = attemptLines(env[RAN_TEST_KEY]) - bailout = False - - if crashed_at or failed_tests or ran_tests: # Test suite follows the babysitter protocol - log_value(SUPPORT_JSON, True) - - if not crashed_at and not ever_completed: # The resume_after whitelist is only - resume_after = [] # used before the first noncrashing run - ever_completed = True - - if timed_out: # Currently no retries after timeout - bailout = True - code = 124 # See GNU timeout manpage - - if code or crashed_at: # Process failures - # Handle crash failures - if crashed_at and not timed_out: - log_test(crashed_at, TEST_CRASH_FAILURES, add=1) - if not crash_resuming: - bailout = True - - if failure_may_retry(crashed_at): - if ever_completed: # Rerun with whitelist next time - for test in retry_these: # Prepopulate with last whitelist minus run testcases - if test == crashed_at or test not in ran_tests: # (plus crashed testcase) - retry_next.append(test) - else: # Rerun with blacklist next time - for test in ran_tests: # Add testcases we just ran to blacklist - if test != crashed_at: # (except for the crashed testcase) - resume_after.append(test) - else: - bailout = True - - # Handle reported failures - for test in failed_tests: - log_test(test, TEST_FAILURES, add=1) - if failure_may_retry(test): - retry_next.append(test) - else: - bailout = True - - # Report human-readable failures for stdout log. - message = "%s:" % (scriptname) - if timed_out: - message += " Saw timeout in test case %s (never allowed)." % (crashed_at) - elif crashed_at: - message += " Saw crash in test case %s." % (failure_annotate(crashed_at)) - if failed_tests: - message += " Saw test failure in test case%s %s." % (pluralize(failed_tests), "; ".join(map(failure_annotate, failed_tests))) - if not (timed_out or crashed_at or failed_tests): - message += " Test suite terminated with code %d, " % (code) - if log[SUPPORT_JSON]: - message += "but failure did not occur during a test case. Halting." - else: - message += "and suite cannot report test case data. Halting." - elif bailout: - message += " Will halt testing." - print(message) - - if bailout or not (resume_after or retry_next): # If not retrying - return code - - # If we got here, a retry is occurring - retry_these = retry_next - - # Report human-readable retry notice for stdout log. - message = "%s: Will rerun test suite" % (scriptname) - if log[COUNT_JSON] > 1: - message += " (iteration #%d)" % (log[COUNT_JSON]) - if resume_after: - message += ", resuming at crashed testcase %s." % (crashed_at) - else: - message += ", running previously failed testcase%s: %s." % (pluralize(retry_these), "; ".join(retry_these)) - print(message) - finally: - # Emergency: Ensure command does not outlive this script - if proc is not None and not died_politely: - send_signal(proc, signal.SIGKILL) - - # Write out logs - log_value(FINAL_CODE_JSON, "EXCEPTION" if code is None else code) - if logging: - with open(logfile, "a") as f: - f.write(json.dumps(log) + os.linesep) - -sys.exit( run() ) diff --git a/scripts/ci/babysitter b/scripts/ci/babysitter new file mode 100755 index 00000000000..f8b5a6c345c --- /dev/null +++ b/scripts/ci/babysitter @@ -0,0 +1,409 @@ +#!/usr/bin/env python + +# Mimics GNU timeout, but does some fancy tracking based on custom features in mono nunit24. + +import argparse +import subprocess +import re +import signal +import time +import sys +import os.path +import copy +import tempfile +import calendar +import json + +### Constants + +# Here is how the communication with nunit works. It has to work with two constraints: +# - We don't invoke nunit directly. We invoke some Makefile which invokes some other Makefile +# and at some point down the line someone calls nunit. +# - nunit has to be able to report back to us even if (especially if) it terminates improperly. +# To deal with all this, communication babysitter->nunit is done by environment variables, +# and communication nunit->babysitter is done by leaving behind files in known locations. + +# Filenames + +CURRENT_TEST_FILE = "babysitter_report_current_test_file.txt" +RAN_TEST_FILE = "babysitter_report_ran_test_file.txt" +FAILED_TEST_FILE = "babysitter_report_failed_test_file.txt" +LOGGING_FILE = "babysitter_report.json_lines" + +# Environment keys + +# Keys used for Babysitter<->Nunit IPC +CURRENT_TEST_KEY = 'MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE' # Tell nunit where to leave files +RAN_TEST_KEY = 'MONO_BABYSITTER_NUNIT_RAN_TEST_FILE' +FAILED_TEST_KEY = 'MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE' +RUN_KEY = 'MONO_BABYSITTER_NUNIT_RUN_TEST' # Semicolon-separated list of test names +RUN_MODE_KEY = 'MONO_BABYSITTER_NUNIT_RUN_MODE' # Equal to either RUN or AFTER + +# Keys used for script configuration (see --help text) +LOG_FILE_KEY = 'MONO_BABYSITTER_LOG_FILE' # Path +RETRY_KEY = 'MONO_BABYSITTER_RETRY' # Equal to an integer +VERBOSE_KEY = 'MONO_BABYSITTER_VERBOSE' # "Undocumented"-- used for debugging babysitter + +# JSON keys + +DATE_JSON = 'date' # POSIX timestamp of test suite run +INVOKE_JSON = 'invocation' +COUNT_JSON = 'iteration' # How many times was command executed? +LIMIT_JSON = 'failure_max' +SUPPORT_JSON = 'babysitter_protocol' # Was the test suite running with a babysitter-aware nunit? +FINAL_CODE_JSON = 'final_code' +TESTS_JSON = 'tests' # Holds dictionary of (test case name)->(dict with TEST_ keys below) +TEST_FAILURES = 'normal_failures' +TEST_CRASH_FAILURES = 'crash_failures' +TEST_TIMEOUT_FAILURES = 'timeout_failures' + +### Interpret arguments + +scriptname = sys.argv[0] + +# This is very silly: This program needs to switch from argparse to manual parsing +# after the second positional argument, but argparse doesn't let you do this. +# I work around this with a custom subclass which can selectively swallow errors: +class Hesitate(Exception): + pass +class HesitantParser(argparse.ArgumentParser): + def __init__(s, *args, **kwargs): + s.hesitating = True # Errors will be swallowed until this is set false + argparse.ArgumentParser.__init__(s, *args, **kwargs) + def error(s, *args, **kwargs): + if s.hesitating: + raise Hesitate() # Bail out before errors are printed. + argparse.ArgumentParser.error(s, *args, **kwargs) + +# Define args +argparser = HesitantParser(description="""\ +Run a test suite with a timeout.\n +Durations are floating point numbers followed by an optional unit:\n +'s' for seconds (the default) +'m' for minutes +'h' for hours +'d' for days\n +supported environment variables: + %s: File to write logs to (as line-delimited JSON) + %s: If set to a number, failed test cases will be rerun this many times (NUnit test suites only)""" % + (LOG_FILE_KEY, RETRY_KEY), + formatter_class=argparse.RawTextHelpFormatter) +argparser.add_argument('-s', '--signal', dest='signal', metavar='signal', default='TERM', + help="Send this signal to the command on timeout, instead of TERM.") +argparser.add_argument('-k', '--kill-after-duration', dest='kill_after', metavar='duration', + help="If process continues running after signal, send KILL after this duration.") +argparser.add_argument('duration', + help="Time to run before sending signal.") +argparser.add_argument('command', nargs="+", help="Command+args to run.") + +# Repeatedly parse the given args until we find the shortest prefix for which parsing succeeds. +argc = len(sys.argv) +extra_args = [] +for limit in range(1,argc+1): + try: + if limit == argc: # On the final pass, parse for real + argparser.hesitating = False + args = argparser.parse_args(sys.argv[1:limit]) + # If we're still here, parse_args succeeded. + # The final parsed arg is the command; remaining argv items are its args. + extra_args = sys.argv[limit:] + break + except Hesitate: # Before the final pass, if parse_args fails, skip + pass + +argparser.hesitating = False # Just act like a normal argparser from here + +durationre = re.compile(r'(\d+)([smhd]?)') +def parse_duration(duration): # Accept units + match = durationre.match(duration) + if not match: + argparser.error("Could not understand duration %s" % duration) + time, units = match.group(1), match.group(2) + time = int(time) + if units == 'm': + time *= 60 + elif units == 'h': + time *= 60*60 + elif units == 'd': + time *= 60*60*24 + return time + +def parse_signal(sig): # Accept names + if sig.isdigit(): + return int(sig) + for k,v in signal.__dict__.iteritems(): + if k == ("SIG%s" % sig): + return v + argparser.error("Could not understand signal name %s" % sig) + +# Final interpretation of arguments +duration = parse_duration(args.duration) +kill_after = parse_duration(args.kill_after) if args.kill_after is not None else None +timeout_signal = parse_signal(args.signal) +command = args.command + extra_args + +# Process environment +global_env = copy.deepcopy( os.environ ) + +verbose = VERBOSE_KEY in global_env +logging = LOG_FILE_KEY in global_env +logfile = global_env[LOG_FILE_KEY] if logging else None +crash_resuming = True # TODO: Consider exposing this option, or adding a retry_on_crash option. +failmax = int(global_env[RETRY_KEY]) if RETRY_KEY in global_env else 0 +babysitting = True # If false, babysitter becomes a timeout clone with no env manipulation or anything. +if babysitting: + babysitter_dir = tempfile.mkdtemp() + global_env[CURRENT_TEST_KEY] = os.path.join(babysitter_dir, CURRENT_TEST_FILE) + global_env[RAN_TEST_KEY] = os.path.join(babysitter_dir, RAN_TEST_FILE) + global_env[FAILED_TEST_KEY] = os.path.join(babysitter_dir, FAILED_TEST_FILE) + +have_unix_process_groups = 'killpg' in os.__dict__ +have_windows_process_groups = 'CREATE_NEW_PROCESS_GROUP' in subprocess.__dict__ + +### Timeout implementation + +def wait(proc, duration): + # TODO: If we detect Python 3.3, Popen objects have a wait(timeout) method we can use + start = time.time() + while True: + code = proc.poll() + if code is not None: + return code + if time.time()-start > duration: + return None + time.sleep(0.05) + +# Popen and send_signal can't be called in their basic forms because we want to +# send signals to all children, not just to the immediately spawned process. +# Unfortunately the way to do this varies by operating system. +def popen(*args, **kwargs): + if have_unix_process_groups: # Call function on spawn to become process group leader + kwargs['preexec_fn'] = os.setsid + elif have_windows_process_groups: # Set magic flag for Windows process groups + kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP + return subprocess.Popen(*args, **kwargs) + +def send_signal(proc, sig): + if have_unix_process_groups: # UNIX + # For compatibility with GNU timeout, pre-send the signal to just the monitored process + os.kill(proc.pid, sig) + # Send signal to entire group + os.killpg(proc.pid, sig) + # For compatibility with GNU Timeout, send a SIGCONT after the signal + # (so delivery has a chance to occur even for stopped processes) + if sig != signal.SIGKILL and sig != signal.SIGCONT: + os.kill(proc.pid, signal.SIGCONT) + elif have_windows_process_groups: # Windows with Python 2.7 or better + os.kill(proc.pid, sig) # Becuase CREATE_NEW_PROCESS_GROUP, will go to entire group + else: # Windows with Python 2.6-- CREATE_NEW_PROCESS_GROUP not supported + proc.send_signal(sig) # No way to contact group, just kill process + +### Utility functions + +def attemptDelete(path): + try: + os.remove(path) + except OSError: + pass + +def attemptLines(path): + try: + with open(path) as f: + return map(lambda s: s.strip('\r\n'), f.readlines()) + except (OSError, IOError): + return [] + +def attemptFirstLine(path): + lines = attemptLines(path) + if lines: + return lines[0] + return None + +def posixtime(): # Amazingly, time.time() does not guarantee an epoch in the docs. However this does: + return calendar.timegm(time.gmtime()) + +failcount = {} +def failure_may_retry(test): + if test not in failcount: + failcount[test] = 0 + failcount[test] += 1 + return failcount[test] < failmax + +def verbose_print(arg): + if (verbose): + print(arg) + +def failure_annotate(test): + return "%s (failure #%d of %d allowed)" % (test, failcount[test], failmax) + +def pluralize(lst): + return "s" if len(lst) > 1 else "" + +### Run command + +def run(): # Returns exit code + resume_after = [] + retry_these = [] + ever_completed = False + died_politely = False + proc = None + code = None + + # Set up logging + log = {DATE_JSON: posixtime(), COUNT_JSON:0, LIMIT_JSON:failmax, SUPPORT_JSON:False, + INVOKE_JSON: " ".join(command)} + + def log_value(key, set=None, add=None, target=log): # Call to add toplevel value to log + if add is not None: + if key not in target: + target[key] = 0 + target[key] += add + else: + target[key] = set + + def log_test(testname, key, set=None, add=None): # Call to add test-case-level value to log + if TESTS_JSON not in log: + log[TESTS_JSON] = {} + if testname not in log[TESTS_JSON]: + log[TESTS_JSON][testname] = {} + log_value(key, set=set, add=add, target=log[TESTS_JSON][testname]) + + # Ready to run tests + try: + while True: + env = copy.copy(global_env) + if ever_completed: + retry_next = [] + else: # Persist reported failures list until first non-crash run + retry_next = retry_these + + log_value(COUNT_JSON, add=1) + + # Prepare environment/filesystem + if babysitting: + for key in [CURRENT_TEST_KEY, RAN_TEST_KEY, FAILED_TEST_KEY]: + attemptDelete(env[key]) + if resume_after: + env[RUN_KEY] = ";".join(resume_after) + env[RUN_MODE_KEY] = "EXCLUDE" + elif retry_these: + env[RUN_KEY] = ";".join(retry_these) + env[RUN_MODE_KEY] = "RUN" + + # Run test suite + try: + proc = popen(command, env=env) + except OSError: + died_politely = True + sys.stderr.write("%s: Could not execute command `%s`\n" % (scriptname, command[0])) + sys.exit(127) + + code = wait(proc, duration) + timed_out = code is None + if timed_out: # Initial timeout + send_signal(proc, timeout_signal) + if kill_after is not None: # Kill-after timeout + code = wait(proc, kill_after) + if code is None: + send_signal(proc, signal.SIGKILL) + code = proc.wait() # Waits forever + sys.stderr.write("%s: Command `%s` timed out\n" % (scriptname, command[0])) + died_politely = True + + # The test suite has now run, and what happens next varies: + # 1. The suite either completed fully without failures, or timed out: Just quit. + # 2. The suite crashed (halted without completing): + # Remember any failures for later and rerun, using a blacklist of testcases we have completed. + # 3. The suite completed, but there were failures reported: + # Rerun, using a whitelist of only reported-failed testcases. + # 4. The suite crashed partway through a run with a whitelist: + # Rerun, using a whitelist consisting of the previous whitelist minus successful testcases. + + crashed_at = attemptFirstLine(env[CURRENT_TEST_KEY]) + failed_tests = attemptLines(env[FAILED_TEST_KEY]) + ran_tests = attemptLines(env[RAN_TEST_KEY]) + bailout = False + + if crashed_at or failed_tests or ran_tests: # Test suite follows the babysitter protocol + log_value(SUPPORT_JSON, True) + + if not crashed_at and not ever_completed: # The resume_after whitelist is only + resume_after = [] # used before the first noncrashing run + ever_completed = True + + if timed_out: # Currently no retries after timeout + bailout = True + code = 124 # See GNU timeout manpage + + if code or crashed_at: # Process failures + # Handle crash failures + if crashed_at and not timed_out: + log_test(crashed_at, TEST_CRASH_FAILURES, add=1) + if not crash_resuming: + bailout = True + + if failure_may_retry(crashed_at): + if ever_completed: # Rerun with whitelist next time + for test in retry_these: # Prepopulate with last whitelist minus run testcases + if test == crashed_at or test not in ran_tests: # (plus crashed testcase) + retry_next.append(test) + else: # Rerun with blacklist next time + for test in ran_tests: # Add testcases we just ran to blacklist + if test != crashed_at: # (except for the crashed testcase) + resume_after.append(test) + else: + bailout = True + + # Handle reported failures + for test in failed_tests: + log_test(test, TEST_FAILURES, add=1) + if failure_may_retry(test): + retry_next.append(test) + else: + bailout = True + + # Report human-readable failures for stdout log. + message = "%s:" % (scriptname) + if timed_out: + message += " Saw timeout in test case %s (never allowed)." % (crashed_at) + elif crashed_at: + message += " Saw crash in test case %s." % (failure_annotate(crashed_at)) + if failed_tests: + message += " Saw test failure in test case%s %s." % (pluralize(failed_tests), "; ".join(map(failure_annotate, failed_tests))) + if not (timed_out or crashed_at or failed_tests): + message += " Test suite terminated with code %d, " % (code) + if log[SUPPORT_JSON]: + message += "but failure did not occur during a test case. Halting." + else: + message += "and suite cannot report test case data. Halting." + elif bailout: + message += " Will halt testing." + print(message) + + if bailout or not (resume_after or retry_next): # If not retrying + return code + + # If we got here, a retry is occurring + retry_these = retry_next + + # Report human-readable retry notice for stdout log. + message = "%s: Will rerun test suite" % (scriptname) + if log[COUNT_JSON] > 1: + message += " (iteration #%d)" % (log[COUNT_JSON]) + if resume_after: + message += ", resuming at crashed testcase %s." % (crashed_at) + else: + message += ", running previously failed testcase%s: %s." % (pluralize(retry_these), "; ".join(retry_these)) + print(message) + finally: + # Emergency: Ensure command does not outlive this script + if proc is not None and not died_politely: + send_signal(proc, signal.SIGKILL) + + # Write out logs + log_value(FINAL_CODE_JSON, "EXCEPTION" if code is None else code) + if logging: + with open(logfile, "a") as f: + f.write(json.dumps(log) + os.linesep) + +sys.exit( run() ) diff --git a/scripts/ci/run-jenkins.sh b/scripts/ci/run-jenkins.sh new file mode 100755 index 00000000000..2507bc9777f --- /dev/null +++ b/scripts/ci/run-jenkins.sh @@ -0,0 +1,101 @@ +#!/bin/bash -e + +TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh + +export TEST_HARNESS_VERBOSE=1 + +if [[ ${label} == 'osx-i386' ]]; then EXTRA_CONF_FLAGS="--with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --enable-nls=no --build=i386-apple-darwin11.2.0"; fi +if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="--with-libgdiplus=/Library/Frameworks/Mono.framework/Versions/Current/lib/libgdiplus.dylib --enable-nls=no"; fi +if [[ ${label} == 'w32' ]]; then PLATFORM=Win32; EXTRA_CONF_FLAGS="--host=i686-pc-mingw32"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\Win32\\\bin\\\Release_SGen\\\mono-sgen.exe`";fi +if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="--host=i686-pc-mingw32"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\x64\\\bin\\\Release_SGen\\\mono-sgen.exe`"; fi + +${TESTCMD} --label=configure --timeout=60m --fatal ./autogen.sh --with-monodroid --with-monotouch --with-monotouch_watch --with-monotouch_tv --with-xammac --with-mobile_static $EXTRA_CONF_FLAGS +if [[ ${label} == w* ]]; + then + ${TESTCMD} --label=make-msvc --timeout=60m --fatal "/cygdrive/c/Program\ Files\ \(x86\)/MSBuild/12.0/Bin/MSBuild.exe" /p:Platform=${PLATFORM} /p:Configuration=Release msvc/mono.sln + ${TESTCMD} --label=make-msvc-sgen --timeout=60m --fatal "/cygdrive/c/Program\ Files\ \(x86\)/MSBuild/12.0/Bin/MSBuild.exe" /p:Platform=${PLATFORM} /p:Configuration=Release_SGen msvc/mono.sln +fi +${TESTCMD} --label=make --timeout=300m --fatal make -w V=1 +if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]]; + then + exit 0 + # we don't run the test suite on Windows PRs, we just ensure the build succeeds, so end here +fi +${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k check +${TESTCMD} --label=runtime --timeout=120m make -w -C mono/tests -k test-wrench V=1 CI=1 +${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test +${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall +${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check +${TESTCMD} --label=compiler --timeout=30m make -w -C mcs/tests run-test +${TESTCMD} --label=compiler-errors --timeout=30m make -w -C mcs/errors run-test +${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test +${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test +${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test +${TESTCMD} --label=System.Security --timeout=5m make -w -C mcs/class/System.Security run-test +${TESTCMD} --label=System.Drawing --timeout=5m make -w -C mcs/class/System.Drawing run-test +if [[ ${label} == osx-* ]] +then ${TESTCMD} --label=Windows.Forms --skip +else ${TESTCMD} --label=Windows.Forms --timeout=5m make -w -C mcs/class/System.Windows.Forms run-test +fi +${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test +${TESTCMD} --label=System.Data.OracleClient --timeout=5m make -w -C mcs/class/System.Data.OracleClient run-test +${TESTCMD} --label=System.Design --timeout=5m make -w -C mcs/class/System.Design run-test +${TESTCMD} --label=Mono.Posix --timeout=5m make -w -C mcs/class/Mono.Posix run-test +${TESTCMD} --label=System.Web --timeout=30m make -w -C mcs/class/System.Web run-test +${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test +${TESTCMD} --label=System.Runtime.SFS --timeout=5m make -w -C mcs/class/System.Runtime.Serialization.Formatters.Soap run-test +${TESTCMD} --label=System.Runtime.Remoting --timeout=5m make -w -C mcs/class/System.Runtime.Remoting run-test +${TESTCMD} --label=Cscompmgd --timeout=5m make -w -C mcs/class/Cscompmgd run-test +${TESTCMD} --label=Commons.Xml.Relaxng --timeout=5m make -w -C mcs/class/Commons.Xml.Relaxng run-test +${TESTCMD} --label=System.ServiceProcess --timeout=5m make -w -C mcs/class/System.ServiceProcess run-test +${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test +${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test +${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test +${TESTCMD} --label=System.DirectoryServices --timeout=5m make -w -C mcs/class/System.DirectoryServices run-test +${TESTCMD} --label=Microsoft.Build.Engine --timeout=5m make -w -C mcs/class/Microsoft.Build.Engine run-test +${TESTCMD} --label=Microsoft.Build.Framework --timeout=5m make -w -C mcs/class/Microsoft.Build.Framework run-test +${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test +${TESTCMD} --label=Microsoft.Build.Utilities --timeout=5m make -w -C mcs/class/Microsoft.Build.Utilities run-test +${TESTCMD} --label=Mono.C5 --timeout=5m make -w -C mcs/class/Mono.C5 run-test +${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System.Configuration run-test +${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test +${TESTCMD} --label=System.Web.Extensions --timeout=5m make -w -C mcs/class/System.Web.Extensions run-test +${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test +${TESTCMD} --label=symbolicate --timeout=60m make -w -C mcs/tools/mono-symbolicate check +${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test +${TESTCMD} --label=System.Data.DSE --timeout=5m make -w -C mcs/class/System.Data.DataSetExtensions run-test +${TESTCMD} --label=System.Web.Abstractions --timeout=5m make -w -C mcs/class/System.Web.Abstractions run-test +${TESTCMD} --label=System.Web.Routing --timeout=5m make -w -C mcs/class/System.Web.Routing run-test +${TESTCMD} --label=System.Runtime.Serialization --timeout=5m make -w -C mcs/class/System.Runtime.Serialization run-test +${TESTCMD} --label=System.IdentityModel --timeout=5m make -w -C mcs/class/System.IdentityModel run-test +${TESTCMD} --label=System.ServiceModel --timeout=15m make -w -C mcs/class/System.ServiceModel run-test +${TESTCMD} --label=System.ServiceModel.Web --timeout=5m make -w -C mcs/class/System.ServiceModel.Web run-test +${TESTCMD} --label=System.Web.Extensions-standalone --timeout=5m make -w -C mcs/class/System.Web.Extensions run-standalone-test +${TESTCMD} --label=System.ComponentModel.DataAnnotations --timeout=5m make -w -C mcs/class/System.ComponentModel.DataAnnotations run-test +${TESTCMD} --label=Mono.CodeContracts --timeout=5m make -w -C mcs/class/Mono.CodeContracts run-test +${TESTCMD} --label=System.Runtime.Caching --timeout=5m make -w -C mcs/class/System.Runtime.Caching run-test +${TESTCMD} --label=System.Data.Services --timeout=5m make -w -C mcs/class/System.Data.Services run-test +${TESTCMD} --label=System.Web.DynamicData --timeout=5m make -w -C mcs/class/System.Web.DynamicData run-test +${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test +${TESTCMD} --label=WindowsBase --timeout=5m make -w -C mcs/class/WindowsBase run-test +${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test +${TESTCMD} --label=System.Runtime.DurableInstancing --timeout=5m make -w -C mcs/class/System.Runtime.DurableInstancing run-test +${TESTCMD} --label=System.ServiceModel.Discovery --timeout=5m make -w -C mcs/class/System.ServiceModel.Discovery run-test +${TESTCMD} --label=System.Xaml --timeout=5m make -w -C mcs/class/System.Xaml run-test +${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test +${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test +${TESTCMD} --label=System.Threading.Tasks.Dataflow --timeout=5m make -w -C mcs/class/System.Threading.Tasks.Dataflow run-test +${TESTCMD} --label=Mono.Debugger.Soft --timeout=5m make -w -C mcs/class/Mono.Debugger.Soft run-test +${TESTCMD} --label=Microsoft.Build --timeout=5m make -w -C mcs/class/Microsoft.Build run-test +${TESTCMD} --label=monodoc --timeout=10m make -w -C mcs/tools/mdoc run-test +${TESTCMD} --label=Microsoft.Build-12 --timeout=10m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_12 +${TESTCMD} --label=Microsoft.Build.Engine-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Engine run-test PROFILE=xbuild_12 +${TESTCMD} --label=Microsoft.Build.Framework-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Framework run-test PROFILE=xbuild_12 +${TESTCMD} --label=Microsoft.Build.Tasks-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_12 +${TESTCMD} --label=Microsoft.Build.Utilities-12 --timeout=60m make -w -C mcs/class/Microsoft.Build.Utilities run-test PROFILE=xbuild_12 +${TESTCMD} --label=Microsoft.Build-14 --timeout=60m make -w -C mcs/class/Microsoft.Build run-test PROFILE=xbuild_14 +${TESTCMD} --label=Microsoft.Build.Engine-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Engine run-test PROFILE=xbuild_14 +${TESTCMD} --label=Microsoft.Build.Framework-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Framework run-test PROFILE=xbuild_14 +${TESTCMD} --label=Microsoft.Build.Tasks-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Tasks run-test PROFILE=xbuild_14 +${TESTCMD} --label=Microsoft.Build.Utilities-14 --timeout=60m make -w -C mcs/class/Microsoft.Build.Utilities run-test PROFILE=xbuild_14 +rm -fr /tmp/jenkins-temp-aspnet* diff --git a/scripts/ci/run-step.sh b/scripts/ci/run-step.sh new file mode 100755 index 00000000000..4ea5fbc4c3a --- /dev/null +++ b/scripts/ci/run-step.sh @@ -0,0 +1,60 @@ +#!/bin/bash -e +TIMEOUTCMD=`dirname "${BASH_SOURCE[0]}"`/babysitter +if ! ${TIMEOUTCMD} -h >/dev/null 2>&1; then + TIMEOUTCMD=timeout # fall back to timeout if babysitter doesn't work (e.g. python not installed or wrong version) +fi + +export MONO_BABYSITTER_LOG_FILE=babysitter_report.json_lines + +helptext () +{ + echo "run-step.sh {--label=LABEL} {--skip|--timeout=TIMEOUT [--fatal]} command to run with arguments" +} + +for i in "$@" +do +case $i in + --help) + helptext + exit 0 + ;; + --label=*) + LABEL="${i#*=}" + shift # past argument=value + ;; + --timeout=*) + TIMEOUT="${i#*=}" + shift # past argument=value + ;; + --fatal) + FATAL="true" + shift # past argument + ;; + --skip) + SKIP="true" + shift # past argument + ;; + *) + # unknown option, assume just part of cmdline + ;; +esac +done +if [ -n "${SKIP}" ] && [ -z "${LABEL}" ] + then helptext + exit 1 +fi +if [ -n "${SKIP}" ] + then echo -e "*** start: ${LABEL}\n*** end(0): ${LABEL}: \e[45mSkipped\e[0m" + exit 0 +fi +if [ -z "${LABEL}" ] || [ -z "${TIMEOUT}" ] + then helptext + exit 1 +fi +STARTTIME=`date +%s` +echo "*** start: ${LABEL}" +if [ -n "${FATAL}" ]; then + ${TIMEOUTCMD} --signal=ABRT --kill-after=60s ${TIMEOUT} "$@" && echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[42mPassed\e[0m" || (echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[41mFailed\e[0m" && exit 1) +else + ${TIMEOUTCMD} --signal=ABRT --kill-after=60s ${TIMEOUT} "$@" && echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[42mPassed\e[0m" || echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[43mUnstable\e[0m" +fi