Skip to content

Commit

Permalink
📦 Embed Scriban for reduced size and improved isolation
Browse files Browse the repository at this point in the history
For cases where more than one analyzer is using Scriban for source generators, we might get conflicts and generation might fail if they use a different version than our generators.

Luckily, scriban now supports source embedding so we can eliminate that risk by leveraging that feature.

Fixes #39
  • Loading branch information
kzu committed Jan 25, 2021
1 parent 4421552 commit ba838ee
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/Directory.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<PackFolder>analyzers\cs</PackFolder>

<RestoreSources Condition="Exists('$(MSBuildThisFileDirectory)..\..\nugetizer\bin\')">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\nugetizer\bin'));$(RestoreSources)</RestoreSources>

<!-- See https://github.com/scriban/scriban#source-embedding -->
<PackageScribanIncludeSource>true</PackageScribanIncludeSource>
</PropertyGroup>

<PropertyGroup Label="Build">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ on the `ThisAssembly.Info` class.
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.6.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Scriban" Version="3.0.6" PrivateAssets="all" />

<PackageReference Include="Scriban" Version="3.4.1" Pack="false" IncludeAssets="build" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" Pack="false" />
</ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/ThisAssembly.Constants/ThisAssembly.Constants.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ C#:
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.6.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Scriban" Version="3.0.6" PrivateAssets="all" />

<PackageReference Include="Scriban" Version="3.4.1" Pack="false" IncludeAssets="build" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" Pack="false" />
</ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions src/ThisAssembly.Metadata/ThisAssembly.Metadata.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ C#:
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.6.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Scriban" Version="3.0.6" PrivateAssets="all" />


<PackageReference Include="Scriban" Version="3.4.1" Pack="false" IncludeAssets="build" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" Pack="false" />
</ItemGroup>

Expand Down
5 changes: 4 additions & 1 deletion src/ThisAssembly.Project/ThisAssembly.Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ C#:
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.6.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Scriban" Version="3.0.6" PrivateAssets="all" />

<PackageReference Include="Scriban" Version="3.4.1" Pack="false" IncludeAssets="build" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" Pack="false" />
</ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/ThisAssembly.Strings/ThisAssembly.Strings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ such as "Hello {name}".
<ItemGroup>
<PackageReference Include="NuGetizer" Version="0.6.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Scriban" Version="3.0.6" PrivateAssets="all" />

<PackageReference Include="Scriban" Version="3.4.1" Pack="false" IncludeAssets="build" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" Pack="false" />
</ItemGroup>
Expand Down

0 comments on commit ba838ee

Please sign in to comment.