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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class CreateMultiDexMainDexClassList : JavaToolTask

public string MultiDexMainDexListFile { get; set; }
public ITaskItem[] CustomMainDexListFiles { get; set; }
public string ProguardInputJarFilter { get; set; }

Action<CommandLineBuilder> commandlineAction;
string tempJar;
Expand All @@ -43,6 +44,7 @@ public override bool Execute ()
Log.LogDebugMessage (" ToolExe: {0}", ToolExe);
Log.LogDebugMessage (" ToolPath: {0}", ToolPath);
Log.LogDebugMessage (" ProguardJarPath: {0}", ProguardJarPath);
Log.LogDebugMessage (" ProguardInputJarFilter: {0}", ProguardInputJarFilter);

if (CustomMainDexListFiles != null && CustomMainDexListFiles.Any ()) {
var content = string.Concat (CustomMainDexListFiles.Select (i => File.ReadAllText (i.ItemSpec)));
Expand Down Expand Up @@ -76,7 +78,7 @@ void GenerateProguardCommands (CommandLineBuilder cmd)
var enclosingChar = OS.IsWindows ? "\"" : string.Empty;
var jars = JavaLibraries.Select (i => i.ItemSpec).Concat (new string [] { Path.Combine (ClassesOutputDirectory, "classes.zip") });
cmd.AppendSwitchIfNotNull ("-jar ", ProguardJarPath);
cmd.AppendSwitchUnquotedIfNotNull ("-injars ", $"{enclosingChar}'" + string.Join ($"'{Path.PathSeparator}'", jars) + $"'{enclosingChar}");
cmd.AppendSwitchUnquotedIfNotNull ("-injars ", $"{enclosingChar}'" + string.Join ($"{ProguardInputJarFilter}'{Path.PathSeparator}'", jars) + $"{ProguardInputJarFilter}'{enclosingChar}");
cmd.AppendSwitch ("-dontwarn");
cmd.AppendSwitch ("-forceprocessing");
cmd.AppendSwitchIfNotNull ("-outjars ", tempJar);
Expand Down
4 changes: 3 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/Proguard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class Proguard : ToolTask
public string PrintSeedsOutput { get; set; }
public string PrintUsageOutput { get; set; }
public string PrintMappingOutput { get; set; }
public string ProguardInputJarFilter { get; set; }

protected override string ToolName {
get {
Expand Down Expand Up @@ -98,6 +99,7 @@ public override bool Execute ()
Log.LogDebugMessage (" DumpOutput: {0}", DumpOutput);
Log.LogDebugMessage (" PrintSeedsOutput: {0}", PrintSeedsOutput);
Log.LogDebugMessage (" PrintMappingOutput: {0}", PrintMappingOutput);
Log.LogDebugMessage (" ProguardInputJarFilter: {0}", ProguardInputJarFilter);

EnvironmentVariables = MonoAndroidHelper.GetProguardEnvironmentVaribles (ProguardHome);

Expand Down Expand Up @@ -170,7 +172,7 @@ protected override string GenerateCommandLineCommands ()
foreach (var jarfile in ExternalJavaLibraries.Select (p => p.ItemSpec))
libjars.Add (jarfile);

cmd.AppendSwitchUnquotedIfNotNull ("-injars ", $"{enclosingChar}'" + string.Join ($"'{Path.PathSeparator}'", injars.Distinct ()) + $"'{enclosingChar}");
cmd.AppendSwitchUnquotedIfNotNull ("-injars ", $"{enclosingChar}'" + string.Join ($"{ProguardInputJarFilter}'{Path.PathSeparator}'", injars.Distinct ()) + $"{ProguardInputJarFilter}'{enclosingChar}");

cmd.AppendSwitchUnquotedIfNotNull ("-libraryjars ", $"{enclosingChar}'" + string.Join ($"'{Path.PathSeparator}'", libjars.Distinct ()) + $"'{enclosingChar}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ public void BuildMultiDexApplication (bool useJackAndJill, string fxVersion)
Assert.IsTrue (File.Exists (multidexKeepPath), "multidex.keep exists");
Assert.IsTrue (File.ReadAllLines (multidexKeepPath).Length > 1, "multidex.keep must contain more than one line.");
Assert.IsTrue (b.LastBuildOutput.ContainsText (Path.Combine (proj.TargetFrameworkVersion, "mono.android.jar")), proj.TargetFrameworkVersion + "/mono.android.jar should be used.");
Assert.IsFalse (b.LastBuildOutput.ContainsText ("Duplicate zip entry"), "Should not get warning about [META-INF/MANIFEST.MF]");
}
}

Expand Down Expand Up @@ -437,6 +438,7 @@ public override void OnCreate()
}" });
using (var b = CreateApkBuilder ("temp/CustomApplicationClassAndMultiDex")) {
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
Assert.IsFalse (b.LastBuildOutput.ContainsText ("Duplicate zip entry"), "Should not get warning about [META-INF/MANIFEST.MF]");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ protected bool BuildInternal (string projectOrSolution, string target, string []
psi.EnvironmentVariables [kvp.Key] = kvp.Value;
}
}
//NOTE: fix for Jenkins, see https://github.com/xamarin/xamarin-android/pull/1049#issuecomment-347625456
psi.EnvironmentVariables ["ghprbPullLongDescription"] = "";

psi.Arguments = args.ToString ();

psi.CreateNoWindow = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<_AndroidLibrayProjectIntermediatePath Condition=" '$(_AndroidLibrayProjectIntermediatePath)' == '' And '$(UseShortFileNames)' == 'True' ">$(IntermediateOutputPath)lp\</_AndroidLibrayProjectIntermediatePath>
<_AndroidLibrayProjectIntermediatePath Condition=" '$(_AndroidLibrayProjectIntermediatePath)' == '' ">$(IntermediateOutputPath)__library_projects__\</_AndroidLibrayProjectIntermediatePath>
<_AndroidLibrayProjectAssemblyMapFile>$(_AndroidLibrayProjectIntermediatePath)map.cache</_AndroidLibrayProjectAssemblyMapFile>
<_AndroidProguardInputJarFilter>(!META-INF/MANIFEST.MF)</_AndroidProguardInputJarFilter>

<!-- $(EnableProguard) is an obsolete property that should be removed at some stage. -->
<AndroidEnableProguard Condition="'$(AndroidEnableProguard)'==''">$(EnableProguard)</AndroidEnableProguard>
Expand Down Expand Up @@ -2153,6 +2154,7 @@ because xbuild doesn't support framework reference assemblies.
PrintSeedsOutput="$(IntermediateOutputPath)proguard\seeds.txt"
PrintUsageOutput="$(IntermediateOutputPath)proguard\usage.txt"
PrintMappingOutput="$(IntermediateOutputPath)proguard\mapping.txt"
ProguardInputJarFilter="$(_AndroidProguardInputJarFilter)"
/>

<CreateItem
Expand All @@ -2176,6 +2178,7 @@ because xbuild doesn't support framework reference assemblies.
JavaLibraries="@(_JarsToProguard)"
MultiDexMainDexListFile="$(_AndroidMainDexListFile)"
CustomMainDexListFiles="@(MultiDexMainDexList)"
ProguardInputJarFilter="$(_AndroidProguardInputJarFilter)"
>
</CreateMultiDexMainDexClassList>

Expand Down