mirror of
https://github.com/Ellpeck/GameBundle.git
synced 2024-11-26 02:18:35 +01:00
install beauty as a local tool instead of a global one
This commit is contained in:
parent
347aa17333
commit
f0195659d1
4 changed files with 27 additions and 8 deletions
12
GameBundle/.config/dotnet-tools.json
Normal file
12
GameBundle/.config/dotnet-tools.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"nulastudio.ncbeauty": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"commands": [
|
||||||
|
"ncbeauty"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,4 +20,10 @@
|
||||||
<PackageReference Include="CommandLineParser" Version="2.7.82" />
|
<PackageReference Include="CommandLineParser" Version="2.7.82" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include=".config\dotnet-tools.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -14,7 +14,8 @@ namespace GameBundle {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Run(Options options) {
|
private static int Run(Options options) {
|
||||||
if (RunProcess(options, "dotnet", "tool install nulastudio.ncbeauty -g") < 0)
|
// make sure all of the required tools are installed
|
||||||
|
if (RunProcess(options, "dotnet", "tool restore", AppDomain.CurrentDomain.BaseDirectory) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
var proj = GetProjectFile(options);
|
var proj = GetProjectFile(options);
|
||||||
|
@ -30,15 +31,15 @@ namespace GameBundle {
|
||||||
|
|
||||||
if (options.BuildWindows) {
|
if (options.BuildWindows) {
|
||||||
Console.WriteLine("Bundling for windows");
|
Console.WriteLine("Bundling for windows");
|
||||||
Publish(options, proj, $"{bundleDir}/win", options.Publish32Bit ? "win-x86" : "win-x64");
|
Publish(options, proj, $"{bundleDir.FullName}/win", options.Publish32Bit ? "win-x86" : "win-x64");
|
||||||
}
|
}
|
||||||
if (options.BuildLinux) {
|
if (options.BuildLinux) {
|
||||||
Console.WriteLine("Bundling for linux");
|
Console.WriteLine("Bundling for linux");
|
||||||
Publish(options, proj, $"{bundleDir}/linux", "linux-x64");
|
Publish(options, proj, $"{bundleDir.FullName}/linux", "linux-x64");
|
||||||
}
|
}
|
||||||
if (options.BuildMac) {
|
if (options.BuildMac) {
|
||||||
Console.WriteLine("Bundling for mac");
|
Console.WriteLine("Bundling for mac");
|
||||||
var dir = $"{bundleDir}/mac";
|
var dir = $"{bundleDir.FullName}/mac";
|
||||||
Publish(options, proj, dir, "osx-x64");
|
Publish(options, proj, dir, "osx-x64");
|
||||||
if (options.MacBundle)
|
if (options.MacBundle)
|
||||||
CreateMacBundle(options, new DirectoryInfo(dir), proj.FullName);
|
CreateMacBundle(options, new DirectoryInfo(dir), proj.FullName);
|
||||||
|
@ -54,7 +55,7 @@ namespace GameBundle {
|
||||||
// Run beauty
|
// Run beauty
|
||||||
var excludes = '"' + string.Join(";", options.ExcludedFiles) + '"';
|
var excludes = '"' + string.Join(";", options.ExcludedFiles) + '"';
|
||||||
var log = options.Verbose ? "Detail" : "Error";
|
var log = options.Verbose ? "Detail" : "Error";
|
||||||
RunProcess(options, "ncbeauty", $"--loglevel={log} --force=True {path} {options.LibFolder} --excludes={excludes}");
|
RunProcess(options, "dotnet", $"ncbeauty --loglevel={log} --force=True {path} {options.LibFolder} {excludes}", AppDomain.CurrentDomain.BaseDirectory);
|
||||||
|
|
||||||
// Remove the beauty file since it's just a marker
|
// Remove the beauty file since it's just a marker
|
||||||
var beautyFile = new FileInfo(Path.Combine(path, "NetCoreBeauty"));
|
var beautyFile = new FileInfo(Path.Combine(path, "NetCoreBeauty"));
|
||||||
|
@ -62,10 +63,10 @@ namespace GameBundle {
|
||||||
beautyFile.Delete();
|
beautyFile.Delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int RunProcess(Options options, string program, string args) {
|
private static int RunProcess(Options options, string program, string args, string workingDir = "") {
|
||||||
if (options.Verbose)
|
if (options.Verbose)
|
||||||
Console.WriteLine($"> {program} {args}");
|
Console.WriteLine($"> {program} {args}");
|
||||||
var info = new ProcessStartInfo(program, args);
|
var info = new ProcessStartInfo(program, args) {WorkingDirectory = workingDir};
|
||||||
if (!options.Verbose)
|
if (!options.Verbose)
|
||||||
info.CreateNoWindow = true;
|
info.CreateNoWindow = true;
|
||||||
var process = Process.Start(info);
|
var process = Process.Start(info);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
"../GameBundle/bin/Debug/netcoreapp3.1/GameBundle.exe" -wlm -s Test.csproj -o bin/Bundled -v -b
|
"../GameBundle/bin/Debug/netcoreapp3.1/GameBundle.exe" -w -s Test.csproj -o bin/Bundled -v -b
|
Loading…
Reference in a new issue