feat: migrate 26eac54 state to Matrix42 26.1
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Matrix42.Extensions.Scaffolder.Core.Project;
|
||||
|
||||
public class ProjectDefinition
|
||||
{
|
||||
/// <summary>
|
||||
/// E.g. "Services", "BizLogic", etc.
|
||||
/// If empty, project name will be equal to ExtensionNamespace.
|
||||
/// </summary>
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
|
||||
public RuntimeTargets Runtimes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Combination of functionality flags: WebApi, Engine, Behavior, Connector, Custom.
|
||||
/// </summary>
|
||||
public ProjectFunctionality Functionality { get; set; } = ProjectFunctionality.None;
|
||||
|
||||
public string Display => $"Prefix: {Prefix} - Runtimes: {Runtimes} - Functionality: {Functionality}";
|
||||
|
||||
public string GetProjectName(string extensionNamespace)
|
||||
{
|
||||
var pfx = Prefix?.Trim();
|
||||
return string.IsNullOrWhiteSpace(pfx)
|
||||
? extensionNamespace
|
||||
: $"{extensionNamespace}.{pfx}";
|
||||
}
|
||||
|
||||
public string GetNamespace(string extensionNamespace) => GetProjectName(extensionNamespace);
|
||||
|
||||
public bool DoesSupportAllRuntimes() => Runtimes.HasFlag(RuntimeTargets.All);
|
||||
|
||||
public string GetRuntimeIdentifiers()
|
||||
{
|
||||
if (DoesSupportAllRuntimes())
|
||||
{
|
||||
return "netstandard2.0";
|
||||
}
|
||||
|
||||
var list = new List<string>();
|
||||
if (Runtimes.HasFlag(RuntimeTargets.Win) || Runtimes.HasFlag(RuntimeTargets.WinCore))
|
||||
{
|
||||
list.Add("win-x64");
|
||||
}
|
||||
|
||||
if (Runtimes.HasFlag(RuntimeTargets.LinuxCore))
|
||||
{
|
||||
list.Add("linux-x64");
|
||||
}
|
||||
|
||||
return string.Join(";", list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace Matrix42.Extensions.Scaffolder.Core.Project;
|
||||
|
||||
[Flags]
|
||||
public enum ProjectFunctionality
|
||||
{
|
||||
None = 0,
|
||||
WebApi = 1,
|
||||
Engine = 2,
|
||||
Behavior = 4,
|
||||
Connector = 8,
|
||||
Custom = 16
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum RuntimeTargets
|
||||
{
|
||||
Win = 1,
|
||||
WinCore = 2,
|
||||
LinuxCore = 4,
|
||||
All = 8
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace Matrix42.Extensions.Scaffolder.Core.Project
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes a single extra reference to put in the csproj.
|
||||
/// </summary>
|
||||
public sealed class ProjectReferenceDefinition
|
||||
{
|
||||
public string Include { get; set; }
|
||||
public string HintPath { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user