Skip to content
Merged
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
22 changes: 17 additions & 5 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/ParseBundlerArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ParseBundlerArguments : XamarinTask {
public string? SkipMarkingNSObjectsInUserAssemblies { get; set; }

[Output]
public int Verbosity { get; set; }
public string? Verbosity { get; set; }

[Output]
public string? Warn { get; set; }
Expand Down Expand Up @@ -102,6 +102,7 @@ public override bool Execute ()
var aot = new List<ITaskItem> ();
var envVariables = new List<ITaskItem> ();
var dlsyms = new List<ITaskItem> ();
int? verbosity = null;

for (int i = 0; i < args.Length; i++) {
var arg = args [i];
Expand Down Expand Up @@ -153,11 +154,15 @@ public override bool Execute ()
break;
case "verbose":
case "v":
Verbosity++;
if (!verbosity.HasValue)
verbosity = 0;
verbosity++;
break;
case "quiet":
case "q":
Verbosity--;
if (!verbosity.HasValue)
verbosity = 0;
verbosity--;
break;
case "marshal-managed-exceptions":
value = hasValue ? value : nextValue; // requires a value, which might be the next option
Expand Down Expand Up @@ -249,10 +254,14 @@ public override bool Execute ()
if (value.Length == 0 && name.Length > 1 && name.All (ch => ch == name [0])) {
switch (name [0]) {
case 'v':
Verbosity += name.Length;
if (!verbosity.HasValue)
verbosity = 0;
verbosity += name.Length;
continue;
case 'q':
Verbosity -= name.Length;
if (!verbosity.HasValue)
verbosity = 0;
verbosity -= name.Length;
continue;
}
}
Expand Down Expand Up @@ -296,6 +305,9 @@ public override bool Execute ()
aot.AddRange (Aot);
Aot = aot.ToArray ();
}

if (verbosity.HasValue)
Verbosity = verbosity.Value.ToString ();
}

return !Log.HasLoggedErrors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,18 @@ public void CustomLinkFlags (string input, string [] output)
CollectionAssert.AreEquivalent (output, task.CustomLinkFlags.Select (v => v.ItemSpec).ToArray (), string.Join (" ", output));
}

[TestCase ("-v", 1)]
[TestCase ("/v", 1)]
[TestCase ("/q", -1)]
[TestCase ("-vvvv", 4)]
[TestCase ("-qqq", -3)]
public void Verbosity (string input, int output)
[TestCase ("-v", "1")]
[TestCase ("/v", "1")]
[TestCase ("/q", "-1")]
[TestCase ("-vvvv", "4")]
[TestCase ("-qqq", "-3")]
[TestCase ("", null)]
public void Verbosity (string input, string output)
{
var task = CreateTask<CustomParseBundlerArguments> ();
task.ExtraArgs = input;
Assert.IsTrue (task.Execute (), input);
Assert.AreEqual (output, task.Verbosity, output.ToString ());
Assert.AreEqual (output, task.Verbosity, "Equality");
}

[TestCase ("--nowarn", "-1")]
Expand Down
Loading