Skip to content

Commit

Permalink
Enabled deterministic builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-a committed Jul 23, 2024
1 parent 4c7aae0 commit 41312fd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="$(CakeVersion)">
<PrivateAssets>all</PrivateAssets>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="$(CakeVersion)">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Cake.Testing" Version="$(CakeVersion)">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Cake.Testing" Version="$(CakeVersion)">
<PrivateAssets>all</PrivateAssets>
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Cake.Chocolatey.Module\Cake.Chocolatey.Module.csproj" />
</ItemGroup>

</Project>
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Cake.Chocolatey.Module\Cake.Chocolatey.Module.csproj" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions Source/Cake.Chocolatey.Module.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Chocolatey.Module", "C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cake.Chocolatey.Module.Tests", "Cake.Chocolatey.Module.Tests\Cake.Chocolatey.Module.Tests.csproj", "{1A12838D-0FD6-448E-834F-23927CF9D91E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{9EB0B68C-69C5-40C0-97FE-2524B51F60B2}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
4 changes: 4 additions & 0 deletions Source/Cake.Chocolatey.Module/Cake.Chocolatey.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ For details see $(PackageProjectUrl)/releases</PackageReleaseNotes>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="JetBrains.Annotations" Version="2024.2.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
28 changes: 28 additions & 0 deletions Source/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

<!-- This target must be imported into Directory.Build.targets -->
<!-- Workaround. Remove once we're targeting the 3.1.300+ SDK
https://github.com/dotnet/sourcelink/issues/572 -->
<Project>
<PropertyGroup>
<!-- Uncomment the following if you want to have pdb files embedded inside a nupkg package -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
</ItemGroup>
<ItemGroup>
<SourceRoot Include="$(NuGetPackageRoot)" />
</ItemGroup>

<Target Name="CoverletGetPathMap"
DependsOnTargets="InitializeSourceRootMappedPaths"
Returns="@(_LocalTopLevelSourceRoot)"
Condition="'$(DeterministicSourcePaths)' == 'true'">
<ItemGroup>
<_LocalTopLevelSourceRoot Include="@(SourceRoot)" Condition="'%(SourceRoot.NestedRoot)' == ''"/>
</ItemGroup>
</Target>
</Project>

0 comments on commit 41312fd

Please sign in to comment.