Skip to content

Commit

Permalink
fix missing assemblies in nuget package (#107)
Browse files Browse the repository at this point in the history
* ms code analysis packages no longer private

* remove dev dep flag as breaking builds

* update pkg descriptions

* batch test output by guid per build

* package marked as deterministic for ci

* mark build as deterministic

* move test ci flag before opencover args

* actually put the ci flag on the build and not the test

* fix test line
  • Loading branch information
dpvreony committed Jan 30, 2021
1 parent 46a8f54 commit 9d03898
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dotnet-core.yml
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Run Build
run: |
dotnet build ${{ env.solutionpath }} --configuration Release --no-restore /bl:artifacts\\binlog\\build.binlog
dotnet build ${{ env.solutionpath }} --configuration Release --no-restore /bl:artifacts\\binlog\\build.binlog /p:ContinuousIntegrationBuild=true
- name: Run Unit Tests
run: |
Expand All @@ -81,7 +81,7 @@ jobs:

- name: Produce Nuget Packages
run: |
dotnet pack ${{ env.solutionpath }} --configuration Release --no-build /bl:artifacts\\binlog\\pack.binlog --nologo /p:PackageOutputPath=..\..\artifacts\nuget
dotnet pack ${{ env.solutionpath }} --configuration Release --no-build /bl:artifacts\\binlog\\pack.binlog --nologo /p:PackageOutputPath=..\..\artifacts\nuget /p:ContinuousIntegrationBuild=true
- name: List outdated packages
run: |
Expand Down
Expand Up @@ -6,7 +6,6 @@
<LangVersion>9</LangVersion>
<DebugType>full</DebugType>
<DebugSymbols>True</DebugSymbols>
<DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/Dhgms.Nucleotide.Generators/Generators/BaseGenerator.cs
Expand Up @@ -59,6 +59,7 @@ public void Execute(GeneratorExecutionContext context)
.GetResult();

var parseOptions = context.ParseOptions;
var folderGuid = Guid.NewGuid();

foreach (var memberDeclarationSyntax in result)
{
Expand All @@ -67,17 +68,18 @@ public void Execute(GeneratorExecutionContext context)

var cu = SyntaxFactory.CompilationUnit().AddMembers(memberDeclarationSyntax).NormalizeWhitespace();


// TODO: hint name per generator, or per class?
var feature = "feature";
var guid = Guid.NewGuid();

var sourceText = SyntaxFactory.SyntaxTree(cu, parseOptions, encoding: Encoding.UTF8).GetText();

// https://github.com/dotnet/roslyn-sdk/pull/553/files
var generatedSourceOutputPath = context.TryCreateGeneratedSourceOutputPath();
var generatedSourceOutputPath = context.TryCreateGeneratedSourceOutputPath(folderGuid);
context.AddSource(
generatedSourceOutputPath,
$"nucleotide.{feature}.{guid}",
$"nucleotide.{feature}.{guid}.g.cs",
sourceText);
}
}
Expand Down
Expand Up @@ -9,15 +9,15 @@ namespace Dhgms.Nucleotide.Generators
{
internal static class SourceGeneratorContextExtensions
{
public static string TryCreateGeneratedSourceOutputPath(this GeneratorExecutionContext context)
public static string TryCreateGeneratedSourceOutputPath(this GeneratorExecutionContext context, Guid folderGuid)
{
string generatedSourceOutputPath = null;
if (context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.SaveSourceGeneratorOutput", out string saveSourceGeneratorOutputValue)
&& bool.TryParse(saveSourceGeneratorOutputValue, out bool saveSourceGeneratorOutput)
&& saveSourceGeneratorOutput
&& context.AnalyzerConfigOptions.GlobalOptions.TryGetValue("build_property.IntermediateOutputPath", out string intermediateOutputPath))
{
generatedSourceOutputPath = Path.Combine(intermediateOutputPath, "Generated");
generatedSourceOutputPath = Path.Combine(intermediateOutputPath, "Generated", folderGuid.ToString());
Directory.CreateDirectory(generatedSourceOutputPath);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Directory.build.props
Expand Up @@ -3,13 +3,13 @@
<Company>DPVreony and Contributors</Company>
<StartYear>2016</StartYear>
<Copyright>© $(StartYear)-$([System.DateTime]::Now.Year) $(Company)</Copyright>
<Product>Whipcords ($(TargetFramework))</Product>
<Product>Nucleotide ($(TargetFramework))</Product>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>dpvreony</Authors>
<Owners>dpvreony</Owners>
<PackageTags>NET core reusable web helpers</PackageTags>
<PackageReleaseNotes>https://github.com/dpvreony/Dhgms.AspNetCoreContrib/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/dpvreony/Dhgms.AspNetCoreContrib</RepositoryUrl>
<PackageTags>Source Generation</PackageTags>
<PackageReleaseNotes>https://github.com/dpvreony/nucleotide/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/dpvreony/nucleotide</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)analyzers.ruleset</CodeAnalysisRuleSet>
Expand Down

0 comments on commit 9d03898

Please sign in to comment.