Skip to content

Commit d7da367

Browse files
authored
Merge pull request #98 from IShix-g/release
v1.0.57
2 parents 7dcac24 + d2af8db commit d7da367

File tree

3 files changed

+51
-14
lines changed

3 files changed

+51
-14
lines changed

.github/workflows/reusable-build-package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
echo "normalized-package-name=$package_name" >> "$GITHUB_OUTPUT"
8989
echo "export-path=$export_path" >> "$GITHUB_OUTPUT"
9090
echo "normalized-project-path=/$project_path/" >> "$GITHUB_OUTPUT"
91-
echo "::notice title=Export Path:: $export_path"
91+
echo "::notice title=Export Path::$export_path"
9292
9393
- uses: actions/checkout@v4
9494
with:

Assets/Editor/ArgumentsParser.cs

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,49 @@ namespace UnityBuilderAction.Input
99
{
1010
public class ArgumentsParser
1111
{
12-
static string EOL = Environment.NewLine;
12+
static string Eol = Environment.NewLine;
1313
static readonly string[] Secrets = { "androidKeystorePass", "androidKeyaliasName", "androidKeyaliasPass" };
14-
14+
const string DefaultCustomBuildName = "TestBuild";
15+
1516
public static Dictionary<string, string> GetValidatedOptions()
1617
{
17-
Dictionary<string, string> validatedOptions;
18-
ParseCommandLineArguments(out validatedOptions);
18+
ParseCommandLineArguments(out var validatedOptions);
19+
20+
if (!validatedOptions.TryGetValue("projectPath", out string _))
21+
{
22+
Console.WriteLine("Missing argument -projectPath");
23+
EditorApplication.Exit(110);
24+
}
25+
26+
if (!validatedOptions.TryGetValue("buildTarget", out string buildTarget))
27+
{
28+
Console.WriteLine("Missing argument -buildTarget");
29+
EditorApplication.Exit(120);
30+
}
31+
32+
if (!Enum.IsDefined(typeof(BuildTarget), buildTarget ?? string.Empty))
33+
{
34+
Console.WriteLine($"{buildTarget} is not a defined {nameof(BuildTarget)}");
35+
EditorApplication.Exit(121);
36+
}
37+
38+
if (!validatedOptions.TryGetValue("customBuildPath", out string _))
39+
{
40+
Console.WriteLine("Missing argument -customBuildPath");
41+
EditorApplication.Exit(130);
42+
}
43+
44+
if (!validatedOptions.TryGetValue("customBuildName", out string customBuildName))
45+
{
46+
Console.WriteLine($"Missing argument -customBuildName, defaulting to {defaultCustomBuildName}.");
47+
validatedOptions.Add("customBuildName", DefaultCustomBuildName);
48+
}
49+
else if (customBuildName == "")
50+
{
51+
Console.WriteLine($"Invalid argument -customBuildName, defaulting to {defaultCustomBuildName}.");
52+
validatedOptions.Add("customBuildName", DefaultCustomBuildName);
53+
}
54+
1955
return validatedOptions;
2056
}
2157

@@ -25,15 +61,16 @@ static void ParseCommandLineArguments(out Dictionary<string, string> providedArg
2561
string[] args = Environment.GetCommandLineArgs();
2662

2763
Console.WriteLine(
28-
EOL +
29-
"###########################" + EOL +
30-
"# Parsing settings #" + EOL +
31-
"###########################" + EOL +
32-
EOL
64+
$"{Eol}" +
65+
$"###########################{Eol}" +
66+
$"# Parsing settings #{Eol}" +
67+
$"###########################{Eol}" +
68+
$"{Eol}"
3369
);
3470

3571
// Extract flags with optional values
36-
for (int current = 0, next = 1; current < args.Length; current++, next++) {
72+
for (int current = 0, next = 1; current < args.Length; current++, next++)
73+
{
3774
// Parse flag
3875
bool isFlag = args[current].StartsWith("-");
3976
if (!isFlag) continue;
@@ -46,7 +83,7 @@ static void ParseCommandLineArguments(out Dictionary<string, string> providedArg
4683
string displayValue = secret ? "*HIDDEN*" : "\"" + value + "\"";
4784

4885
// Assign
49-
Console.WriteLine("Found flag \"" + flag + "\" with value " + displayValue);
86+
Console.WriteLine($"Found flag \"{flag}\" with value {displayValue}.");
5087
providedArguments.Add(flag, value);
5188
}
5289
}

Assets/Editor/PackageExporter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static void Export(string assetsFolderPath, string exportPath)
3636

3737
if (File.Exists(exportPath))
3838
{
39-
PrintLog("Export complete: " + Path.GetFullPath(exportPath));
39+
PrintLog("::notice title=Export Path(C#)::Export complete: " + Path.GetFullPath(exportPath));
4040
}
4141
else
4242
{
@@ -54,7 +54,7 @@ public static void PrintErrorLog(string msg)
5454
{
5555
if (Application.isBatchMode)
5656
{
57-
Console.WriteLine($"::error:: {msg}");
57+
Console.WriteLine($"::error::{msg}");
5858
EditorApplication.Exit(1);
5959
}
6060
else Debug.LogError(msg);

0 commit comments

Comments
 (0)