Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
[assembly: InternalsVisibleTo("Fallout.Utilities.IO.Globbing")]
[assembly: InternalsVisibleTo("Fallout.Utilities.Specs")]

// Application-layer tool families — some tool attributes integrate with the (currently
// internal) value-injection plumbing. Interim bridge until value-injection is a public
// Application API; tracked with the tool-namespace-alignment follow-up.
[assembly: InternalsVisibleTo("Fallout.Application.Tools.Signing")]
[assembly: InternalsVisibleTo("Fallout.Application.Tools.Versioning")]
[assembly: InternalsVisibleTo("Fallout.Application.Tools.Shell")]
[assembly: InternalsVisibleTo("Fallout.Application.Tools.DotNet")]
[assembly: InternalsVisibleTo("Fallout.Application.Tools.Coverage")]
[assembly: InternalsVisibleTo("Fallout.Application.Tools.Containers")]
[assembly: InternalsVisibleTo("Fallout.Application.Tools.VersionControl")]

// External extensions — kept as Nuke.* until those projects rebrand independently.
[assembly: InternalsVisibleTo("Nuke.VisualStudio")]
[assembly: InternalsVisibleTo("ReSharper.Nuke")]
Expand Down
1 change: 1 addition & 0 deletions build/Build.CodeGeneration.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using Fallout.Common;
using Fallout.Common.IO;
using Fallout.Common.Git;
using Fallout.Common.Tools.GitHub;
using Fallout.Common.Utilities.Collections;
using static Fallout.CodeGeneration.CodeGenerator;
Expand Down
1 change: 1 addition & 0 deletions build/Build.Stargazers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Fallout.Common;
using Fallout.Common.IO;
using Fallout.Common.Git;
using Fallout.Common.Tools.GitHub;
using Fallout.Common.Utilities;

Expand Down
3 changes: 3 additions & 0 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@

<ItemGroup>
<ProjectReference Include="..\src\Fallout.Components\Fallout.Components.csproj" />
<ProjectReference Include="..\src\Tools\Fallout.Application.Tools.Containers\Fallout.Application.Tools.Containers.csproj" />
<ProjectReference Include="..\src\Tools\Fallout.Application.Tools.DotNet\Fallout.Application.Tools.DotNet.csproj" />
<ProjectReference Include="..\src\Tools\Fallout.Application.Tools.VersionControl\Fallout.Application.Tools.VersionControl.csproj" />
<ProjectReference Include="..\src\Fallout.Tooling.Generator\Fallout.Tooling.Generator.csproj" />
<ProjectReference Include="..\src\Fallout.SourceGenerators\Fallout.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
</ItemGroup>
Expand Down
14 changes: 14 additions & 0 deletions fallout.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@
<Project Path="src\Fallout.Application.Tooling.Requirements\Fallout.Application.Tooling.Requirements.csproj" />
<Project Path="src\Fallout.Tooling.Generator\Fallout.Tooling.Generator.csproj" />
<Project Path="src\Fallout.Tooling\Fallout.Tooling.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Cloud\Fallout.Application.Tools.Cloud.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Containers\Fallout.Application.Tools.Containers.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Coverage\Fallout.Application.Tools.Coverage.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.DotNet\Fallout.Application.Tools.DotNet.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Documentation\Fallout.Application.Tools.Documentation.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Gaming\Fallout.Application.Tools.Gaming.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.JavaScript\Fallout.Application.Tools.JavaScript.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Notifications\Fallout.Application.Tools.Notifications.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Packaging\Fallout.Application.Tools.Packaging.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Shell\Fallout.Application.Tools.Shell.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Signing\Fallout.Application.Tools.Signing.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Testing\Fallout.Application.Tools.Testing.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.Versioning\Fallout.Application.Tools.Versioning.csproj" />
<Project Path="src\Tools\Fallout.Application.Tools.VersionControl\Fallout.Application.Tools.VersionControl.csproj" />
<Project Path="src\Fallout.Utilities.IO.Compression\Fallout.Utilities.IO.Compression.csproj" />
<Project Path="src\Fallout.Utilities.IO.Globbing\Fallout.Utilities.IO.Globbing.csproj" />
<Project Path="src\Fallout.Utilities.Net\Fallout.Utilities.Net.csproj" />
Expand Down
119 changes: 119 additions & 0 deletions src/Fallout.Build/VCS/GitHubUrlExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System.IO;
using Fallout.Common.Utilities;
using static Fallout.Common.IO.PathConstruction;

namespace Fallout.Common.Git;

public enum GitHubItemType
{
Automatic,
File,
Directory
}

/// <summary>
/// Pure URL/identity helpers over a <see cref="GitRepository"/> for GitHub-hosted repositories.
/// These are Git-domain string helpers (no GitHub API access) and live next to
/// <see cref="GitRepository"/>; the Octokit-backed client lives in the GitHub tool.
/// </summary>
public static class GitHubUrlExtensions
{
public static bool IsGitHubRepository(this GitRepository repository)
{
return repository?.Endpoint?.EqualsOrdinalIgnoreCase("github.com") ?? false;
}

public static string GetGitHubOwner(this GitRepository repository)
{
Assert.True(repository.IsGitHubRepository());
return repository.Identifier.Split('/')[0];
}

public static string GetGitHubName(this GitRepository repository)
{
Assert.True(repository.IsGitHubRepository());
return repository.Identifier.Split('/')[1];
}

public static string GetGitHubCompareCommitsUrl(this GitRepository repository, string startCommitSha, string endCommitSha)
{
Assert.True(repository.IsGitHubRepository());
return $"https://github.com/{repository.Identifier}/compare/{endCommitSha}^...{startCommitSha}";
}

public static string GetGitHubCompareTagToHeadUrl(this GitRepository repository, string tag)
{
Assert.True(repository.IsGitHubRepository());
return $"https://github.com/{repository.Identifier}/compare/{tag}...HEAD";
}

public static string GetGitHubCompareTagsUrl(this GitRepository repository, string startTag, string endTag)
{
Assert.True(repository.IsGitHubRepository());
return $"https://github.com/{repository.Identifier}/compare/{endTag}...{startTag}";
}

public static string GetGitHubCommitUrl(this GitRepository repository, string commitSha)
{
Assert.True(repository.IsGitHubRepository());
return $"https://github.com/{repository.Identifier}/commit/{commitSha}";
}

/// <summary>Url in the form of <c>https://raw.githubusercontent.com/{identifier}/{branch}/{file}</c>.</summary>
public static string GetGitHubDownloadUrl(this GitRepository repository, string file, string branch = null)
{
Assert.True(repository.IsGitHubRepository());

branch ??= repository.Branch.NotNull("repository.Branch != null");
var relativePath = GetRepositoryRelativePath(file, repository);
return $"https://raw.githubusercontent.com/{repository.Identifier}/{branch}/{relativePath}";
}

/// <summary>
/// Url in the form of <c>https://github.com/{identifier}/tree/{branch}/directory</c> or
/// <c>https://github.com/{identifier}/blob/{branch}/file</c> depending on the item type.
/// </summary>
public static string GetGitHubBrowseUrl(
this GitRepository repository,
string path = null,
string branch = null,
GitHubItemType itemType = GitHubItemType.Automatic)
{
Assert.True(repository.IsGitHubRepository());

branch ??= repository.Branch.NotNull();
var relativePath = GetRepositoryRelativePath(path, repository);
var method = GetMethod(relativePath, itemType, repository);
Assert.True(path == null || method != null, "Could not determine item type");

return $"https://github.com/{repository.Identifier}/{method}/{branch}/{relativePath}".TrimEnd("/");
}

private static string GetMethod(string relativePath, GitHubItemType itemType, GitRepository repository)
{
var absolutePath = repository.LocalDirectory != null && relativePath != null
? NormalizePath(Path.Combine(repository.LocalDirectory, relativePath))
: null;

if (itemType == GitHubItemType.Directory || Directory.Exists(absolutePath) || relativePath == null)
return "tree";

if (itemType == GitHubItemType.File || File.Exists(absolutePath))
return "blob";

return null;
}

private static string GetRepositoryRelativePath(string path, GitRepository repository)
{
if (path == null)
return null;

if (!Path.IsPathRooted(path))
return path;

var localDirectory = repository.LocalDirectory.NotNull();
Assert.True(IsDescendantPath(localDirectory, path), $"Path {path.SingleQuote()} must be descendant of {localDirectory:s}");
return GetRelativePath(localDirectory, path).Replace(oldChar: '\\', newChar: '/');
}
}
4 changes: 4 additions & 0 deletions src/Fallout.Cli/Fallout.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<ItemGroup>
<ProjectReference Include="..\Fallout.Build\Fallout.Build.csproj" />
<ProjectReference Include="..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.DotNet\Fallout.Application.Tools.DotNet.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.Signing\Fallout.Application.Tools.Signing.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.VersionControl\Fallout.Application.Tools.VersionControl.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.Versioning\Fallout.Application.Tools.Versioning.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/Fallout.Common/CI/TeamCity/TeamCity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Linq;
using System.Text;
using Fallout.Common.IO;
using Fallout.Common.Tools.DotCover;
using Fallout.Common.Utilities;
using Fallout.Common.Utilities.Collections;
using Serilog;
Expand Down Expand Up @@ -140,8 +139,8 @@ public void ImportData(
{
Log.Warning("Configuration parameter 'teamcity.dotCover.home' is set to the bundled version." +
"Adding the {AttributeName} will automatically set " +
$"it to '{nameof(DotCoverTasks)}.{nameof(DotCoverTasks.DotCoverPath)}'",
nameof(TeamCitySetDotCoverHomePathAttribute));
"it to 'DotCoverTasks.DotCoverPath'",
"TeamCitySetDotCoverHomePathAttribute");
}

Write("importData",
Expand Down
1 change: 0 additions & 1 deletion src/Fallout.Common/ChangeLog/ChangeLogTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using NuGet.Versioning;
using Fallout.Common.Git;
using Fallout.Common.IO;
using Fallout.Common.Tools.GitHub;
using Fallout.Common.Utilities;
using Serilog;

Expand Down
8 changes: 0 additions & 8 deletions src/Fallout.Common/Fallout.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
<ProjectReference Include="..\Fallout.Utilities.Text.Json\Fallout.Utilities.Text.Json.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" />
<PackageReference Include="Azure.Security.KeyVault.Keys" />
<PackageReference Include="Azure.Security.KeyVault.Secrets" />
<PackageReference Include="Octokit" />
</ItemGroup>

<ItemGroup Condition="'$(_IsPacking)' == 'True'">
<None Include="$(MSBuildProjectName).props" PackagePath="build" Pack="true" />
<None Include="$(MSBuildProjectName).targets" PackagePath="build" Pack="true" />
Expand Down
5 changes: 5 additions & 0 deletions src/Fallout.Components/Fallout.Components.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

<ItemGroup>
<ProjectReference Include="..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.Coverage\Fallout.Application.Tools.Coverage.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.DotNet\Fallout.Application.Tools.DotNet.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.Signing\Fallout.Application.Tools.Signing.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.VersionControl\Fallout.Application.Tools.VersionControl.csproj" />
<ProjectReference Include="..\Tools\Fallout.Application.Tools.Versioning\Fallout.Application.Tools.Versioning.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions src/Fallout.Components/ICreateGitHubRelease.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Fallout.Common;
using Fallout.Common.ChangeLog;
using Fallout.Common.CI.GitHubActions;
using Fallout.Common.Git;
using Fallout.Common.IO;
using Fallout.Common.Tools.GitHub;
using Fallout.Common.Utilities;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Cloud/deploy tool wrappers — Octopus, Netlify, Static Web Apps. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Container/orchestration tool wrappers for Fallout — Docker, Helm, Kubernetes, Pulumi. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
<ProjectReference Include="..\Fallout.Application.Tools.DotNet\Fallout.Application.Tools.DotNet.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Code-coverage/quality tool wrappers for Fallout — Coverlet, OpenCover, dotCover, ReportGenerator, Codecov, Coveralls.net, CodeMetrics, SonarScanner. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
<ProjectReference Include="..\Fallout.Application.Tools.DotNet\Fallout.Application.Tools.DotNet.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Documentation tool wrappers — DocFX. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>.NET SDK tool wrappers for Fallout — dotnet, MSBuild, NuGet, Paket, EntityFramework, NSwag, ILRepack, CorFlags, VSWhere, MauiCheck, WebConfigTransformRunner. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Game-engine tool wrappers — Unity. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>JavaScript/Node tool wrappers — Npm. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Notification tool wrappers for Fallout — Slack, Discord, Teams, Twitter, Mastodon. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Packaging/installer tool wrappers — Chocolatey, Squirrel, Inno Setup, NSIS, Boots, dotnet-packaging. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Description>Shell tool wrappers — PowerShell, pwsh. Application layer (Fallout.Application.Tools.*).</Description>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Fallout.Common\Fallout.Common.csproj" />
<ProjectReference Include="..\..\Fallout.Tooling\Fallout.Tooling.csproj" />
</ItemGroup>

</Project>
Loading