Skip to content

Commit

Permalink
[genproj] Getting closer to a full build
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
migueldeicaza committed May 31, 2016
1 parent d156027 commit b078895
Show file tree
Hide file tree
Showing 20 changed files with 97 additions and 19 deletions.
3 changes: 3 additions & 0 deletions build-libs.bat
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion build-libs.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions mcs/class/Microsoft.Build/Microsoft.Build-net_4_x.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
$(ProjectDir)\..\..\jay\jay -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs

</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
$(ProjectDir)\..\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs

</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
Expand Down
2 changes: 1 addition & 1 deletion mcs/class/Mono.Data.Sqlite/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ $(PREBUILT): %.prebuilt: %
cp $* $@

$(RESX_RESOURCES): %.resources: %.resx
$(RESGEN) $< || cp $@.prebuilt $@
$(RESGEN) -useSourcePath $< || cp $@.prebuilt $@

6 changes: 3 additions & 3 deletions mcs/class/Mono.Data.Sqlite/resources/SR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="DataTypes" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>resources/DataTypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
<value>DataTypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="Keywords" xml:space="preserve">
<value>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</value>
</data>
<data name="MetaDataCollections" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>resources/MetaDataCollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
<value>MetaDataCollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

resgen $(ProjectDir)\src\ComponentModel\Strings.resx $(ProjectDir)\Microsoft.Internal.Strings.resx
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">

resgen $(ProjectDir)\src\ComponentModel\Strings.resx $(ProjectDir)\Microsoft.Internal.Strings.resx
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

resgen $(ProjectDir)\Client\System.Data.Services.Client.txt $(ProjectDir)\Client\System.Data.Services.Client.resx
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">

resgen $(ProjectDir)\Client\System.Data.Services.Client.txt $(ProjectDir)\Client\System.Data.Services.Client.resx
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

Expand Down
6 changes: 4 additions & 2 deletions mcs/class/System.Web.Razor/System.Web.Razor-net_4_x.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

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
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">

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
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

Expand Down
4 changes: 4 additions & 0 deletions mcs/ilasm/ilasm-net_4_x.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,13 @@
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
$(ProjectDir)\..\jay\jay -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs


</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
$(ProjectDir)\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs


</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
Expand Down
4 changes: 3 additions & 1 deletion mcs/mcs/mcs-net_4_x.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,14 @@
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
$(ProjectDir)\..\jay\jay -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs
$(ProjectDir)\..\jay\jay -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs


</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
$(ProjectDir)\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs


</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">

Expand Down
1 change: 1 addition & 0 deletions msvc/scripts/Microsoft.Build.pre
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$(ProjectDir)\..\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs
1 change: 1 addition & 0 deletions msvc/scripts/System.ComponentModel.Composition.pre
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resgen $(ProjectDir)\src\ComponentModel\Strings.resx $(ProjectDir)\Microsoft.Internal.Strings.resx
1 change: 1 addition & 0 deletions msvc/scripts/System.Data.Services.Client.pre
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resgen $(ProjectDir)\Client\System.Data.Services.Client.txt $(ProjectDir)\Client\System.Data.Services.Client.resx
2 changes: 2 additions & 0 deletions msvc/scripts/System.Web.Razor.pre
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions msvc/scripts/TODO.md
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion msvc/scripts/genproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -921,14 +921,18 @@ string GenerateStep (string library, string suffix, string eventKey)
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");
} else {
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 =
Expand Down
2 changes: 2 additions & 0 deletions msvc/scripts/ilasm.pre
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$(ProjectDir)\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs

1 change: 1 addition & 0 deletions msvc/scripts/mcs.pre
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
$(ProjectDir)\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs

42 changes: 42 additions & 0 deletions msvc/scripts/prepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,46 @@ static void Filter (string inpath, string outpath, filt filter)
}
}
}

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)
{
Expand All @@ -32,6 +72,8 @@ static void Main (string [] args)
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:
Expand Down
12 changes: 6 additions & 6 deletions net_4_x.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b078895

Please sign in to comment.