Skip to content

Conversation

@nkoroste
Copy link
Contributor

Gradle supports excluding artifacts from modules using the exclude keyword. This functionality is used across the Android ecosystem to exclude artifacts from the final APK mainly to reduce app size.

This PR adds new excludes attribute to android_application which supports a list of regex file patterns to exclude from the final binary (aab).

…_application

Gradle supports excluding artifacts from modules using the exclude keyword. This functionality is used across the Android ecosystem to exclude artifacts from the final APK mainly to reduce app size.

This PR adds new `excludes` attribute to `android_application` which supports a list of regex file patterns to exclude from the final binary (`aab`).
@timpeut
Copy link
Collaborator

timpeut commented Jul 18, 2023

Is it not feasible to clean up your build dependencies to only include artifacts that you expect to be included in your final aab? Can you share an example usecase for the type of artifact you would want to exclude?

@nkoroste
Copy link
Contributor Author

Sorry somehow missed your reply, here is a list of things we typically exclude

PACKAGE_EXCLUDE_LIST = [
    "META-INF/DEPENDENCIES\\.txt",
    "META-INF/LICENSE\\.txt",
    "META-INF/NOTICE\\.txt",
    "META-INF/NOTICE",
    "META-INF/LICENSE",
    "META-INF/DEPENDENCIES",
    "META-INF/notice\\.txt",
    "META-INF/license\\.txt",
    "META-INF/dependencies\\.txt",
    "META-INF/LGPL2\\.1",
    "META-INF/README\\.txt",
    "META-INF/maven/.*/pom\\.xml",
    "META-INF/maven/.*/pom\\.properties",
    "META-INF/com.android.tools/proguard/.*\\.pro",
    "META-INF/com.android.tools/r8/.*\\.pro",
    "META-INF/maven/.*",
    "LICENSE_OFL",
    "LICENSE_UNICODE",
    "LICENSE\\.txt",
    "README",
    "SDKONLY_LICENSES",
    "version\\.txt",
    "builddef\\.lst",
    "COPYING\\.txt",
    "MANIFEST",
    ".*/.*\\.java",
    ".*/.*\\.kt",
    ".*/dagger-android\\.pro",
    "META-INF/rxjava\\.properties",
    "META-INF/.*\\.kotlin_module",
    "META-INF/proguard/*",
    ".*/.*\\.proto",
    ".*/protobuf\\.meta",
    "protobuf.meta",
    ".*/.*\\.kotlin_builtins",
    ".*/.*\\.kotlin_metadata",
    "jsr305_annotations/Jsr305_annotations\\.gwt\\.xml",
    "error_prone/Annotations\\.gwt\\.xml",
    "third_party/java_src/error_prone/project/annotations/.*\\.xml",
    "org/jcodec/testing/jm\\.conf",
    "build-data\\.properties",
    "git\\.properties",
    "androidsupportmultidexversion\\.txt",
    "bazel-.*/.*",
    # exclude play service lib properties
    ".*/play-services-.*\\.properties",
    ".*/firebase-.*\\.properties",
    "DebugProbesKt\\.bin",
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants