aboutsummaryrefslogtreecommitdiffstats
path: root/java/app.go
Commit message (Collapse)AuthorAgeFilesLines
* Dedup registration code for module types and singletonsPaul Duffin2019-12-191-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The registration of module types and singletons is duplicated between init() functions that register them for use in the build runtime and test context creation code that registers them for testing. This is a proof of concept for a mechanism that will allow the code to be shared. It defines a RegistrationContext interface that is implemented by both the TestContext and the new initRegistrationContext type. An instance of the the latter is available through the InitRegistrationContext variable. The intent is that the registration of the module types and singleton types will be extracted from the init() function into a separate function that takes a RegistrationContext parameter. That method is called from init() passing in the InitRegistrationContext and from a test passing in the TestContext. Something like this: func init() { RegisterBuildComponents(android.InitRegistrationContext) } func RegisterBuildComponents(ctx android.RegistrationContext) { ctx.RegisterModuleType(....) .... } A test would do something like this: ctx := android.NewTestContext() RegisterBuildComponents(ctx) Test: m nothing Change-Id: I97173cabb6d6cf7ce98fdb5f73418438b1997b35
* Reland "Also package recursive jni_libs deps of android_apps as well as ↵Peter Collingbourne2019-12-171-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | direct deps." with bug fix. This time, exclude NDK libraries instead of LLNDK libraries from the package. This is necessary because there are libraries such as libvndksupport which are LLNDK but are not accessible to apps. Original commit message: > Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true > (e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their > recursive library dependencies, including for example libc++ when depending > on the platform libc++. This means unnecessary churn when we add a new > dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow > jni_libs clauses to be simplified, make the build system search for the > recursive dependencies and automatically include them. > > This change allows us to remove code that was previously adding NDK libc++ > as a special case, as it is now covered by the generic code. > > Also fix some improper quoting that was exposed as a result of this change > causing more files to be packaged than before. > > [1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22 Bug: 144430859 Test: atest CtsAppOpsTestCases Test: atest FrameworksNetSmokeTests Change-Id: I8311ede0b44d7e50b9f272912ead8ef07e82b074
* Merge "Revert "Also package recursive jni_libs deps of android_apps as well ↵Joseph Murphy2019-12-181-26/+16
|\ | | | | | | as direct deps.""
| * Revert "Also package recursive jni_libs deps of android_apps as well as ↵Lorenzo Colitti2019-12-181-26/+16
| | | | | | | | | | | | | | | | | | | | | | direct deps." This reverts commit 6f907ad3ddad9eb0e928ff7ad7965fa17a8a6946. Reason for revert: Broke FrameworksNetSmokeTests Bug: 146456945 Change-Id: Ibef7bb80c532e70cfcfb974f51a99ed25437a343
* | Declare manifest as input to test config fixer.Jaewoong Jung2019-12-171-1/+1
|/ | | | | | | | It needs to be an implicit input for it to work consistently. Test: m GooglePermissionControllerUnitTests Bug: 145011263 Change-Id: Ib71d768e750faa5b577652e79a18d05929bde52f
* Also package recursive jni_libs deps of android_apps as well as direct deps.Peter Collingbourne2019-12-161-16/+26
| | | | | | | | | | | | | | | | | | | | | Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true (e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their recursive library dependencies, including for example libc++ when depending on the platform libc++. This means unnecessary churn when we add a new dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow jni_libs clauses to be simplified, make the build system search for the recursive dependencies and automatically include them. This change allows us to remove code that was previously adding NDK libc++ as a special case, as it is now covered by the generic code. Also fix some improper quoting that was exposed as a result of this change causing more files to be packaged than before. [1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22 Bug: 144430859 Change-Id: I3d6fbcce75bc108a982eb7483992a4b202056339
* Merge "Optionally overwrite package value in test config."Jaewoong Jung2019-12-161-0/+11
|\
| * Optionally overwrite package value in test config.Jaewoong Jung2019-12-051-0/+11
| | | | | | | | | | | | | | | | | | If package_name is set for an android_test module, package names in its AndroidTest.xml config need to be updated too. Test: test_config_fixer_test.py Fixes: 145011263 Change-Id: I52f17ef1d1902364b9bcfec4f6e246bd655dbf09
* | Fix incorrect install path for priv-app prebuiltKyeongkab.Nam2019-11-221-1/+7
|/ | | | | | | | | | | | | Dexpreopted files for privleged app prebuilt(android_app_import) are installed wrongly to /system/app. To fix this issue, install path is changed to /system/priv-app in the case that "privileged" flag is true. Bug: 144945646 Test: build and check dexpreopted files of privileged app are installed to /system/priv-app Change-Id: Iec140119f58179a3eb0feeff7af2699fcc855fe7
* Fix test app and helper installation dirs.Jaewoong Jung2019-11-211-1/+5
| | | | | | Fixes: 143902486 Test: app_test.go + m CtsIsolatedSplitApp Change-Id: I3e1b8bf14cb9f440a6d8b0d2ac65525f00470cb8
* Add override_android_test.Jaewoong Jung2019-11-151-2/+36
| | | | | | | | | | This change also adds instrumentation_target_package to android_test, so that the target package name in a test manifest can be easily overridden. Fixes: 134624457 Test: app_test.go Change-Id: Ib8dd703da0038ac76210c92d79e133e37c718122
* Install AndroidApp only when neededJiyong Park2019-11-141-3/+5
| | | | | | | | | | | | | | When an android_app is (directly or transitively) included in an APEX, multiple variants of the app is created. The problem was that all the variants were unconditionally installed to the device, which resulted in duplicated targets. Fixing the problem by not installing the app when it is included in APEX. Bug: 144387414 Bug: 144135069 Test: m Test: OUT_DIR=out DIST_DIR=out/dist build/soong/scripts/build-ndk-prebuilts.sh Change-Id: Ibcc1096e30bc55a70ddc592490805f447e185eae
* Reland: JNI lib is always embedded for APKs in APEXJiyong Park2019-11-141-4/+7
| | | | | | | | | | | If a JNI lib is depended on by an APK that is included in an APEX, the lib is embedded inside the APK. This change also fixes a bug that APKs are not mutated for APEXes. Bug: 144135069 Test: m (apex_test.go amended) Change-Id: I21ac24412b30c05afc03385655c6b196130dffe3
* Merge "Revert submission"Sam Saccone2019-11-131-7/+4
|\
| * Revert submissionSam Saccone2019-11-131-7/+4
| | | | | | | | | | | | Reason for revert: b/144387414 Fixes: b/144387414 Change-Id: I21e15a4d149a5a8fefd0f84010600cb41b59db95
* | Merge "JNI lib is always embedded for APKs in APEX"Treehugger Robot2019-11-131-4/+7
|\|
| * JNI lib is always embedded for APKs in APEXJiyong Park2019-11-111-4/+7
| | | | | | | | | | | | | | | | | | | | | | If a JNI lib is depended on by an APK that is included in an APEX, the lib is embedded inside the APK. This change also fixes a bug that APKs are not mutated for APEXes. Bug: 144135069 Test: m (apex_test.go amended) Change-Id: Icf490d2701a7ede8bcad7e671fc72be9c8d7c01e
* | Merge "Enforce hidden apis usage in product(soong)"Treehugger Robot2019-11-111-0/+1
|\ \ | |/ |/|
| * Enforce hidden apis usage in product(soong)Jeongik Cha2019-11-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Only if PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is set, every app and java library in product cannot use hidden APIs anymore. checkSdkVersion() checks if sdk_version of app and library is narrow enough, checkLinkType() checks every library that app links agianst Bug: 132780927 Test: m Test: set PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE, and check whether build error occurs. Change-Id: Ic630503b875040f730feda4fef826ed6d71da111
* | Merge "Install signed split apks."Jaewoong Jung2019-11-081-6/+5
|\ \
| * | Install signed split apks.Jaewoong Jung2019-11-071-6/+5
| |/ | | | | | | | | | | | | | | | | | | This fixes a bug where unsigned split apks were installed instead of their signed counterparts. Fixes: 140795853 Test: app_test.go Test: m Split && apksigner verify --print-certs Change-Id: I12cdbcaff9932b6388f920d7e03301d687c3bfdb
* / Call shouldEmbedJnis only when needed.Jaewoong Jung2019-11-051-2/+1
|/ | | | | Test: app_test.go Change-Id: I4351b0ba5e1e7c89f16b4c891fcfbabb5c90c8c8
* Add support for including app prebuilts in APEX.Dario Freni2019-10-281-0/+4
| | | | | | | Bug: 138429615 Test: Created an APEX containing CtsShimPrebuilt and CtsShimPrivPrebuilt. Change-Id: I9d138ccfc03e4b96c9989d2681ad4e4ad5f20108
* Merge "Support privleged app in APEX"Treehugger Robot2019-10-181-4/+12
|\
| * Support privleged app in APEXJiyong Park2019-10-171-4/+12
| | | | | | | | | | | | | | privileged apps are installed to priv-app dir in APEX Test: m Change-Id: I8141e1c20e9486655606fa43b949783f11da09f4
* | Add method to determine variations from a TargetColin Cross2019-10-161-4/+2
|/ | | | | | | | | | The arch variants are hardcoded in every module type. Refactor them out into a Target.Variations() method in preparation for splitting the arch mutator into two, which will require using different variations. Test: m checkbuild Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
* Separate InstallPath from OutputPathColin Cross2019-10-031-2/+2
| | | | | | | | | | | | | | | | | | | Create a new type InstallPath that is similar to OutputPath to differentiate intermediates output paths from installed output paths. RelPathString is a poorly defined, undocumented function that is primarily used to get an install path relative to out/soong to generate an equivalent install path for Make relative to $(OUT_DIR). Move it to InstallPath for now, and fix the one remaining user on OutputPath. Add a method to create an NDK install path so that ndk_sysroot.go doesn't have to do it manually with PathForOutput. Bug: 141877526 Test: m checkbuild Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
* Fix split apk paths.Jaewoong Jung2019-09-271-0/+3
| | | | | | | | | | | | | Soong has been outputting incorrect Android.mk entries for split apks. soong_app_prebuilt.mk expects LOCAL_SOONG_BUILT_INSTALLED to contain a list of <split apk path>:<on device install path> pairs whereas Soong outputs <split apk path>:$(LOCAL_MODULE_PATH)/<split apk filename> pairs. This also adds a missing underscore in split apk filenames. Test: m Split Bug: 140795853 Change-Id: I3d6506f5e12106174fbbaef34749a272b5e1b90c
* Fix android_test install path.Jaewoong Jung2019-09-271-10/+16
| | | | | | Test: m nothing + diff soong mk and ninja files. Bug: 140795853 Change-Id: I3667eac951dea7e447cf73219ff89199fca9ed63
* Allow test to specify whether or not to auto-generate test configDan Shi2019-09-261-1/+7
| | | | | | | | | | | | | | | | | Attribute `auto_gen_config` is added to test modules. Test config will be generated if: the attribute is not set and AndroidTest.xml doesn't exists or the attribute is set to true, whether or not AndroidTest.xml exists. Test config will NOT be auto-generated if: the attribute is not set and AndroidTest.xml exists or the attribute is set to false, whether or not AndroidTest.xml exists. Bug: 141684102 Test: build test module with auto_gen_config set to true Change-Id: I64fb003a83d8c32a967835e5f8d12fe4476043be
* Support including apk inside an apexSundong Ahn2019-09-041-0/+4
| | | | | | | | | | | New property "apps" is added to APEX soong module. This property configure a list of APKs to package inside APEX payload. For each android_app module package it's APK into /app/$(android_app module Name) directory. Bug: 139906763 Test: m -j Change-Id: Ic6655f211951af08097c76e157a07ebc52425718
* Prepare to be able to put framework-res in srcsJiyong Park2019-08-291-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces two changes required to put framework-res explicitly in srcs property, without relying on the build system to specially add framework-res as a dependency to framework-minus-apex, etc. 1) R.java and Manifest.java generated from aapt were packaged to the file R.jar directly under the gen directory. With this change, the file becomes android/R.srcjar under the gen directory. 2) android_app module now overrides OutputFileProducer interface so that it can recognize "{.aapt.srcjar}" tag to reference the generated srcjar file. Being able to put framework-res in srcs allows us to pass all the source files (both in the source tree and the ones generates) via a filegroup. Previously, the source files could only be passed via the java_library module type. This caused a circular dependency problem when the java library was used as an input (src_libs) of the droiddoc module. Using filegroup eliminates the circular dependency. Bug: 70046217 Test: m Merged-In: I9ab6116bcc6fa3da60933d427575463b05ae69b4 (cherry picked from commit 94f37f33ed9dc5c7ad6ff901f5aa613970513ead) Change-Id: I9ab6116bcc6fa3da60933d427575463b05ae69b4
* Implement android_test_importJaewoong Jung2019-08-281-0/+38
| | | | | | Test: app_test.go, prebuilt CTS tests Fixes: 132371143 Change-Id: Ife12ba691dfa597dde90faf0957224a6f444e139
* Add default_dev_cert to android_app_importJaewoong Jung2019-08-231-7/+20
| | | | | | | Test: app_test.go Bug: 122333215 Bug: 128610294 Change-Id: I4be98a57ffec0885258ed7d7bb2badc8b2798750
* Add arch variant support to android_app_import.Jaewoong Jung2019-08-151-30/+51
| | | | | | | Bug: 128610294 Fixes: 138792623 Test: app_test.go Change-Id: I47c80ec283ce58a0ce9b7d0af40844bd73e9d3f1
* Merge "Add filename property to android_app_import"Jaewoong Jung2019-08-151-1/+7
|\
| * Add filename property to android_app_importJaewoong Jung2019-07-171-1/+7
| | | | | | | | | | | | Test: app_test.go Bug: 137218697 Change-Id: If2b20a355bb6e9e8dbcd57347c0e2c6fa041a932
* | Add a rule about platform_apisJeongik Cha2019-07-291-4/+8
| | | | | | | | | | | | | | | | | | | | | | As sdk_check.mk checks, soong starts to check every app. If sdk_version is empty, platform_apis must be true. If sdk_version is not empty, platform_apis must be false. Test: soong test Test: m Bug: 132780927 Change-Id: I7ba702d616404d155f8ac40cd008828663ad1488
* | Add RuleBuilder helper functions for built and prebuilt toolsColin Cross2019-07-111-3/+3
|/ | | | | | | | | | | | Replace the common pattern of: cmd.Tool(ctx.Config().HostToolPath(ctx, "tool")) with: cmd.BuiltTool("tool") And similarly for PrebuiltBuildTool. Test: m checkbuild Change-Id: I7d63188505362c7df6a3b3e7330b4a2cca5a2409
* Merge "Improve android_app_import.dpi_variants handling."Jaewoong Jung2019-07-101-70/+77
|\
| * Improve android_app_import.dpi_variants handling.Jaewoong Jung2019-07-091-70/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of circumventing the limitation of Prebuilt implementation by picking a source path itself, it now uses the same mechanism as archMutator and replaces the source path in advance so that Prebuilt always sees the corrent source path. Because this requires the Apk field to be a string pointer, the single source prebuilt implementation is being updated to be reflection-based. Test: Soong unit tests, m soong_docs, TreeHugger Change-Id: I2304f15e32d632f74f95f0d9e9bf1f75ff3e2225
* | Dist NOTICE outputs for app targets.Jaewoong Jung2019-07-081-9/+9
|/ | | | | | Bug: 136501164 Test: m NetworkStack, TreeHugger Change-Id: I2279eeb0e50b1b5685e23130a8da6ab090f37f56
* Uncompress dex in unbundled privileged appsColin Cross2019-06-251-5/+6
| | | | | | | | | | Mainline builds privileged apps unbundled and then uses them as prebuilts, so they need to respect the privileged flag when deciding whether or not to uncompress the dex. Bug: 135772877 Test: TestUncompressDex Change-Id: I91da7116b779ae35c0617ef77dbcb9788902370c
* Optionally embed NOTICE files in apks.Jaewoong Jung2019-06-241-10/+65
| | | | | | | | | | | If embed_notices or ALWAYS_EMBED_NOTICES is set, collect NOTICE files from all dependencies of the android_app, merge them with the app's own one (if exists), transform it to HTML, gzip it, and put it as an asset in the final APK output. Bug: 135460391 Test: app_test.go Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
* Make sdkDep/decodeSdkDep the source of truth about the sdkPaul Duffin2019-06-131-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, different parts of the build used different sources of information about the SDK (i.e. the default libraries) against which a Java module aimed at the device was built. Some used the sdk_version property, others used the no_standard_libs or no_framework_libs, some used a combination of all three. That lead to inconsistent handling in the code, e.g. some parts treated no_standard_libs: true as implying no_framework_libs: true and others did not, and also in the build files, e.g. some modules specified no_framework_libs: true and sdk_version: "system_current" which makes no sense, or no_standard_libs: true and sdk_version: "core_current" which are inconsistent. This is the first step in a refactoring to simplify the sdk selection process by replacing the no_standard_libs/no_framework_libs properties with some extra options for the sdk_version property. This change consists of: 1) Extra functions sdkContext to access the no_standard_libs and no_framework_libs properties. 2) Extra field/functions in sdkDep to store and access the value of no_standard_libs/no_framework_libs. 3) Changes to decodeSdkDep(...) to pass the values of the no_... properties through to the returned sdkDep. 4) Change all code that accesses the no_... properties directly to call decodeSdkDep(...) to get an sdkDep object and then accessing the values of the no_... properties from there. The accessor functions on sdkDep are called has...() rather than no...() as most callers of the methods invert the value anyway and !no...() is harder to reason about than has...(). The hasFrameworkLibs() function returns true if and only if no_standard_libs and no_framework_libs are false. That is consistent with all but one usage of the no_framework_libs property and that is not affected by it. Bug: 134566750 Test: m droid Change-Id: I196e3304e8bd802fb154e897397b0dd337f868e2 Exempt-From-Owner-Approval: Colin has already given +2 modulo some minor nits and this blocking other changes.
* Don't add dependencies on uses-library modules in unbundled buildsColin Cross2019-06-121-10/+12
| | | | | | | | Unbundled builds may not have definitions of shared libraries, and they are not dexpreopted so the dependencies are not used anyways. Test: manual Change-Id: I89ad92f3b073422734f824ac3a8a3b9baf995ccb
* Consolidate baseContext, BaseContext, and BaseModuleContextColin Cross2019-06-061-1/+1
| | | | | | | | | | | blueprint.BaseModuleContext is the set of methods available to all module-specific calls (GenerateBuildActions or mutators). The android package split the same functionality across baseContext (nee androidBaseContext), BaseModuleContext, and BaseContext. Consolidate all of them into android.BaseModuleContext. Test: m checkbuild Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
* Merge "Touch up manifest if there's no source code."Jaewoong Jung2019-06-061-0/+3
|\
| * Touch up manifest if there's no source code.Jaewoong Jung2019-06-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | The new package manager behavior requires packages without source code to have an application element with hasCode attribute set to false in their manifest. With this change, Soong can now automatically insert one for codeless apps. Test: app_test.go, manifest_fixer_test.py Fixes: 124375490 Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
* | android_app stl property bug fixJaewoong Jung2019-06-041-1/+1
|/ | | | | | | | | When it is set to c++_shared, the added dependency should be libc++_shared, not libc++. Fixes: 130891985 Test: app_test.go, atest 'CtsNdkBinderTestCases' w/ conversion CL Change-Id: I0e50e0d5bf511aa6e52d16cd715a185721011255