forked from cake-contrib/Cake.Issues.Recipe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cake-contribGH-389) Multi-Target .NET8
- Loading branch information
1 parent
c9d7eaa
commit fe532fe
Showing
11 changed files
with
291 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe/Cake.Frosting.Issues.Recipe.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
$RECIPE_PACKAGE_PATH = "packages/cake.frosting.issues.recipe" | ||
if (Test-Path $RECIPE_PACKAGE_PATH) | ||
{ | ||
Write-Host "Cleaning up cached version of $RECIPE_PACKAGE_PATH..." | ||
Remove-Item $RECIPE_PACKAGE_PATH -Recurse; | ||
} | ||
else | ||
{ | ||
Write-Host "$RECIPE_PACKAGE_PATH not cached..." | ||
} | ||
|
||
dotnet run --project build/Build.csproj -- $args | ||
exit $LASTEXITCODE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
$RECIPE_PACKAGE_PATH = "packages/cake.frosting.issues.recipe" | ||
if [ -d "$RECIPE_PACKAGE_PATH" ] | ||
then | ||
echo "Cleaning up cached version of $RECIPE_PACKAGE_PATH..." | ||
rm -Rf $RECIPE_PACKAGE_PATH | ||
else | ||
echo "$RECIPE_PACKAGE_PATH not cached..." | ||
fi | ||
|
||
dotnet run --project ./build/Build.csproj -- "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
### Cake ### | ||
tools/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Cake.Frosting" Version="3.0.0" /> | ||
<PackageReference Include="Cake.Frosting.Issues.Recipe" Version="*-*" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
using System; | ||
using System.Reflection; | ||
using Cake.Common; | ||
using Cake.Common.Diagnostics; | ||
using Cake.Common.Tools.InspectCode; | ||
using Cake.Core; | ||
using Cake.Core.Diagnostics; | ||
using Cake.Core.IO; | ||
using Cake.Frosting; | ||
using Cake.Frosting.Issues.Recipe; | ||
|
||
public static class Program | ||
{ | ||
public static int Main(string[] args) | ||
{ | ||
return new CakeHost() | ||
.UseContext<BuildContext>() | ||
.UseLifetime<Lifetime>() | ||
.InstallTool(new Uri("nuget:?package=JetBrains.ReSharper.CommandLineTools")) | ||
// Register Cake.Frosting.Issues.Recipe tasks. | ||
.AddAssembly(Assembly.GetAssembly(typeof(IssuesTask))) | ||
.Run(args); | ||
} | ||
} | ||
|
||
public class BuildContext : IssuesContext<BuildParameters, BuildState> | ||
{ | ||
public BuildContext(ICakeContext context) | ||
: base(context) | ||
{ | ||
} | ||
|
||
protected override BuildParameters CreateIssuesParameters() | ||
{ | ||
return new BuildParameters(); | ||
} | ||
|
||
protected override BuildState CreateIssuesState() | ||
{ | ||
return new BuildState(this); | ||
} | ||
} | ||
|
||
public class BuildParameters : IssuesParameters | ||
{ | ||
public DirectoryPath LogDirectoryPath => this.OutputDirectory.Combine("logs"); | ||
|
||
public BuildParameters() | ||
{ | ||
this.OutputDirectory = this.OutputDirectory.Combine("output"); | ||
} | ||
} | ||
|
||
public class BuildState : IssuesState | ||
{ | ||
public FilePath SolutionFilePath { get; } | ||
|
||
public BuildState(BuildContext context) | ||
: base(context, RepositoryInfoProviderType.Cli) | ||
{ | ||
this.SolutionFilePath = | ||
this.ProjectRootDirectory | ||
.Combine("src") | ||
.CombineWithFilePath("ClassLibrary1.sln"); | ||
} | ||
} | ||
|
||
public class Lifetime : FrostingLifetime<BuildContext> | ||
{ | ||
public override void Setup(BuildContext context, ISetupContext info) | ||
{ | ||
// Determine Build Identifier | ||
var platform = context.Environment.Platform.Family.ToString(); | ||
var runtime = context.Environment.Runtime.IsCoreClr ? ".NET Core" : ".NET Framework"; | ||
|
||
context.Parameters.BuildIdentifier = $"Cake Frosting {platform} ({runtime})"; | ||
|
||
context.Information("Build identifier: {0}", context.Parameters.BuildIdentifier); | ||
} | ||
|
||
public override void Teardown(BuildContext context, ITeardownContext info) | ||
{ | ||
} | ||
} | ||
|
||
[TaskName("Run-InspectCode")] | ||
public sealed class RunInspectCodeTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) | ||
{ | ||
return context.IsRunningOnWindows(); | ||
} | ||
|
||
public override void Run(BuildContext context) | ||
{ | ||
// Run InspectCode. | ||
var inspectCodeLogFilePath = context.Parameters.LogDirectoryPath.CombineWithFilePath("inspectCode.log"); | ||
|
||
var settings = new InspectCodeSettings() { | ||
OutputFile = inspectCodeLogFilePath, | ||
ArgumentCustomization = x => x.Append("--no-build"), | ||
WorkingDirectory = context.State.ProjectRootDirectory | ||
}; | ||
|
||
context.InspectCode( | ||
context.State.SolutionFilePath, | ||
settings); | ||
|
||
// Pass path to InspectCode log file to Cake.Frosting.Issues.Recipe. | ||
context.Parameters.InputFiles.AddInspectCodeLogFile(inspectCodeLogFilePath); | ||
} | ||
} | ||
|
||
[TaskName("Lint")] | ||
[IsDependentOn(typeof(RunInspectCodeTask))] | ||
[IsDependeeOf(typeof(ReadIssuesTask))] | ||
public class LintTask : FrostingTask | ||
{ | ||
} | ||
|
||
[TaskName("Default")] | ||
[IsDependentOn(typeof(IssuesTask))] | ||
public class DefaultTask : FrostingTask | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<config> | ||
<add key="globalPackagesFolder" value="packages" /> | ||
</config> | ||
<packageSources> | ||
<clear /> | ||
<add key="Integration" value="../../../BuildArtifacts/Packages/NuGet" /> | ||
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" /> | ||
</packageSources> | ||
<disabledPackageSources> | ||
<clear /> | ||
</disabledPackageSources> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{9B73BB5B-06A3-46F3-9068-E3607A8217B0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{9B73BB5B-06A3-46F3-9068-E3607A8217B0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ClassLibrary1 | ||
{ | ||
public class Class1 | ||
{ | ||
public void Foo() | ||
{ | ||
var foo = "foo"; | ||
var bar = "bar"; | ||
if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) | ||
{ | ||
var foobar = foo + bar; | ||
} | ||
} | ||
|
||
public void Bar() | ||
{ | ||
var foo = "foo"; | ||
var bar = "bar"; | ||
if (!string.IsNullOrEmpty(foo) && !string.IsNullOrEmpty(bar)) | ||
{ | ||
var foobar = foo + bar; | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/frosting/net8.0/src/ClassLibrary1/ClassLibrary1.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<Version>3.0.0</Version> | ||
</PackageReference> | ||
<PackageReference Include="StyleCop.Analyzers"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<Version>1.1.118</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Properties\" /> | ||
</ItemGroup> | ||
</Project> |