From 793558ed5b888b57553df4c8a3e740aa171e51d3 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 10 Aug 2015 16:45:38 -0700 Subject: Remove unused resource string StackTrace_Stack was conditional between Unix and Windows, which is problematic when building on Unix, since the Mono provided ResGen does not understand our define directives. It turns out this string is unused (in both CoreCLR and Desktop) so to make things easier, we can just remove it. --- src/mscorlib/src/mscorlib.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/mscorlib/src/mscorlib.txt b/src/mscorlib/src/mscorlib.txt index 1a036b88c3..6a519b2dc5 100644 --- a/src/mscorlib/src/mscorlib.txt +++ b/src/mscorlib/src/mscorlib.txt @@ -68,12 +68,6 @@ PostconditionOnExceptionFailed = Postcondition failed after throwing an exceptio PostconditionOnExceptionFailed_Cnd = Postcondition failed after throwing an exception: {0} InvariantFailed = Invariant failed. InvariantFailed_Cnd = Invariant failed: {0} -#if PLATFORM_UNIX -StackTrace_Stack = Stack trace: \n{0} -#endif -#if !PLATFORM_UNIX -StackTrace_Stack = Stack trace: \r\n{0} -#endif // PLATFORM_UNIX MustUseCCRewrite = An assembly (probably "{1}") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \r\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that "Perform Runtime Contract Checking" is enabled, which will define CONTRACTS_FULL. ; Access Control -- cgit v1.2.3 From 614d58f99a8385bb54281f2b7fb9d5dd6672a519 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 10 Aug 2015 22:36:57 -0700 Subject: Build mscolrib.dll on Unix Initial work to get mscorlib.dll building via Roslyn + MSBuild running on top of Mono on Linux. - Use a newer version of BclRewriter.exe which works cross-platform, the major difference here is that now we need to specify the input assembly as a named argument instead (since fully qualified paths on Unix look like flags on Windows). - The ResGen we use comes from Mono, which does not support the -d flag, so we need to stop passing defines to ResGen. I know the mono folks recently did some work to address this, but long term we need to move towards getting our ResGen.exe running on CoreCLR and use that instead. - Don't require that mono is installed in order to build coreclr. If mono is not on the path, skip the build step to enable folks to do development without Mono. In this case, they will need to continue to build mscorlib.dll on Windows, targeting Unix. - Mono stability has been an issue for folks that have buddy tested this. I've found that recent mono 4.2 builds, when run with the Boehm GC work well for me. Other folks have other builds they like instead. The `skipmscorlib` flag can be passed to build.sh if you want to skip building mscorlib.dll locally. --- build.sh | 83 ++++++++++++++++++---- dir.props | 12 +++- src/.nuget/packages.Unix.config | 7 +- src/.nuget/packages.Windows_NT.config | 4 +- src/mscorlib/GenerateSplitStringResources.targets | 11 +-- src/mscorlib/Tools/BclRewriter/BclRewriter.targets | 2 +- src/mscorlib/Tools/PostProcessingTools.targets | 4 +- .../Tools/Versioning/GenerateVersionInfo.targets | 15 ++-- src/mscorlib/mscorlib.csproj | 10 ++- 9 files changed, 115 insertions(+), 33 deletions(-) diff --git a/build.sh b/build.sh index 14ef25f2bb..f3cbb11dc0 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ usage() { - echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [cross] [clangx.y]" + echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [cross] [clangx.y] [skipmscorlib]" echo "BuildArch can be: x64, ARM" echo "BuildType can be: Debug, Release" echo "clean - optional argument to force a clean build." @@ -10,6 +10,7 @@ usage() echo "clangx.y - optional argument to build using clang version x.y." echo "cross - optional argument to signify cross compilation," echo " - will use ROOTFS_DIR environment variable if set." + echo "skipmscorlib - do not build mscorlib.dll even if mono is installed." exit 1 } @@ -17,7 +18,7 @@ usage() setup_dirs() { echo Setting up directories for build - + mkdir -p "$__RootBinDir" mkdir -p "$__BinDir" mkdir -p "$__LogsDir" @@ -31,10 +32,10 @@ clean() echo Cleaning previous output for the selected configuration rm -rf "$__BinDir" rm -rf "$__IntermediatesDir" - + rm -rf "$__TestWorkingDir" rm -rf "$__TestIntermediatesDir" - + rm -rf "$__LogsDir/*_$__BuildOS__$__BuildArch__$__BuildType.*" } @@ -43,28 +44,28 @@ clean() check_prereqs() { echo "Checking pre-requisites..." - + # Check presence of CMake on the path hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; } - + # Check for clang hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang before running this script"; exit 1; } - + } build_coreclr() { # All set to commence the build - + echo "Commencing build of native components for $__BuildOS.$__BuildArch.$__BuildType" cd "$__IntermediatesDir" - + # Regenerate the CMake solution echo "Invoking cmake with arguments: \"$__ProjectRoot\" $__CMakeArgs" "$__ProjectRoot/src/pal/tools/gen-buildsys-clang.sh" "$__ProjectRoot" $__ClangMajorVersion $__ClangMinorVersion $__BuildArch $__CMakeArgs - + # Check that the makefiles were created. - + if [ ! -f "$__IntermediatesDir/Makefile" ]; then echo "Failed to generate native component build project!" exit 1 @@ -78,9 +79,9 @@ build_coreclr() else NumProc=$(($(getconf _NPROCESSORS_ONLN)+1)) fi - + # Build CoreCLR - + echo "Executing make install -j $NumProc $__UnprocessedBuildArgs" make install -j $NumProc $__UnprocessedBuildArgs @@ -90,6 +91,52 @@ build_coreclr() fi } +build_mscorlib() +{ + hash mono 2> /dev/null || { echo >&2 "Skipping mscorlib.dll build since Mono is not installed."; return; } + + if [ $__SkipMSCorLib == 1 ]; then + echo "Skipping mscorlib.dll build." + return + fi + + echo "Commencing build of mscorlib components for $__BuildOS.$__BuildArch.$__BuildType" + + # Pull NuGet.exe down if we don't have it already + if [ ! -e "$__NuGetPath" ]; then + hash curl 2>/dev/null || hash wget 2>/dev/null || { echo >&2 echo "cURL or wget is required to build mscorlib." ; exit 1; } + + echo "Restoring NuGet.exe..." + + # curl has HTTPS CA trust-issues less often than wget, so lets try that first. + which curl > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + mkdir -p $__PackagesDir + wget -q -O $__NuGetPath https://api.nuget.org/downloads/nuget.exe + else + curl -sSL --create-dirs -o $__NuGetPath https://api.nuget.org/downloads/nuget.exe + fi + + if [ $? -ne 0 ]; then + echo "Failed to restore NuGet.exe." + exit 1 + fi + fi + + # Grab the MSBuild package if we don't have it already + if [ ! -e "$__MSBuildPath" ]; then + echo "Restoring MSBuild..." + mono "$__NuGetPath" install $__MSBuildPackageId -Version $__MSBuildPackageVersion -source "https://www.myget.org/F/dotnet-buildtools/" -OutputDirectory "$__PackagesDir" + if [ $? -ne 0 ]; then + echo "Failed to restore MSBuild." + exit 1 + fi + fi + + # Invoke MSBuild + mono "$__MSBuildPath" /nologo "$__ProjectRoot/build.proj" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/MSCorLib_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:OSGroup=$__BuildOS /p:BuildOS=$__BuildOS /p:UseRoslynCompiler=true /p:BuildNugetPackage=false +} + echo "Commencing CoreCLR Repo build" # Argument types supported by this script: @@ -142,11 +189,16 @@ __RootBinDir="$__ProjectDir/bin" __LogsDir="$__RootBinDir/Logs" __UnprocessedBuildArgs= __MSBCleanBuildArgs= +__SkipMSCorLib=false __CleanBuild=false __VerboseBuild=false __CrossBuild=false __ClangMajorVersion=3 __ClangMinorVersion=5 +__MSBuildPackageId="Microsoft.Build.Mono.Debug" +__MSBuildPackageVersion="14.1.0.0-prerelease" +__MSBuildPath="$__PackagesDir/$__MSBuildPackageId.$__MSBuildPackageVersion/lib/MSBuild.exe" +__NuGetPath="$__PackagesDir/NuGet.exe" for i in "$@" do @@ -197,6 +249,7 @@ for i in "$@" __ClangMinorVersion=7 ;; skipmscorlib) + __SkipMSCorLib=1 ;; *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" @@ -245,6 +298,10 @@ check_prereqs build_coreclr +# Build mscolrib. + +build_mscorlib + # Build complete echo "Repo successfully built." diff --git a/dir.props b/dir.props index 5fc9429b00..c004378884 100644 --- a/dir.props +++ b/dir.props @@ -10,7 +10,7 @@ 1.0.25-prerelease-00056 - 1.0.2-prerelease + 1.0.3-prerelease 1.0.0-beta5-12101 1.0.0-beta5-12101 dnx-coreclr-win-x86.$(DnxVersion) @@ -112,6 +112,14 @@ + + + $(PackagesDir)/$(RoslynPackageName).$(RoslynVersion)/ + $(RoslynPackageDir)build/Microsoft.Net.ToolsetCompilers.props + + true @@ -121,4 +129,4 @@ true - \ No newline at end of file + diff --git a/src/.nuget/packages.Unix.config b/src/.nuget/packages.Unix.config index b7a7e0b415..0f758ef11f 100644 --- a/src/.nuget/packages.Unix.config +++ b/src/.nuget/packages.Unix.config @@ -1,6 +1,7 @@ - - - \ No newline at end of file + + + + diff --git a/src/.nuget/packages.Windows_NT.config b/src/.nuget/packages.Windows_NT.config index 872e60dd1b..6379b7954b 100644 --- a/src/.nuget/packages.Windows_NT.config +++ b/src/.nuget/packages.Windows_NT.config @@ -2,5 +2,5 @@ - - \ No newline at end of file + + diff --git a/src/mscorlib/GenerateSplitStringResources.targets b/src/mscorlib/GenerateSplitStringResources.targets index dd00efd80c..4b69ba6ead 100644 --- a/src/mscorlib/GenerateSplitStringResources.targets +++ b/src/mscorlib/GenerateSplitStringResources.targets @@ -1,6 +1,7 @@ - $(SDK40ToolsPath)ResGen.exe + $(SDK40ToolsPath)ResGen.exe + resgen GenerateSplitStringResources;$(PrepareResourcesDependsOn) @@ -8,12 +9,14 @@ Inputs="$(MSBuildThisFileFullPath);$(MSBuildProjectFile);$(BclSourcesRoot)\mscorlib.txt" Outputs="@(SplitTextStringResource->'$(IntermediateOutputPath)%(Filename).resources')"> - + + + - + @@ -27,4 +30,4 @@ - \ No newline at end of file + diff --git a/src/mscorlib/Tools/BclRewriter/BclRewriter.targets b/src/mscorlib/Tools/BclRewriter/BclRewriter.targets index 837f14fd43..3588a7750b 100644 --- a/src/mscorlib/Tools/BclRewriter/BclRewriter.targets +++ b/src/mscorlib/Tools/BclRewriter/BclRewriter.targets @@ -24,7 +24,7 @@ unix - + diff --git a/src/mscorlib/Tools/PostProcessingTools.targets b/src/mscorlib/Tools/PostProcessingTools.targets index 78768ebaae..7231540ddf 100644 --- a/src/mscorlib/Tools/PostProcessingTools.targets +++ b/src/mscorlib/Tools/PostProcessingTools.targets @@ -19,7 +19,7 @@ - + - \ No newline at end of file + diff --git a/src/mscorlib/Tools/Versioning/GenerateVersionInfo.targets b/src/mscorlib/Tools/Versioning/GenerateVersionInfo.targets index 2a804b403c..00f5282c7c 100644 --- a/src/mscorlib/Tools/Versioning/GenerateVersionInfo.targets +++ b/src/mscorlib/Tools/Versioning/GenerateVersionInfo.targets @@ -68,6 +68,7 @@ @@ -96,12 +97,18 @@ - + $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1@InstallationFolder) $(WindowsSdkDir)bin\x86\rc.exe - - + + + + - \ No newline at end of file + diff --git a/src/mscorlib/mscorlib.csproj b/src/mscorlib/mscorlib.csproj index 559e6857ef..a41f7b079e 100644 --- a/src/mscorlib/mscorlib.csproj +++ b/src/mscorlib/mscorlib.csproj @@ -1,4 +1,4 @@ - + @@ -29,7 +29,7 @@ true prompt true - true + true true 4 false @@ -78,6 +78,12 @@ TRACE;$(DefineConstants) + + + false + none + + mscorlib -- cgit v1.2.3