[ArPow] Reduce the size of the tarball. (#11662)
* Copy instead of clone and remove .git/objects directories * Add depth 1 to fetch command * Add commit count to git-info for installer repo * Update targets to fix dependency ordering Some repos take a dependency on PrepareInnerSourceBuildRepoRoot, assuming that the inner repo will be setup. The condition for copy instead of clone caused a conflict. Keep PrepareInnerSourceBuildRepoRoot and make it depend on either copy or clone completing. * Don't copy artifacts dir * Actually don't remove artifacts directory * Update prebuilt version
This commit is contained in:
parent
f0066a6f95
commit
290df5778e
4 changed files with 46 additions and 3 deletions
|
@ -57,7 +57,8 @@ namespace Microsoft.DotNet.SourceBuild.Tasks
|
||||||
SourceBuildRepoName = dep.GetMetadata("SourceBuildRepoName"),
|
SourceBuildRepoName = dep.GetMetadata("SourceBuildRepoName"),
|
||||||
Version = dep.GetMetadata("ExactVersion"),
|
Version = dep.GetMetadata("ExactVersion"),
|
||||||
Sha = dep.GetMetadata("Sha"),
|
Sha = dep.GetMetadata("Sha"),
|
||||||
Uri = dep.GetMetadata("Uri")
|
Uri = dep.GetMetadata("Uri"),
|
||||||
|
GitCommitCount = dep.GetMetadata("GitCommitCount")
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
string repoName = dependency.SourceBuildRepoName;
|
string repoName = dependency.SourceBuildRepoName;
|
||||||
|
@ -72,6 +73,10 @@ namespace Microsoft.DotNet.SourceBuild.Tasks
|
||||||
["PreReleaseVersionLabel"] = derivedVersion.PreReleaseVersionLabel,
|
["PreReleaseVersionLabel"] = derivedVersion.PreReleaseVersionLabel,
|
||||||
["IsStable"] = string.IsNullOrWhiteSpace(derivedVersion.PreReleaseVersionLabel) ? "true" : "false",
|
["IsStable"] = string.IsNullOrWhiteSpace(derivedVersion.PreReleaseVersionLabel) ? "true" : "false",
|
||||||
};
|
};
|
||||||
|
if (!string.IsNullOrEmpty(dependency.GitCommitCount))
|
||||||
|
{
|
||||||
|
repoProps.Add("GitCommitCount", dependency.GitCommitCount);
|
||||||
|
}
|
||||||
WritePropsFile(propsPath, repoProps);
|
WritePropsFile(propsPath, repoProps);
|
||||||
allRepoProps[$"{safeRepoName}GitCommitHash"] = dependency.Sha;
|
allRepoProps[$"{safeRepoName}GitCommitHash"] = dependency.Sha;
|
||||||
allRepoProps[$"{safeRepoName}OutputPackageVersion"] = dependency.Version;
|
allRepoProps[$"{safeRepoName}OutputPackageVersion"] = dependency.Version;
|
||||||
|
|
|
@ -60,6 +60,14 @@
|
||||||
<Output TaskParameter="ConsoleOutput" ItemName="RootRepoCommitSha" />
|
<Output TaskParameter="ConsoleOutput" ItemName="RootRepoCommitSha" />
|
||||||
</Exec>
|
</Exec>
|
||||||
|
|
||||||
|
<!-- Get commit count for installer repo only -->
|
||||||
|
<Exec
|
||||||
|
Command="cd $(RepoRoot);git rev-list --count HEAD"
|
||||||
|
ConsoleToMSBuild="true"
|
||||||
|
WorkingDirectory="$(RepoRoot)">
|
||||||
|
<Output TaskParameter="ConsoleOutput" ItemName="RootRepoCommitCount" />
|
||||||
|
</Exec>
|
||||||
|
|
||||||
<!-- This is hardcoding version for the root repo (installer), since there
|
<!-- This is hardcoding version for the root repo (installer), since there
|
||||||
isn't a Version.Details.xml file to read it from.
|
isn't a Version.Details.xml file to read it from.
|
||||||
See https://github.com/dotnet/source-build/issues/2250 -->
|
See https://github.com/dotnet/source-build/issues/2250 -->
|
||||||
|
@ -70,6 +78,7 @@
|
||||||
<ExactVersion>1.0.0</ExactVersion>
|
<ExactVersion>1.0.0</ExactVersion>
|
||||||
<Sha>@(RootRepoCommitSha)</Sha>
|
<Sha>@(RootRepoCommitSha)</Sha>
|
||||||
<Uri>@(RootRepoUri)</Uri>
|
<Uri>@(RootRepoUri)</Uri>
|
||||||
|
<GitCommitCount>@(RootRepoCommitCount)</GitCommitCount>
|
||||||
<SourceBuildRepoName>$(GitHubRepositoryName)</SourceBuildRepoName>
|
<SourceBuildRepoName>$(GitHubRepositoryName)</SourceBuildRepoName>
|
||||||
<IsRootRepo>true</IsRootRepo>
|
<IsRootRepo>true</IsRootRepo>
|
||||||
</SourceBuildRepos>
|
</SourceBuildRepos>
|
||||||
|
@ -133,7 +142,7 @@
|
||||||
|
|
||||||
<!-- Fetching a sha requires git 2.5.0 or newer -->
|
<!-- Fetching a sha requires git 2.5.0 or newer -->
|
||||||
<Exec
|
<Exec
|
||||||
Command="git fetch origin $(RepoSha)"
|
Command="git fetch --depth 1 origin $(RepoSha)"
|
||||||
WorkingDirectory="$(TarballRepoSourceDir)"
|
WorkingDirectory="$(TarballRepoSourceDir)"
|
||||||
Condition="$(IsRootRepo) != 'true'" />
|
Condition="$(IsRootRepo) != 'true'" />
|
||||||
|
|
||||||
|
@ -146,6 +155,11 @@
|
||||||
Command="git submodule update --init --recursive"
|
Command="git submodule update --init --recursive"
|
||||||
WorkingDirectory="$(TarballRepoSourceDir)" />
|
WorkingDirectory="$(TarballRepoSourceDir)" />
|
||||||
|
|
||||||
|
<!-- Remove the git objects folder to free up tarball space -->
|
||||||
|
<Exec
|
||||||
|
Command="rm -rf objects"
|
||||||
|
WorkingDirectory="$(TarballRepoSourceDir).git" />
|
||||||
|
|
||||||
<Message Text="--> Done Cloning Repo $(SourceBuildRepoName)" Importance="High" />
|
<Message Text="--> Done Cloning Repo $(SourceBuildRepoName)" Importance="High" />
|
||||||
|
|
||||||
<!-- Override to use a temporary SourceBuild specific Version.Details.xml file in installer for Preview 6
|
<!-- Override to use a temporary SourceBuild specific Version.Details.xml file in installer for Preview 6
|
||||||
|
|
|
@ -97,6 +97,29 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
PrepareInnerSourceBuildRepoRoot either clones the source to the inner repo
|
||||||
|
or copies the source to the inner repo depending on CopySrcInsteadOfClone.
|
||||||
|
Repos take a dependency on PrepareInnerSourceBuildRepoRoot, so this target
|
||||||
|
exists to wait until either the source is cloned or copied.
|
||||||
|
-->
|
||||||
|
<Target Name="PrepareInnerSourceBuildRepoRoot"
|
||||||
|
DependsOnTargets="CopyInnerSourceBuildRepoRoot;CloneInnerSourceBuildRepoRoot">
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<Target Name="CopyInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' == 'true' ">
|
||||||
|
<ItemGroup>
|
||||||
|
<SourceBuildFilesToCopy Include="$(RepoRoot)/**/*" />
|
||||||
|
<SourceBuildFilesToCopy Include="$(RepoRoot)/**/.*" />
|
||||||
|
<SourceBuildFilesToCopy Remove="$(RepoRoot)/artifacts/**/*" />
|
||||||
|
<SourceBuildFilesToCopy Remove="$(RepoRoot)/artifacts/**/.*" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Copy
|
||||||
|
SourceFiles="@(SourceBuildFilesToCopy)"
|
||||||
|
DestinationFolder="$(InnerSourceBuildRepoRoot)%(RecursiveDir)" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Clone the repo to a new location. Source-build targets will change the source dynamically.
|
Clone the repo to a new location. Source-build targets will change the source dynamically.
|
||||||
Creating a fresh clone avoids overwriting existing work or making subtle changes that might
|
Creating a fresh clone avoids overwriting existing work or making subtle changes that might
|
||||||
|
@ -104,7 +127,7 @@
|
||||||
access to the git data, this also makes it easy to see what changes the source-build infra has
|
access to the git data, this also makes it easy to see what changes the source-build infra has
|
||||||
made, for diagnosis or exploratory purposes.
|
made, for diagnosis or exploratory purposes.
|
||||||
-->
|
-->
|
||||||
<Target Name="PrepareInnerSourceBuildRepoRoot">
|
<Target Name="CloneInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' != 'true' ">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!--
|
<!--
|
||||||
By default, copy WIP. WIP copy helps with local machine dev work. Don't copy WIP if this is
|
By default, copy WIP. WIP copy helps with local machine dev work. Don't copy WIP if this is
|
||||||
|
|
|
@ -147,6 +147,7 @@
|
||||||
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:ArcadeBuildFromSource=true</StandardSourceBuildArgs>
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:ArcadeBuildFromSource=true</StandardSourceBuildArgs>
|
||||||
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</StandardSourceBuildArgs>
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:CopyWipIntoInnerSourceBuildRepo=true</StandardSourceBuildArgs>
|
||||||
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:DotNetBuildOffline=true</StandardSourceBuildArgs>
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:DotNetBuildOffline=true</StandardSourceBuildArgs>
|
||||||
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:CopySrcInsteadOfClone=true</StandardSourceBuildArgs>
|
||||||
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:DotNetPackageVersionPropsPath="$(PackageVersionPropsPath)"</StandardSourceBuildArgs>
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:DotNetPackageVersionPropsPath="$(PackageVersionPropsPath)"</StandardSourceBuildArgs>
|
||||||
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:AdditionalSourceBuiltNupkgCacheDir="$(SourceBuiltPackagesPath)"</StandardSourceBuildArgs>
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:AdditionalSourceBuiltNupkgCacheDir="$(SourceBuiltPackagesPath)"</StandardSourceBuildArgs>
|
||||||
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:ReferencePackageNupkgCacheDir="$(ReferencePackagesDir)"</StandardSourceBuildArgs>
|
<StandardSourceBuildArgs>$(StandardSourceBuildArgs) /p:ReferencePackageNupkgCacheDir="$(ReferencePackagesDir)"</StandardSourceBuildArgs>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue