Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions src/SourceBuild/content/eng/finish-source-only.proj
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,27 @@
OutputPath="$(ArtifactsLogDir)" />
</Target>

<Target Name="DetermineSourceBuiltSdkNonStableVersion"
DependsOnTargets="DetermineSourceBuiltSdkVersion">
<ItemGroup>
<SdkVersionFileItem Include="$(DotNetSdkExtractDir)/sdk/**/.version" />
</ItemGroup>

<PropertyGroup>
<SourceBuiltSdkNonStableVersion>$([System.Text.RegularExpressions.Regex]::Split('$([System.IO.File]::ReadAllText('%(SdkVersionFileItem.Identity)'))', '\r\n|\r|\n')[3])</SourceBuiltSdkNonStableVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ReadAllLines be used instead to simplify the logic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get ReadAllLines to work in MSBuild: error MSB4185: The function "ReadAllLines" on type "System.IO.File" is not available for execution as an MSBuild property function

There is a built-in task as an alternative - ReadLinesFromFile. But, then the code gets a bit larger.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah not sure why we allow ReadAllText but not ReadAllLines; I'd be willing to expand that if you care to file it. But this seems ok (or using string.Split()).

</PropertyGroup>
</Target>

<!--
Determine symbols tarball names and discover all intermediate symbols,
to be used as inputs and outputs of symbols repackaging targets.
-->
<Target Name="DetermineSymbolsTargetsInputsAndOutputs"
AfterTargets="Build"
DependsOnTargets="DetermineSourceBuiltSdkVersion">
DependsOnTargets="DetermineSourceBuiltSdkNonStableVersion">
<PropertyGroup>
<UnifiedSymbolsTarball>$(ArtifactsAssetsDir)dotnet-symbols-all-$(SourceBuiltSdkVersion)-$(TargetRid)$(ArchiveExtension)</UnifiedSymbolsTarball>
<SdkSymbolsTarball>$(ArtifactsAssetsDir)dotnet-symbols-sdk-$(SourceBuiltSdkVersion)-$(TargetRid)$(ArchiveExtension)</SdkSymbolsTarball>
<UnifiedSymbolsTarball>$(ArtifactsAssetsDir)dotnet-symbols-all-$(SourceBuiltSdkNonStableVersion)-$(TargetRid)$(ArchiveExtension)</UnifiedSymbolsTarball>
<SdkSymbolsTarball>$(ArtifactsAssetsDir)dotnet-symbols-sdk-$(SourceBuiltSdkNonStableVersion)-$(TargetRid)$(ArchiveExtension)</SdkSymbolsTarball>
</PropertyGroup>
<ItemGroup>
<IntermediateSymbol Include="$(IntermediateSymbolsRootDir)**/*" />
Expand Down Expand Up @@ -162,10 +173,10 @@
</Target>

<Target Name="CreatePrebuiltsTarballIfPrebuiltsExist"
DependsOnTargets="DetermineSourceBuiltSdkVersion"
DependsOnTargets="DetermineSourceBuiltSdkNonStableVersion"
Condition="'@(PrebuiltFile)' != ''">
<PropertyGroup>
<PrebuiltsTarball>$(ArtifactsAssetsDir)$(SourceBuiltPrebuiltsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</PrebuiltsTarball>
<PrebuiltsTarball>$(ArtifactsAssetsDir)$(SourceBuiltPrebuiltsTarballName).$(SourceBuiltSdkNonStableVersion).$(TargetRid)$(ArchiveExtension)</PrebuiltsTarball>
<PrebuiltsTarballWorkingDir>$(ResultingPrebuiltPackagesDir)</PrebuiltsTarballWorkingDir>
</PropertyGroup>

Expand All @@ -182,7 +193,7 @@


<Target Name="GetInputsOutputForCreatePrivateSourceBuiltArtifactsArchive"
DependsOnTargets="DetermineSourceBuiltSdkVersion;ResolveProjectReferences">
DependsOnTargets="DetermineSourceBuiltSdkNonStableVersion;ResolveProjectReferences">
<!-- Inputs: Packages to include in the tarball -->
<ItemGroup>
<ArtifactsPackageToBundle Include="$(ArtifactsShippingPackagesDir)**;
Expand All @@ -198,7 +209,7 @@
<SourceBuiltLayoutDir>$([MSBuild]::NormalizeDirectory('$(BaseIntermediateOutputPath)', 'artifacts-layout'))</SourceBuiltLayoutDir>

<!-- Outputs -->
<SourceBuiltTarballName>$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName).$(SourceBuiltSdkVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
<SourceBuiltTarballName>$(ArtifactsAssetsDir)$(SourceBuiltArtifactsTarballName).$(SourceBuiltSdkNonStableVersion).$(TargetRid)$(ArchiveExtension)</SourceBuiltTarballName>
<SourceBuiltVersionName>$(SourceBuiltLayoutDir).version</SourceBuiltVersionName>
<AllPackageVersionsPropsName>$(SourceBuiltLayoutDir)PackageVersions.props</AllPackageVersionsPropsName>
<SourceBuiltMergedAssetManifestName>$(SourceBuiltLayoutDir)%(MergedAssetManifest.Filename)%(MergedAssetManifest.Extension)</SourceBuiltMergedAssetManifestName>
Expand Down Expand Up @@ -231,7 +242,7 @@

<!-- Content of the .version file to include in the tarball -->
<ItemGroup>
<VersionFileContent Include="$(RepositoryCommit);$(SourceBuiltSdkVersion)" />
<VersionFileContent Include="$(RepositoryCommit);$(SourceBuiltSdkNonStableVersion)" />
</ItemGroup>

<WriteLinesToFile File="$(SourceBuiltVersionName)"
Expand Down