Skip to content

Commit

Permalink
Merge faithlife-build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejball committed Feb 18, 2024
2 parents 1ca912a + de21e6b commit ecb9941
Show file tree
Hide file tree
Showing 27 changed files with 160 additions and 144 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ resharper_comment_typo_highlighting = none
resharper_identifier_typo_highlighting = none
resharper_string_literal_typo_highlighting = none

[Directory.Packages.props]
insert_final_newline = false

[dotnet-tools.json]
insert_final_newline = false

Expand Down Expand Up @@ -83,6 +86,7 @@ csharp_style_prefer_local_over_anonymous_function = true : suggestion
csharp_style_prefer_not_pattern = true : suggestion
csharp_style_prefer_null_check_over_type_check = true : suggestion
csharp_style_prefer_pattern_matching = true : suggestion
csharp_style_prefer_primary_constructors = true : suggestion
csharp_style_prefer_range_operator = true : suggestion
csharp_style_prefer_switch_expression = true : suggestion
csharp_style_prefer_tuple_swap = true : warning
Expand Down Expand Up @@ -199,7 +203,9 @@ dotnet_diagnostic.IDE0160.severity = suggestion
dotnet_diagnostic.IDE0161.severity = suggestion
dotnet_diagnostic.IDE0170.severity = suggestion
dotnet_diagnostic.IDE0180.severity = warning
dotnet_diagnostic.IDE0290.severity = suggestion
dotnet_diagnostic.IDE1005.severity = suggestion
dotnet_diagnostic.NUnit2045.severity = suggestion
dotnet_diagnostic.SA0001.severity = none
dotnet_diagnostic.SA1003.severity = none
dotnet_diagnostic.SA1008.severity = none
Expand Down Expand Up @@ -322,6 +328,7 @@ resharper_arrange_missing_parentheses_highlighting = hint
resharper_arrange_trailing_comma_in_multiline_lists_highlighting = warning
resharper_comment_typo_highlighting = none
resharper_compare_of_floats_by_equality_operator_highlighting = suggestion
resharper_convert_to_primary_constructor_highlighting = hint
resharper_csharp_align_first_arg_by_paren = false
resharper_csharp_align_linq_query = false
resharper_csharp_align_multiline_argument = false
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Build

on:
push:
branches: [master]
tags-ignore: ['**']
pull_request:
workflow_dispatch:
inputs:
beta-version-number:
description: 'To publish a beta version: use the workflow version from the branch you want to publish from and include the beta version number in the box below. For example, a value of `1` will result in a package with a version suffix of `-beta.1`.'
type: string
required: false
push:
branches:
- 'master'
tags-ignore:
- '**'
pull_request:

env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1

defaults:
run:
shell: pwsh

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Set up .NET 7
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Check out code
uses: actions/checkout@v3
- name: Restore
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ jobs:
publish-docs:
runs-on: windows-latest
steps:
- name: Set up .NET 7
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Check out code
uses: actions/checkout@v3
- name: Publish Docs
Expand Down
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
.vs/
.idea/
artifacts/
bin/
obj/
release/
.vs/
.idea/
Thumbs.db

*.cache
*.user
*.userprefs
*.log
*.ncrunchproject
*.ncrunchsolution
*.user
launchSettings.json
nCrunchTemp*
_ReSharper*
.DS_Store
19 changes: 10 additions & 9 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

<PropertyGroup>
<VersionPrefix>5.20.0</VersionPrefix>
<LangVersion>11.0</LangVersion>
<PackageValidationBaselineVersion>5.19.1</PackageValidationBaselineVersion>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>$(NoWarn);1591;1998;NU5105</NoWarn>
<NoWarn>$(NoWarn);1591;1998;NU1507;NU5105</NoWarn>
<NeutralLanguage>en-US</NeutralLanguage>
<DebugType>embedded</DebugType>
<GitHubOrganization>Faithlife</GitHubOrganization>
<RepositoryName>FaithlifeBuild</RepositoryName>
Expand All @@ -19,22 +21,21 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisLevel>latest-all</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
<IsTestProject>false</IsTestProject>
<SelfContained>false</SelfContained>
<UseArtifactsOutput>true</UseArtifactsOutput>
<EnableStrictModeForCompatibleFrameworksInPackageValidation>true</EnableStrictModeForCompatibleFrameworksInPackageValidation>
<EnableStrictModeForCompatibleTfms>true</EnableStrictModeForCompatibleTfms>
<DisablePackageBaselineValidation Condition=" $(PackageValidationBaselineVersion) == $(VersionPrefix) or $(PackageValidationBaselineVersion) == '0.0.0' ">true</DisablePackageBaselineValidation>
</PropertyGroup>

<PropertyGroup Condition=" '$(BuildNumber)' != '' ">
<AssemblyVersion>$(VersionPrefix).$(BuildNumber)</AssemblyVersion>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Faithlife.Analyzers" Version="1.4.0" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507" PrivateAssets="All" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Bullseye" Version="5.0.0" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="LibGit2Sharp" Version="0.27.2" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="NuGet.CommandLine" Version="6.6.2" />
<PackageVersion Include="NuGet.Configuration" Version="6.6.1" />
<PackageVersion Include="NuGet.Protocol" Version="6.6.1" />
<PackageVersion Include="NUnit" Version="4.0.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="Polly" Version="7.2.4" />
<PackageVersion Include="XmlDocMarkdown.Core" Version="2.9.0" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Faithlife.Analyzers" Version="1.4.0" />
<GlobalPackageReference Include="NUnit.Analyzers" Version="4.0.1" />
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
</ItemGroup>
</Project>
52 changes: 27 additions & 25 deletions FaithlifeBuild.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,59 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faithlife.Build", "src\Faithlife.Build\Faithlife.Build.csproj", "{E1BF8BA1-9E9D-4E27-83FC-777B8D14F806}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faithlife.Build", "src\Faithlife.Build\Faithlife.Build.csproj", "{1F75E8CE-F59A-4738-81EC-17B71C125A06}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faithlife.Build.Tests", "tests\Faithlife.Build.Tests\Faithlife.Build.Tests.csproj", "{DF559AD1-5287-43B1-AB47-61B6F342B0FE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Faithlife.Build.Tests", "tests\Faithlife.Build.Tests\Faithlife.Build.Tests.csproj", "{3506DA15-B470-42E7-B897-D436451CBC32}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{028A6C6D-8F8F-4A91-A063-45FFCF892109}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "tools\Build\Build.csproj", "{9BB3C85C-100E-4128-A9AF-8F697D753538}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XmlDocGen", "tools\XmlDocGen\XmlDocGen.csproj", "{0A5C4B36-610E-4451-BD56-86E5C8A52C42}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A21957E2-3EB8-4CA5-8537-04F60C9F98D5}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
build.ps1 = build.ps1
.github\workflows\build.yaml = .github\workflows\build.yaml
.github\dependabot.yml = .github\dependabot.yml
CONTRIBUTING.md = CONTRIBUTING.md
Directory.Build.props = Directory.Build.props
dotnet-tools.json = dotnet-tools.json
Directory.Packages.props = Directory.Packages.props
global.json = global.json
LICENSE = LICENSE
nuget.config = nuget.config
README.md = README.md
ReleaseNotes.md = ReleaseNotes.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "tools\Build\Build.csproj", "{CBD807B4-F49F-4DD1-BC9A-359E90EA913F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XmlDocGen", "tools\XmlDocGen\XmlDocGen.csproj", "{EC2B2484-B209-41A2-94E5-4203A9740983}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1BF8BA1-9E9D-4E27-83FC-777B8D14F806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1BF8BA1-9E9D-4E27-83FC-777B8D14F806}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1BF8BA1-9E9D-4E27-83FC-777B8D14F806}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1BF8BA1-9E9D-4E27-83FC-777B8D14F806}.Release|Any CPU.Build.0 = Release|Any CPU
{DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF559AD1-5287-43B1-AB47-61B6F342B0FE}.Release|Any CPU.Build.0 = Release|Any CPU
{CBD807B4-F49F-4DD1-BC9A-359E90EA913F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBD807B4-F49F-4DD1-BC9A-359E90EA913F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBD807B4-F49F-4DD1-BC9A-359E90EA913F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBD807B4-F49F-4DD1-BC9A-359E90EA913F}.Release|Any CPU.Build.0 = Release|Any CPU
{EC2B2484-B209-41A2-94E5-4203A9740983}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC2B2484-B209-41A2-94E5-4203A9740983}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC2B2484-B209-41A2-94E5-4203A9740983}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC2B2484-B209-41A2-94E5-4203A9740983}.Release|Any CPU.Build.0 = Release|Any CPU
{1F75E8CE-F59A-4738-81EC-17B71C125A06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1F75E8CE-F59A-4738-81EC-17B71C125A06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1F75E8CE-F59A-4738-81EC-17B71C125A06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1F75E8CE-F59A-4738-81EC-17B71C125A06}.Release|Any CPU.Build.0 = Release|Any CPU
{3506DA15-B470-42E7-B897-D436451CBC32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3506DA15-B470-42E7-B897-D436451CBC32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3506DA15-B470-42E7-B897-D436451CBC32}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3506DA15-B470-42E7-B897-D436451CBC32}.Release|Any CPU.Build.0 = Release|Any CPU
{9BB3C85C-100E-4128-A9AF-8F697D753538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BB3C85C-100E-4128-A9AF-8F697D753538}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BB3C85C-100E-4128-A9AF-8F697D753538}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BB3C85C-100E-4128-A9AF-8F697D753538}.Release|Any CPU.Build.0 = Release|Any CPU
{0A5C4B36-610E-4451-BD56-86E5C8A52C42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A5C4B36-610E-4451-BD56-86E5C8A52C42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A5C4B36-610E-4451-BD56-86E5C8A52C42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A5C4B36-610E-4451-BD56-86E5C8A52C42}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6D621D28-8AB2-41C2-AA99-AE2225542E17}
SolutionGuid = {28CD7BF1-0965-4088-8597-4C08C20C814C}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright 2023 Faithlife
Copyright 2024 Faithlife

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 3 additions & 8 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
$ErrorActionPreference = 'Stop'
Push-Location $PSScriptRoot
try {
if (-not (Test-Path ./tools/bin/Build) -or
(Get-ChildItem ./tools/Build/* | Measure-Object LastWriteTime -Maximum).Maximum -gt
(Get-ChildItem ./tools/bin/Build/* | Measure-Object LastWriteTime -Maximum).Maximum) {
if (Test-Path ./tools/bin/Build) { Remove-Item ./tools/bin/Build -Recurse }
dotnet publish ./tools/Build/Build.csproj --output ./tools/bin/Build --nologo --verbosity quiet
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
dotnet ./tools/bin/Build/Build.dll $args
dotnet publish ./tools/Build/Build.csproj --artifacts-path ./artifacts --nologo --verbosity quiet
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet ./artifacts/publish/Build/release/Build.dll $args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
finally {
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
1 change: 1 addition & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
Expand Down
10 changes: 4 additions & 6 deletions src/Faithlife.Build/AppRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ public static int RunCmd(string path, AppRunnerSettings settings)

private static int DoRunApp(string path, AppRunnerSettings settings)
{
if (path is null)
throw new ArgumentNullException(nameof(path));
if (settings is null)
throw new ArgumentNullException(nameof(settings));
ArgumentNullException.ThrowIfNull(path);
ArgumentNullException.ThrowIfNull(settings);

var arguments = settings.Arguments?.WhereNotNull() ?? Enumerable.Empty<string>();
var arguments = settings.Arguments?.WhereNotNull() ?? [];
string commandPath;
string argsString;
if (settings.UseCmdOnWindows && BuildEnvironment.IsWindows())
Expand Down Expand Up @@ -144,7 +142,7 @@ private static int DoRunApp(string path, AppRunnerSettings settings)
};

if (!settings.NoEcho)
Console.Error.WriteLine($"{settings.WorkingDirectory}>> {ArgumentEscaper.EscapeAndConcatenate(new[] { commandPath })} {argsString}");
Console.Error.WriteLine($"{settings.WorkingDirectory}>> {ArgumentEscaper.EscapeAndConcatenate([commandPath])} {argsString}");

using var outputDone = handleOutputLine is not null ? new AutoResetEvent(initialState: false) : null;
using var errorDone = handleErrorLine is not null ? new AutoResetEvent(initialState: false) : null;
Expand Down
3 changes: 1 addition & 2 deletions src/Faithlife.Build/BuildApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ public BuildOption AddOption(string template, string description, string? defaul
/// <returns>The specified build target. If a target with the specified name already exists, it is returned.</returns>
public BuildTarget Target(string name)
{
if (name is null)
throw new ArgumentNullException(nameof(name));
ArgumentNullException.ThrowIfNull(name);

var target = m_targets.SingleOrDefault(x => x.Name == name);
if (target is null)
Expand Down
8 changes: 3 additions & 5 deletions src/Faithlife.Build/BuildRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ public static int Execute(string[] args, Action<BuildApp> initialize) =>
/// <returns>The exit code for the build.</returns>
public static async Task<int> ExecuteAsync(string[] args, Action<BuildApp> initialize)
{
if (args is null)
throw new ArgumentNullException(nameof(args));
if (initialize is null)
throw new ArgumentNullException(nameof(initialize));
ArgumentNullException.ThrowIfNull(args);
ArgumentNullException.ThrowIfNull(initialize);

if (Assembly.GetEntryAssembly()?.EntryPoint?.ReturnType == typeof(void))
{
Expand Down Expand Up @@ -76,7 +74,7 @@ public static async Task<int> ExecuteAsync(string[] args, Action<BuildApp> initi
var skipDependencies = skipDependenciesFlag.Value;
if (skipOption.Value is not null && !skipDependencies)
{
var skipTargetNames = new HashSet<string>(skipOption.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
var skipTargetNames = new HashSet<string>(skipOption.Value.Split(',', StringSplitOptions.RemoveEmptyEntries));
var targetNamesWithDependencies = new List<string>();

void AddTargetAndDependencies(BuildTarget target)
Expand Down
6 changes: 2 additions & 4 deletions src/Faithlife.Build/BuildTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public BuildTarget DependsOn(params string[] targets)
/// <returns>The target, for use by the "fluent" builder pattern.</returns>
public BuildTarget Does(Action action)
{
if (action is null)
throw new ArgumentNullException(nameof(action));
ArgumentNullException.ThrowIfNull(action);

m_actions.Add(ActionAsync);
return this;
Expand All @@ -65,8 +64,7 @@ public BuildTarget Does(Action action)
/// <returns>The target, for use by the "fluent" builder pattern.</returns>
public BuildTarget Does(Func<Task> action)
{
if (action is null)
throw new ArgumentNullException(nameof(action));
ArgumentNullException.ThrowIfNull(action);

m_actions.Add(action);
return this;
Expand Down
Loading

0 comments on commit ecb9941

Please sign in to comment.