mirror of https://github.com/abpframework/abp.git
5 changed files with 181 additions and 0 deletions
@ -0,0 +1,99 @@ |
|||
namespace Volo.Abp.Studio.Packages |
|||
{ |
|||
public static class PackageTypes |
|||
{ |
|||
public const string Domain = "lib.domain"; |
|||
public const string DomainShared = "lib.domain-shared"; |
|||
public const string Application = "lib.application"; |
|||
public const string ApplicationContracts = "lib.application-contracts"; |
|||
public const string EntityFrameworkCore = "lib.ef"; |
|||
public const string MongoDB = "lib.mongodb"; |
|||
public const string HttpApi = "lib.http-api"; |
|||
public const string HttpApiClient = "lib.http-api-client"; |
|||
public const string Mvc = "lib.mvc"; |
|||
public const string Blazor = "lib.blazor"; |
|||
public const string BlazorWebAssembly = "lib.blazor-wasm"; |
|||
public const string BlazorServer = "lib.blazor-server"; |
|||
public const string Test = "lib.test"; |
|||
|
|||
public const string HostHttpApi = "host.http-api"; |
|||
public const string HostMvc = "host.mvc"; |
|||
public const string HostBlazorWebAssembly = "host.blazor-wasm"; |
|||
public const string HostBlazorServer = "host.blazor-server"; |
|||
public const string HostApiGatewayOcelot = "host.api-gateway-ocelot"; |
|||
|
|||
public static string CalculateDefaultPackageNameForModule( |
|||
string moduleName, |
|||
string packageType) |
|||
{ |
|||
switch (packageType) |
|||
{ |
|||
case Domain: |
|||
return moduleName + ".Domain"; |
|||
case DomainShared: |
|||
return moduleName + ".Domain.Shared"; |
|||
case Application: |
|||
return moduleName + ".Application"; |
|||
case ApplicationContracts: |
|||
return moduleName + ".Application.Contracts"; |
|||
case EntityFrameworkCore: |
|||
return moduleName + ".EntityFrameworkCore"; |
|||
case HttpApi: |
|||
return moduleName + ".HttpApi"; |
|||
case HttpApiClient: |
|||
return moduleName + ".HttpApi.Client"; |
|||
case MongoDB: |
|||
return moduleName + ".MongoDB"; |
|||
case Mvc: |
|||
return moduleName + ".Web"; |
|||
case Blazor: |
|||
return moduleName + ".Blazor"; |
|||
case BlazorWebAssembly: |
|||
return moduleName + ".Blazor.WebAssembly"; |
|||
case BlazorServer: |
|||
return moduleName + ".Blazor.Server"; |
|||
case HostHttpApi: |
|||
return moduleName + ".HttpApi.Host"; |
|||
case HostMvc: |
|||
return moduleName + ".Web.Host"; |
|||
case HostBlazorWebAssembly: |
|||
return moduleName + ".Blazor.Client"; |
|||
case HostBlazorServer: |
|||
return moduleName + ".Blazor.Host"; |
|||
case HostApiGatewayOcelot: |
|||
return moduleName + ".Gateway"; |
|||
default: |
|||
throw new AbpStudioException(AbpStudioErrorCodes.PackageNameMustBeSpecified); |
|||
} |
|||
} |
|||
|
|||
public static bool IsHostProject(string packageType) |
|||
{ |
|||
return |
|||
packageType == HostMvc || |
|||
packageType == HostHttpApi || |
|||
packageType == HostBlazorWebAssembly || |
|||
packageType == HostBlazorServer || |
|||
packageType == HostApiGatewayOcelot; |
|||
} |
|||
|
|||
public static bool IsUiProject(string packageType) |
|||
{ |
|||
return |
|||
packageType == Mvc || |
|||
packageType == BlazorWebAssembly || |
|||
packageType == BlazorServer; |
|||
} |
|||
|
|||
public static string GetHostTypeOfUi(string packageType, bool useHostBlazorServerForMvcPackages = false) |
|||
{ |
|||
return packageType switch |
|||
{ |
|||
Mvc => !useHostBlazorServerForMvcPackages ? HostMvc : HostBlazorServer, |
|||
BlazorWebAssembly => HostBlazorWebAssembly, |
|||
BlazorServer => HostBlazorServer, |
|||
_ => null |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
namespace Volo.Abp.Studio.Packages |
|||
{ |
|||
public static class PackageConsts |
|||
{ |
|||
public const string FileExtension = ".abppkg.json"; |
|||
|
|||
public const string RoleProperty = "role"; |
|||
} |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
using System; |
|||
using System.IO; |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace Volo.Abp.Studio.Packages |
|||
{ |
|||
public static class PackageHelper |
|||
{ |
|||
public static string GetNameFromPath([NotNull] string path) |
|||
{ |
|||
Check.NotNullOrWhiteSpace(path, nameof(path)); |
|||
|
|||
return Path |
|||
.GetFileName(path) |
|||
.RemovePostFix(StringComparison.OrdinalIgnoreCase, PackageConsts.FileExtension); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Studio.Analyzing; |
|||
|
|||
namespace Volo.Abp.Studio.Packages |
|||
{ |
|||
public class PackageInfo |
|||
{ |
|||
[NotNull] |
|||
public string Path { get; } |
|||
|
|||
[NotNull] |
|||
public string Name { get; } |
|||
|
|||
[CanBeNull] |
|||
public string Role { get; } |
|||
|
|||
[CanBeNull] |
|||
public AnalyzingOptions AnalyzingOptions { get; set; } |
|||
|
|||
public PackageInfo([NotNull] string path, [CanBeNull] string role) |
|||
{ |
|||
Path = Check.NotNullOrWhiteSpace(path, nameof(path)); |
|||
Name = PackageHelper.GetNameFromPath(path); |
|||
Role = role; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Studio.Analyzing.Models; |
|||
|
|||
namespace Volo.Abp.Studio.Packages |
|||
{ |
|||
public class PackageInfoWithAnalyze |
|||
{ |
|||
[NotNull] |
|||
public string Path { get; } |
|||
|
|||
[NotNull] |
|||
public string Name { get; } |
|||
|
|||
[CanBeNull] |
|||
public string Role { get; } |
|||
|
|||
[NotNull] |
|||
public PackageModel Analyze { get; } |
|||
|
|||
public PackageInfoWithAnalyze([NotNull] string path, [CanBeNull] string role, [NotNull] PackageModel analyze) |
|||
{ |
|||
Path = Check.NotNullOrWhiteSpace(path, nameof(path)); |
|||
Name = PackageHelper.GetNameFromPath(path); |
|||
Role = role; |
|||
Analyze = Check.NotNull(analyze, nameof(analyze)); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue