Commit graph

27 commits

Author SHA1 Message Date
Cole Faust
1269a74fad Make pom2bp output preprocessed: true on app imports
The only difference between preprocessed + presigned vs just presigned
is that just presigned will zip align the apk, and preprocessed +
presigned will instead check that the apk is already aligned and has
uncompressed jni and dex libs. This should be the default to ensure
we're getting valid apk imports from external sources.

Presigned alone also won't work for apps with target sdk >= 30, because
on those target sdks you have to use apk signature v2, and having the
build system align the zip file will break that signature.

Bug: 185811447
Test: Presubmits
Change-Id: Ie825ab2eab4feeda5c266233a9dca7bbf9559be7
2023-07-14 15:44:24 -07:00
Brett Chabot
98fb28670c Add support for pom with packaging=apk to pom2bp.
Bug: 251825866
Test: ./prebuilts/misc/common/androidx-test/update-from-gmaven.py
Change-Id: I7811898d9801bb733f3b43c55308f6741778a378
2022-10-12 12:12:02 -07:00
Alan Viverette
efab514e51 Make writing command-line arguments as a comment in the generated file optional
Bug: 246630004
Test: ./update_prebuilts.py -x ######
Change-Id: Ic7d5d5ba55f5bba5cc2d0866a7a25f753f3428f8
2022-09-26 15:26:06 +00:00
Alan Viverette
d3be6f5885 Add support for prepending text from a file
Fixes: 241826272
Test: ./update_prebuilts.py -x <bid>
Change-Id: I47146fc8a4f9120891ee28d15b006448d66aaff7
2022-08-11 11:41:38 -04:00
Romain Jobredeaux
b669398c45 remove redundant 'deps' section from template with 'exports' section.
Test: pom2bp -regen prebuilts/sdk/current/support/BUILD.bazel
Bug: 198418951
Change-Id: I4d0e3d100d0e319473723a75077e2520fc1535e1
2021-09-22 16:50:33 -04:00
Romain Jobredeaux
89cb22416d Add a flag-protected (-pom2build) feature for pom2bp to produce Bazel BUILD files.
Note that this is an initial, rather crude attempt at this,
that unblocks generating BUILD files needed to build AOSP android apps.
In particular, note that
- Jetifier step currently ignored
- Visibility set to public for all output targets
- All dependencies are gathered in 'deps', though they are split under various categories in bp files
- Host, host-only notions are ignored for now

Test: Copy first 2 lines of, e.g. prebuilts/sdk/current/support/Android.bp to a BUILD.bazel file and run pom2bp -pom2build -regen BUILD.bazel
Bug: 198433754
Change-Id: I5efa93517e6c319fd828da5b16ba7efd2d90bca8
2021-09-21 20:36:07 +00:00
Alan Viverette
bcbfc5f53c Patch "Add support for --optional-uses-libs to pom2bp" to match master
Cherry pick that was originally submitted was not up-to-date.

Change-Id: Ia599ea294926666cddfd84f8c2a3e22e7e7c0434
2021-09-13 19:28:35 +00:00
Alan Viverette
24658d07f8 Add support for --optional-uses-libs to pom2bp
Fixes: 198303986
Test: ./update_prebuilts.py -x <build-id>
Change-Id: I4eb322e905f636eb18d1940f05682f38e448a344
2021-08-31 20:30:41 +00:00
Anton Hansson
ebfbad2969 Revert^2 "Set min_sdk_version for java imports in pom2bp"
f99ba27101

Change-Id: Ic88670182029ace2e6dcdcae2713cb48bb0f59cd
2021-04-06 19:21:34 +00:00
Jack He
f99ba27101 Revert "Set min_sdk_version for java imports in pom2bp"
Revert "Give pom2bp -default-min-sdk-version 24 param"

Revert submission 1662079-axd

Bug: 184656328
Reason for revert: Break build
Reverted Changes:
I2f4dc7585:Update androidx min_sdk_version in allowed_deps
I5cb8c736d:Give pom2bp -default-min-sdk-version 24 param
I3b029315a:Set min_sdk_version for java imports in pom2bp

Change-Id: Ic97cbd1714f6113188ad4647ce71105f9641fad7
2021-04-06 18:52:50 +00:00
Anton Hansson
5d8652fcaf Set min_sdk_version for java imports in pom2bp
Previously min_sdk_version was only set for *_library build rules, and
not for *_import targets. This made min_sdk_version default to
sdk_version, which is usually "current", which is not correct for these
libraries.

Test: pom2bp -default-min_sdk_version 24 for androidx
Change-Id: I3b029315abeb559e66efad847ae664efb79f4509
2021-04-01 11:49:35 +00:00
Anton Hansson
c29f076768 Add pom2bp param for default min_sdk_version
Previously 24 was hardcoded (for somewhat unclear reasons). Update
the tool to accept specifying the correct value on the cmdline.

Test: pom2bp -default-min-sdk-version 24
Change-Id: I39c23dd4bca91684a2a68d7b963cf3cb66eb1f33
2021-03-29 16:45:52 +01:00
Jooyung Han
43d3025cd5 pom2bp: add apex_available/min_sdk_version
apex_available/min_sdk_version are required to be available for mainline
modules(APK/APEX).

- java_import/java_library_static
- android_library/android_library_import

Bug: 156996905
Test: prebuilts/sdk/update_prebuilts.sh
Change-Id: I201ebabaa533c5ee19e394ab30ca2fa0e3d7ce0e
2020-05-27 00:37:45 +09:00
Tony Mak
817850063b Allow other module types in androidx
1. Update pom2bp to support "host_support" device module.
2. Allow other module type in support library

(The intention is to support the room annotation processor)

Test: m

Bug: 137918883

Change-Id: I9a8fbcff903cc395d5dc38430774202ce389d6bc
Merged-In: I9a8fbcff903cc395d5dc38430774202ce389d6bc
(cherry picked from commit bd7c2f9a1d)
2019-07-22 13:18:48 -07:00
Dan Willemsen
52c90d868e pom2bp: Implement -static-deps to match pom2mk
This changes the default behavior of pom2bp to match pom2mk, and not
require pre-extraction of all of the manifests.

Test: convert an internal pom2mk user to pom2bp
Change-Id: I08120cce1f923ef28519563ffd772032b2e500ed
2019-04-21 21:46:42 -07:00
Dan Willemsen
7fdab6eeec Add -jetifier to pom2mk and pom2bp
Test: use pom2mk -jetifier to replace some hand-modified makefiles
Change-Id: I2a1988d0120fee1edf2d85c8b3294041840efe7c
2019-04-20 21:47:14 -07:00
Paul Duffin
babaf07b13 Rename -extra-deps to --extra-static-libs and add --extra-libs
Allow callers of pom2bp to add dependencies on runtime libraries as
well as static libraries. Renames -extra-deps to --extra-static-libs
to make it clearer what it does.

Bug: 130287656
Test: prebuilts/sdk/update_prebuilts.py --stx 5280039
      prebuilts/misc/common/androidx-test/update-from-gmaven.py

Change-Id: I8a3ee8056aa4ed9935a4f47d563ec423672cf38b
2019-04-16 11:55:48 +01:00
Colin Cross
1aa7f26a22 pom2bp: add jar deps to -nodeps modules
The dependency type in the pom file is not always accurate, just
add all jar and aar dependencies to both the -nodeps and final
module.

Test: cd prebuilts/sdk/current/androidx && pom2bp -regen Android.bp && mma
Change-Id: I1784b8ebf3485db19405cb353c9bb5fb3ae837d8
2019-04-10 18:31:55 +00:00
Colin Cross
0b9f31fb08 Replace *Escape with *EscapeList
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings.  Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.

Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
2019-03-04 18:11:53 +00:00
Colin Cross
632987ac21 pom2bp: clean up templates
Move some of the more complicated conditional logic out to helper
functions.  Use the {{- }} syntax to strip previous whitespace to
allow spacing out the remaning conditionals in the templates.

Test: (cd prebuilts/sdk/current/androidx && pom2bp -regen Android.bp)
Change-Id: I766bd0e1837aa04375f322fbe796d923cd99ecde
2018-08-30 11:18:50 -07:00
Colin Cross
8a9900a75f pom2bp: use java_import_host for host modules
java_library_host modules shouldn't depend on java_import modules.

Bug: 112707915
Test: (cd prebuilts/sdk/current/androidx && pom2bp -regen Android.bp)
Change-Id: Ia5ac353a696c9f51f1b50b334a327937ddcb47e7
2018-08-29 15:37:19 -07:00
Colin Cross
86bc9d4622 gofmt -w .
Test: m checkbuild
Change-Id: Ia4aec5ddadf1f1b00f7c567522ca89fd839504f0
2018-08-29 15:37:15 -07:00
Jeff Gaston
d492853a52 pom2bp support to specify which modules are host modules
Bug: 112804807
Test: cd prebuilts/sdk/current/support && pom2bp -regen Android.bp
Change-Id: Ib816db8274cb05c9d0ed2cb557799ddcf6ee74fd
2018-08-24 14:32:50 -04:00
Colin Cross
fe5a3b7fac Fix lint errors caught by go test
Test: m checkbuild
Change-Id: I5b8522aa9da22fc595e4f26c23e7836de59bdfa2
2018-07-16 15:24:43 -07:00
Colin Cross
461ba49a0a pom2bp: move misplaced {{end}}
manifest property should only be added to aar imports and not jar
imports.

Bug: 110848854
Test: cd prebuilts/sdk/current/support && pom2bp -regen Android.bp
Change-Id: Ifaab81582c87f0af4419f90c3928d0d5d52cec33
2018-07-10 13:46:58 -07:00
Colin Cross
cf53e608a7 pom2bp: extract minSdkVersion from manifest into Android.bp
When manifest merging in Soong is turned on the modules created
by pom2bp will need to have min_sdk_version specified in order
to prevent manifest_fixer from setting it to the current SDK
level.  Read the minSdkVersion attribute out of the
AndroidManifest.xml file inside each .aar file.

Bug: 110848854
Test: cd prebuilts/sdk/current/support && pom2bp -regen Android.bp
Change-Id: Ieaf37ba6eccaf32dc5d3411566335830b1a327ff
2018-07-09 13:10:35 -07:00
Colin Cross
70dd38f09e Add pom2bp
Convert pom2mk to pom2bp that writes out Android.bp files instead
of Android.mk files.  pom2mk stays for now until the last users
of it are cleaned up.

Bug: 78300023
Test: cd prebuilts/sdk/current/support && pom2bp -regen Android.mk
Change-Id: I584d63c4228bad32f9e1914b06bde807078d6a55
2018-04-24 13:37:38 -07:00