Skip to content

Commit

Permalink
Improve shared files inclusion
Browse files Browse the repository at this point in the history
This fixes some IDE-errors which caused slowness in git operations too.
  • Loading branch information
kzu committed Nov 26, 2024
1 parent 699d3cb commit fd53181
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
16 changes: 9 additions & 7 deletions src/StructId.Analyzer/StructId.Analyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="PolySharp" PrivateAssets="All" Version="1.15.0" />
<PackageReference Include="Scriban" Version="5.12.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="2.0.9" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="2.0.9" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Resources" Version="2.0.9" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Resources" Version="2.0.10" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -25,13 +25,15 @@
<UpToDateCheck Include="@(TemplateCode);@(EmbeddedResource)" />
</ItemGroup>

<Target Name="CopyTemplateCode" Inputs="@(TemplateCode)" Outputs="@(TemplateCode -> '$(IntermediateOutputPath)Templates\%(Filename).txt')">
<Copy SourceFiles="@(TemplateCode)" DestinationFiles="@(TemplateCode -> '$(IntermediateOutputPath)Templates\%(Filename).txt')" SkipUnchangedFiles="true" />
<Target Name="CopyTemplateCode" Inputs="@(TemplateCode)" Outputs="@(TemplateCode -> '$(BaseIntermediateOutputPath)Templates\%(Filename).txt')">
<Copy SourceFiles="@(TemplateCode)" DestinationFiles="@(TemplateCode -> '$(BaseIntermediateOutputPath)Templates\%(Filename).txt')" SkipUnchangedFiles="true" />
</Target>

<Target Name="AddTemplateCode" DependsOnTargets="CopyTemplateCode" BeforeTargets="SplitResourcesByCulture">
<Target Name="AddTemplateCode" DependsOnTargets="CopyTemplateCode" BeforeTargets="AssignTargetPaths;SplitResourcesByCulture">
<ItemGroup>
<EmbeddedResource Include="@(TemplateCode -> '$(IntermediateOutputPath)Templates\%(Filename).txt')" Link="Templates\%(TemplateCode.Filename).txt" Type="Non-Resx" />
<EmbeddedResource Include="@(TemplateCode -> '$(BaseIntermediateOutputPath)Templates\%(Filename).txt')"
Link="Templates\%(TemplateCode.Filename).txt"
Type="Non-Resx" />
</ItemGroup>
</Target>

Expand Down
4 changes: 2 additions & 2 deletions src/StructId.FunctionalTests/StructId.FunctionalTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
<Using Include="Xunit" />
<Using Include="Xunit.Abstractions" />

<StructId Include="..\StructId\*.cs" Link="StructId\%(RecursiveDir)%(Filename)%(Extension)" />
<StructId Include="..\StructId\*.cs" Link="StructId\%(Filename)%(Extension)" />

<Analyzer Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll" />
<Analyzer Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll" Condition="Exists('$(PkgScriban)/lib/netstandard2.0/Scriban.dll')" />
</ItemGroup>

<Import Project="..\StructId.Package\StructId.targets" />
Expand Down
4 changes: 2 additions & 2 deletions src/StructId.Package/StructId.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<PropertyGroup>
<StructIdNamespace Condition="$(StructIdNamespace) == ''">$(RootNamespace)</StructIdNamespace>
<StructIdNamespace Condition="$(StructIdNamespace) == ''">StructId</StructIdNamespace>
<StrictIdPathHash Condition="$(StructIdNamespace) != ''">$([MSBuild]::StableStringHash($(StructIdNamespace)))\</StrictIdPathHash>
<StructIdPathHash Condition="$(StructIdNamespace) != ''">$([MSBuild]::StableStringHash($(StructIdNamespace)))\</StructIdPathHash>
</PropertyGroup>

<ItemGroup>
<StructId Include="$(MSBuildThisFileDirectory)*.cs" Link="StructId\$(StrictIdPathHash)%(Filename)%(Extension)" />
<StructId Include="$(MSBuildThisFileDirectory)*.cs" Link="StructId\$(StructIdPathHash)%(Filename)%(Extension)" />
</ItemGroup>

<Target Name="CollectStructIds">
Expand Down
19 changes: 12 additions & 7 deletions src/StructId.Tests/StructId.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeRefactoring.Testing" Version="1.1.2" />
<PackageReference Include="ThisAssembly.Resources" Version="2.0.9" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Resources" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Scriban" Version="5.12.0" GeneratePathProperty="true" />
</ItemGroup>
Expand All @@ -34,17 +34,22 @@
<Using Include="Xunit" />
<Using Include="Xunit.Abstractions" />

<StructId Include="..\StructId\*.cs" Link="StructId\%(RecursiveDir)%(Filename)%(Extension)" />

<Analyzer Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll"/>
<Analyzer Include="$(PkgScriban)/lib/netstandard2.0/Scriban.dll" Condition="Exists('$(PkgScriban)/lib/netstandard2.0/Scriban.dll')" />
</ItemGroup>

<Import Project="..\StructId.Package\StructId.targets" />

<ItemGroup>
<UpToDateCheck Include="@(StructId)"/>
<EmbeddedResource Include="@(StructId)" Type="Non-Resx" />
<EmbeddedResource Include="..\StructId\Templates\*.cs" Link="StructId\Templates\%(Filename)%(Extension)" Type="Non-Resx"/>
<StructId Include="..\StructId\*.cs" Link="StructId\%(Filename)%(Extension)" />
</ItemGroup>

<Target Name="AddTemplateCode" BeforeTargets="AssignTargetPaths;PrepareEmbeddedResources">
<ItemGroup>
<TemplateCode Include="..\StructId.Analyzer\obj\Templates\*.txt" />
<UpToDateCheckInput Include="@(TemplateCode);@(StructId)" />
<EmbeddedResource Include="@(StructId)" LogicalName="StructId.%(StructId.Filename)%(StructId.Extension)" Type="Non-Resx" />
<EmbeddedResource Include="@(TemplateCode)" Type="Non-Resx" Link="StructId\Templates\%(TemplateCode.Filename)%(TemplateCode.Extension)" LogicalName="StructId.Templates.%(TemplateCode.Filename)%(TemplateCode.Extension)" />
</ItemGroup>
</Target>

</Project>

0 comments on commit fd53181

Please sign in to comment.