Skip to content

Commit

Permalink
Add incremental build (#1700)
Browse files Browse the repository at this point in the history
* Add semaphores for incremental build

* Updates based on PR review comments

* One more PR comment update
  • Loading branch information
dseefeld authored Aug 14, 2020
1 parent 6997f78 commit 32a3fcd
Show file tree
Hide file tree
Showing 17 changed files with 231 additions and 63 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,4 @@ testing-smoke/
# UpdateDependenciesAndSubmitPullRequest: if no upgrades are performed, the
# sanity check fails when "git status" shows this file.
msbuild.ProjectImports.zip
Build_*.ProjectImports.zip
11 changes: 7 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,13 @@
<RootRepo>known-good</RootRepo>
<RootRepoTests>known-good-tests</RootRepoTests>
</PropertyGroup>

<ItemGroup>
<SourceBuiltPackage Include="$(SourceBuiltPackagesPath)/*.nupkg" />
</ItemGroup>

<!--
Semaphore path for incremental builds
-->
<PropertyGroup>
<CompletedSemaphorePath>$(BaseIntermediatePath)semaphores/</CompletedSemaphorePath>
</PropertyGroup>

<!-- CLI internal version is statically set by us to a version that will never show up in the wild.
This ensures we will never restore a public version instead of our source-built version. We
Expand Down
6 changes: 5 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
<Target Name="AcquireDarc"
Condition="
'$(OfflineBuild)' != 'true' and
'$(SkipAcquireDarc)' != 'true'">
'$(SkipAcquireDarc)' != 'true'"
Inputs="$(MSBuildThisFileDirectory)tools-local\acquire-darc\acquire-darc.proj"
Outputs="$(CompletedSemaphorePath)AcquireDarc.complete">
<MSBuild
Projects="$(MSBuildThisFileDirectory)tools-local\acquire-darc\acquire-darc.proj"
Targets="AcquireDarcCore" />

<WriteLinesToFile File="$(CompletedSemaphorePath)AcquireDarc.complete" Overwrite="true" />
</Target>

<Target Name="GetCommonDarcCloneCommand" DependsOnTargets="AcquireDarc">
Expand Down
2 changes: 1 addition & 1 deletion build-source-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ mkdir -p "$FULL_TARBALL_ROOT"
MAIN_BUILD_ARGS+=( "/p:TarballRoot=$FULL_TARBALL_ROOT" )
MAIN_BUILD_ARGS+=( "/p:PackSourceBuildTarball=true" )

$SCRIPT_ROOT/build.sh ${MAIN_BUILD_ARGS[@]} "$@"
$SCRIPT_ROOT/build.sh ${MAIN_BUILD_ARGS[@]} /bl:$SCRIPT_ROOT/artifacts/log/Debug/BuildTarball_$(date +"%m%d%H%M%S").binlog "$@"

echo "Done. Tarball created: $TARBALL_ROOT"
30 changes: 25 additions & 5 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
-->
<Target Name="CopyAndDisassembleReferenceOnlyPackages"
AfterTargets="Build"
Condition="'$(OfflineBuild)' != 'true' and '$(ArchiveDownloadedPackages)' == 'true' and '$(OS)' != 'Windows_NT'">
Condition="'$(OfflineBuild)' != 'true' and '$(ArchiveDownloadedPackages)' == 'true' and '$(OS)' != 'Windows_NT'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)CopyAndDisassembleReferenceOnlyPackages.complete" >

<CopyReferenceOnlyPackages
PackageCacheDir="$(PackagesDir)"
Expand Down Expand Up @@ -124,6 +126,8 @@
<ReplaceTextInFile InputFile="%(RefAssyNuspecFiles.Identity)"
OldText="http://go.microsoft.com/fwlink/?LinkId=529443"
NewText="https://microsoft.mit-license.org/" />

<WriteLinesToFile File="$(CompletedSemaphorePath)CopyAndDisassembleReferenceOnlyPackages.complete" Overwrite="true" />
</Target>

<Target Name="ReplaceLicenseFiles"
Expand All @@ -148,7 +152,9 @@

<Target Name="DownloadSourceBuildReferencePackages"
AfterTargets="Build"
Condition="'$(OfflineBuild)' != 'true' and '$(OS)' != 'Windows_NT' and '$(SkipDownloadingReferencePackages)' != 'true'">
Condition="'$(OfflineBuild)' != 'true' and '$(OS)' != 'Windows_NT' and '$(SkipDownloadingReferencePackages)' != 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)DownloadSourceBuildReferencePackages.complete" >
<PropertyGroup Condition="'$(DownloadSourceBuildReferencePackagesTimeoutSeconds)' == ''">
<DownloadSourceBuildReferencePackagesTimeoutSeconds>600</DownloadSourceBuildReferencePackagesTimeoutSeconds>
</PropertyGroup>
Expand All @@ -157,11 +163,15 @@
SourceUrl="$(ReferencePackagesTarballUrl)$(ReferencePackagesTarballName).$(PrivateSourceBuildReferencePackagesPackageVersion).tar.gz"
DestinationFolder="$(ExternalTarballsDir)"
TimeoutSeconds="$(DownloadSourceBuildReferencePackagesTimeoutSeconds)" />

<WriteLinesToFile File="$(CompletedSemaphorePath)DownloadSourceBuildReferencePackages.complete" Overwrite="true" />
</Target>

<Target Name="DownloadSourceBuiltArtifacts"
AfterTargets="Build"
Condition="'$(OfflineBuild)' != 'true' and '$(OS)' != 'Windows_NT' and '$(SkipDownloadingPreviouslySourceBuiltPackages)' != 'true'">
Condition="'$(OfflineBuild)' != 'true' and '$(OS)' != 'Windows_NT' and '$(SkipDownloadingPreviouslySourceBuiltPackages)' != 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)DownloadSourceBuiltArtifacts.complete" >
<PropertyGroup Condition="'$(DownloadSourceBuiltArtifactsTimeoutSeconds)' == ''">
<DownloadSourceBuiltArtifactsTimeoutSeconds>1500</DownloadSourceBuiltArtifactsTimeoutSeconds>
</PropertyGroup>
Expand All @@ -170,6 +180,8 @@
SourceUrl="$(SourceBuiltArtifactsTarballUrl)$(SourceBuiltArtifactsTarballName).$(PrivateSourceBuiltArtifactsPackageVersion).tar.gz"
DestinationFolder="$(ExternalTarballsDir)"
TimeoutSeconds="$(DownloadSourceBuiltArtifactsTimeoutSeconds)" />

<WriteLinesToFile File="$(CompletedSemaphorePath)DownloadSourceBuiltArtifacts.complete" Overwrite="true" />
</Target>

<!-- After building, generate a prebuilt usage report. -->
Expand All @@ -191,23 +203,31 @@

<Target Name="ReportPoisonUsage"
AfterTargets="Build"
Condition="'$(EnablePoison)' == 'true' and '$(OfflineBuild)' == 'true'">
Condition="'$(EnablePoison)' == 'true' and '$(OfflineBuild)' == 'true'"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)ReportPoisonUsage.complete" >
<ItemGroup>
<FinalCliTarball Include="$(SourceBuiltTarBallPath)**/*$(TarBallExtension)" />
</ItemGroup>
<CheckForPoison FilesToCheck="@(FinalCliTarball)"
HashCatalogFilePath="$(PoisonReportDataFile)"
MarkerFileName="$(PoisonMarkerFile)"
PoisonReportOutputFilePath="$(PoisonUsageReportFile)" />

<WriteLinesToFile File="$(CompletedSemaphorePath)ReportPoisonUsage.complete" Overwrite="true" />
</Target>

<Target Name="GeneratePrebuiltBurndownData">
<Target Name="GeneratePrebuiltBurndownData"
Inputs="$(MSBuildProjectFullPath)"
Outputs="$(CompletedSemaphorePath)GeneratePrebuiltBurndownData.complete" >
<WriteUsageBurndownData RootDirectory="$(ProjectDir)"
PrebuiltBaselineFile="$(OnlineBaselineDataFile)"
OutputFilePath="$(OnlinePrebuiltBurndownDataFile)" />
<WriteUsageBurndownData RootDirectory="$(ProjectDir)"
PrebuiltBaselineFile="$(OfflineBaselineDataFile)"
OutputFilePath="$(OfflinePrebuiltBurndownDataFile)" />

<WriteLinesToFile File="$(CompletedSemaphorePath)GeneratePrebuiltBurndownData.complete" Overwrite="true" />
</Target>

<Target Name="RunSmokeTest" DependsOnTargets="GetProdConBlobFeedUrl">
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
if [ "$alternateTarget" == "true" ]; then
"$CLIPATH/dotnet" $SDKPATH/MSBuild.dll "$scriptroot/build.proj" /bl:source-build-test.binlog /flp:v=diag /clp:v=m "$@"
else
"$scriptroot/eng/common/build.sh" --restore --build -c Release --warnaserror false -bl /flp:v=diag "$@"
"$scriptroot/eng/common/build.sh" --restore --build -c Release --warnaserror false /bl:$scriptroot/artifacts/log/Debug/Build_$(date +"%m%d%H%M%S").binlog /flp:v=diag "$@"
fi
5 changes: 5 additions & 0 deletions repos/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<RepoConsoleLogFile>$(LoggingDir)$(RepositoryName).log</RepoConsoleLogFile>
<RedirectRepoOutputToLog Condition="'$(MinimalConsoleLogOutput)' == 'true'">&gt;&gt; $(RepoConsoleLogFile) 2&gt;&amp;1</RedirectRepoOutputToLog>
<IsStable Condition="'$(UseStableVersions)' == 'true'">true</IsStable>

<!--
Repo specific semaphore path for incremental build
-->
<RepoCompletedSemaphorePath>$(CompletedSemaphorePath)$(RepositoryName)/</RepoCompletedSemaphorePath>
</PropertyGroup>

<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
Expand Down
Loading

0 comments on commit 32a3fcd

Please sign in to comment.