diff options
author | Katelyn Gadd <kg@luminance.org> | 2018-02-23 01:48:37 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-02-23 01:48:37 +0300 |
commit | f0b78251899a5d98f16f84ef53ec777102c29ace (patch) | |
tree | d551f19008d04d33326e95f78a28a13ad32b3f25 | |
parent | 123d086e27efa803ff4894f3670bd449d8b9712a (diff) |
Updates to support building the BCL using Visual Studio 2017 on windows (#6877)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | mcs/class/Commons.Xml.Relaxng/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/Microsoft.Build/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/Mono.CSharp/Makefile | 2 | ||||
-rw-r--r-- | mcs/class/Mono.Xml.Ext/Makefile | 4 | ||||
-rw-r--r-- | mcs/ilasm/Makefile | 2 | ||||
-rw-r--r-- | mcs/jay/defs.h | 2 | ||||
-rw-r--r-- | mcs/jay/main.c | 51 | ||||
-rw-r--r-- | mcs/jay/output.c | 218 | ||||
-rw-r--r-- | mcs/mcs/Makefile | 2 | ||||
-rw-r--r-- | mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/NUnitCore/core/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs | 4 | ||||
-rw-r--r-- | msvc/scripts/System.Web.pre | 2 | ||||
-rw-r--r-- | msvc/scripts/csproj.tmpl | 1 | ||||
-rw-r--r-- | msvc/scripts/genproj.cs | 149 |
21 files changed, 273 insertions, 197 deletions
diff --git a/.gitignore b/.gitignore index c6ef19a849b..c37d4fce3f0 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ Ankh.NoLoad *.gpState .vscode/ *.exp +.vs/ # Tooling _ReSharper*/ diff --git a/mcs/class/Commons.Xml.Relaxng/Makefile b/mcs/class/Commons.Xml.Relaxng/Makefile index 1febae4eb1e..f9b57fea265 100644 --- a/mcs/class/Commons.Xml.Relaxng/Makefile +++ b/mcs/class/Commons.Xml.Relaxng/Makefile @@ -22,7 +22,7 @@ EXTRA_DISTFILES = \ $(RESOURCE_FILES) Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs - $(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $(CURDIR)/Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs + $(topdir)/jay/jay -ctv -o Commons.Xml.Relaxng.Rnc/RncParser.cs $< < $(topdir)/jay/skeleton.cs BUILT_SOURCES = Commons.Xml.Relaxng.Rnc/RncParser.cs diff --git a/mcs/class/Microsoft.Build/Makefile b/mcs/class/Microsoft.Build/Makefile index 2dcbefdf7f9..1a711069b0b 100644 --- a/mcs/class/Microsoft.Build/Makefile +++ b/mcs/class/Microsoft.Build/Makefile @@ -26,7 +26,7 @@ EXTRA_DISTFILES = \ EXPR_PARSER = Microsoft.Build.Internal/ExpressionParser $(EXPR_PARSER).cs: $(EXPR_PARSER).jay $(topdir)/jay/skeleton.cs - (cd Microsoft.Build.Internal; $(topdir)/../jay/jay -ctv < $(topdir)/../jay/skeleton.cs ExpressionParser.jay > ExpressionParser.cs) + (cd Microsoft.Build.Internal; $(topdir)/../jay/jay -ctv -o ExpressionParser.cs ExpressionParser.jay < $(topdir)/../jay/skeleton.cs ) BUILT_SOURCES = $(EXPR_PARSER).cs diff --git a/mcs/class/Mono.CSharp/Makefile b/mcs/class/Mono.CSharp/Makefile index 7b1986b78e5..3615532853d 100644 --- a/mcs/class/Mono.CSharp/Makefile +++ b/mcs/class/Mono.CSharp/Makefile @@ -24,7 +24,7 @@ LIB_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS) BUILT_SOURCES = $(PROFILE)-parser.cs $(PROFILE)-parser.cs: $(topdir)/mcs/cs-parser.jay $(topdir)/jay/skeleton.cs - $(topdir)/jay/jay -c < $(topdir)/jay/skeleton.cs $< > $(PROFILE)-jay-tmp.out && mv $(PROFILE)-jay-tmp.out $@ + $(topdir)/jay/jay -c -o $(PROFILE)-jay-tmp.out $< < $(topdir)/jay/skeleton.cs && mv $(PROFILE)-jay-tmp.out $@ include ../../build/library.make diff --git a/mcs/class/Mono.Xml.Ext/Makefile b/mcs/class/Mono.Xml.Ext/Makefile index dc49f816fee..16498215a38 100644 --- a/mcs/class/Mono.Xml.Ext/Makefile +++ b/mcs/class/Mono.Xml.Ext/Makefile @@ -29,13 +29,13 @@ Mono.Xml.XPath2/XQueryParser.jay: Mono.Xml.XPath2/ParserBase.jay $(SKELETON) Mono.Xml.XPath2/XPath2Parser.cs: Mono.Xml.XPath2/XPath2Parser.jay echo "#define XPATH2_PARSER" > $@ echo "#if NET_2_0" >> $@ - $(topdir)/jay/jay -ct < $(SKELETON) $(CURDIR)/$< >>$@ + $(topdir)/jay/jay -ct $(CURDIR)/$< < $(SKELETON) >>$@ echo "#endif" >> $@ Mono.Xml.XPath2/XQueryParser.cs: Mono.Xml.XPath2/XQueryParser.jay $(SKELETON) echo "#define XQUERY_PARSER" > $@ echo "#if NET_2_0" >> $@ - $(topdir)/jay/jay -ct < $(SKELETON) $(CURDIR)/$< >>$@ + $(topdir)/jay/jay -ct $(CURDIR)/$< < $(SKELETON) >>$@ echo "#endif" >> $@ Mono.Xml.XPath2/XPath2Tokenizer.cs: Mono.Xml.XPath2/TokenizerBase.cs diff --git a/mcs/ilasm/Makefile b/mcs/ilasm/Makefile index 090d1cc3231..4ca11545781 100644 --- a/mcs/ilasm/Makefile +++ b/mcs/ilasm/Makefile @@ -13,7 +13,7 @@ EXTRA_DISTFILES = \ $(wildcard tests/*.il) ILParser.cs: parser/ILParser.jay $(topdir)/jay/skeleton.cs - $(topdir)/jay/jay -ct < $(topdir)/jay/skeleton.cs $(CURDIR)/$< >$@ + $(topdir)/jay/jay -ct -o $@ $(CURDIR)/$< < $(topdir)/jay/skeleton.cs include ../build/executable.make diff --git a/mcs/jay/defs.h b/mcs/jay/defs.h index b5dfc4303b8..fd9fc2348ee 100644 --- a/mcs/jay/defs.h +++ b/mcs/jay/defs.h @@ -237,12 +237,14 @@ extern char *input_file_name; extern char *prolog_file_name; extern char *local_file_name; extern char *verbose_file_name; +extern char *output_file_name; extern FILE *action_file; extern FILE *input_file; extern FILE *prolog_file; extern FILE *local_file; extern FILE *verbose_file; +extern FILE *output_file; extern int nitems; extern int nrules; diff --git a/mcs/jay/main.c b/mcs/jay/main.c index e0397635719..2dc3580bd18 100644 --- a/mcs/jay/main.c +++ b/mcs/jay/main.c @@ -70,6 +70,7 @@ char *input_file_name = (char*)""; char *prolog_file_name; char *local_file_name; char *verbose_file_name; +char *output_file_name = 0; FILE *action_file; /* a temp file, used to save actions associated */ /* with rules until the parser is written */ @@ -77,6 +78,7 @@ FILE *input_file; /* the input file */ FILE *prolog_file; /* temp files, used to save text until all */ FILE *local_file; /* symbols have been defined */ FILE *verbose_file; /* y.output */ +FILE *output_file; /* defaults to stdout */ int nitems; int nrules; @@ -113,6 +115,7 @@ done (int k) if (action_file) { fclose(action_file); unlink(action_file_name); } if (prolog_file) { fclose(prolog_file); unlink(prolog_file_name); } if (local_file) { fclose(local_file); unlink(local_file_name); } + if (output_file && (output_file != stdout)) { fclose(output_file); if (k != 0) unlink(output_file_name); } exit(k); } @@ -143,7 +146,7 @@ set_signals (void) static void usage (void) { - fprintf(stderr, "usage: %s [-tvcp] [-b file_prefix] filename\n", myname); + fprintf(stderr, "usage: %s [-tvcp] [-b file_prefix] [-o output_filename] input_filename\n", myname); exit(1); } @@ -172,9 +175,9 @@ getargs (int argc, char *argv[]) if (i + 1 < argc) usage(); return; - case '-': - ++i; - goto no_more_options; + case '-': + ++i; + goto no_more_options; case 'b': if (*++s) @@ -185,13 +188,22 @@ getargs (int argc, char *argv[]) usage(); continue; - case 't': - tflag = 1; - break; + case 'o': + if (*++s) + output_file_name = s; + else if (++i < argc) + output_file_name = argv[i]; + else + usage(); + continue; + + case 't': + tflag = 1; + break; case 'p': - print_skel_dir (); - break; + print_skel_dir (); + break; case 'c': csharp = 1; @@ -222,12 +234,12 @@ getargs (int argc, char *argv[]) vflag = 1; break; - case 'p': - print_skel_dir (); - break; + case 'p': + print_skel_dir (); + break; - case 'c': - csharp = 1; + case 'c': + csharp = 1; line_format = "#line %d \"%s\"\n"; default_line_format = "#line default\n"; @@ -359,6 +371,17 @@ open_files (void) if (verbose_file == 0) open_error(verbose_file_name); } + + if (output_file == 0) + { + if (output_file_name != 0) { + output_file = fopen(output_file_name, "w"); + if (output_file == 0) + open_error(output_file_name); + } else { + output_file = stdout; + } + } } diff --git a/mcs/jay/output.c b/mcs/jay/output.c index 9e883a7504d..859415a69f4 100644 --- a/mcs/jay/output.c +++ b/mcs/jay/output.c @@ -141,7 +141,7 @@ output (void) fprintf(stderr, "jay: line %d is too long\n", lno), done(1); switch (buf[0]) { case '#': continue; - case 't': if (!tflag) fputs("//t", stdout); + case 't': if (!tflag) fputs("//t", output_file); case '.': break; default: cp = strtok(buf, " \t\r\n"); @@ -162,7 +162,7 @@ output (void) } continue; } - fputs(buf+1, stdout), ++ outline; + fputs(buf+1, output_file), ++ outline; } free_parser(); } @@ -173,19 +173,19 @@ output_rule_data (void) register int i; register int j; - printf("/*\n All more than 3 lines long rules are wrapped into a method\n*/\n"); + fprintf(output_file, "/*\n All more than 3 lines long rules are wrapped into a method\n*/\n"); for (i = 0; i < nmethods; ++i) { - printf("%s", methods[i]); + fprintf(output_file, "%s", methods[i]); FREE(methods[i]); - printf("\n\n"); + fprintf(output_file, "\n\n"); } FREE(methods); - printf(default_line_format, ++outline + 1); + fprintf(output_file, default_line_format, ++outline + 1); - printf(" %s static %s short [] yyLhs = {%16d,", + fprintf(output_file, " %s static %s short [] yyLhs = {%16d,", csharp ? "" : " protected", csharp ? "readonly" : "final", symbol_value[start_symbol]); @@ -196,18 +196,18 @@ output_rule_data (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; - printf("%5d,", symbol_value[rlhs[i]]); + fprintf(output_file, "%5d,", symbol_value[rlhs[i]]); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); - printf(" %s static %s short [] yyLen = {%12d,", + fprintf(output_file, " %s static %s short [] yyLen = {%12d,", csharp ? "" : "protected", csharp ? "readonly" : "final", 2); @@ -218,16 +218,16 @@ output_rule_data (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else j++; - printf("%5d,", rrhs[i + 1] - rrhs[i] - 1); + fprintf(output_file, "%5d,", rrhs[i + 1] - rrhs[i] - 1); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); } static void @@ -235,7 +235,7 @@ output_yydefred (void) { register int i, j; - printf(" %s static %s short [] yyDefRed = {%13d,", + fprintf(output_file, " %s static %s short [] yyDefRed = {%13d,", csharp ? "" : "protected", csharp ? "readonly" : "final", (defred[0] ? defred[0] - 2 : 0)); @@ -248,15 +248,15 @@ output_yydefred (void) else { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } - printf("%5d,", (defred[i] ? defred[i] - 2 : 0)); + fprintf(output_file, "%5d,", (defred[i] ? defred[i] - 2 : 0)); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); } static void @@ -380,7 +380,7 @@ goto_actions (void) state_count = NEW2(nstates, short); k = default_goto(start_symbol + 1); - printf(" protected static %s short [] yyDgoto = {%14d,", csharp ? "readonly" : "final", k); + fprintf(output_file, " protected static %s short [] yyDgoto = {%14d,", csharp ? "readonly" : "final", k); save_column(start_symbol + 1, k); j = 10; @@ -389,19 +389,19 @@ goto_actions (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; k = default_goto(i); - printf("%5d,", k); + fprintf(output_file, "%5d,", k); save_column(i, k); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); FREE(state_count); } @@ -696,7 +696,7 @@ output_base (void) { register int i, j; - printf(" protected static %s short [] yySindex = {%13d,", csharp? "readonly":"final", base[0]); + fprintf(output_file, " protected static %s short [] yySindex = {%13d,", csharp? "readonly":"final", base[0]); j = 10; for (i = 1; i < nstates; i++) @@ -704,17 +704,17 @@ output_base (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; - printf("%5d,", base[i]); + fprintf(output_file, "%5d,", base[i]); } outline += 2; - printf("\n };\n protected static %s short [] yyRindex = {%13d,", + fprintf(output_file, "\n };\n protected static %s short [] yyRindex = {%13d,", csharp ? "readonly" : "final", base[nstates]); @@ -724,17 +724,17 @@ output_base (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; - printf("%5d,", base[i]); + fprintf(output_file, "%5d,", base[i]); } outline += 2; - printf("\n };\n protected static %s short [] yyGindex = {%13d,", + fprintf(output_file, "\n };\n protected static %s short [] yyGindex = {%13d,", csharp ? "readonly" : "final", base[2*nstates]); @@ -744,17 +744,17 @@ output_base (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; - printf("%5d,", base[i]); + fprintf(output_file, "%5d,", base[i]); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); FREE(base); } @@ -764,7 +764,7 @@ output_table (void) register int i; register int j; - printf(" protected static %s short [] yyTable = {%14d,", csharp ? "readonly" : "final", table[0]); + fprintf(output_file, " protected static %s short [] yyTable = {%14d,", csharp ? "readonly" : "final", table[0]); j = 10; for (i = 1; i <= high; i++) @@ -772,17 +772,17 @@ output_table (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; - printf("%5d,", table[i]); + fprintf(output_file, "%5d,", table[i]); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); FREE(table); } @@ -792,7 +792,7 @@ output_check (void) register int i; register int j; - printf(" protected static %s short [] yyCheck = {%14d,", + fprintf(output_file, " protected static %s short [] yyCheck = {%14d,", csharp ? "readonly" : "final", check[0]); @@ -802,17 +802,17 @@ output_check (void) if (j >= 10) { ++outline; - putchar('\n'); + putc('\n', output_file); j = 1; } else ++j; - printf("%5d,", check[i]); + fprintf(output_file, "%5d,", check[i]); } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); FREE(check); } @@ -859,30 +859,30 @@ output_defines (const char *prefix) if (is_C_identifier(s)) { if (prefix) - printf(" %s ", prefix); + fprintf(output_file, " %s ", prefix); c = *s; if (c == '"') { while ((c = *++s) != '"') { - putchar(c); + putc(c, output_file); } } else { do { - putchar(c); + putc(c, output_file); } while ((c = *++s)); } ++outline; - printf(" = %d%s\n", symbol_value[i], csharp ? ";" : ";"); + fprintf(output_file, " = %d%s\n", symbol_value[i], csharp ? ";" : ";"); } } ++outline; - printf(" %s yyErrorCode = %d%s\n", prefix ? prefix : "", symbol_value[1], csharp ? ";" : ";"); + fprintf(output_file, " %s yyErrorCode = %d%s\n", prefix ? prefix : "", symbol_value[1], csharp ? ";" : ";"); } static void @@ -898,14 +898,14 @@ output_stored_text (FILE *file, const char *name) if ((c = getc(in)) != EOF) { if (c == '\n') ++outline; - putchar(c); + putc(c, output_file); while ((c = getc(in)) != EOF) { if (c == '\n') ++outline; - putchar(c); + putc(c, output_file); } - printf(default_line_format, ++outline + 1); + fprintf(output_file, default_line_format, ++outline + 1); } fclose(in); } @@ -918,67 +918,67 @@ output_debug (void) const char * prefix = tflag ? "" : "//t"; ++outline; - printf(" protected %s int yyFinal = %d;\n", csharp ? "const" : "static final", final_state); + fprintf(output_file, " protected %s int yyFinal = %d;\n", csharp ? "const" : "static final", final_state); ++outline; - printf ("%s // Put this array into a separate class so it is only initialized if debugging is actually used\n", prefix); - printf ("%s // Use MarshalByRefObject to disable inlining\n", prefix); - printf("%s class YYRules %s {\n", prefix, csharp ? ": MarshalByRefObject" : ""); - printf("%s public static %s string [] yyRule = {\n", prefix, csharp ? "readonly" : "final"); + fprintf(output_file, "%s // Put this array into a separate class so it is only initialized if debugging is actually used\n", prefix); + fprintf(output_file, "%s // Use MarshalByRefObject to disable inlining\n", prefix); + fprintf(output_file, "%s class YYRules %s {\n", prefix, csharp ? ": MarshalByRefObject" : ""); + fprintf(output_file, "%s public static %s string [] yyRule = {\n", prefix, csharp ? "readonly" : "final"); for (i = 2; i < nrules; ++i) { - printf("%s \"%s :", prefix, symbol_name[rlhs[i]]); + fprintf(output_file, "%s \"%s :", prefix, symbol_name[rlhs[i]]); for (j = rrhs[i]; ritem[j] > 0; ++j) { s = symbol_name[ritem[j]]; if (s[0] == '"') { - printf(" \\\""); + fprintf(output_file, " \\\""); while (*++s != '"') { if (*s == '\\') { if (s[1] == '\\') - printf("\\\\\\\\"); + fprintf(output_file, "\\\\\\\\"); else - printf("\\\\%c", s[1]); + fprintf(output_file, "\\\\%c", s[1]); ++s; } else - putchar(*s); + putc(*s, output_file); } - printf("\\\""); + fprintf(output_file, "\\\""); } else if (s[0] == '\'') { if (s[1] == '"') - printf(" '\\\"'"); + fprintf(output_file, " '\\\"'"); else if (s[1] == '\\') { if (s[2] == '\\') - printf(" '\\\\\\\\"); + fprintf(output_file, " '\\\\\\\\"); else - printf(" '\\\\%c", s[2]); + fprintf(output_file, " '\\\\%c", s[2]); s += 2; while (*++s != '\'') - putchar(*s); - putchar('\''); + putc(*s, output_file); + putc('\'', output_file); } else - printf(" '%c'", s[1]); + fprintf(output_file, " '%c'", s[1]); } else - printf(" %s", s); + fprintf(output_file, " %s", s); } ++outline; - printf("\",\n"); + fprintf(output_file, "\",\n"); } ++ outline; - printf("%s };\n", prefix); - printf ("%s public static string getRule (int index) {\n", prefix); - printf ("%s return yyRule [index];\n", prefix); - printf ("%s }\n", prefix); - printf ("%s}\n", prefix); + fprintf(output_file, "%s };\n", prefix); + fprintf(output_file, "%s public static string getRule (int index) {\n", prefix); + fprintf(output_file, "%s return yyRule [index];\n", prefix); + fprintf(output_file, "%s }\n", prefix); + fprintf(output_file, "%s}\n", prefix); max = 0; for (i = 2; i < ntokens; ++i) @@ -987,7 +987,7 @@ output_debug (void) /* need yyNames for yyExpecting() */ - printf(" protected static %s string [] yyNames = {", csharp ? "readonly" : "final"); + fprintf(output_file, " protected static %s string [] yyNames = {", csharp ? "readonly" : "final"); symnam = (char **) MALLOC((max+1)*sizeof(char *)); if (symnam == 0) no_space(); @@ -999,7 +999,7 @@ output_debug (void) symnam[symbol_value[i]] = symbol_name[i]; symnam[0] = (char*)"end-of-file"; - j = 70; fputs(" ", stdout); + j = 70; fputs(" ", output_file); for (i = 0; i <= max; ++i) { if ((s = symnam[i])) @@ -1021,25 +1021,25 @@ output_debug (void) if (j > 70) { ++outline; - printf("\n "); + fprintf(output_file, "\n "); j = k; } - printf("\"\\\""); + fprintf(output_file, "\"\\\""); s = symnam[i]; while (*++s != '"') { if (*s == '\\') { - printf("\\\\"); + fprintf(output_file, "\\\\"); if (*++s == '\\') - printf("\\\\"); + fprintf(output_file, "\\\\"); else - putchar(*s); + putc(*s, output_file); } else - putchar(*s); + putc(*s, output_file); } - printf("\\\"\","); + fprintf(output_file, "\\\"\","); } else if (s[0] == '\'') { @@ -1049,10 +1049,10 @@ output_debug (void) if (j > 70) { ++outline; - printf("\n "); + fprintf(output_file, "\n "); j = 7; } - printf("\"'\\\"'\","); + fprintf(output_file, "\"'\\\"'\","); } else { @@ -1071,25 +1071,25 @@ output_debug (void) if (j > 70) { ++outline; - printf("\n "); + fprintf(output_file, "\n "); j = k; } - printf("\"'"); + fprintf(output_file, "\"'"); s = symnam[i]; while (*++s != '\'') { if (*s == '\\') { - printf("\\\\"); + fprintf(output_file, "\\\\"); if (*++s == '\\') - printf("\\\\"); + fprintf(output_file, "\\\\"); else - putchar(*s); + putc(*s, output_file); } else - putchar(*s); + putc(*s, output_file); } - printf("'\","); + fprintf(output_file, "'\","); } } else @@ -1099,12 +1099,12 @@ output_debug (void) if (j > 70) { ++outline; - printf("\n "); + fprintf(output_file, "\n "); j = k; } - putchar('"'); - do { putchar(*s); } while (*++s); - printf("\","); + putc('"', output_file); + do { putc(*s, output_file); } while (*++s); + fprintf(output_file, "\","); } } else @@ -1113,14 +1113,14 @@ output_debug (void) if (j > 70) { ++outline; - printf("\n "); + fprintf(output_file, "\n "); j = 5; } - printf("null,"); + fprintf(output_file, "null,"); } } outline += 2; - printf("\n };\n"); + fprintf(output_file, "\n };\n"); FREE(symnam); } @@ -1141,19 +1141,19 @@ output_trailing_text (void) if ((c = getc(in)) == EOF) return; ++outline; - printf(line_format, lineno, input_file_name); + fprintf(output_file, line_format, lineno, input_file_name); if (c == '\n') ++outline; - putchar(c); + putc(c, output_file); last = c; } else { ++outline; - printf(line_format, lineno, input_file_name); - do { putchar(c); } while ((c = *++cptr) != '\n'); + fprintf(output_file, line_format, lineno, input_file_name); + do { putc(c, output_file); } while ((c = *++cptr) != '\n'); ++outline; - putchar('\n'); + putc('\n', output_file); last = '\n'; } @@ -1161,16 +1161,16 @@ output_trailing_text (void) { if (c == '\n') ++outline; - putchar(c); + putc(c, output_file); last = c; } if (last != '\n') { ++outline; - putchar('\n'); + putc('\n', output_file); } - printf(default_line_format, ++outline + 1); + fprintf(output_file, default_line_format, ++outline + 1); } static void @@ -1189,22 +1189,22 @@ output_semantic_actions (void) last = c; if (c == '\n') ++outline; - putchar(c); + putc(c, output_file); while ((c = getc(action_file)) != EOF) { if (c == '\n') ++outline; - putchar(c); + putc(c, output_file); last = c; } if (last != '\n') { ++outline; - putchar('\n'); + putc('\n', output_file); } - printf(default_line_format, ++outline + 1); + fprintf(output_file, default_line_format, ++outline + 1); } static void diff --git a/mcs/mcs/Makefile b/mcs/mcs/Makefile index dbd71a3d581..dbf040afdd6 100644 --- a/mcs/mcs/Makefile +++ b/mcs/mcs/Makefile @@ -32,7 +32,7 @@ BUILT_SOURCES = cs-parser.cs CLEAN_FILES += y.output %-parser.cs: %-parser.jay $(topdir)/jay/skeleton.cs - $(topdir)/jay/jay $(JAY_FLAGS) < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@ + $(topdir)/jay/jay $(JAY_FLAGS) -o jay-tmp.out $< < $(topdir)/jay/skeleton.cs && mv jay-tmp.out $@ KEEP_OUTPUT_FILE_COPY = yes diff --git a/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs b/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs index 919ca07ace3..6489c1b2a58 100644 --- a/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs +++ b/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs @@ -5,7 +5,3 @@ // ****************************************************************
using System.Reflection;
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs b/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs index 919ca07ace3..6489c1b2a58 100644 --- a/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs +++ b/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs @@ -5,7 +5,3 @@ // ****************************************************************
using System.Reflection;
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs b/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs index 747032c7e63..2f66d80222c 100644 --- a/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs +++ b/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs @@ -7,7 +7,3 @@ using System; using System.Reflection;
[assembly: CLSCompliant(true)]
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs b/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs index fa86732b3d3..efeaecf1986 100644 --- a/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs +++ b/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs @@ -8,7 +8,3 @@ using System; using System.Reflection;
[assembly: CLSCompliant(true)]
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs b/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs index fa86732b3d3..efeaecf1986 100644 --- a/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs +++ b/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs @@ -8,7 +8,3 @@ using System; using System.Reflection;
[assembly: CLSCompliant(true)]
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs b/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs index a9553f691cd..2b4b5bfb340 100644 --- a/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs +++ b/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs @@ -8,7 +8,3 @@ using System; using System.Reflection;
[assembly: CLSCompliant(true)]
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs b/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs index fa86732b3d3..efeaecf1986 100644 --- a/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs +++ b/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs @@ -8,7 +8,3 @@ using System; using System.Reflection;
[assembly: CLSCompliant(true)]
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs b/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs index 599b04ce453..f87ae602810 100644 --- a/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs +++ b/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs @@ -6,7 +6,3 @@ using System;
using System.Reflection;
-
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("../../nunit.snk")]
-[assembly: AssemblyKeyName("")]
diff --git a/msvc/scripts/System.Web.pre b/msvc/scripts/System.Web.pre index c071bf45bfd..8f8d262597f 100644 --- a/msvc/scripts/System.Web.pre +++ b/msvc/scripts/System.Web.pre @@ -1 +1 @@ -@MONO@ $(ProjectDir)\..\lib\net_4_x\culevel.exe -o $(ProjectDir)\System.Web\UplevelHelper.cs $(ProjectDir)\UplevelHelperDefinitions.xml +@MONO@ $([MSBuild]::GetDirectoryNameOfFileAbove($(TargetDir), culevel.exe))\culevel.exe -o $(ProjectDir)\System.Web\UplevelHelper.cs $(ProjectDir)\UplevelHelperDefinitions.xml diff --git a/msvc/scripts/csproj.tmpl b/msvc/scripts/csproj.tmpl index 642c9537321..c18b51d334e 100644 --- a/msvc/scripts/csproj.tmpl +++ b/msvc/scripts/csproj.tmpl @@ -17,6 +17,7 @@ <IntermediateOutputPath>obj-@OUTPUTSUFFIX@</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
@NOSTDLIB@
+ @METADATAVERSION@
@STARTUPOBJECT@
@NOCONFIG@
@ALLOWUNSAFE@
diff --git a/msvc/scripts/genproj.cs b/msvc/scripts/genproj.cs index e139f222fc8..4b6d2fe1359 100644 --- a/msvc/scripts/genproj.cs +++ b/msvc/scripts/genproj.cs @@ -27,27 +27,43 @@ public enum Target { class SlnGenerator { public static readonly string NewLine = "\r\n"; //Environment.NewLine; // "\n"; - public SlnGenerator (string formatVersion = "2012") + public SlnGenerator (string slnVersion) { - switch (formatVersion) { - case "2008": - this.header = MakeHeader ("10.00", "2008"); - break; - default: - this.header = MakeHeader ("12.00", "2012"); - break; - } + Console.WriteLine("Requested sln version is {0}", slnVersion); + this.header = MakeHeader ("12.00", "15", "15.0.0.0"); } - const string project_start = "Project(\"{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}\") = \"{0}\", \"{1}\", \"{2}\""; // Note: No need to double up on {} around {2} + const string project_start = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; // Note: No need to double up on {} around {2} const string project_end = "EndProject"; + public List<string> profiles = new List<string> { + "net_4_x", + "monodroid", + "monotouch", + "monotouch_tv", + "monotouch_watch", + "orbis", + "unreal", + "wasm", + "winaot", + "xammac", + }; + + const string jay_vcxproj_guid = "{5D485D32-3B9F-4287-AB24-C8DA5B89F537}"; + const string jay_sln_guid = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; + public List<MsbuildGenerator.VsCsproj> libraries = new List<MsbuildGenerator.VsCsproj> (); string header; - string MakeHeader (string formatVersion, string yearTag) + string MakeHeader (string formatVersion, string yearTag, string minimumVersion) { - return string.Format ("Microsoft Visual Studio Solution File, Format Version {0}" + NewLine + "# Visual Studio {1}", formatVersion, yearTag); + return string.Format ( + "Microsoft Visual Studio Solution File, Format Version {0}" + NewLine + + "# Visual Studio {1}" + NewLine + + "MinimumVisualStudioVersion = {2}", + formatVersion, yearTag, + minimumVersion + ); } public void Add (MsbuildGenerator.VsCsproj vsproj) @@ -59,6 +75,40 @@ class SlnGenerator { } } + private void WriteProjectReference (StreamWriter sln, string prefixGuid, string library, string relativePath, string projectGuid, params string[] dependencyGuids) + { + sln.WriteLine (project_start, prefixGuid, library, relativePath, projectGuid); + + foreach (var guid in dependencyGuids) { + sln.WriteLine (" ProjectSection(ProjectDependencies) = postProject"); + sln.WriteLine (" {0} = {0}", guid); + sln.WriteLine (" EndProjectSection"); + } + + sln.WriteLine (project_end); + } + + private void WriteProjectReference (StreamWriter sln, string slnFullPath, MsbuildGenerator.VsCsproj proj) + { + var unixProjFile = proj.csProjFilename.Replace ("\\", "/"); + var fullProjPath = Path.GetFullPath (unixProjFile); + var relativePath = MsbuildGenerator.GetRelativePath (slnFullPath, fullProjPath); + var dependencyGuids = new string[0]; + if (proj.preBuildEvent.Contains ("jay")) + dependencyGuids = new [] { jay_vcxproj_guid }; + WriteProjectReference(sln, "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", proj.library, relativePath, proj.projectGuid, dependencyGuids); + } + + private void WriteProjectConfigurationPlatforms (StreamWriter sln, string guid, string platformToBuild) + { + foreach (var profile in profiles) { + sln.WriteLine ("\t\t{0}.Debug|{1}.ActiveCfg = Debug|{2}", guid, profile, platformToBuild); + sln.WriteLine ("\t\t{0}.Debug|{1}.Build.0 = Debug|{2}", guid, profile, platformToBuild); + sln.WriteLine ("\t\t{0}.Release|{1}.ActiveCfg = Release|{2}", guid, profile, platformToBuild); + sln.WriteLine ("\t\t{0}.Release|{1}.Build.0 = Release|{2}", guid, profile, platformToBuild); + } + } + public void Write (string filename) { var fullPath = Path.GetDirectoryName (filename) + "/"; @@ -66,27 +116,32 @@ class SlnGenerator { using (var sln = new StreamWriter (filename)) { sln.WriteLine (); sln.WriteLine (header); + + // Manually insert jay's vcxproj. We depend on jay.exe to perform build steps later. + WriteProjectReference (sln, jay_sln_guid, "jay", "mcs\\jay\\jay.vcxproj", jay_vcxproj_guid); + foreach (var proj in libraries) { - var unixProjFile = proj.csProjFilename.Replace ("\\", "/"); - var fullProjPath = Path.GetFullPath (unixProjFile); - sln.WriteLine (project_start, proj.library, MsbuildGenerator.GetRelativePath (fullPath, fullProjPath), proj.projectGuid); - sln.WriteLine (project_end); + WriteProjectReference (sln, fullPath, proj); } + sln.WriteLine ("Global"); sln.WriteLine ("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - sln.WriteLine ("\t\tDebug|Any CPU = Debug|Any CPU"); - sln.WriteLine ("\t\tRelease|Any CPU = Release|Any CPU"); + foreach (var profile in profiles) { + sln.WriteLine ("\t\tDebug|{0} = Debug|{0}", profile); + sln.WriteLine ("\t\tRelease|{0} = Release|{0}", profile); + } sln.WriteLine ("\tEndGlobalSection"); sln.WriteLine ("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); + + // Manually insert jay's configurations because they are different + WriteProjectConfigurationPlatforms (sln, jay_vcxproj_guid, "Win32"); + foreach (var proj in libraries) { - var guid = proj.projectGuid; - sln.WriteLine ("\t\t{0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU", guid); - sln.WriteLine ("\t\t{0}.Debug|Any CPU.Build.0 = Debug|Any CPU", guid); - sln.WriteLine ("\t\t{0}.Release|Any CPU.ActiveCfg = Release|Any CPU", guid); - sln.WriteLine ("\t\t{0}.Release|Any CPU.Build.0 = Release|Any CPU", guid); + WriteProjectConfigurationPlatforms (sln, proj.projectGuid, "Any CPU"); } + sln.WriteLine ("\tEndGlobalSection"); sln.WriteLine ("\tGlobalSection(SolutionProperties) = preSolution"); @@ -634,6 +689,7 @@ class MsbuildGenerator { public List<VsCsproj> projReferences = new List<VsCsproj> (); public string library; public MsbuildGenerator MsbuildGenerator; + public string preBuildEvent, postBuildEvent; } public VsCsproj Csproj; @@ -682,7 +738,7 @@ class MsbuildGenerator { fx_version = "4.0"; profile = "net_4_0"; } else if (response.Contains (profile_4_x)) { - fx_version = "4.5"; + fx_version = "4.6.2"; profile = "net_4_x"; } } @@ -887,6 +943,26 @@ class MsbuildGenerator { bool basic_or_build = (library.Contains ("-basic") || library.Contains ("-build")); + // If an EXE is built with nostdlib, it won't work unless run with mono.exe. This stops our build steps + // from working in visual studio (because we already replace @MONO@ with '' on Windows.) + + if (Target != Target.Library) + StdLib = true; + + // We have our target framework set to 4.5 in many places because broken scripts check for files with 4.5 + // in the path, even though we compile code that uses 4.6 features. So we need to manually fix that here. + + if (fx_version == "4.5") + fx_version = "4.6.2"; + + // The VS2017 signing system fails to sign using this key for some reason, so for now, + // just disable code signing for the nunit assemblies. It's not important. + // I'd rather fix this by updating the makefiles but it seems to be impossible to disable + // code signing in our make system... + + if (StrongNameKeyFile?.Contains("nunit.snk") ?? false) + StrongNameKeyFile = null; + // // Replace the template values // @@ -899,6 +975,9 @@ class MsbuildGenerator { " <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", StrongNameKeyFile, StrongNameDelaySign ? " <DelaySign>true</DelaySign>" + NewLine : ""); } + + string assemblyName = Path.GetFileNameWithoutExtension (output_name); + Csproj.output = template. Replace ("@OUTPUTTYPE@", Target == Target.Library ? "Library" : "Exe"). Replace ("@SIGNATURE@", strongNameSection). @@ -911,7 +990,7 @@ class MsbuildGenerator { Replace ("@NOCONFIG@", "<NoConfig>" + (!load_default_config).ToString () + "</NoConfig>"). Replace ("@ALLOWUNSAFE@", Unsafe ? "<AllowUnsafeBlocks>true</AllowUnsafeBlocks>" : ""). Replace ("@FX_VERSION", fx_version). - Replace ("@ASSEMBLYNAME@", Path.GetFileNameWithoutExtension (output_name)). + Replace ("@ASSEMBLYNAME@", assemblyName). Replace ("@OUTPUTDIR@", build_output_dir). Replace ("@OUTPUTSUFFIX@", Path.GetFileName (build_output_dir)). Replace ("@DEFINECONSTANTS@", defines.ToString ()). @@ -925,7 +1004,11 @@ class MsbuildGenerator { Replace ("@ADDITIONALLIBPATHS@", String.Empty). Replace ("@RESOURCES@", resources.ToString ()). Replace ("@OPTIMIZE@", Optimize ? "true" : "false"). - Replace ("@SOURCES@", sources.ToString ()); + Replace ("@SOURCES@", sources.ToString ()). + Replace ("@METADATAVERSION@", assemblyName == "mscorlib" ? "<RuntimeMetadataVersion>Mono</RuntimeMetadataVersion>" : ""); + + Csproj.preBuildEvent = prebuild; + Csproj.postBuildEvent = postbuild; //Console.WriteLine ("Generated {0}", ofile.Replace ("\\", "/")); using (var o = new StreamWriter (generatedProjFile)) { @@ -944,15 +1027,13 @@ class MsbuildGenerator { if (q != -1) target = target + Load (library.Substring (0, q) + suffix); - if (target.IndexOf ("@MONO@") != -1){ - target_unix = target.Replace ("@MONO@", "mono").Replace ("@CAT@", "cat"); - target_windows = target.Replace ("@MONO@", "").Replace ("@CAT@", "type"); - } else { - target_unix = target.Replace ("jay.exe", "jay"); - target_windows = target; - } + target_unix = target.Replace ("@MONO@", "mono").Replace ("@CAT@", "cat"); + target_windows = target.Replace ("@MONO@", "").Replace ("@CAT@", "type"); + + target_unix = target_unix.Replace ("\\jay\\jay.exe", "\\jay\\jay\\jay"); + target_unix = target_unix.Replace ("@COPY@", "cp"); - target_windows = target_unix.Replace ("@COPY@", "copy"); + target_windows = target_windows.Replace ("@COPY@", "copy"); target_unix = target_unix.Replace ("\r", ""); const string condition_unix = "Condition=\" '$(OS)' != 'Windows_NT' \""; |