forked from NuGet/NuGet.Client
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the Arcade-powered source-build wrapper. (NuGet#4105)
- Loading branch information
Showing
12 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<GitHubRepositoryName>nuget-client</GitHubRepositoryName> | ||
<SourceBuildManagedOnly>true</SourceBuildManagedOnly> | ||
|
||
<VersionPrefix>1.0.0</VersionPrefix> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<UsageData> | ||
<IgnorePatterns> | ||
<UsagePattern IdentityGlob="*/*" /> | ||
</IgnorePatterns> | ||
</UsageData> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
steps: | ||
- task: PowerShell@2 | ||
displayName: "Update Build Number" | ||
inputs: | ||
targetType: "inline" | ||
script: | | ||
Write-Host "##vso[build.updatebuildnumber]$env:FULLVSTSBUILDNUMBER" | ||
failOnStderr: "true" | ||
condition: "always()" | ||
|
||
- task: PowerShell@2 | ||
displayName: "Build source-build" | ||
inputs: | ||
targetType: "inline" | ||
script: | | ||
./eng/source-build/build.sh | ||
condition: "always()" | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Upload source-build log | ||
condition: "always()" | ||
continueOnError: true | ||
inputs: | ||
PathToPublish: "artifacts/source-build/self/log/source-build.binlog" | ||
ArtifactName: "Source-build log" | ||
ArtifactType: Container | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
eng/source-build-patches/0001-Rename-NuGet.Config-to-NuGet.config-to-account-for-a.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
From 4743459f7b61cb6a43e23573687e91232afcf06a Mon Sep 17 00:00:00 2001 | ||
From: Chris Rummel <[email protected]> | ||
Date: Mon, 21 Jun 2021 15:11:21 -0500 | ||
Subject: [PATCH] Rename NuGet.Config to NuGet.config to account for an Arcade | ||
issue. | ||
|
||
--- | ||
NuGet.Config => NuGet.config | 0 | ||
1 file changed, 0 insertions(+), 0 deletions(-) | ||
rename NuGet.Config => NuGet.config (100%) | ||
|
||
diff --git a/NuGet.Config b/NuGet.config | ||
similarity index 100% | ||
rename from NuGet.Config | ||
rename to NuGet.config | ||
-- | ||
2.18.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
source="${BASH_SOURCE[0]}" | ||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" | ||
|
||
# resolve $SOURCE until the file is no longer a symlink | ||
while [[ -h $source ]]; do | ||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" | ||
source="$(readlink "$source")" | ||
|
||
# if $source was a relative symlink, we need to resolve it relative to the path where the | ||
# symlink file was located | ||
[[ $source != /* ]] && source="$scriptroot/$source" | ||
done | ||
|
||
function ReadGlobalVersion { | ||
local key=$1 | ||
local global_json_file="$scriptroot/global.json" | ||
|
||
if command -v jq &> /dev/null; then | ||
_ReadGlobalVersion="$(jq -r ".[] | select(has(\"$key\")) | .\"$key\"" "$global_json_file")" | ||
elif [[ "$(cat "$global_json_file")" =~ \"$key\"[[:space:]\:]*\"([^\"]+) ]]; then | ||
_ReadGlobalVersion=${BASH_REMATCH[1]} | ||
fi | ||
|
||
if [[ -z "$_ReadGlobalVersion" ]]; then | ||
Write-PipelineTelemetryError -category 'Build' "Error: Cannot find \"$key\" in $global_json_file" | ||
ExitWithExitCode 1 | ||
fi | ||
} | ||
|
||
function GetNuGetPackageCachePath { | ||
if [[ -z ${NUGET_PACKAGES:-} ]]; then | ||
if [[ "$use_global_nuget_cache" == true ]]; then | ||
export NUGET_PACKAGES="$HOME/.nuget/packages" | ||
else | ||
export NUGET_PACKAGES="$repo_root/.packages" | ||
export RESTORENOCACHE=true | ||
fi | ||
fi | ||
} | ||
|
||
export DOTNET=${DOTNET:-dotnet} | ||
|
||
ReadGlobalVersion Microsoft.DotNet.Arcade.Sdk | ||
export ARCADE_VERSION=$_ReadGlobalVersion | ||
"$DOTNET" msbuild "$scriptroot/source-build.proj" /p:DotNetBuildFromSource=true /p:ArcadeBuildFromSource=true "/p:RepoRoot=$scriptroot/../../" "/bl:$scriptroot/../../artifacts/source-build/self/log/source-build.binlog" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"msbuild-sdks": { | ||
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21309.7" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<Project Sdk="Microsoft.DotNet.Arcade.Sdk" DefaultTargets="Build"> | ||
|
||
<Import Project="../SourceBuild.props" /> | ||
|
||
<PropertyGroup> | ||
<ProjectRoot>$(MSBuildThisFileDirectory)../../</ProjectRoot> | ||
</PropertyGroup> | ||
|
||
<Target Name="Build" DependsOnTargets="SourceBuildPostBuild"> | ||
<Message Text="Running source-build Build target" Importance="High" /> | ||
</Target> | ||
|
||
<Target Name="SourceBuildPreBuild" DependsOnTargets="ApplySourceBuildPatchFiles"> | ||
<Message Text="Running source-build PreBuild target" Importance="High" /> | ||
|
||
</Target> | ||
|
||
<Target Name="SourceBuildPostBuild" DependsOnTargets="SourceBuildInnerBuild"> | ||
<Message Text="Running source-build PostBuild target" Importance="High" /> | ||
|
||
<MSbuild Projects="$(NuGetPackageRoot)/microsoft.dotnet.arcade.sdk/$(ARCADE_VERSION)/tools/Build.proj" | ||
Properties="_NETCORE_ENGINEERING_TELEMETRY=AfterSourceBuild;ArcadeBuildFromSource=true;Restore=true;Build=false;Pack=false;Publish=false;Rebuild=false;Test=false;IntegrationTest=false;PerformanceTest=false;PreventPrebuiltBuild=false;BaseInnerSourceBuildCommand=echo skipping internal build with args: " | ||
Targets="Execute" | ||
/> | ||
|
||
<Message Text="Finished restoring Arcade" Importance="High" /> | ||
|
||
<MSbuild Projects="$(NuGetPackageRoot)/microsoft.dotnet.arcade.sdk/$(ARCADE_VERSION)/tools/SourceBuild/AfterSourceBuild.proj" | ||
Properties="_NETCORE_ENGINEERING_TELEMETRY=AfterSourceBuild;ArcadeBuildFromSource=true;CurrentRepoSourceBuildArtifactsPackagesDir=$(ProjectRoot)artifacts/nupkgs/" | ||
/> | ||
|
||
</Target> | ||
|
||
<Target Name="SourceBuildInnerBuild" DependsOnTargets="SourceBuildPreBuild"> | ||
<Message Text="Running source-build InnerBuild target" Importance="High" /> | ||
|
||
<MSBuild Projects="$(ProjectRoot)build/build.proj" | ||
Properties="Configuration=$(BuildConfiguration);DotNetBuildFromSource=true" | ||
Targets="RestoreXPlat" /> | ||
|
||
<MSBuild Projects="$(ProjectRoot)build/build.proj" | ||
Properties="Configuration=$(BuildConfiguration);DotNetBuildFromSource=true" | ||
Targets="BuildXPlat" /> | ||
|
||
<MSBuild Projects="$(ProjectRoot)build/build.proj" | ||
Properties="Configuration=$(BuildConfiguration);DotNetBuildFromSource=true" | ||
Targets="PackXPlat" /> | ||
|
||
</Target> | ||
|
||
<Target Name="ApplySourceBuildPatchFiles"> | ||
<Message Text="Check for patches in $(ProjectRoot)eng/source-build-patches/*.patch" Importance="High" /> | ||
<ItemGroup> | ||
<SourceBuildPatchFile Include="$(ProjectRoot)eng/source-build-patches/*.patch" /> | ||
</ItemGroup> | ||
|
||
<Exec | ||
Command="git apply --ignore-whitespace --whitespace=nowarn "%(SourceBuildPatchFile.FullPath)"" | ||
WorkingDirectory="$(ProjectRoot)" | ||
Condition="'@(SourceBuildPatchFile)' != ''" /> | ||
</Target> | ||
|
||
|
||
</Project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
// This empty file has no effect and is here to support Arcade-powered source-build. | ||
// The Arcade build process requires a global.json at the root of the repo and normally | ||
// uses it to restore the necessary SDK and tools to build the repo. | ||
// However, NuGet explitcly wants to use the ambient SDK (normally latest), not any particular | ||
// version. We also don't want to introduce MS.DN.Arcade.SDK into the non-source-build build. | ||
// eng/source-build/global.json has the entry for the Arcade version we need for | ||
// Arcade-powered source-build. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters