Skip to content

Commit

Permalink
Remove dependency on Prerequisites package
Browse files Browse the repository at this point in the history
The work done by the prerequisites package was a simple trivial targets file. Move that to be an included target in all packages and imported by the first one instead.
  • Loading branch information
kzu committed Mar 22, 2023
1 parent ca0fb63 commit 105f085
Show file tree
Hide file tree
Showing 20 changed files with 26 additions and 61 deletions.
7 changes: 1 addition & 6 deletions ThisAssembly.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
src\Directory.targets = src\Directory.targets
src\Directory.targets.user = src\Directory.targets.user
readme.md = readme.md
src\ThisAssembly.Prerequisites.targets = src\ThisAssembly.Prerequisites.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisAssembly", "src\ThisAssembly\ThisAssembly.csproj", "{D3A47732-4937-4B6E-BCD1-66896D04E20D}"
Expand All @@ -30,8 +31,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\tag.yml = .github\workflows\tag.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisAssembly.Prerequisites", "src\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj", "{568E5150-84AD-4619-BEA3-AA5EDF084ABC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisAssembly.Constants", "src\ThisAssembly.Constants\ThisAssembly.Constants.csproj", "{31C53CCE-13FC-4890-803A-85CD146B909B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThisAssembly.Tests", "src\ThisAssembly.Tests\ThisAssembly.Tests.csproj", "{AD25424F-7DE0-4515-AE9F-B95414218292}"
Expand Down Expand Up @@ -66,10 +65,6 @@ Global
{3E7158B5-BFEF-4416-8226-9096C7C98268}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E7158B5-BFEF-4416-8226-9096C7C98268}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E7158B5-BFEF-4416-8226-9096C7C98268}.Release|Any CPU.Build.0 = Release|Any CPU
{568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Release|Any CPU.Build.0 = Release|Any CPU
{31C53CCE-13FC-4890-803A-85CD146B909B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31C53CCE-13FC-4890-803A-85CD146B909B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31C53CCE-13FC-4890-803A-85CD146B909B}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
6 changes: 6 additions & 0 deletions src/Directory.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

<PackageFile Include="$(MSBuildThisFileDirectory)_._" PackagePath="lib/netstandard2.0/_._" />
<PackageFile Include="*.props;*.targets" PackagePath="build\$(TargetFramework)\%(Filename)%(Extension)" Visible="true" />

<!-- Add prerequisites to package -->
<None Include="$(MSBuildThisFileDirectory)ThisAssembly.Prerequisites.targets"
CopyToOutputDirectory="PreserveNewest"
PackagePath="build\$(TargetFramework)\%(Filename)%(Extension)"
Condition="'$(IncludePrerequisites)' != 'false'"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,4 @@ on the `ThisAssembly.Info` class.
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<PackageReference Update="ThisAssembly.AssemblyInfo" PrivateAssets="all" PackTransitive="false" />
</ItemGroup>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
4 changes: 0 additions & 4 deletions src/ThisAssembly.Constants/ThisAssembly.Constants.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,4 @@ C#:
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/ThisAssembly.Constants/ThisAssembly.Constants.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@
</ItemGroup>
</Target>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
1 change: 1 addition & 0 deletions src/ThisAssembly.Git/ThisAssembly.Git.targets
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@
</ItemGroup>
</Target>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
4 changes: 0 additions & 4 deletions src/ThisAssembly.Metadata/ThisAssembly.Metadata.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,4 @@ C#:
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/ThisAssembly.Metadata/ThisAssembly.Metadata.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<PackageReference Update="ThisAssembly.Metadata" PrivateAssets="all" PackTransitive="false" />
</ItemGroup>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<Project>

<PropertyGroup>
<!-- Incremental source generator interface appeared first on Roslyn 4.0.1, see
https://learn.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.iincrementalgenerator?view=roslyn-dotnet-4.0.1 -->
<ThisAssemblyMinimumRoslynVersion Condition="'$(ThisAssemblyMinimumRoslynVersion)' == ''">4.0</ThisAssemblyMinimumRoslynVersion>
</PropertyGroup>

<Target Name="_ThisAssemblyCheckCompilerVersion" BeforeTargets="CoreCompile">

<!-- Version comparison functions require MSBuild 16.5+ -->
Expand All @@ -20,4 +26,8 @@
('$(Language)' == 'C#' Or '$(Language)' == 'VB')" />
</Target>

<PropertyGroup>
<ThisAssemblyPrerequisitesImported>true</ThisAssemblyPrerequisitesImported>
</PropertyGroup>

</Project>
22 changes: 0 additions & 22 deletions src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.csproj

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions src/ThisAssembly.Project/ThisAssembly.Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,4 @@ C#:
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/ThisAssembly.Project/ThisAssembly.Project.targets
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@
</ItemGroup>
</Target>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
4 changes: 0 additions & 4 deletions src/ThisAssembly.Resources/ThisAssembly.Resources.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="..\EmbeddedResource.cs" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/ThisAssembly.Resources/ThisAssembly.Resources.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
</ItemGroup>
</Target>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
4 changes: 0 additions & 4 deletions src/ThisAssembly.Strings/ThisAssembly.Strings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ such as "Hello {name}".
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Remove="ThisAssembly.Strings.cs" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/ThisAssembly.Strings/ThisAssembly.Strings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
<CompilerVisibleItemMetadata Include="AdditionalFiles" MetadataName="ManifestResourceName" />
</ItemGroup>

<Import Condition="'$(ThisAssemblyPrerequisitesImported)' != 'true'" Project="ThisAssembly.Prerequisites.targets" />
</Project>
1 change: 1 addition & 0 deletions src/ThisAssembly.Tests/ThisAssembly.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<Compile Include="..\ThisAssembly.Strings\Model.cs" Link="Model.cs" />
</ItemGroup>

<Import Project="..\ThisAssembly.Prerequisites.targets"/>
<Import Project="..\*\*.targets" />

</Project>
1 change: 1 addition & 0 deletions src/ThisAssembly/ThisAssembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>true</IsPackable>
<PackBuildOutput>false</PackBuildOutput>
<IncludePrerequisites>false</IncludePrerequisites>
</PropertyGroup>

<PropertyGroup>
Expand Down

0 comments on commit 105f085

Please sign in to comment.