Introduce a central packages.builds file that controls building the nuget packages.
authorAlex Ghiondea <ghiondea.alexandru@microsoft.com>
Tue, 24 May 2016 17:59:37 +0000 (10:59 -0700)
committerAlex Ghiondea <ghiondea.alexandru@microsoft.com>
Fri, 27 May 2016 21:22:56 +0000 (14:22 -0700)
This removes the need to have individual packages added to the build scripts to generate them.

Commit migrated from https://github.com/dotnet/coreclr/commit/c004a43d75c5e7e2959ac3fcfbafca2f23d20bb4

src/coreclr/build.cmd
src/coreclr/build.sh
src/coreclr/src/.nuget/packages.builds [new file with mode: 0644]

index c3cb4a0..44865f0 100644 (file)
@@ -491,51 +491,17 @@ set __msbuildLogArgs=^
 /consoleloggerparameters:Summary ^
 /verbosity:minimal
 
-if not defined __SkipCoreLibBuild (
-       set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.Runtime.CoreClr\Microsoft.NETCore.Runtime.CoreCLR.builds" /p:Platform=%__BuildArch%
-       %_msbuildexe% !__msbuildArgs! %__msbuildLogArgs%
-       if errorlevel 1 (
-           echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details:
-           echo     %__BuildLog%
-           echo     %__BuildWrn%
-           echo     %__BuildErr%
-           exit /b 1
-       )
-)
-
-if not defined __SkipNativeBuild (
-       set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.Jit\Microsoft.NETCore.Jit.builds" /p:Platform=%__BuildArch%
-       %_msbuildexe% !__msbuildArgs! %__msbuildLogArgs%
-       if errorlevel 1 (
-           echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details:
-           echo     %__BuildLog%
-           echo     %__BuildWrn%
-           echo     %__BuildErr%
-           exit /b 1
-       )
-)
-
-rem Build the ILAsm package
-set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.ILAsm\Microsoft.NETCore.ILAsm.builds" /p:Platform=%__BuildArch%
-%_msbuildexe% %__msbuildArgs% %__msbuildLogArgs%
+REM The conditions as to what to build are captured in the builds file.
+set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\packages.builds" /p:Platform=%__BuildArch%
+%_msbuildexe% !__msbuildArgs! %__msbuildLogArgs%
 if errorlevel 1 (
-    echo %__MsgPrefix%Error: ILAsm Nuget package generation failed build failed. Refer to the build log files for details:
+    echo %__MsgPrefix%Error: Nuget package generation failed build failed. Refer to the build log files for details:
     echo     %__BuildLog%
     echo     %__BuildWrn%
     echo     %__BuildErr%
     exit /b 1
 )
 
-rem Build the ILDAsm package
-set __msbuildArgs="%__ProjectFilesDir%\src\.nuget\Microsoft.NETCore.ILDAsm\Microsoft.NETCore.ILDAsm.builds" /p:Platform=%__BuildArch%
-%_msbuildexe% %__msbuildArgs% %__msbuildLogArgs%
-if errorlevel 1 (
-    echo %__MsgPrefix%Error: ILDAsm Nuget package generation failed build failed. Refer to the build log files for details:
-    echo     %__BuildLog%
-    echo     %__BuildWrn%
-    echo     %__BuildErr%
-    exit /b 1
-)
 
 :SkipNuget
 
index e86fc1f..4f95f11 100755 (executable)
@@ -315,45 +315,20 @@ generate_NugetPackages()
         return
     fi
 
-    echo "Generating nuget packages for "$__BuildOS
-
     if [ $__SkipMSCorLib == 1 ]; then
         # Restore buildTools, since we skipped doing so with the mscorlib build.
-
         restoreBuildTools
 
        echo "Unable to generate Microsoft.NETCore.Runtime.CoreCLR nuget package since mscorlib was not built."
-    else
-        # Build the CoreCLR packages
-        $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/Microsoft.NETCore.Runtime.CoreCLR.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false
-
-        if [ $? -ne 0 ]; then
-            echo "Failed to generate Nuget packages."
-            exit 1
-        fi
-    fi
-
-    # Build the JIT packages
-    $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.Jit/Microsoft.NETCore.Jit.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:__RootBinDir=$__RootBinDir /p:UseSharedCompilation=false
-
-    if [ $? -ne 0 ]; then
-        echo "Failed to generate Nuget packages."
-        exit 1
     fi
 
-    # Build the ILAsm package
-    $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILAsm/Microsoft.NETCore.ILAsm.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:__RootBinDir=$__RootBinDir /p:UseSharedCompilation=false
-
-    if [ $? -ne 0 ]; then
-        echo "Failed to generate ILAsm Nuget packages."
-        exit 1
-    fi
+    echo "Generating nuget packages for "$__BuildOS
 
-    # Build the ILDAsm package
-    $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/Microsoft.NETCore.ILDAsm/Microsoft.NETCore.ILDAsm.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:BuildNugetPackage=false /p:__RootBinDir=$__RootBinDir /p:UseSharedCompilation=false
+    # Build the packages
+    $__ProjectRoot/Tools/corerun "$__MSBuildPath" /nologo "$__ProjectRoot/src/.nuget/packages.builds" /verbosity:minimal "/fileloggerparameters:Verbosity=normal;LogFile=$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.log" /t:Build /p:__BuildOS=$__BuildOS /p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:BuildNugetPackage=false /p:UseSharedCompilation=false
 
     if [ $? -ne 0 ]; then
-        echo "Failed to generate ILDAsm Nuget packages."
+        echo "Failed to generate Nuget packages."
         exit 1
     fi
 }
diff --git a/src/coreclr/src/.nuget/packages.builds b/src/coreclr/src/.nuget/packages.builds
new file mode 100644 (file)
index 0000000..9134b3c
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+  <PropertyGroup>
+    <!-- This property must be set to the same value as $(PackageOutputPath) for the nuspecs and nupkgs to be binplaced to the intended location. -->
+    <OutputPath>$(PackageOutputPath)</OutputPath>
+  </PropertyGroup>
+
+  <ItemGroup Condition="'$(__SkipCoreLibBuild)'==''">
+    <Project Include="Microsoft.NETCore.Runtime.CoreCLR\Microsoft.NETCore.Runtime.CoreCLR.builds" /> 
+    <Project Include="Microsoft.TargetingPack.Private.CoreCLR\Microsoft.TargetingPack.Private.CoreCLR.pkgproj" /> 
+  </ItemGroup>
+
+  <ItemGroup Condition="'$(__SkipNativeBuild)'==''">
+    <Project Include="Microsoft.NETCore.Jit\Microsoft.NETCore.Jit.builds" />     
+  </ItemGroup>
+
+  <ItemGroup>
+    <Project Include="Microsoft.NETCore.ILAsm\Microsoft.NETCore.ILAsm.builds" /> 
+    <Project Include="Microsoft.NETCore.ILDAsm\Microsoft.NETCore.ILDAsm.builds" />     
+  </ItemGroup>
+
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
+</Project>