Skip to content

Commit

Permalink
Genproj updates for BCL build in Windows Visual Studio (mono/mono#7755)
Browse files Browse the repository at this point in the history
This batch of commits makes further updates to our support for building the BCL using msbuild (Visual Studio, to be specific).

* Generates a single sln and set of csproj files with support for all of our build profiles (orbis, monodroid, net_4_x, etc)
* Project configuration selector (in VS or as parameter to msbuild) can be used to select which profile to build
* Includes partial dependency information so that culevel and jay are compiled before the rest of the sln (this keeps pre/post events from from failing on first build)

As of this rev things are working pretty good, but a lot of the measures I took here are temporary so I'd appreciate thoughts on how to go about them. The hard-coded System.Web -> Culevel dependency feels gross, for example - I kind of want to go through and build an automatic solution for it but I'm not sure it's necessary.

Implements mono/mono#6858

---

* Checkpoint: Generate single .csproj file with conditional item/property groups

* Checkpoint: Updates to csproj and sln generation to support building specific profiles

* Move targets file in csproj template so that it isn't evaluated before all properties are set

* Checkpoint profile fallback (use net_4_x if project does not have appropriate profile)

* Use in-process cache for project guids to fix bug where many guids were being generated. Fix profile fallback.

* Clean up unnecessary debug writelines

* genproj error fixes

* Remove duplicate gacutil entry from makefile to fix order.xml corruption. Cleaner project names in msbuild sln. Compile genproj before generating inputs.

* Delete genproj.exe at beginning of update-solution-files because otherwise syntax errors will cause an old version to be used silently
Cleaner messages from genproj

* Hard-code the guid for culevel and add it as a dependency for system.web

* Bug fixes

* sln files are sensitive to whitespace format

* Don't generate pointless solution configurations if we have no information for them

* Updates based on PR feedback


Commit migrated from mono/mono@954911d
  • Loading branch information
kg authored and akoeplinger committed Mar 23, 2018
1 parent e0f068f commit c3d3c27
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 124 deletions.
3 changes: 2 additions & 1 deletion src/mono/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ update-llvm-version:


update-solution-files:
(pushd msvc/scripts; rm genproj.exe; $(MAKE) genproj.exe; popd)
$(MAKE) update-csproj
$(MAKE) package-inputs
(cd msvc/scripts; $(MAKE) genproj.exe; mono genproj.exe $(GENPROJ_ARGS))
(cd msvc/scripts; mono --debug genproj.exe $(GENPROJ_ARGS))

update-solution-files-with-tests:
$(MAKE) "GENPROJ_ARGS=2012 true true" update-solution-files
61 changes: 27 additions & 34 deletions src/mono/msvc/scripts/csproj.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>@PROJECTGUID@</ProjectGuid>
Expand All @@ -13,62 +12,56 @@
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<OutputPath>@OUTPUTDIR@</OutputPath>
<IntermediateOutputPath>obj-@OUTPUTSUFFIX@</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@NOSTDLIB@
@METADATAVERSION@
@STARTUPOBJECT@
@NOCONFIG@
@ALLOWUNSAFE@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<RootNamespace></RootNamespace>
<AssemblyName>@ASSEMBLYNAME@</AssemblyName>
<TargetFrameworkVersion>v@FX_VERSION</TargetFrameworkVersion>
<TargetFrameworkVersion>v@FX_VERSION@</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
@SIGNATURE@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>

<!-- @ALL_PROFILE_PROPERTIES@ -->

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>@DISABLEDWARNINGS@</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;@DEFINECONSTANTS@</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<NoWarn>@DISABLEDWARNINGS@</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>@DEFINECONSTANTS@</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@SOURCES@ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->

<!-- @ALL_SOURCES@ -->
<!-- @ALL_REFERENCES@ -->

<PropertyGroup>
@PREBUILD@
@POSTBUILD@
</PropertyGroup>
<ItemGroup>
@REFERENCES@ </ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
@RESOURCES@</Project>

<!-- @ALL_RESOURCES@ -->
</Project>
Loading

0 comments on commit c3d3c27

Please sign in to comment.