Skip to content

Commit c387499

Browse files
Fix response file: Remove quoting as R8/D8 treats each line as complete argument
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
1 parent 47683d2 commit c387499

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

  • src/Xamarin.Android.Build.Tasks

src/Xamarin.Android.Build.Tasks/Tasks/D8.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,12 @@ protected virtual string CreateResponseFile ()
163163
}
164164

165165
/// <summary>
166-
/// Writes a single argument to the response file, quoting if necessary for paths with spaces.
166+
/// Writes a single argument to the response file.
167+
/// R8/D8 response files treat each line as a complete argument, so no quoting is needed.
167168
/// </summary>
168169
protected void WriteArg (StreamWriter writer, string arg)
169170
{
170-
// Quote paths that contain spaces
171-
if (arg.Contains (" ")) {
172-
writer.WriteLine ($"\"{arg}\"");
173-
} else {
174-
writer.WriteLine (arg);
175-
}
171+
writer.WriteLine (arg);
176172
Log.LogDebugMessage ($" {arg}");
177173
}
178174

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/D8Tests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ public void ResponseFileContainsLibAndInputJars ()
9696
}
9797

9898
/// <summary>
99-
/// Tests that paths with spaces are quoted in the response file.
99+
/// Tests that paths with spaces are written correctly to the response file.
100+
/// R8/D8 response files treat each line as a complete argument, so no quoting is needed.
100101
/// </summary>
101102
[Test]
102-
public void ResponseFileQuotesPathsWithSpaces ()
103+
public void ResponseFileHandlesPathsWithSpaces ()
103104
{
104105
var pathWithSpaces = Path.Combine (tempDir, "path with spaces");
105106
Directory.CreateDirectory (pathWithSpaces);
@@ -127,8 +128,8 @@ public void ResponseFileQuotesPathsWithSpaces ()
127128
FileAssert.Exists (responseFilePath, "Response file should exist");
128129
string responseFileContent = File.ReadAllText (responseFilePath);
129130

130-
// Paths with spaces should be quoted
131-
Assert.IsTrue (responseFileContent.Contains ("\""), "Response file should contain quoted paths");
131+
// Paths with spaces should NOT be quoted (R8/D8 treats each line as a complete argument)
132+
Assert.IsFalse (responseFileContent.Contains ("\""), "Response file should not contain quoted paths");
132133
Assert.IsTrue (responseFileContent.Contains ("path with spaces"), "Response file should contain the path with spaces");
133134

134135
} finally {

0 commit comments

Comments
 (0)