From 4332cd1cae56e1ce22eaf13c90668b2d85412903 Mon Sep 17 00:00:00 2001 From: Zi Wang Date: Wed, 6 Mar 2024 18:58:05 +0000 Subject: [PATCH] Add property Skip_jarjar_repackage If this property is set to true on a module, this module will not have jarjar repackaging. Test: CI Bug: 327009143 Ignore-AOSP-First: Will cp to aosp (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9bdd4228cb959d46a60610f3b0eb9b52b95a73ad) Merged-In: I9384c9c25ce581ac00d309a188cf7533eb2e44a6 Change-Id: I9384c9c25ce581ac00d309a188cf7533eb2e44a6 --- java/base.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/java/base.go b/java/base.go index f11e30dc2..d8ccec6c6 100644 --- a/java/base.go +++ b/java/base.go @@ -95,6 +95,9 @@ type CommonProperties struct { // if not blank, used as prefix to generate repackage rule Jarjar_prefix *string + // if set to true, skip the jarjar repackaging + Skip_jarjar_repackage *bool + // If not blank, set the java version passed to javac as -source and -target Java_version *string @@ -1101,11 +1104,13 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath jarjarProviderData := j.collectJarJarRules(ctx) if jarjarProviderData != nil { android.SetProvider(ctx, JarJarProvider, *jarjarProviderData) - text := getJarJarRuleText(jarjarProviderData) - if text != "" { - ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt") - android.WriteFileRule(ctx, ruleTextFile, text) - j.repackageJarjarRules = ruleTextFile + if !proptools.Bool(j.properties.Skip_jarjar_repackage) { + text := getJarJarRuleText(jarjarProviderData) + if text != "" { + ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt") + android.WriteFileRule(ctx, ruleTextFile, text) + j.repackageJarjarRules = ruleTextFile + } } }