Skip to content

Commit

Permalink
Initial version using Nuke
Browse files Browse the repository at this point in the history
  • Loading branch information
glennawatson committed Jul 29, 2023
1 parent 7ddcc94 commit 2988d7b
Show file tree
Hide file tree
Showing 21 changed files with 741 additions and 241 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ------------------------------------------------------------------------------
# <auto-generated>
#
# This code was generated.
#
# - To turn off auto-generation set:
#
# [GitHubActions (AutoGenerate = false)]
#
# - To trigger manual generation invoke:
#
# nuke --generate-configuration GitHubActions_continuous --host GitHubActions
#
# </auto-generated>
# ------------------------------------------------------------------------------

name: continuous

on: [push]

jobs:
windows-latest:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: 'Run: Compile'
run: ./build.cmd Compile
112 changes: 112 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
"properties": {
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"InstallDependencies",
"Pack",
"Print",
"Restore"
]
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"InstallDependencies",
"Pack",
"Print",
"Restore"
]
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
}
}
}
}
}
4 changes: 4 additions & 0 deletions .nuke/parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "./build.schema.json",
"Solution": "ReactiveUI.Web.sln"
}
22 changes: 22 additions & 0 deletions Directory.build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Authors>.NET Foundation and Contributors</Authors>
<Copyright>Copyright (c) .NET Foundation and Contributors</Copyright>
<WarningsAsErrors>nullable</WarningsAsErrors>
<!-- Net Analyzers config taken from : https://docs.microsoft.com/en-gb/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers?view=vs-2019 -->
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.3.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
43 changes: 43 additions & 0 deletions Helper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReactiveUI.Web;

internal static class Helper
{
private static readonly object _lockConsoleObject = new();

public static Bootstrapper ConfigureLinks(this Bootstrapper bootstrapper, string[] args)
{
var isProduction = args.Any(x => x.Contains("preview", StringComparison.OrdinalIgnoreCase)) ? "false" : "true";
LogInfo($"Is Production Build: {isProduction}");
return bootstrapper.AddSetting(WebKeys.MakeLinksAbsolute, isProduction);
}

public static string WithSourceFilter(this string repository, params string[] exclude)
{
var excludeFilter = exclude.Length > 0 ? string.Join(",", exclude.Select(x => $"!{x}")) + "," : string.Empty;
return $"../../{repository}/src/**/{{!.git,!bin,!obj,!packages,!*.Tests,!*.Templates,!*.Benchmarks,{excludeFilter}}}/**/*.cs";
}

[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Do not pass literals as localized parameters", Justification = "Deliberate")]
private static void LogInfo(string message)
{
lock (_lockConsoleObject)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("[INFO] ");
Console.ResetColor();
Console.Write($"{message}");
Console.WriteLine();
}
}
}
24 changes: 13 additions & 11 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
await Bootstrapper
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

await Bootstrapper
.Factory
.CreateDocs(args)
.FetchTheme(args)
//.GetSources("reactiveui", "reactiveui", "akavache", "fusillade", "punchclock", "splat")
//.GetSources("reactivemarbles", "DynamicData")
.ConfigureLinks(args)
.AddSetting(MarkdownKeys.MarkdownExtensions, "bootstrap")
//.AddSourceFiles(
// "dynamicdata".WithSourceFilter(),
// "splat".WithSourceFilter("*.Drawing"),
// "reactiveui".WithSourceFilter("Benchmarks", "*.Test", "*.LeakTests", "*.TestRunner", "*.Uwp"),
// "akavache".WithSourceFilter(),
// "punchclock".WithSourceFilter(),
// "fusillade".WithSourceFilter())
.AddSourceFiles(
"dynamicdata".WithSourceFilter(),
"splat".WithSourceFilter("*.Drawing"),
"reactiveui".WithSourceFilter("Benchmarks", "*.Test", "*.LeakTests", "*.TestRunner", "*.Uwp"),
"akavache".WithSourceFilter(),
"punchclock".WithSourceFilter(),
"fusillade".WithSourceFilter())
.RunAsync();
5 changes: 3 additions & 2 deletions ReactiveUI.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@

<ItemGroup>
<PackageReference Include="Statiq.Docs" Version="1.0.0-beta.14" />
<PackageReference Include="Polly" Version="7.2.3" />
</ItemGroup>

<ItemGroup>
<Compile Remove="build\**" />
<EmbeddedResource Remove="build\**" />
<None Remove="build\**" />
<Compile Remove="external\**" />
<EmbeddedResource Remove="external\**" />
<None Remove="external\**" />
</ItemGroup>

<ItemGroup Condition="Exists('theme\Docable5.csproj')">
<ProjectReference Include="theme\Docable5.csproj" />
<Using Include="Docable" />
</ItemGroup>

Expand Down
9 changes: 4 additions & 5 deletions ReactiveUI.Web.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Web", "ReactiveU
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6EC3FF5D-8E64-4A2E-BCAA-4D0A605192F2}"
ProjectSection(SolutionItems) = preProject
Directory.build.props = Directory.build.props
.github\workflows\main.yml = .github\workflows\main.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Docable5", "theme\Docable5.csproj", "{F75CB46F-7768-4D9E-BEE9-CADACD0F7C92}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{CA0C518B-D50E-4FC9-962D-BA4D30403F4A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -22,10 +23,8 @@ Global
{22B46BAE-384C-4B20-828E-CB1ACA6D5EFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22B46BAE-384C-4B20-828E-CB1ACA6D5EFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22B46BAE-384C-4B20-828E-CB1ACA6D5EFC}.Release|Any CPU.Build.0 = Release|Any CPU
{F75CB46F-7768-4D9E-BEE9-CADACD0F7C92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F75CB46F-7768-4D9E-BEE9-CADACD0F7C92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F75CB46F-7768-4D9E-BEE9-CADACD0F7C92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F75CB46F-7768-4D9E-BEE9-CADACD0F7C92}.Release|Any CPU.Build.0 = Release|Any CPU
{CA0C518B-D50E-4FC9-962D-BA4D30403F4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA0C518B-D50E-4FC9-962D-BA4D30403F4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 2988d7b

Please sign in to comment.