зеркало из
1
0
Форкнуть 0

Convert DotNet.ReproducibleBuild.csproj to pack during build

This commit is contained in:
Aaron Lahman 2021-05-14 11:48:21 -07:00
Родитель 4ce5530d5e
Коммит 6355e76842
3 изменённых файлов: 23 добавлений и 20 удалений

5
Directory.Build.props Normal file
Просмотреть файл

@ -0,0 +1,5 @@
<Project>
<PropertyGroup Condition="'$(Build_ArtifactStagingDirectory)' != ''">
<PackageOutputPath>$(Build_ArtifactStagingDirectory)packages\</PackageOutputPath>
</PropertyGroup>
</Project>

Просмотреть файл

@ -30,16 +30,11 @@ stages:
- task: NuGetToolInstaller@1
- pwsh: |
mkdir $(Build.ArtifactStagingDirectory)\Packages
$version = .\nbgv get-version -f json | ConvertFrom-Json
nuget pack $(System.DefaultWorkingDirectory)\src\DotNet.ReproducibleBuilds\DotNet.ReproducibleBuilds.nuspec `
-outputdirectory $(Build.ArtifactStagingDirectory)\Packages `
-basepath $(System.DefaultWorkingDirectory)\src\DotNet.ReproducibleBuilds `
-NoPackageAnalysis `
-Properties "version=$($version.NuGetPackageVersion);RepositoryCommit=$($version.GitCommitId)"
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: pack
arguments: src/DotNet.ReproducibleBuilds
displayName: Create package
- publish: $(Build.ArtifactStagingDirectory)\Packages

Просмотреть файл

@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<DevelopmentDependency>true</DevelopmentDependency>
@ -12,14 +11,9 @@
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<GenerateAssemblyVersionInfo>false</GenerateAssemblyVersionInfo>
<NuspecFile>DotNet.ReproducibleBuilds.nuspec</NuspecFile>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<IntermediateAssembly Remove="@(IntermediateAssembly)"/>
<IntermediateRefAssembly Remove="@(IntermediateRefAssembly)"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.194" PrivateAssets="all" />
</ItemGroup>
@ -33,8 +27,17 @@
<AssemblyVersion>$(BuildVersionSimple)</AssemblyVersion>
<NuspecProperties>version=$(NuGetPackageVersion);RepositoryType=git;RepositoryCommit=$(GitCommitId);RepositoryUrl=$(GitRepositoryUrl)</NuspecProperties>
</PropertyGroup>
</Target>
<Target Name="CustomPack" BeforeTargets="Pack">
<!--
Manually package the nuget.
There's no way to use the pack targets without it putting Exclude=Build,Analyzers, which we don't
want. We also explicitly need the dependent reference's build targets to run (for soucelink). That's
why we specify the nuspec directly.
-->
<Exec Command="nuget pack DotNet.ReproducibleBuilds.nuspec -outputdirectory $(PackageOutputPath) -basepath . -NoPackageAnalysis -Properties &quot;$(NuspecProperties)&quot;" />
</Target>
</Project>