From b078895e893c2896b1dbdff3fac055aa2f7f2b1f Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Tue, 31 May 2016 12:56:57 -0400 Subject: [PATCH] [genproj] Getting closer to a full build * Add TODO list * Use -useSourcePath when building resources, so we do not need to add the explicit extra path * More updates, now battling resource generation across the board * Use newlines in the Unix commands to avoid generating things like cs-parser.cs^M --- build-libs.bat | 3 ++ build-libs.sh | 2 +- .../Microsoft.Build-net_4_x.csproj | 2 + mcs/class/Mono.Data.Sqlite/Makefile | 2 +- mcs/class/Mono.Data.Sqlite/resources/SR.resx | 6 +-- ....ComponentModel.Composition-net_4_x.csproj | 4 +- ...System.Data.Services.Client-net_4_x.csproj | 4 +- .../System.Web.Razor-net_4_x.csproj | 6 ++- mcs/ilasm/ilasm-net_4_x.csproj | 4 ++ mcs/mcs/mcs-net_4_x.csproj | 4 +- msvc/scripts/Microsoft.Build.pre | 1 + .../System.ComponentModel.Composition.pre | 1 + msvc/scripts/System.Data.Services.Client.pre | 1 + msvc/scripts/System.Web.Razor.pre | 2 + msvc/scripts/TODO.md | 11 +++++ msvc/scripts/genproj.cs | 6 ++- msvc/scripts/ilasm.pre | 2 + msvc/scripts/mcs.pre | 1 + msvc/scripts/prepare.cs | 42 +++++++++++++++++++ net_4_x.sln | 12 +++--- 20 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 msvc/scripts/Microsoft.Build.pre create mode 100644 msvc/scripts/System.ComponentModel.Composition.pre create mode 100644 msvc/scripts/System.Data.Services.Client.pre create mode 100644 msvc/scripts/System.Web.Razor.pre create mode 100644 msvc/scripts/TODO.md create mode 100644 msvc/scripts/ilasm.pre diff --git a/build-libs.bat b/build-libs.bat index df0d97868d6..342a6b8daf3 100644 --- a/build-libs.bat +++ b/build-libs.bat @@ -1,4 +1,7 @@ @echo off cd mcs\jay vcbuild jay.vcxproj +cd msvc\scripts +csc prepare.cs +prepare.exe ..\..\mcs core msbuild net_4_x.sln diff --git a/build-libs.sh b/build-libs.sh index 1b339764f88..f7583abaa03 100755 --- a/build-libs.sh +++ b/build-libs.sh @@ -1,4 +1,4 @@ #!/bin/sh (cd mcs/jay; make) -(cd msvc/scripts/; make prepare.exe; mono prepare.exe `pwd`/mcs core) +(cd msvc/scripts/; make prepare.exe; mono prepare.exe ../../mcs core) msbuild net_4_x.sln diff --git a/mcs/class/Microsoft.Build/Microsoft.Build-net_4_x.csproj b/mcs/class/Microsoft.Build/Microsoft.Build-net_4_x.csproj index 5c862548286..2c795c82303 100644 --- a/mcs/class/Microsoft.Build/Microsoft.Build-net_4_x.csproj +++ b/mcs/class/Microsoft.Build/Microsoft.Build-net_4_x.csproj @@ -167,9 +167,11 @@ --> +$(ProjectDir)\..\..\jay\jay -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs +$(ProjectDir)\..\..\jay\jay.exe -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs diff --git a/mcs/class/Mono.Data.Sqlite/Makefile b/mcs/class/Mono.Data.Sqlite/Makefile index a5453d47d27..35eb5c1bb81 100644 --- a/mcs/class/Mono.Data.Sqlite/Makefile +++ b/mcs/class/Mono.Data.Sqlite/Makefile @@ -42,5 +42,5 @@ $(PREBUILT): %.prebuilt: % cp $* $@ $(RESX_RESOURCES): %.resources: %.resx - $(RESGEN) $< || cp $@.prebuilt $@ + $(RESGEN) -useSourcePath $< || cp $@.prebuilt $@ diff --git a/mcs/class/Mono.Data.Sqlite/resources/SR.resx b/mcs/class/Mono.Data.Sqlite/resources/SR.resx index 9851beb1a81..082a3e024a7 100644 --- a/mcs/class/Mono.Data.Sqlite/resources/SR.resx +++ b/mcs/class/Mono.Data.Sqlite/resources/SR.resx @@ -119,12 +119,12 @@ - resources/DataTypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + DataTypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE - resources/MetaDataCollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + MetaDataCollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - \ No newline at end of file + diff --git a/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition-net_4_x.csproj b/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition-net_4_x.csproj index 7f8014de96b..a676a9be185 100644 --- a/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition-net_4_x.csproj +++ b/mcs/class/System.ComponentModel.Composition.4.5/System.ComponentModel.Composition-net_4_x.csproj @@ -232,10 +232,10 @@ --> - +resgen $(ProjectDir)\src\ComponentModel\Strings.resx $(ProjectDir)\Microsoft.Internal.Strings.resx - +resgen $(ProjectDir)\src\ComponentModel\Strings.resx $(ProjectDir)\Microsoft.Internal.Strings.resx diff --git a/mcs/class/System.Data.Services.Client/System.Data.Services.Client-net_4_x.csproj b/mcs/class/System.Data.Services.Client/System.Data.Services.Client-net_4_x.csproj index 86f2abd37b1..55b9e130c8c 100644 --- a/mcs/class/System.Data.Services.Client/System.Data.Services.Client-net_4_x.csproj +++ b/mcs/class/System.Data.Services.Client/System.Data.Services.Client-net_4_x.csproj @@ -173,10 +173,10 @@ --> - +resgen $(ProjectDir)\Client\System.Data.Services.Client.txt $(ProjectDir)\Client\System.Data.Services.Client.resx - +resgen $(ProjectDir)\Client\System.Data.Services.Client.txt $(ProjectDir)\Client\System.Data.Services.Client.resx diff --git a/mcs/class/System.Web.Razor/System.Web.Razor-net_4_x.csproj b/mcs/class/System.Web.Razor/System.Web.Razor-net_4_x.csproj index 495234806c5..561a784fa70 100644 --- a/mcs/class/System.Web.Razor/System.Web.Razor-net_4_x.csproj +++ b/mcs/class/System.Web.Razor/System.Web.Razor-net_4_x.csproj @@ -213,10 +213,12 @@ --> - +resgen $(ProjectDir)\..\..\..\external\aspnetwebstack\src\CommonResources.resx $(ProjectDir)\System.Web.Razor.Common.CommonResources.resx +resgen $(ProjectDir)\..\..\..\external\aspnetwebstack\src\System.Web.Razor\Resources\RazorResources.resx $(ProjectDir)\System.Web.Razor.Resources.RazorResources.resx - +resgen $(ProjectDir)\..\..\..\external\aspnetwebstack\src\CommonResources.resx $(ProjectDir)\System.Web.Razor.Common.CommonResources.resx +resgen $(ProjectDir)\..\..\..\external\aspnetwebstack\src\System.Web.Razor\Resources\RazorResources.resx $(ProjectDir)\System.Web.Razor.Resources.RazorResources.resx diff --git a/mcs/ilasm/ilasm-net_4_x.csproj b/mcs/ilasm/ilasm-net_4_x.csproj index bb3643e628c..338a2ea7c56 100644 --- a/mcs/ilasm/ilasm-net_4_x.csproj +++ b/mcs/ilasm/ilasm-net_4_x.csproj @@ -144,9 +144,13 @@ --> +$(ProjectDir)\..\jay\jay -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs + +$(ProjectDir)\..\jay\jay.exe -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs + diff --git a/mcs/mcs/mcs-net_4_x.csproj b/mcs/mcs/mcs-net_4_x.csproj index e36e17bc2d0..5e67322f296 100644 --- a/mcs/mcs/mcs-net_4_x.csproj +++ b/mcs/mcs/mcs-net_4_x.csproj @@ -123,12 +123,14 @@ --> -$(ProjectDir)\..\jay\jay -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs +$(ProjectDir)\..\jay\jay -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs + $(ProjectDir)\..\jay\jay.exe -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs + diff --git a/msvc/scripts/Microsoft.Build.pre b/msvc/scripts/Microsoft.Build.pre new file mode 100644 index 00000000000..7d981d52698 --- /dev/null +++ b/msvc/scripts/Microsoft.Build.pre @@ -0,0 +1 @@ +$(ProjectDir)\..\..\jay\jay.exe -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs diff --git a/msvc/scripts/System.ComponentModel.Composition.pre b/msvc/scripts/System.ComponentModel.Composition.pre new file mode 100644 index 00000000000..70fe6d0bff8 --- /dev/null +++ b/msvc/scripts/System.ComponentModel.Composition.pre @@ -0,0 +1 @@ +resgen $(ProjectDir)\src\ComponentModel\Strings.resx $(ProjectDir)\Microsoft.Internal.Strings.resx \ No newline at end of file diff --git a/msvc/scripts/System.Data.Services.Client.pre b/msvc/scripts/System.Data.Services.Client.pre new file mode 100644 index 00000000000..a8709db4c93 --- /dev/null +++ b/msvc/scripts/System.Data.Services.Client.pre @@ -0,0 +1 @@ +resgen $(ProjectDir)\Client\System.Data.Services.Client.txt $(ProjectDir)\Client\System.Data.Services.Client.resx \ No newline at end of file diff --git a/msvc/scripts/System.Web.Razor.pre b/msvc/scripts/System.Web.Razor.pre new file mode 100644 index 00000000000..a33b050d616 --- /dev/null +++ b/msvc/scripts/System.Web.Razor.pre @@ -0,0 +1,2 @@ +resgen $(ProjectDir)\..\..\..\external\aspnetwebstack\src\CommonResources.resx $(ProjectDir)\System.Web.Razor.Common.CommonResources.resx +resgen $(ProjectDir)\..\..\..\external\aspnetwebstack\src\System.Web.Razor\Resources\RazorResources.resx $(ProjectDir)\System.Web.Razor.Resources.RazorResources.resx \ No newline at end of file diff --git a/msvc/scripts/TODO.md b/msvc/scripts/TODO.md new file mode 100644 index 00000000000..7d195a3f4e0 --- /dev/null +++ b/msvc/scripts/TODO.md @@ -0,0 +1,11 @@ +These are the tasks that are pending in the MSVC scripts to fully roll it out: + +[ ] Validate that all generated assemblies are identical +[ ] Add support for listing CLEAN_FILES in the `csproj` file +[ ] Adding an "install" target +[ ] On Windows- have a solution that builds both runtime and libraries all in one +[ ] Add the other profiles (mobile, iOS, etc) +[ ] Generate the dependency files +[ ] Eliminate the need for "build-libs.sh/build-libs.bat" at the toplevel with proper MSBuild idioms +[ ] Integrate the "update-solution-files" with each build, so we auto-update the files on commits +[ ] Make it work with MSBuild instead of xbuild diff --git a/msvc/scripts/genproj.cs b/msvc/scripts/genproj.cs index 7c775bb70c9..5205c6ed6ad 100644 --- a/msvc/scripts/genproj.cs +++ b/msvc/scripts/genproj.cs @@ -921,7 +921,7 @@ class MsbuildGenerator { int q = library.IndexOf ("-"); 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"); @@ -929,6 +929,10 @@ class MsbuildGenerator { target_unix = target.Replace ("jay.exe", "jay"); target_windows = target; } + target_unix = target_unix.Replace ("@COPY@", "cp"); + target_windows = target_unix.Replace ("@COPY@", "copy"); + + target_unix = target_unix.Replace ("\r", ""); const string condition_unix = "Condition=\" '$(OS)' != 'Windows_NT' \""; const string condition_windows = "Condition=\" '$(OS)' == 'Windows_NT' \""; var result = diff --git a/msvc/scripts/ilasm.pre b/msvc/scripts/ilasm.pre new file mode 100644 index 00000000000..fec25b7d0c6 --- /dev/null +++ b/msvc/scripts/ilasm.pre @@ -0,0 +1,2 @@ +$(ProjectDir)\..\jay\jay.exe -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs + diff --git a/msvc/scripts/mcs.pre b/msvc/scripts/mcs.pre index 0c19d3a7dc6..2126ebd7731 100644 --- a/msvc/scripts/mcs.pre +++ b/msvc/scripts/mcs.pre @@ -1 +1,2 @@ $(ProjectDir)\..\jay\jay.exe -ct < $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs + diff --git a/msvc/scripts/prepare.cs b/msvc/scripts/prepare.cs index fba952f0701..20f78e5cf85 100644 --- a/msvc/scripts/prepare.cs +++ b/msvc/scripts/prepare.cs @@ -17,6 +17,46 @@ class Prepare { } } } + + static void SystemDataConnectionReplace (string srcdir, string targetdir, string target, string ns, string factory, string conn) + { + var t = File.ReadAllText (Path.Combine (srcdir, "DbConnectionHelper.cs")); + + File.WriteAllText (Path.Combine (targetdir, target), t.Replace ("NAMESPACE", ns).Replace ("CONNECTIONFACTORYOBJECTNAME", factory).Replace ("CONNECTIONOBJECTNAME", conn)); + } + + static void SystemDataParameterReplace (string srcdir, string targetdir, string target, string resns, string ns, string parname) + { + var t = File.ReadAllText (Path.Combine (srcdir, "DbParameterHelper.cs")); + + File.WriteAllText (Path.Combine (targetdir, target), t.Replace ("RESNAMESPACE", resns).Replace ("NAMESPACE", ns).Replace ("PARAMETEROBJECTNAME", parname)); + } + + static void SystemDataParameterCollReplace (string srcdir, string targetdir, string target, string resns, string ns, string parname) + { + var t = File.ReadAllText (Path.Combine (srcdir, "DbParameterCollectionHelper.cs")); + + Console.WriteLine ("Creating " + Path.Combine (targetdir, target)); + File.WriteAllText (Path.Combine (targetdir, target), t.Replace ("RESNAMESPACE", resns).Replace ("PARAMETERCOLLECTIONOBJECTNAME", parname + "Collection").Replace ("NAMESPACE", ns).Replace ("PARAMETEROBJECTNAME", parname)); + } + + static void GenerateSystemData (string bdir) + { + var rs = Path.Combine (bdir, "class", "referencesource", "System.Data", "System", "Data", "ProviderBase"); + var sd = Path.Combine (bdir, "class", "System.Data"); + + SystemDataConnectionReplace (rs, sd, "gen_OdbcConnection.cs", "System.Data.Odbc", "OdbcConnectionFactory.SingletonInstance", "OdbcConnection"); + SystemDataConnectionReplace (rs, sd, "gen_OleDbConnection.cs", "System.Data.OleDb", "OleDbConnectionFactory.SingletonInstance", "OleDbConnection"); + SystemDataConnectionReplace (rs, sd, "gen_SqlConnection.cs", "System.Data.SqlClient", "SqlConnectionFactory.SingletonInstance", "SqlConnection"); + + SystemDataParameterReplace (rs, sd, "gen_OdbcParameter.cs", "System.Data", "System.Data.Odbc", "OdbcParameter"); + SystemDataParameterReplace (rs, sd, "gen_OleDbParameter.cs", "System.Data", "System.Data.OleDb", "OleDbParameter"); + SystemDataParameterReplace (rs, sd, "gen_SqlParameter.cs", "System.Data", "System.Data.SqlClient", "SqlParameter"); + + SystemDataParameterCollReplace (rs, sd, "gen_OdbcParameterCollection.cs", "System.Data", "System.Data.Odbc", "OdbcParameter"); + SystemDataParameterCollReplace (rs, sd, "gen_OleDbParameterCollection.cs", "System.Data", "System.Data.OleDb", "OleDbParameter"); + SystemDataParameterCollReplace (rs, sd, "gen_SqlParameterCollection.cs", "System.Data", "System.Data.SqlClient", "SqlParameter"); + } static void Main (string [] args) { @@ -32,6 +72,8 @@ class Prepare { Filter (bdir + "/build/common/Consts.cs.in", bdir + "/build/common/Consts.cs", (i, o) => o.Write (i.ReadToEnd ().Replace ("@MONO_VERSION@", "2.5.0"))); + + GenerateSystemData (bdir); break; default: diff --git a/net_4_x.sln b/net_4_x.sln index ba17c5e4e21..55750f27a09 100644 --- a/net_4_x.sln +++ b/net_4_x.sln @@ -23,10 +23,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security-net_4_x", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Core-net_4_x", "mcs/class/System.Core/System.Core-net_4_x.csproj", "{359142A1-D80F-401E-AA64-7167C9317649}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix-net_4_x", "mcs/class/Mono.Posix/Mono.Posix-net_4_x.csproj", "{66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.CompilerServices.SymbolWriter-net_4_x", "mcs/class/Mono.CompilerServices.SymbolWriter/Mono.CompilerServices.SymbolWriter-net_4_x.csproj", "{88177C4B-894F-485D-B95A-44199C06BE9F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix-net_4_x", "mcs/class/Mono.Posix/Mono.Posix-net_4_x.csproj", "{66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Core-plaincore-net_4_x", "mcs/class/System.Core/System.Core-plaincore-net_4_x.csproj", "{1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resgen-net_4_x", "mcs/tools/resgen/resgen-net_4_x.csproj", "{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}" @@ -725,14 +725,14 @@ Global {359142A1-D80F-401E-AA64-7167C9317649}.Debug|Any CPU.Build.0 = Debug|Any CPU {359142A1-D80F-401E-AA64-7167C9317649}.Release|Any CPU.ActiveCfg = Release|Any CPU {359142A1-D80F-401E-AA64-7167C9317649}.Release|Any CPU.Build.0 = Release|Any CPU - {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.Build.0 = Release|Any CPU {88177C4B-894F-485D-B95A-44199C06BE9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {88177C4B-894F-485D-B95A-44199C06BE9F}.Debug|Any CPU.Build.0 = Debug|Any CPU {88177C4B-894F-485D-B95A-44199C06BE9F}.Release|Any CPU.ActiveCfg = Release|Any CPU {88177C4B-894F-485D-B95A-44199C06BE9F}.Release|Any CPU.Build.0 = Release|Any CPU + {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66DBB049-785B-4C2E-9EF6-C9E163F7DDD1}.Release|Any CPU.Build.0 = Release|Any CPU {1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}.Debug|Any CPU.Build.0 = Debug|Any CPU {1EC0EBC0-0B35-454C-89AE-3F8F0FDD9705}.Release|Any CPU.ActiveCfg = Release|Any CPU -- 2.25.1