Closed jonathanpeppers closed 5 days ago
Removing the line in this PR is fine for main, but it seems like the rules here might be needed:
As mentioned here:
The Android SDK doesn't seem to redistribute any proguard rules anymore, but they have it in their repo?
Hmm:
This file is no longer maintained and is not used by new (2.2+) versions of the # Android plugin for Gradle. Instead, the Android plugin for Gradle generates the # default rules at build time and stores them in the build directory.
So, we might have to dig up what the Android Gradle plugin does and port the logic to C#?
We should not merge this PR until better understand the Android Gradle plugin behavior.
I think I should:
proguard-android.txt
proguard-android.txt
file insteadSome links:
I was going to add a TPN, like:
using System;
using System.Collections.Generic;
using System.IO;
namespace Xamarin.Android.Prepare;
[TPN]
class android_build_tools_gradle_TPN : ThirdPartyNotice
{
// https://mvnrepository.com/artifact/com.android.tools.build/gradle
static readonly Uri url = new Uri ("https://android.googlesource.com/platform/tools/base");
public override string LicenseFile => CommonLicenses.Apache20Path;
public override string Name => "google/com.android.tools.build/gradle";
public override Uri SourceUrl => url;
public override string LicenseText => String.Empty;
public override bool Include (bool includeExternalDeps, bool includeBuildDeps) => includeExternalDeps;
}
When running -t:Prepare
I saw no changes?!?
Then I found we already have an entry for this:
So, maybe we are good and no TPN changed needed?
Should we update the existing TPN URL to? https://android.googlesource.com/platform/tools/base/+/refs/heads/main/sdk-common/NOTICE
(explicit branch name of master
vs. explicit commit)
Context: https://discord.com/channels/732297728826277939/732297837953679412/1303383272918618163
A customer found their app grew in size when building on Windows versus macOS.
The difference being a file that was passed to the
<R8/>
task on Windows, but not on macOS:tools
is ancient, as any Android SDK should be usingcmdline-tools
now.Let's stop using this file as a default set of proguard rules.
But we need to use the right set of proguard rules, reading the text of the old one:
I found the source code for the gradle task that generates the new files at:
In order to get this file, we can setup an empty gradle project using the Android gradle plugin:
Which, hopefully, dependabot is able to update this version.
Then we can run the task:
This outputs files such as:
For now, I simply redistributed the
proguard-android.txt
file, but we could consider makingproguard-android-optimize.txt
useable in the future. I believe the only difference is the-allowaccessmodification
flag, which users could put in their own proguard rules.