Merge changes I5645ddb9,Ib3d50f15,Ib4c5815a,If3b63706 into main

* changes:
  Revert "Revert^2 "Always embed jni libs and store uncompressed""
  Revert "Revert "Revert "Collect transitve deps of jni libs only for bund...""
  Revert "Add SkipToTransitiveDepsTag interface for dependency tags"
  Revert "Install transitive deps of jni libs, but not the jni libs themselves"
This commit is contained in:
Treehugger Robot
2024-05-14 20:16:05 +00:00
committed by Gerrit Code Review
10 changed files with 200 additions and 173 deletions

View File

@@ -62,8 +62,8 @@ def parse_args():
'in the manifest.'))
parser.add_argument('--extract-native-libs', dest='extract_native_libs',
default=None, type=lambda x: (str(x).lower() == 'true'),
help=('specify if the app wants to use embedded native libraries. Must not '
'be true if manifest says false.'))
help=('specify if the app wants to use embedded native libraries. Must not conflict '
'if already declared in the manifest.'))
parser.add_argument('--has-no-code', dest='has_no_code', action='store_true',
help=('adds hasCode="false" attribute to application. Ignored if application elem '
'already has a hasCode attribute.'))
@@ -299,16 +299,7 @@ def add_extract_native_libs(doc, extract_native_libs):
attr = doc.createAttributeNS(android_ns, 'android:extractNativeLibs')
attr.value = value
application.setAttributeNode(attr)
elif attr.value == "false" and value == "true":
# Note that we don't disallow the case of extractNativeLibs="true" in manifest and
# --extract-native-libs="false". This is fine because --extract-native-libs="false" means that
# the build system didn't compress the JNI libs, which is a fine choice for built-in apps. At
# runtime the JNI libs will be extracted to outside of the APK, but everything will still work
# okay.
#
# The opposite (extractNativeLibs="false" && --extract-native-libs="true") should however be
# disallowed because otherwise that would make an ill-formed APK; JNI libs are stored compressed
# but they won't be extracted. There's no way to execute the JNI libs.
elif attr.value != value:
raise RuntimeError('existing attribute extractNativeLibs="%s" conflicts with --extract-native-libs="%s"' %
(attr.value, value))

View File

@@ -479,8 +479,8 @@ class AddExtractNativeLibsTest(unittest.TestCase):
self.assert_xml_equal(output, expected)
def test_conflict(self):
manifest_input = self.manifest_tmpl % self.extract_native_libs('false')
self.assertRaises(RuntimeError, self.run_test, manifest_input, True)
manifest_input = self.manifest_tmpl % self.extract_native_libs('true')
self.assertRaises(RuntimeError, self.run_test, manifest_input, False)
class AddNoCodeApplicationTest(unittest.TestCase):