Skip to content

Commit

Permalink
Initial version of Cake.MinVer
Browse files Browse the repository at this point in the history
  • Loading branch information
augustoproiete committed Aug 1, 2020
1 parent f642822 commit f612b30
Show file tree
Hide file tree
Showing 24 changed files with 1,701 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "0.38.4",
"commands": [
"dotnet-cake"
]
},
"minver-cli": {
"version": "2.3.0",
"commands": [
"minver"
]
}
}
}
54 changes: 54 additions & 0 deletions Cake.MinVer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30320.27
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{A17F6CAD-6E1D-4F5B-8140-24958CA0748D}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
build.cake = build.cake
cake.config = cake.config
CHANGES.md = CHANGES.md
CODEOWNERS = CODEOWNERS
Directory.Build.props = Directory.Build.props
global.json = global.json
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{39E0B476-6754-4FCE-B6C6-61783D57E94F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{31D2C35C-5A44-4B2C-A441-C0FAF47AF452}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.MinVer", "src\Cake.MinVer\Cake.MinVer.csproj", "{FC01B04E-3A39-4894-993B-DE637E0A0382}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.MinVer.Tests", "test\Cake.MinVer.Tests\Cake.MinVer.Tests.csproj", "{042B93C7-FA3B-453D-B29C-2E0992F94B58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FC01B04E-3A39-4894-993B-DE637E0A0382}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC01B04E-3A39-4894-993B-DE637E0A0382}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC01B04E-3A39-4894-993B-DE637E0A0382}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC01B04E-3A39-4894-993B-DE637E0A0382}.Release|Any CPU.Build.0 = Release|Any CPU
{042B93C7-FA3B-453D-B29C-2E0992F94B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{042B93C7-FA3B-453D-B29C-2E0992F94B58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{042B93C7-FA3B-453D-B29C-2E0992F94B58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{042B93C7-FA3B-453D-B29C-2E0992F94B58}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{FC01B04E-3A39-4894-993B-DE637E0A0382} = {39E0B476-6754-4FCE-B6C6-61783D57E94F}
{042B93C7-FA3B-453D-B29C-2E0992F94B58} = {31D2C35C-5A44-4B2C-A441-C0FAF47AF452}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {18E76962-5395-46C7-8CCF-476EC8581FE7}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions Cake.MinVer.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleAnonymousFunction/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleLiteral/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleNamedExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleStringLiteral/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MarkupAttributeTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MarkupTextTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String></wpf:ResourceDictionary>
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>

<PropertyGroup>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup>

</Project>
Binary file added assets/cake-minver-nuget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
var target = Argument<string>("target", "pack");
var buildVersion = Argument<string>("buildVersion", "0.0.1-local");

#tool "nuget:?package=NuGet.CommandLine&version=5.6.0"

Task("clean")
.Does(() =>
{
CleanDirectory("./build/artifacts");
});

Task("restore")
.IsDependentOn("clean")
.Does(() =>
{
NuGetRestore("./Cake.MinVer.sln");
});

Task("build")
.IsDependentOn("clean")
.Does(() =>
{
DotNetCoreBuild("./Cake.MinVer.sln", new DotNetCoreBuildSettings
{
Configuration = "Debug",
NoRestore = true,
NoIncremental = false,
ArgumentCustomization = args =>
args.AppendQuoted($"-p:Version={buildVersion}")
.AppendQuoted($"-p:ContinuousIntegrationBuild=true")
});

DotNetCoreBuild("./Cake.MinVer.sln", new DotNetCoreBuildSettings
{
Configuration = "Release",
NoRestore = true,
NoIncremental = false,
ArgumentCustomization = args =>
args.AppendQuoted($"-p:Version={buildVersion}")
.AppendQuoted($"-p:ContinuousIntegrationBuild=true")
});
});

Task("test")
.IsDependentOn("build")
.Does(() =>
{
var settings = new DotNetCoreTestSettings
{
Configuration = "Release",
NoRestore = true,
NoBuild = true,
};

var projectFiles = GetFiles("./test/**/*.csproj");
foreach (var file in projectFiles)
{
DotNetCoreTest(file.FullPath, settings);
}
});

Task("pack")
.IsDependentOn("test")
.Does(() =>
{
var releaseNotes = $"https://github.com/augustoproiete/Cake.MinVer/releases/tag/v{buildVersion}";

DotNetCorePack("./src/Cake.MinVer/Cake.MinVer.csproj", new DotNetCorePackSettings
{
Configuration = "Release",
NoRestore = true,
NoBuild = true,
OutputDirectory = "./build/artifacts",
ArgumentCustomization = args =>
args.AppendQuoted($"-p:Version={buildVersion}")
.AppendQuoted($"-p:PackageReleaseNotes={releaseNotes}")
});
});

Task("publish")
.IsDependentOn("pack")
.Does(context =>
{
var url = context.EnvironmentVariable("NUGET_URL");
if (string.IsNullOrWhiteSpace(url))
{
context.Information("No NuGet URL specified. Skipping publishing of NuGet packages");
return;
}

var apiKey = context.EnvironmentVariable("NUGET_API_KEY");
if (string.IsNullOrWhiteSpace(apiKey))
{
context.Information("No NuGet API key specified. Skipping publishing of NuGet packages");
return;
}

foreach (var nugetPackageFile in GetFiles("./build/artifacts/*.nupkg"))
{
context.Information($"Publishing {nugetPackageFile}...");
context.NuGetPush(nugetPackageFile, new NuGetPushSettings
{
Source = url,
ApiKey = apiKey,
});
}
});

RunTarget(target);
12 changes: 12 additions & 0 deletions cake.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Nuget]
Source=https://api.nuget.org/v3/index.json
UseInProcessClient=true
LoadDependencies=false

[Paths]
Tools=./tools
Addins=./tools/addins
Modules=./tools/modules

[Settings]
SkipVerification=false
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "3.1.100",
"rollForward": "latestFeature"
}
}
25 changes: 25 additions & 0 deletions src/Cake.MinVer/AddInInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Reflection;
using Cake.Core.Diagnostics;

namespace Cake.MinVer
{
internal static class AddInInformation
{
private static readonly Assembly _thisAssembly = typeof(AddInInformation).GetTypeInfo().Assembly;

private static readonly string _informationalVersion = _thisAssembly
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;

private static readonly string _assemblyVersion = _thisAssembly
.GetName().Version.ToString();

private static readonly string _assemblyName = _thisAssembly
.GetName().Name;

public static void LogVersionInformation(ICakeLog log)
{
log.Verbose(entry =>
entry("Using add-in: {0} v{1} ({2})", _assemblyName, _assemblyVersion, _informationalVersion));
}
}
}
53 changes: 53 additions & 0 deletions src/Cake.MinVer/Cake.MinVer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Cake.MinVer</RootNamespace>

<AssemblyName>Cake.MinVer</AssemblyName>
<AssemblyVersion>0.1.0.0</AssemblyVersion>
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<DebugType>portable</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

<NoWarn>$(NoWarn);NU5048</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />
</PropertyGroup>

<PropertyGroup>
<MinClientVersion>4.0.0</MinClientVersion>
<PackageId>Cake.MinVer</PackageId>
<Version>0.0.1-local</Version>
<Authors>C. Augusto Proiete &amp; Contributors</Authors>
<Company>augustoproiete.net</Company>
<Description>Cake add-in that makes MinVer available as a tool in Cake.</Description>
<Copyright>Copyright 2020 C. Augusto Proiete &amp; Contributors - Provided under the Apache License, Version 2.0</Copyright>
<PackageTags>cake;minver;cake-addin;cake-build;cake-contrib</PackageTags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageIcon>images\icon.png</PackageIcon>
<PackageIconUrl>https://raw.githubusercontent.com/augustoproiete/Cake.MinVer/master/assets/cake-minver-nuget.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/augustoproiete/Cake.MinVer</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/augustoproiete/Cake.MinVer/releases</PackageReleaseNotes>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/augustoproiete/Cake.MinVer</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Cake.Core" Version="0.33.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="0.33.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\assets\cake-minver-nuget.png" Pack="true" Visible="false" PackagePath="images\icon.png" />
</ItemGroup>

</Project>
Loading

0 comments on commit f612b30

Please sign in to comment.