Skip to content

Commit

Permalink
Initial version of Cake.ExcelDnaPack
Browse files Browse the repository at this point in the history
  • Loading branch information
augustoproiete committed Jan 19, 2021
1 parent b8a78b2 commit 1ad065f
Show file tree
Hide file tree
Showing 25 changed files with 1,360 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.5",
"commands": [
"dotnet-cake"
]
},
"minver-cli": {
"version": "2.3.1",
"commands": [
"minver"
]
}
}
}
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = unset
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.{xml,config,nuspec,csproj,props,targets,ps1}]
indent_size = 2

[*.{sh}]
end_of_line = lf

[*.{dotsettings}]
end_of_line = lf
13 changes: 13 additions & 0 deletions .github/workflows/dependabot-cake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
schedule:
# every Sunday at 6am
- cron: '0 6 * * SUN'

workflow_dispatch:

jobs:
dependabot-cake:
runs-on: ubuntu-latest
steps:
- name: check/update cake dependencies
uses: augustoproiete-actions/nils-org--dependabot-cake-action@v1
56 changes: 56 additions & 0 deletions Cake.ExcelDnaPack.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A9A83466-9CAD-4375-95F1-D9076C84F91F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.ExcelDnaPack", "src\Cake.ExcelDnaPack\Cake.ExcelDnaPack.csproj", "{AF41A4CC-4C49-462F-8093-DDE0728ED080}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{5335FA0D-89D3-4929-91FD-9E034B446C6F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.ExcelDnaPack.Tests", "test\Cake.ExcelDnaPack.Tests\Cake.ExcelDnaPack.Tests.csproj", "{CB06C244-620D-49F8-8D25-FC09B5A2D634}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "asset", "asset", "{93529E0B-F492-407B-9410-F4872FA21CF1}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
build.cake = build.cake
build.cmd = build.cmd
build.ps1 = build.ps1
build.sh = build.sh
cake.config = cake.config
CHANGES.md = CHANGES.md
CODEOWNERS = CODEOWNERS
Directory.Build.props = Directory.Build.props
global.json = global.json
LICENSE = LICENSE
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AF41A4CC-4C49-462F-8093-DDE0728ED080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF41A4CC-4C49-462F-8093-DDE0728ED080}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF41A4CC-4C49-462F-8093-DDE0728ED080}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF41A4CC-4C49-462F-8093-DDE0728ED080}.Release|Any CPU.Build.0 = Release|Any CPU
{CB06C244-620D-49F8-8D25-FC09B5A2D634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB06C244-620D-49F8-8D25-FC09B5A2D634}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB06C244-620D-49F8-8D25-FC09B5A2D634}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB06C244-620D-49F8-8D25-FC09B5A2D634}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AF41A4CC-4C49-462F-8093-DDE0728ED080} = {A9A83466-9CAD-4375-95F1-D9076C84F91F}
{CB06C244-620D-49F8-8D25-FC09B5A2D634} = {5335FA0D-89D3-4929-91FD-9E034B446C6F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4A94F7B1-5AA4-40C5-AA9C-22A3F47318A7}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions Cake.ExcelDnaPack.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<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:Int64 x:Key="/Default/CodeEditing/NullCheckPatterns/PatternTypeNamesToPriority/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002ENullChecking_002EIfThenThrowPattern/@EntryIndexedValue">1000</s:Int64>
<s:Int64 x:Key="/Default/CodeEditing/NullCheckPatterns/PatternTypeNamesToPriority/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002ENullChecking_002EPatternMatchingIfThenThrowPattern/@EntryIndexedValue">3000</s:Int64>
<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/=ArrangeTrailingCommaInMultilineLists/@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/=RedundantAnonymousTypePropertyName/@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 asset/cake-exceldnapack-nuget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#addin "nuget:?package=Cake.MinVer&version=0.2.0"

var target = Argument<string>("target", "pack");
var buildVersion = MinVer(s => s.WithTagPrefix("v").WithDefaultPreReleasePhase("preview"));

Task("clean")
.Does(() =>
{
CleanDirectory("./build/artifacts");
CleanDirectories("./src/**/bin");
CleanDirectories("./src/**/obj");
CleanDirectories("./test/**/bin");
CleanDirectories("./test/**/obj");
});

Task("restore")
.IsDependentOn("clean")
.Does(() =>
{
DotNetCoreRestore("./Cake.ExcelDnaPack.sln", new DotNetCoreRestoreSettings
{
LockedMode = true,
});
});

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

DotNetCoreBuild("./Cake.ExcelDnaPack.sln", new DotNetCoreBuildSettings
{
Configuration = "Release",
NoRestore = true,
NoIncremental = false,
ArgumentCustomization = args =>
args.AppendQuoted($"-p:Version={buildVersion.Version}")
.AppendQuoted($"-p:AssemblyVersion={buildVersion.FileVersion}")
.AppendQuoted($"-p:FileVersion={buildVersion.FileVersion}")
.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.ExcelDnaPack/releases/tag/v{buildVersion.Version}";

DotNetCorePack("./src/Cake.ExcelDnaPack/Cake.ExcelDnaPack.csproj", new DotNetCorePackSettings
{
Configuration = "Release",
NoRestore = true,
NoBuild = true,
OutputDirectory = "./build/artifacts",
ArgumentCustomization = args =>
args.AppendQuoted($"-p:Version={buildVersion.Version}")
.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;
}

var nugetPushSettings = new DotNetCoreNuGetPushSettings
{
Source = url,
ApiKey = apiKey,
};

foreach (var nugetPackageFile in GetFiles("./build/artifacts/*.nupkg"))
{
DotNetCoreNuGetPush(nugetPackageFile.FullPath, nugetPushSettings);
}
});

RunTarget(target);
11 changes: 11 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo on
@cd %~dp0

set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_CLI_TELEMETRY_OPTOUT=1
set DOTNET_NOLOGO=1

dotnet tool restore
@if %ERRORLEVEL% neq 0 goto :eof

dotnet cake %*
13 changes: 13 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ErrorActionPreference = 'Stop'

Set-Location -LiteralPath $PSScriptRoot

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
$env:DOTNET_NOLOGO = '1'

dotnet tool restore
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

dotnet cake @args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euox pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"

export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1

dotnet tool restore

dotnet cake "$@"
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=./.cake
Addins=./.cake/addins
Modules=./.cake/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": "5.0.100",
"rollForward": "latestFeature"
}
}
39 changes: 39 additions & 0 deletions src/Cake.ExcelDnaPack/AddInInformation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2021 C. Augusto Proiete & Contributors
//
// Licensed under the MIT (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System.Reflection;
using Cake.Core.Diagnostics;

namespace Cake.ExcelDnaPack
{
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(3);

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));
}
}
}
Loading

0 comments on commit 1ad065f

Please sign in to comment.