Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
nils-a committed Apr 10, 2021
2 parents d3d305c + bf86ae9 commit 6822b1f
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 36 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ jobs:
with:
fetch-depth: 0

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
- name: Cache Tools
uses: actions/cache@v2
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -49,8 +50,13 @@ jobs:
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- run: ./build.ps1 --target=DotNetCore-Build
shell: pwsh
- name: Build project
uses: cake-build/cake-action@v1
with:
script-path: recipe.cake
target: DotNetCore-Build
cake-version: 0.38.5
cake-bootstrap: true

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
10 changes: 5 additions & 5 deletions .github/workflows/publishDocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # GitVersion is somewhat irritated when fetch-depth is "1"....
ref: ${{ github.event.ref }}

- name: Fetch all tags and branches
run: git fetch --prune --unshallow

- name: Cache Tools
uses: actions/cache@v2
with:
Expand All @@ -32,5 +32,5 @@ jobs:
script-path: recipe.cake
target: Force-Publish-Documentation
verbosity: Diagnostic
cake-version: 0.38.4
cake-version: 0.38.5
cake-bootstrap: true
4 changes: 2 additions & 2 deletions src/Guidelines/Guidelines.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageTags>cake, build, automation, guideline, addin</PackageTags>
<RepositoryUrl>https://github.com/cake-contrib/CakeContrib.Guidelines.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>images/icon.png</PackageIcon>
<PackageIcon>images/cake-contrib-community-medium.png</PackageIcon>
<PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>
<MinClientVersion>2.8</MinClientVersion>
<DevelopmentDependency>true</DevelopmentDependency>
Expand All @@ -36,4 +36,4 @@
<None Include="images/*" PackagePath="images/" Pack="true" />
<None Include="tasks/**/*.*" PackagePath="tasks/" Pack="true" Exclude=".gitignore" />
</ItemGroup>
</Project>
</Project>
25 changes: 22 additions & 3 deletions src/Guidelines/build/Icon.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@

<Target Name="_EnsureCakeContribGuidelinesIcon"
AfterTargets="BeforeBuild"
BeforeTargets="CoreBuild;SetNuspecProperties;GenerateNuspec;_GetPackageFiles">
BeforeTargets="CoreBuild;SetNuspecProperties;GenerateNuspec;_GetPackageFiles"
DependsOnTargets="EnsureProjectTypeIsSet">
<PropertyGroup>
<CakeContribIconPath>$(MSBuildThisFileDirectory)/../images/cake-contrib-community-medium.png</CakeContribIconPath>
<CakeContribIconPath
Condition="$(CakeContribGuidelinesProjectType) == 'addin'">$(MSBuildThisFileDirectory)/../images/cake-contrib-addin-medium.png</CakeContribIconPath>
<CakeContribIconPath
Condition="$(CakeContribGuidelinesProjectType) == 'module'">$(MSBuildThisFileDirectory)/../images/cake-contrib-module-medium.png</CakeContribIconPath>
<CakeContribIconPath
Condition="$(CakeContribGuidelinesProjectType) == 'recipe'">$(MSBuildThisFileDirectory)/../images/cake-contrib-recipe-medium.png</CakeContribIconPath>
</PropertyGroup>
<EnsureCakeContribIcon
ProjectFile="$(MSBuildProjectFullPath)"
PackageIcon="$(PackageIcon)"
NoneReferences="@(None)"
CakeContribIconPath="$(MSBuildThisFileDirectory)/../images/icon.png"
CakeContribIconPath="$(CakeContribIconPath)"
OmitIconImport="$(CakeContribGuidelinesIconOmitImport)"
NoWarn="$(NoWarn)"
WarningsAsErrors="$(WarningsAsErrors)">
Expand All @@ -38,11 +48,20 @@
ItemName="None" />
</CreateItem>

<PropertyGroup>
<CakeContribIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/community/cake-contrib-community-medium.png</CakeContribIconUrl>
<CakeContribIconUrl
Condition="$(CakeContribGuidelinesProjectType) == 'addin'">https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png</CakeContribIconUrl>
<CakeContribIconUrl
Condition="$(CakeContribGuidelinesProjectType) == 'module'">https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/module/cake-contrib-module-medium.png</CakeContribIconUrl>
<CakeContribIconUrl
Condition="$(CakeContribGuidelinesProjectType) == 'recipe'">https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/recipe/cake-contrib-recipe-medium.png</CakeContribIconUrl>
</PropertyGroup>
<EnsureCakeContribIconUrl
ProjectFile="$(MSBuildProjectFullPath)"
PackageIconUrl="$(PackageIconUrl)"
OmitIconImport="$(CakeContribGuidelinesIconOmitImport)"
CakeContribIconUrl="https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png"
CakeContribIconUrl="$(CakeContribIconUrl)"
NoWarn="$(NoWarn)"
WarningsAsErrors="$(WarningsAsErrors)">
<Output PropertyName="TempPackageIconUrl" TaskParameter="PackageIconUrlOutput" />
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/Guidelines/images/icon.png
Binary file not shown.
58 changes: 46 additions & 12 deletions src/Tasks.IntegrationTests/E2eTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,8 @@ public void ProjectType_Manually_Set_Is_Not_Overridden()
public void ProjectType_When_Assembly_Is_Module_Is_Module()
{
// given
fixture.WithAssemblyName("Cake.Buildsystems.Module");
fixture.WithCustomContent(@"
<PropertyGroup>
<AssemblyName>Cake.Buildsystems.Module</AssemblyName>
</PropertyGroup>
<Target Name=""ForTest""
AfterTargets=""BeforeBuild""
BeforeTargets=""CoreBuild""
Expand Down Expand Up @@ -403,11 +400,8 @@ public void ProjectType_When_PackageId_Is_Module_Is_Module()
public void ProjectType_When_Assembly_Is_Not_Module_Is_Addin()
{
// given
fixture.WithAssemblyName("Cake.7zip");
fixture.WithCustomContent(@"
<PropertyGroup>
<AssemblyName>Cake.7zip</AssemblyName>
</PropertyGroup>
<Target Name=""ForTest""
AfterTargets=""BeforeBuild""
BeforeTargets=""CoreBuild""
Expand Down Expand Up @@ -482,16 +476,56 @@ public void Packaging_Should_Add_The_Icon_As_Link_And_Pack_True()
.First(x => x.IndexOf("icon.png", StringComparison.OrdinalIgnoreCase) > -1);
output = output.Substring(output.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase)+11);
output.Should().Contain("Pack:True");
output.Should().Contain("Link:icon.png");
output.Should().Contain("Link:cake-contrib-addin-medium.png");
output.Should().Contain("PackagePath:");
}

[Fact]
public void Packaging_Should_Add_The_IconUrl_To_Properties()
[Theory]
[InlineData("Cake.7zip", "/../images/cake-contrib-addin-medium.png")]
[InlineData("Cake.Recipe", "/../images/cake-contrib-recipe-medium.png")]
[InlineData("Cake.Buildsystems.Module", "/../images/cake-contrib-module-medium.png")]
[InlineData("Polly", "/../images/cake-contrib-community-medium.png")]
public void Packaging_Different_Types_Should_Add_The_Correct_Icon(string assemblyName, string expectedFileName)
{
// given
fixture.WithoutPackageIcon();
fixture.WithoutPackageIconUrl();
fixture.WithAssemblyName(assemblyName);
fixture.WithCustomContent(@"
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<Target Name=""ForTest""
BeforeTargets=""SetNuspecProperties;GenerateNuspec""
DependsOnTargets=""_EnsureCakeContribGuidelinesIcon"">
<Warning Text=""!FOR-TEST!:%(None.Identity) Pack:%(None.Pack) Link:%(None.Link) PackagePath:%(None.PackagePath)"" />
</Target>");

// when
var result = fixture.Run();

// then
result.IsErrorExitCode.Should().BeFalse();
var output = result.WarningLines
.Where(x => x.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase) > -1)
.First(x => x.IndexOf("icon.png", StringComparison.OrdinalIgnoreCase) > -1);
output = output.Substring(output.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase)+11);
output.Should().Contain(expectedFileName);
}

[Theory]
[InlineData("Cake.7zip", "cake-contrib/graphics/png/addin/cake-contrib-addin-medium.png")]
[InlineData("Cake.Recipe", "cake-contrib/graphics/png/recipe/cake-contrib-recipe-medium.png")]
[InlineData("Cake.Buildsystems.Module", "cake-contrib/graphics/png/module/cake-contrib-module-medium.png")]
[InlineData("Polly", "cake-contrib/graphics/png/community/cake-contrib-community-medium.png")]
public void Packaging_Different_Types_Should_Add_The_Correct_IconUrl_To_Properties(string assemblyName, string expectedUrl)
{
// given
fixture.WithoutPackageIcon();
fixture.WithoutPackageIconUrl();
fixture.WithAssemblyName(assemblyName);
fixture.WithCustomContent(@"
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand All @@ -512,7 +546,7 @@ public void Packaging_Should_Add_The_IconUrl_To_Properties()
var output = result.WarningLines
.Single(x => x.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase) > -1);
output = output.Substring(output.IndexOf("!FOR-TEST!:", StringComparison.OrdinalIgnoreCase)+11);
output.Should().Contain("cake-contrib/graphics/png/cake-contrib-medium.png");
output.Should().Contain(expectedUrl);
}

[Fact]
Expand Down
5 changes: 5 additions & 0 deletions src/Tasks.IntegrationTests/Fixtures/E2eTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,5 +341,10 @@ public void WithoutDefaultCakeReference()
{
hasDefaultCakeReference = false;
}

public void WithAssemblyName(string name)
{
assemblyName = name;
}
}
}
4 changes: 2 additions & 2 deletions src/Tasks.IntegrationTests/Tasks.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="FluentAssertions.Analyzers" Version="0.11.4" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Text.Analyzers" Version="2.6.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion src/Tasks.Tests/EnsureCakeContribIconTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void Should_Not_Output_NewNoneRef_If_None_Is_Specified()
{
// given
var fixture = new EnsureCakeContribIconFixture();
fixture.WithIconFileReference("temp\\logo.png", "");
fixture.WithIconFileReference("temp\\icon.png", "");

// when
fixture.Execute();
Expand Down
2 changes: 1 addition & 1 deletion src/Tasks.Tests/Fixtures/EnsureCakeContribIconFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public EnsureCakeContribIconFixture()
{
fileFacadeMock = new Mock<IFileFacade>();
noneReferences = new List<ITaskItem>();
cakeContribDefaultIcon = "C:\\users\\someUser\\.dotnet\\whatever\\CakeContrib-Guidelines\\data\\logo.png";
cakeContribDefaultIcon = "C:\\users\\someUser\\.dotnet\\whatever\\CakeContrib-Guidelines\\data\\icon.png";
}

public string PackageIconOutput { get; private set; }
Expand Down
4 changes: 2 additions & 2 deletions src/Tasks.Tests/Tasks.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="FluentAssertions.Analyzers" Version="0.11.4" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Text.Analyzers" Version="2.6.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion src/Tasks/EnsureCakeContribIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public override bool Execute()
return false;
}

PackageIconOutput = Path.GetFileName(CakeContribIconPath.NormalizePathSeparators());
PackageIconOutput = "icon" + Path.GetExtension(CakeContribIconPath.NormalizePathSeparators());
Log.CcgTrace($"PackageIcon was not set. Setting it to {PackageIconOutput}.");
}

Expand Down
2 changes: 1 addition & 1 deletion src/Tasks/Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.9.0" CopyLocal="false" Publish="false" ExcludeAssets="runtime" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Framework" Version="16.9.0" CopyLocal="false" Publish="false" ExcludeAssets="runtime" PrivateAssets="All" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
Expand Down

0 comments on commit 6822b1f

Please sign in to comment.