Skip to content

Commit 6123cca

Browse files
pjcollinsjonpryor
authored andcommitted
[Xamarin.Android.Build.Tasks] Set PROGUARD_HOME on Windows (#550)
Context: d71dcc9 The `$PROGUARD_HOME` environment variable is used by the `<CreateMultiDexMainDexClassList/>` task/`mainDexClasses` script to specify the location of the `proguard` directory+script to use. `$PROGUARD_HOME` is exported on Linux and macOS but not Windows because the `proguard.bat` distributed with the Android SDK contained a quoting bug: java -jar "%PROGUARD_HOME%"\lib\proguard.jar %* Starting with commit 59aff45, xamarin-android bundles its own ProGuard binaries, which doesn't suffer from the above quoting bug. Additionally, we want to use our bundled ProGuard, which necessitates exporting the `%PROGUARD_HOME%` environment variable on Windows. Export the `$PROGUARD_HOME` environment variable on all platforms.
1 parent dfea975 commit 6123cca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,13 @@ public static Dictionary<string, string> LoadAcwMapFile (string acwPath)
470470

471471
public static string [] GetProguardEnvironmentVaribles (string proguardHome)
472472
{
473+
string proguardHomeVariable = "PROGUARD_HOME=" + proguardHome;
474+
473475
return Environment.OSVersion.Platform == PlatformID.Unix ?
474-
new string [] { "PROGUARD_HOME=" + proguardHome } :
475-
//TODO ReAdd the PROGUARD_HOME env variable once we are shipping our own proguard
476+
new string [] { proguardHomeVariable } :
476477
// Windows seems to need special care, needs JAVA_TOOL_OPTIONS.
477478
// On the other hand, xbuild has a bug and fails to parse '=' in the value, so we skip JAVA_TOOL_OPTIONS on Mono runtime.
478-
new string [] { "JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8" };
479+
new string [] { proguardHomeVariable, "JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8" };
479480
}
480481
}
481482
}

0 commit comments

Comments
 (0)