Remove backported arcade overrides (#15453)

This commit is contained in:
Michael Simons 2023-02-07 15:39:53 -06:00 committed by GitHub
parent c4895ea106
commit 67154bad64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 636 deletions

View file

@ -1,159 +0,0 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project DefaultTargets="AfterSourceBuild">
<Import Project="..\BuildStep.props" />
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.GetLicenseFilePath" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
<PropertyGroup>
<MicrosoftDotNetSourceBuildTasksBuildDir>$(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\</MicrosoftDotNetSourceBuildTasksBuildDir>
</PropertyGroup>
<Import Project="$(MicrosoftDotNetSourceBuildTasksBuildDir)Microsoft.DotNet.SourceBuild.Tasks.props" />
<Target Name="AfterSourceBuild"
Condition="'$(ArcadeInnerBuildFromSource)' != 'true'"
DependsOnTargets="
ReportPrebuiltUsage;
PackSourceBuildIntermediateNupkgs" />
<Target Name="WritePrebuiltUsageData">
<ItemGroup>
<AllRestoredPackageFiles Include="$(CurrentRepoSourceBuildPackageCache)**/*.nupkg" />
<SourceBuiltPackageFiles Include="$(CurrentRepoSourceBuiltNupkgCacheDir)**/*.nupkg" />
<SourceBuiltPackageFiles Include="$(AdditionalSourceBuiltNupkgCacheDir)**/*.nupkg" Condition=" '$(AdditionalSourceBuiltNupkgCacheDir)' != '' " />
<SourceBuiltPackageFiles Include="$(ReferencePackageNupkgCacheDir)**/*.nupkg" Condition=" '$(ReferencePackageNupkgCacheDir)' != '' " />
<SourceBuiltPackageFiles Include="$(PreviouslySourceBuiltNupkgCacheDir)**/*.nupkg" Condition=" '$(PreviouslySourceBuiltNupkgCacheDir)' != '' " />
<!-- Add some other potential top-level project directories for a more specific report. -->
<ProjectDirectories Include="$(CurrentRepoSourceBuildSourceDir)" />
<!-- Finally, scan entire source-build, in case project.assets.json ends up in an unexpected place. -->
<ProjectDirectories Include="$(SourceBuildSelfDir)" />
</ItemGroup>
<PropertyGroup>
<PackageReportDataFile Condition="'$(PackageReportDataFile)' == ''">$([MSBuild]::NormalizePath('$(SourceBuildSelfPrebuiltReportDir)prebuilt-usage.xml'))</PackageReportDataFile>
</PropertyGroup>
<WritePackageUsageData
RestoredPackageFiles="@(AllRestoredPackageFiles)"
TarballPrebuiltPackageFiles="@(TarballPrebuiltPackageFiles)"
SourceBuiltPackageFiles="@(SourceBuiltPackageFiles)"
ReferencePackageFiles="@(ReferencePackageFiles)"
PlatformsRuntimeJsonFiles="@(PlatformsRuntimeJsonFiles)"
TargetRid="$(TargetRid)"
ProjectDirectories="@(ProjectDirectories)"
RootDir="$(SourceBuildSelfDir)"
IgnoredProjectAssetsJsonFiles="@(IgnoredProjectAssetsJsonFiles)"
DataFile="$(PackageReportDataFile)"
ProjectAssetsJsonArchiveFile="$(ProjectAssetsJsonArchiveFile)" />
</Target>
<Target Name="ReportPrebuiltUsage"
DependsOnTargets="WritePrebuiltUsageData">
<PropertyGroup>
<FailOnPrebuiltBaselineError Condition="'$(FailOnPrebuiltBaselineError)' == ''">false</FailOnPrebuiltBaselineError>
</PropertyGroup>
<WriteUsageReports
DataFile="$(PackageReportDataFile)"
PoisonedReportFile="$(PoisonedReportFile)"
OutputDirectory="$(SourceBuildSelfPrebuiltReportDir)" />
<PropertyGroup Condition="'$(ContinueOnPrebuiltBaselineError)' == ''">
<ContinueOnPrebuiltBaselineError>false</ContinueOnPrebuiltBaselineError>
<ContinueOnPrebuiltBaselineError Condition="'$(FailOnPrebuiltBaselineError)' != 'true'">true</ContinueOnPrebuiltBaselineError>
</PropertyGroup>
<ValidateUsageAgainstBaseline
DataFile="$(PackageReportDataFile)"
BaselineDataFile="$(PrebuiltBaselineDataFile)"
BaselineDataUpdateHintFile="$(PrebuiltBaselineDataFileDefault)"
OutputBaselineFile="$(SourceBuildSelfPrebuiltReportDir)generated-new-baseline.xml"
OutputReportFile="$(SourceBuildSelfPrebuiltReportDir)baseline-comparison.xml"
AllowTestProjectUsage="$(AllowTestProjectUsage)"
ContinueOnError="$(ContinueOnPrebuiltBaselineError)"
Condition="'$(DotNetBuildFromSourceFlavor)' != 'Product'" />
</Target>
<!--
Copies the intermediate nupkg project to 'artifacts/' so the repo's global.json is in an
ancestor dir. This helps ensure the same version of Arcade is used throughout the build.
-->
<Target Name="CopyIntermediateNupkgProjToProjectDirectory">
<PropertyGroup>
<SourceBuildIntermediateProjFile>$(MSBuildThisFileDirectory)SourceBuildIntermediate.proj</SourceBuildIntermediateProjFile>
<SourceBuildIntermediateProjTargetFile>$(ArtifactsObjDir)ArcadeGeneratedProjects\SourceBuildIntermediate\SourceBuildIntermediate.proj</SourceBuildIntermediateProjTargetFile>
</PropertyGroup>
<Copy
SourceFiles="$(SourceBuildIntermediateProjFile)"
DestinationFiles="$(SourceBuildIntermediateProjTargetFile)" />
<!-- Run a restore so the SDK doesn't complain. Nothing should actually get restored. -->
<MSBuild
Projects="$(SourceBuildIntermediateProjTargetFile)"
Targets="Restore"
Properties="
SourceBuildArcadeTargetsFile=$(MSBuildThisFileDirectory)SourceBuildArcade.targets;
" />
</Target>
<Target Name="GetLicenseFileForIntermediateNupkgPack"
Condition="'$(DetectSourceBuildIntermediateNupkgLicense)' == 'true'">
<!-- Find the repository's global LICENSE file to apply. -->
<Microsoft.DotNet.Arcade.Sdk.GetLicenseFilePath Directory="$(RepoRoot)">
<Output TaskParameter="Path" PropertyName="DetectedLicenseFile"/>
</Microsoft.DotNet.Arcade.Sdk.GetLicenseFilePath>
<!-- Copy it to a file with '.txt' extension to avoid running into this NuGet problem: https://github.com/NuGet/Home/issues/7601 -->
<PropertyGroup>
<SourceBuildIntermediateNupkgLicenseFile>$(ArtifactsObjDir)ArcadeGeneratedProjects\SourceBuildIntermediate\LICENSE.txt</SourceBuildIntermediateNupkgLicenseFile>
</PropertyGroup>
<Copy
SourceFiles="$(DetectedLicenseFile)"
DestinationFiles="$(SourceBuildIntermediateNupkgLicenseFile)" />
</Target>
<!--
Create source-build intermediate NuGet package and supplemental intermediate NuGet packages (if
necessary) for dependency transport to downstream repos.
-->
<Target Name="PackSourceBuildIntermediateNupkgs"
DependsOnTargets="
CopyIntermediateNupkgProjToProjectDirectory;
GetLicenseFileForIntermediateNupkgPack;
GetCategorizedIntermediateNupkgContents;
GetSourceBuildIntermediateNupkgNameConvention">
<ItemGroup>
<IntermediateNupkgProject Include="$(SourceBuildIntermediateProjTargetFile)" />
<IntermediateNupkgProject
Include="$(SourceBuildIntermediateProjTargetFile)"
Condition=" '%(SupplementalIntermediateNupkgCategory.Identity)' != '' "
AdditionalProperties="
SupplementalIntermediateNupkgCategory=%(SupplementalIntermediateNupkgCategory.Identity)" />
</ItemGroup>
<PropertyGroup>
<IntermediateNupkgBuildMessage>Building intermediate nupkg</IntermediateNupkgBuildMessage>
<IntermediateNupkgBuildMessage Condition=" '@(SupplementalIntermediateNupkgCategory)' != '' ">$(IntermediateNupkgBuildMessage), and supplemental nupkgs for @(SupplementalIntermediateNupkgCategory, ', ')</IntermediateNupkgBuildMessage>
</PropertyGroup>
<Message Importance="High" Text="$(IntermediateNupkgBuildMessage)..." />
<MSBuild
Projects="@(IntermediateNupkgProject)"
Targets="Pack"
Properties="
CurrentRepoSourceBuildArtifactsPackagesDir=$(CurrentRepoSourceBuildArtifactsPackagesDir);
SourceBuildArcadeTargetsFile=$(MSBuildThisFileDirectory)SourceBuildArcade.targets;
SourceBuildIntermediateNupkgLicenseFile=$(SourceBuildIntermediateNupkgLicenseFile);
"
BuildInParallel="false"/>
</Target>
<Import Project="SourceBuildArcade.targets" />
</Project>

View file

@ -1,100 +0,0 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!-- Repo extensibility point. -->
<Import Project="$(RepositoryEngineeringDir)SourceBuild.props" Condition="Exists('$(RepositoryEngineeringDir)SourceBuild.props')" />
<PropertyGroup>
<SourceBuildOutputDir Condition="'$(SourceBuildOutputDir)' == ''">$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'source-build'))</SourceBuildOutputDir>
<SourceBuildSelfDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildOutputDir)', 'self'))</SourceBuildSelfDir>
<CurrentRepoSourceBuildSourceDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildSelfDir)', 'src'))</CurrentRepoSourceBuildSourceDir>
<CurrentRepoSourceBuildPackageCache>$([MSBuild]::NormalizeDirectory('$(SourceBuildSelfDir)', 'package-cache'))</CurrentRepoSourceBuildPackageCache>
<SourceBuildSelfPrebuiltReportDir>$([MSBuild]::NormalizeDirectory('$(SourceBuildSelfDir)', 'prebuilt-report'))</SourceBuildSelfPrebuiltReportDir>
<!--
Keep artifacts/ inside source dir so that ancestor-based file lookups find the inner repo, not
the outer repo. The inner repo global.json and NuGet.config files may have been modified by
source-build, and we want projects inside the artifacts/ dir to respect that.
-->
<CurrentRepoSourceBuildArtifactsDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildSourceDir)', 'artifacts'))</CurrentRepoSourceBuildArtifactsDir>
<CurrentRepoSourceBuildArtifactsPackagesDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildArtifactsDir)', 'packages', '$(Configuration)'))</CurrentRepoSourceBuildArtifactsPackagesDir>
<CurrentRepoSourceBuiltNupkgCacheDir>$([MSBuild]::NormalizeDirectory('$(CurrentRepoSourceBuildArtifactsDir)', 'obj', 'source-built-upstream-cache'))</CurrentRepoSourceBuiltNupkgCacheDir>
<PrebuiltBaselineDataFileDefault>$(RepositoryEngineeringDir)SourceBuildPrebuiltBaseline.xml</PrebuiltBaselineDataFileDefault>
<PrebuiltBaselineDataFile Condition="Exists('$(PrebuiltBaselineDataFileDefault)')">$(PrebuiltBaselineDataFileDefault)</PrebuiltBaselineDataFile>
<!-- By default, use the license file from the root of the repo for the intermediate nupkg. -->
<DetectSourceBuildIntermediateNupkgLicense Condition="'$(DetectSourceBuildIntermediateNupkgLicense)' == ''">true</DetectSourceBuildIntermediateNupkgLicense>
<EnableDefaultSourceBuildIntermediateItems Condition="'$(EnableDefaultSourceBuildIntermediateItems)' == ''">true</EnableDefaultSourceBuildIntermediateItems>
</PropertyGroup>
<Target Name="GetSourceBuildIntermediateNupkgNameConvention">
<PropertyGroup Condition="'$(SourceBuildNonPortable)' == 'true' and '$(TargetRid)' == ''">
<TargetRid>$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</TargetRid>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetRid)' == ''">
<HostArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</HostArchitecture>
<SourceBuildTargetArchitecture Condition="'$(SourceBuildTargetArchitecture)' == ''">$(HostArchitecture)</SourceBuildTargetArchitecture>
<SourceBuildTargetPortableOSPlatform Condition="$([MSBuild]::IsOSPlatform('windows'))">win</SourceBuildTargetPortableOSPlatform>
<SourceBuildTargetPortableOSPlatform Condition="$([MSBuild]::IsOSPlatform('osx'))">osx</SourceBuildTargetPortableOSPlatform>
<SourceBuildTargetPortableOSPlatform Condition="$([MSBuild]::IsOSPlatform('linux'))">linux</SourceBuildTargetPortableOSPlatform>
<SourceBuildTargetPortableOSPlatform Condition="'$(SourceBuildTargetPortableOSPlatform)'==''">linux</SourceBuildTargetPortableOSPlatform>
<!-- By default, build for the portable OS platform with host machine architecture. -->
<TargetRid>$(SourceBuildTargetPortableOSPlatform)-$(SourceBuildTargetArchitecture)</TargetRid>
</PropertyGroup>
<!-- If this repo builds only managed outputs, no RID is used for the intermediate nupkg. -->
<PropertyGroup Condition="'$(SourceBuildManagedOnly)' != 'true'">
<SourceBuildIntermediateNupkgRid Condition="'$(SourceBuildIntermediateNupkgRid)' == ''">$(TargetRid)</SourceBuildIntermediateNupkgRid>
</PropertyGroup>
<PropertyGroup>
<SourceBuildIntermediateNupkgPrefix>Microsoft.SourceBuild.Intermediate.</SourceBuildIntermediateNupkgPrefix>
<SourceBuildIntermediateNupkgSuffix Condition="'$(SourceBuildIntermediateNupkgRid)' != ''">.$(SourceBuildIntermediateNupkgRid)</SourceBuildIntermediateNupkgSuffix>
</PropertyGroup>
</Target>
<!--
Get the list of nupkg contents, categorized into supplemental categories if necessary. By
default, all non-symbol-package nupkg files and tar.gz files in
'artifacts/packages/{configuration}' are packed in the intermediate nupkg.
To configure this, add a target to eng/SourceBuild.props with
'BeforeTargets="GetCategorizedIntermediateNupkgContents"' that sets up
'IntermediateNupkgArtifactFile' items with optional 'Category' metadata.
When 'Category' is set, this tooling produces one supplemental intermediate nupkg per named
category. All files not in a category are put into the "main" intermediate nupkg.
-->
<Target Name="GetCategorizedIntermediateNupkgContents">
<ItemGroup Condition="'$(EnableDefaultSourceBuildIntermediateItems)' == 'true'">
<!-- Catch-all: anything not in a category gets packed in the 'main' intermediate nupkg. -->
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.nupkg" />
<IntermediateNupkgArtifactFile Include="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.tar.gz" />
<!-- Don't pack any symbol packages: not needed for downstream source-build CI. -->
<IntermediateNupkgArtifactFile Remove="$(CurrentRepoSourceBuildArtifactsPackagesDir)**\*.symbols.nupkg" />
</ItemGroup>
<ItemGroup>
<IntermediateNupkgFile Include="@(IntermediateNupkgArtifactFile)" PackagePath="artifacts" />
<!-- Report goes into the 'main' intermediate nupkg. -->
<IntermediateNupkgFile Include="$(SourceBuildSelfPrebuiltReportDir)**\*" PackagePath="prebuilt-report" />
</ItemGroup>
<RemoveDuplicates Inputs="@(IntermediateNupkgFile)">
<Output TaskParameter="Filtered" ItemName="IntermediatePackageFile" />
</RemoveDuplicates>
<ItemGroup>
<IntermediateNonShippingNupkgFile Include="@(IntermediatePackageFile)" Condition="$([System.Text.RegularExpressions.Regex]::Match(%(Identity),'[\\\\/]NonShipping[\\\\/]').Success)"/>
<SupplementalIntermediateNupkgCategory Include="%(IntermediatePackageFile.Category)" />
</ItemGroup>
</Target>
</Project>

View file

@ -1,207 +0,0 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!--
These targets inject source-build into Arcade's build process.
-->
<Import Project="SourceBuildArcade.targets" />
<PropertyGroup>
<CurrentRepoSourceBuildBinlogFile>$([MSBuild]::NormalizePath('$(CurrentRepoSourceBuildArtifactsDir)', 'sourcebuild.binlog'))</CurrentRepoSourceBuildBinlogFile>
<InnerSourceBuildRepoRoot Condition="'$(InnerSourceBuildRepoRoot)' == ''">$(CurrentRepoSourceBuildSourceDir)</InnerSourceBuildRepoRoot>
<CleanInnerSourceBuildRepoRoot Condition="'$(CleanInnerSourceBuildRepoRoot)' == ''">true</CleanInnerSourceBuildRepoRoot>
</PropertyGroup>
<Target Name="ExecuteWithSourceBuiltTooling"
DependsOnTargets="
BuildUpstreamRepos;
GetSourceBuildCommandConfiguration;
RunInnerSourceBuildCommand;
PackSourceBuildTarball"
Condition="
'$(ArcadeBuildFromSource)' == 'true' and
'$(ArcadeInnerBuildFromSource)' != 'true'"
BeforeTargets="Execute" />
<!--
Use BeforeTargets="ExecuteInnerSourceBuild" to trigger when the inner build is happening.
-->
<Target Name="ExecuteInnerSourceBuild" />
<!--
HookExecuteInnerSourceBuild triggers ExecuteInnerSourceBuild only if it's the right time. A
BeforeTargets on HookExecuteInnerSourceBuild would always execute because BeforeTargets runs
even if the condition isn't met, so we need this indirection.
-->
<Target Name="HookExecuteInnerSourceBuild"
Condition="
'$(ArcadeBuildFromSource)' == 'true' and
'$(ArcadeInnerBuildFromSource)' == 'true'"
DependsOnTargets="ExecuteInnerSourceBuild"
BeforeTargets="Execute"/>
<!--
Build upstream repos from source.
TODO: (arcade-sb) Support building upstreams from source based on int nupkgs. For now this
target is overridden in any repo that implements the upstream build from source. It involves a
lot of source-build infra that will be more gradually moved. Same for PackSourceBuildTarball.
-->
<Target Name="BuildUpstreamRepos"
Condition="'$(BuildUpstreamRepos)' == 'true'">
<Error Text="NotImplemented" />
</Target>
<Target Name="PackSourceBuildTarball"
Condition="'$(PackSourceBuildTarball)' == 'true'">
<Error Text="NotImplemented" />
</Target>
<!--
Set up build args to append to the passed build command. These args specify what is unique about
building from source, such as non-overlapping artifacts dirs and package caches.
Use BeforeTargets="GetSourceBuildCommandConfiguration" or set props/items to customize.
-->
<Target Name="GetSourceBuildCommandConfiguration">
<PropertyGroup>
<!-- Track that this is the inner build to prevent infinite recursion. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:ArcadeInnerBuildFromSource=true</InnerBuildArgs>
<!-- Set DotNetBuildFromSource to avoid publishing. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:DotNetBuildFromSource=true</InnerBuildArgs>
<!-- Use a fresh clone of the repo so that source-build modifications are isolated. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:RepoRoot=$(InnerSourceBuildRepoRoot)</InnerBuildArgs>
<!-- Override the artifacts dir to cleanly separate the inner build from outer build. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:ArtifactsDir=$(CurrentRepoSourceBuildArtifactsDir)</InnerBuildArgs>
<!-- Set a custom binlog location to avoid clashing over the currenly specified file. -->
<InnerBuildArgs>$(InnerBuildArgs) /bl:$(CurrentRepoSourceBuildBinlogFile)</InnerBuildArgs>
<!-- Flow ContinuousIntegrationBuild to the inner build. -->
<InnerBuildArgs Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(InnerBuildArgs) /p:ContinuousIntegrationBuild=true</InnerBuildArgs>
<!-- The inner build needs to reference the overall output dir for nupkg transport etc. -->
<InnerBuildArgs>$(InnerBuildArgs) /p:SourceBuildOutputDir=$(SourceBuildOutputDir)</InnerBuildArgs>
<InnerBuildArgs>$(InnerBuildArgs) /p:SourceBuiltBlobFeedDir=$(SourceBuiltBlobFeedDir)</InnerBuildArgs>
<InnerBuildArgs >$(InnerBuildArgs) /p:DotNetBuildOffline=true</InnerBuildArgs>
<InnerBuildArgs Condition=" '$(DotNetPackageVersionPropsPath)' != '' ">$(InnerBuildArgs) /p:DotNetPackageVersionPropsPath=$(DotNetPackageVersionPropsPath)</InnerBuildArgs>
</PropertyGroup>
<ItemGroup>
<!-- Override package cache to separate source-built packages from upstream. -->
<InnerBuildEnv Include="NUGET_PACKAGES=$(CurrentRepoSourceBuildPackageCache)" />
</ItemGroup>
</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.
Creating a fresh clone avoids overwriting existing work or making subtle changes that might
accidentally get added to the user's existing work via a 'git add .'. Since the clone also 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.
-->
<Target Name="CloneInnerSourceBuildRepoRoot" Condition=" '$(CopySrcInsteadOfClone)' != 'true' ">
<PropertyGroup>
<!--
By default, copy WIP. WIP copy helps with local machine dev work. Don't copy WIP if this is
a CI build: CI often uses shallow clones, which WIP copying doesn't support.
-->
<CopyWipIntoInnerSourceBuildRepo Condition="'$(CopyWipIntoInnerSourceBuildRepo)' == '' and '$(ContinuousIntegrationBuild)' == 'true'">false</CopyWipIntoInnerSourceBuildRepo>
<CopyWipIntoInnerSourceBuildRepo Condition="'$(CopyWipIntoInnerSourceBuildRepo)' == ''">true</CopyWipIntoInnerSourceBuildRepo>
<_GitCloneToDirArgs />
<_GitCloneToDirArgs>$(_GitCloneToDirArgs) --source &quot;$(RepoRoot)&quot;</_GitCloneToDirArgs>
<_GitCloneToDirArgs>$(_GitCloneToDirArgs) --dest &quot;$(InnerSourceBuildRepoRoot)&quot;</_GitCloneToDirArgs>
<_GitCloneToDirArgs Condition="'$(CopyWipIntoInnerSourceBuildRepo)' == 'true'">$(_GitCloneToDirArgs) --copy-wip</_GitCloneToDirArgs>
<_GitCloneToDirArgs Condition="'$(CleanInnerSourceBuildRepoRoot)' == 'true'">$(_GitCloneToDirArgs) --clean</_GitCloneToDirArgs>
<_GitCloneToDirScriptFile>$(MSBuildThisFileDirectory)git-clone-to-dir.sh</_GitCloneToDirScriptFile>
</PropertyGroup>
<Exec Command="$(_GitCloneToDirScriptFile) $(_GitCloneToDirArgs)" />
<!--
If the repo has submodules, use 'git clone' on each submodule to put it in the inner repo. We
could simply call 'git submodule update ...' one time in the inner repo. However, that hits
the network, which is slow and may be unreliable. Also:
* 'git clone' copies the minimal amount of files from one place on disk to another.
* 'git clone' uses hard links instead of doing a full copy of all the Git data files. (In some
cases it can't use hard links, but Git figures that out itself.)
The result of cloning each submodule into the right location in the inner repo isn't identical
to fully setting up a submodule, but it behaves the same in the context of source-build.
-->
<PropertyGroup>
<CloneSubmodulesToInnerSourceBuildRepo Condition="'$(CloneSubmodulesToInnerSourceBuildRepo)' == ''">true</CloneSubmodulesToInnerSourceBuildRepo>
<_GitSubmoduleCloneArgs />
<_GitSubmoduleCloneArgs>$(_GitSubmoduleCloneArgs) --source .</_GitSubmoduleCloneArgs>
<_GitSubmoduleCloneArgs>$(_GitSubmoduleCloneArgs) --dest &quot;$(InnerSourceBuildRepoRoot)$sm_path&quot;</_GitSubmoduleCloneArgs>
<_GitSubmoduleCloneArgs Condition="'$(CopyWipIntoInnerSourceBuildRepo)' == 'true'">$(_GitSubmoduleCloneArgs) --copy-wip</_GitSubmoduleCloneArgs>
<_GitSubmoduleCloneArgs Condition="'$(CleanInnerSourceBuildRepoRoot)' == 'true'">$(_GitSubmoduleCloneArgs) --clean</_GitSubmoduleCloneArgs>
</PropertyGroup>
<Exec
Condition="'$(CloneSubmodulesToInnerSourceBuildRepo)' == 'true'"
Command="git submodule foreach --recursive '$(_gitCloneToDirScriptFile) $(_GitSubmoduleCloneArgs)'"
WorkingDirectory="$(RepoRoot)" />
</Target>
<Target Name="RunInnerSourceBuildCommand"
DependsOnTargets="PrepareInnerSourceBuildRepoRoot">
<PropertyGroup>
<!-- Prevent any projects from building in the outside build: they would use prebuilts. -->
<PreventPrebuiltBuild>true</PreventPrebuiltBuild>
<!--
Normally, the inner build should run using the original build command with some extra args
appended. Allow the repo to override this default behavior if the repo is e.g. not onboarded
enough on Arcade for this to work nicely.
-->
<BaseInnerSourceBuildCommand Condition="'$(BaseInnerSourceBuildCommand)' == ''">$(ARCADE_BUILD_TOOL_COMMAND)</BaseInnerSourceBuildCommand>
</PropertyGroup>
<Exec
Command="$(BaseInnerSourceBuildCommand) $(InnerBuildArgs)"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
EnvironmentVariables="@(InnerBuildEnv)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="PreventPrebuiltBuild"
DependsOnTargets="ExecuteWithSourceBuiltTooling"
Condition="'$(PreventPrebuiltBuild)' == 'true'"
BeforeTargets="Execute">
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)" />
<ProjectToBuild Include="$(MSBuildThisFileDirectory)Noop.proj" />
</ItemGroup>
</Target>
</Project>

View file

@ -1,62 +0,0 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<Import Project="SourceBuildArcade.targets" />
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.SourceBuild.AddSourceToNuGetConfig" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
<UsingTask TaskName="Microsoft.DotNet.Arcade.Sdk.SourceBuild.ReadSourceBuildIntermediateNupkgDependencies" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.SourceBuild.Tasks" Version="$(MicrosoftDotNetSourceBuildTasksVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
<Target Name="CollectSourceBuildIntermediateNupkgDependencies"
Condition="
'$(DotNetBuildFromSourceFlavor)' != 'Product' and
(('$(ArcadeBuildFromSource)' == 'true' and '$(ArcadeInnerBuildFromSource)' == 'true') or
'$(SetUpSourceBuildIntermediateNupkgCache)' == 'true')"
DependsOnTargets="GetSourceBuildIntermediateNupkgNameConvention"
BeforeTargets="CollectPackageReferences">
<ReadSourceBuildIntermediateNupkgDependencies
VersionDetailsXmlFile="$([MSBuild]::NormalizePath('$(RepositoryEngineeringDir)', 'Version.Details.xml'))"
SourceBuildIntermediateNupkgPrefix="$(SourceBuildIntermediateNupkgPrefix)"
SourceBuildIntermediateNupkgRid="$(SourceBuildIntermediateNupkgRid)">
<Output TaskParameter="Dependencies" ItemName="SourceBuildIntermediateNupkgReference" />
</ReadSourceBuildIntermediateNupkgDependencies>
<ItemGroup>
<PackageReference Include="@(SourceBuildIntermediateNupkgReference)" />
</ItemGroup>
</Target>
<Target Name="SetUpSourceBuildIntermediateNupkgCache"
Condition="
'$(DotNetBuildFromSourceFlavor)' != 'Product' and
(('$(ArcadeBuildFromSource)' == 'true' and '$(ArcadeInnerBuildFromSource)' == 'true' and '@(SourceBuildIntermediateNupkgReference)' != '') or
'$(SetUpSourceBuildIntermediateNupkgCache)' == 'true')"
AfterTargets="Restore">
<PropertyGroup>
<SourceBuiltNupkgCacheDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'source-built-upstream-cache'))</SourceBuiltNupkgCacheDir>
</PropertyGroup>
<ItemGroup>
<IntermediateNupkgSourceDir Include="$([MSBuild]::NormalizeDirectory(
'$(NuGetPackageRoot)',
'$([System.String]::new(`%(SourceBuildIntermediateNupkgReference.Identity)`).ToLowerInvariant())',
'$([System.String]::new(`%(SourceBuildIntermediateNupkgReference.ExactVersion)`).ToLowerInvariant())',
'artifacts'))" />
<SourceBuiltNupkgFile Include="%(IntermediateNupkgSourceDir.Identity)**\*.nupkg" />
</ItemGroup>
<Copy
SourceFiles="@(SourceBuiltNupkgFile)"
DestinationFiles="@(SourceBuiltNupkgFile -> '$(SourceBuiltNupkgCacheDir)%(Filename)%(Extension)')" />
<AddSourceToNuGetConfig
NuGetConfigFile="$(RestoreConfigFile)"
SourceName="source-build-int-nupkg-cache"
SourcePath="$(SourceBuiltNupkgCacheDir)" />
</Target>
</Project>

View file

@ -1,108 +0,0 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!-- Shield this project from nonstandard Directory.Build.props/targets. -->
<PropertyGroup>
<ImportDirectoryPackagesProps>false</ImportDirectoryPackagesProps>
<ImportDirectoryBuildProps>false</ImportDirectoryBuildProps>
<ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!-- Import common functionality, including repo extension point. -->
<Import Project="$(SourceBuildArcadeTargetsFile)" />
<PropertyGroup>
<Copyright Condition="'$(Copyright)' == ''">$(CopyrightNetFoundation)</Copyright>
<IsPackable>true</IsPackable>
<IsShipping>false</IsShipping>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<IncludeBuildOutput>false</IncludeBuildOutput>
<!-- NuGet excludes nupkgs by default: disable this behavior. -->
<NoDefaultExcludes>true</NoDefaultExcludes>
<!-- Arbitrary TargetFramework to appease SDK. -->
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(SourceBuildIntermediateNupkgLicenseFile)' != ''">
<PackageLicenseFile>$([System.IO.Path]::GetFileName('$(SourceBuildIntermediateNupkgLicenseFile)'))</PackageLicenseFile>
</PropertyGroup>
<ItemGroup Condition="'$(SourceBuildIntermediateNupkgLicenseFile)' != ''">
<None Include="$(SourceBuildIntermediateNupkgLicenseFile)" Pack="true" PackagePath="$(PackageLicenseFile)" />
</ItemGroup>
<Target Name="InitializeSourceBuildIntermediatePackageId"
DependsOnTargets="GetSourceBuildIntermediateNupkgNameConvention"
BeforeTargets="GenerateNuspec;InitializeStandardNuspecProperties">
<Error Condition="'$(GitHubRepositoryName)' == ''" Text="GitHubRepositoryName property is not defined." />
<PropertyGroup>
<PackageId>$(GitHubRepositoryName)</PackageId>
<PackageId Condition="'$(SupplementalIntermediateNupkgCategory)' != ''">$(PackageId).$(SupplementalIntermediateNupkgCategory)</PackageId>
<PackageId>$(SourceBuildIntermediateNupkgPrefix)$(PackageId)$(SourceBuildIntermediateNupkgSuffix)</PackageId>
</PropertyGroup>
</Target>
<Target Name="GetIntermediateNupkgArtifactFiles"
DependsOnTargets="
GetCategorizedIntermediateNupkgContents;
GetSupplementalIntermediateNupkgManifest;
CreateNonShippingNupkgList"
BeforeTargets="_GetPackageFiles">
<ItemGroup>
<Content Include="@(IntermediatePackageFile->WithMetadataValue('Category', '$(SupplementalIntermediateNupkgCategory)'))" />
</ItemGroup>
</Target>
<Target Name="GetSupplementalIntermediateNupkgManifest"
Condition="'$(SupplementalIntermediateNupkgCategory)' == ''"
DependsOnTargets="InitializeSourceBuildIntermediatePackageId">
<PropertyGroup>
<SupplementalIntermediateNupkgManifestFile>$(BaseOutputPath)SupplementalIntermediatePackages.txt</SupplementalIntermediateNupkgManifestFile>
</PropertyGroup>
<WriteLinesToFile
File="$(SupplementalIntermediateNupkgManifestFile)"
Lines="@(SupplementalIntermediateNupkgCategory->'$(SourceBuildIntermediateNupkgPrefix)$(GitHubRepositoryName).%(Identity)$(SourceBuildIntermediateNupkgSuffix)', '%0A')"
Overwrite="true" />
<ItemGroup>
<!-- The list of supplemental package ids goes into the "main" intermediate nupkg. -->
<Content Include="$(SupplementalIntermediateNupkgManifestFile)" PackagePath="." />
</ItemGroup>
</Target>
<!-- Create a list of non-shipping packages and include it in the intermediate package. -->
<Target Name="CreateNonShippingNupkgList"
Condition="'@(IntermediateNonShippingNupkgFile)' != ''">
<PropertyGroup>
<!-- The prefix needs to match what's defined in tarball source-build infra. Consider using a single property, in the future. -->
<NonShippingPackagesListPrefix>NonShipping.Packages.</NonShippingPackagesListPrefix>
<NonShippingPackagesList>$(CurrentRepoSourceBuildArtifactsPackagesDir)$(NonShippingPackagesListPrefix)$(GitHubRepositoryName).lst</NonShippingPackagesList>
</PropertyGroup>
<WriteLinesToFile
File="$(NonShippingPackagesList)"
Lines="@(IntermediateNonShippingNupkgFile->'%(Filename)%(Extension)')"
Overwrite="true" />
<ItemGroup>
<!-- The list of non-shipping packages goes into the "main" intermediate nupkg. -->
<Content Include="$(NonShippingPackagesList)" PackagePath="." />
</ItemGroup>
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Target Name="Build" />
</Project>