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
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
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
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
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
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 94f37f33ed)
Change-Id: I9ab6116bcc6fa3da60933d427575463b05ae69b4
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
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
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
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
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
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.
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
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
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
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
Ports 09f3b97f4b488cd3a7b7d72038b173575b02c162 (Add support for
preopt with uses-libraries) from Make to Soong to support verifying
and preopting shared libraries.
This reapplies Id25f55f07a55120bebe2a9b32c094209efc85c8b with fixes
for unbundled builds and builds with ALLOW_MISSING_DEPENDENCIES=true
set.
Bug: 132357300
Test: app_test.go
Test: m checkbuild
Change-Id: I964309a68ec4ed081f3f3154879c71048ecb5455
Ports 09f3b97f4b488cd3a7b7d72038b173575b02c162 (Add support for
preopt with uses-libraries) from Make to Soong to support verifying
and preopting shared libraries.
Bug: 132357300
Test: app_test.go
Test: m checkbuild
Change-Id: Id25f55f07a55120bebe2a9b32c094209efc85c8b
The flag is a Soong version of LOCAL_NDK_STL_VARIANT in apps and app
tests. Unlike in the case of cc_library and its siblings, the only
meaningful value for the make var when it's used in apps is
'c++_shared', in which case we add additional dependency to libc++.
Fixes: 130891985
Test: app_test.go + CtsNdkBinderTestCases
Change-Id: I83f45d375742164fff7f160a734b0686e56b5c38
This change fixes an issue where an android_test could not depened on an
override_android_app or an android_app overridden by one by moving all
override processing to post-deps and forwarding incoming dependencies on
override_android_apps to base android_app modules
Fixes: 132447700
Test: app_test.go
Change-Id: I4ac593be661f541f5ea9823ef97373bee4b186f9
This implements the uncompress-dexs macro's behavior in Soong.
Test: Converted TvSampleLeanbackLauncher + zipinfo
Change-Id: I9477aa21429d055f3f36ca90c7fd2c345c999029
`use_embedded_native_libs: true` should cause
`--extract-native-libs=false` be added to the manifest_fixer invocation,
and it was not happening.
There are also minor naming improvements.
Bug: 117618214
Test: treehugger and 'atest CtsDynamicLinkerTestCases' after
cts/tests/tests/dynamic_linker has been converted to Android.bp.
Change-Id: I93ec2aed3f3b185d320e56b1b4eebb71339b81ee
This is an initial version that handles the most basic cases.
Bug: 128610294
Test: app_test.go + prebuilt webview.apk
Change-Id: Ic525559aad5612987e50aa75b326b77b23acb716
Some module types (`android_test`, etc.) set `optimize.enabled` by
default. If such module happens to have `defaults` attribute which
clears `optimize.enabled`, the latter value is ignored.
Fixes: 129858282
Test: unit tests in java_test.go,
`atest CtsExtendedMockingTestCases` succeeds with aog/936802
reverted (that is, with cts/test/mocking converted to Android.bp)
Change-Id: Ib8e3a0ab0bd489d70ed07f626082aeae31c45e7c
android_test modules should always have native libraries packaged
into the APK even when use_embedded_native_libs: false is set.
Fixes: 129298278
Test: TestJNIPackaging
Change-Id: Idfcc630f7c6579c1280a920b5d71808b0a502e06
This enables users to override the package name of their apps either
directly in android_app or through override_android_app.
Bug: 122957760
Test: app_test.go
Change-Id: I98080a4076ce970fc85e58fc33495ba9b363eec9
This is a new implementation of overriding module types that makes use
of local variants. With this, product owners can use PRODUCT_PACKAGES to
decide which override module to include in their products.
Bug: 122957760
Bug: 123640028
Test: app_test.go
Change-Id: Ie65e97f615d006b6e9475193b6017ea9d97e8e97
Move the logic from ctx.ExpandSources into android.PathsForModuleSrc
and ctx.ExpandSource into android.PathForModuleSrc, and deprecate
them. When combined with the pathDepsMutator this will let all
properties that take source paths also take filegroups or genrule
outputs, as long as they are tagged with `android:"path"`.
Test: All soong tests
Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
Pass the package_splits list from the property to aapt2 as
--split arguments, sign the extra outputs, install them, and
add them as extra output files for SourceFileProducer.
Bug: 127921149
Test: TestAppSplits
Change-Id: Id94a53ae6a8a68ec81e98abba2fefc9c23feaa7a
Add `android:"path"` to all properties that take paths to source
files, and remove the calls to ExtractSource(s)Deps, the
pathsDepsMutator will add the necessary SourceDepTag dependency.
Test: All soong tests
Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
This change adds an aapt2 flag, rename-instrumentation-target-package,
when an android test's instrumention target module's manifest package
name is overridden.
Bug: 122957760
Test: app_test.go, atest DocumentsUITests
Change-Id: I7116a51ec5ec9d61a20cd28509b3af0e383730d7
This reverts commit aa65e17016.
Reason for revert: Not compatible with PRODUCT_PACKAGES, and so has very limited use.
Change-Id: Ib141d3984a6f12bb50989e66037494c466b066f1
This new module type replaces the inherit-package function in make by
allowing developers to override the name, the certificate, and the
manifest package name of an android_app module.
Bug: 122957760
Fixes: 123640028
Test: app_test.go + BrowserGoogle
Change-Id: Iefe447e7078b25039233221361ef95c83a29973a
Current soong use source code's under cts as the rule for judgement.
Should change to use test_suites define instead.
Bug: 124313692
Test: m hello_world_test, make sure test config be auog-enerated.
Modified platform_testing/tests/example/native/Android.bp
m hello_world_test, make sure test config not be auto-generatetd.
Change-Id: I1bc5216f73329d2a82d9ff29ccbede436dd2976c
The Platform_apis field in CompilerDeviceProperties currently has no
effect. Unify the behaviour with make and run manifest_fixer.py to
encode the information in the manifest. This is used to exempt
bundled apps and platform tests from hidden API access checks without
having a fixed whitelist of packages.
Bug: 113315999
Bug: 124671117
Test: m UbSystemUiJankTests && \
aapt d xmltree \
target/product/taimen/data/app/UbSystemUiJankTests/UbSystemUiJankTests.apk \
AndroidManifest.xml | grep usesNonSdkApi
Change-Id: I20c392d91ee6275ef8139fbeb5b9700385abbc80
Add some overview of the java module types so that we have something
to display in the autogenerated docs.
Bug: 67909957
Test: m soong_docs
Change-Id: I3594dd550f8272f4418f3ea12cded4083674809b
This reverts commit 67e8ec1973.
Test: build && atest android.text.cts.EmojiTest#testEmojiGlyphWebView on Cuttlefish
Exempt-From-Owner-Approval: Got +2 from Colin, latest PS is a rebase across conflicts.
Change-Id: I99faf0f2ec698d70c107516bd43756b9ddcb90d0
When use_embedded_dex is set, store the dex uncompressed in the
APK and set the android:useEmbeddedDex="true" attribute in the
manifest.
Test: m checkbuild
Change-Id: Iea6e7ed19599830ac72392ef93f9c98957df1cce
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.
Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
RRO dirs from static android_library dependencies should be
included in the final module.
Bug: 123510624
Test: TestEnforceRRO
Change-Id: I28c45e139b187894a4ebc43d573eab5ea1be9861
Add an empty DepsMutator to ModuleBase so it doesn't have to be
implemented on every module that doesn't need it.
Test: all soong tests
Change-Id: I545a832a0dbf27386d3080377a75ea482cd9ce59
Currently only java/app.go is affected by package name overrides. When
the var is used, the corresponding module's install APK name is changed
to the overriding name.
Bug: 122957760
Test: app_test.go + TreeHugger
Change-Id: Ie522da3d7280970d740d779cf2694560feae6180
The function became a gigantic machine, so I decided to split it up to
smaller, logically self-contained pieces to provide better readability.
Test: app.go + TreeHugger
Change-Id: I50e5767ed779078b2d8c60c39c3951b0b5a191d7
Currently it is only for android_app, though it can be easily ported to
apex.
The make-side change will be made later, along with a real application.
Bug: 122957760
Test: app_test.go
Change-Id: I41f0be84f8b9f93e9518a16160e10eaa649388cd
Use foo.apk instead of package.apk for the intermediate package for
a module named foo.
Fixes: 122996822
Test: m checkbuild
Change-Id: I38058a54038e1c2eeaefc0f0e7f450a74a3e96a7
Only if enforcement option is enable, it makes build error when there is apk located at system partition but signed with system certificate.
Bug: 74699609
Test: m -j
Change-Id: I23c41f2665dd97abac3e77d1c82d81ff91b894eb
It is a list of <module_name>:<manifest_name> pairs. When the module
name of an APK or an APEX matches with <module_name>, then its app
manifest name is overridden to <manifest_name>.
<module_name> and <manifest_name> can be patterns as in
com.android.%:com.mycompany.android.%.release
Note that, in case of APEXes, the manifest name refers to the name of
the zip container. The apex manifest name (which is specified in
apex_manifest.json) is not overridden.
Test: m with PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES for
1) an APK in Android.mk
2) an APK in ANdroid.bp
3) an APEX
and check that manifest names are modified as specified
Change-Id: Ie58882d90884695e893944c43d9c8803b283e93d
shouldUncompressDex has already been computed and stored in
deviceProperties.UncompressDex, pass it to dexpreopter instead
of recomputing it.
Also add a stub for java libraries to set UncompressDex.
Test: no change to build.ninja
Change-Id: I663d9fbbe768a8dc9a97c7d456dd7a010f43162d
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
Create a bundle module in addition to creating an APK, which can
then optionally be merged with bundle modules from builds for
other architectures and then be passed to bundletool to create an
app bundle.
Bug: 117295826
Test: tapas RecoveryLocalizer && m dist
Change-Id: I98a17d7407dc56823ece9ec88c087780185a6555
The entire APEX (which is a zip file) is signed with the apk signer.
Certificate can be specified via the 'certificate' property just like
ordinary apps. Note: multiple additional certificates are not supported.
Bug: 115721587
Test: m apex.test
Test: jarsigner -verify -verbose -certs .../apex.test.apex shows the
certificate info
Change-Id: Ia4c898d3427779a3809fdc683b85d7661ca65137
APKs that are preopted to system_other should not be stripped.
For now, don't strip any APKs.
Bug: 118592830
Test: m PrintSpooler; zipinfo $OUT/system/app/PrintSpooler.apk | grep classes.dex
Change-Id: Ife8a5fe4ff90e5e00ec24f43e089d9b3aa552fc0
Privileged APKs need to store their dex files uncompressed so they
can be verified and mapped directly out of the APK.
Also track whether the module will be dexpreopted or not in order
to determine if the dex file should be stripped before signing.
Test: SystemUI.apk contains an uncompressed dex file
Change-Id: I4dca86c7f8778595882405b34adcf2a7bae03c67
The value from instrumentation_for should not go to
aapt2 link --rename-instrumentation-target-package, that should
be the equivalent of LOCAL_MANIFEST_INSTRUMENTATION_FOR. That
property is never used in Make, so it is left unimplemented in
Soong.
Add the module listed in instrumentation_for as a shared library
for javac, but don't import its resources.
Bug: 117804211
Test: m checkbuild
Change-Id: I7f035dc0ecb964a3ca391ae1ca2b87cb0f6a7cec
Add a module that can build an APK that will be used by a test.
The APK will be sideloadable, and can be added to a test suite,
but will not autogenerate a test config file.
Test: m checkbuild
Change-Id: Idf325b1c9a2cbcd16b126da3331671e4aed4b3da
Some android_app modules need certificates located outside their
directory. Instead of requiring paths from the root of the tree,
add an android_app_certificate module that exports the certificate
files.
Test: m checkbuild
Change-Id: Icbf3898894f3eb857e2d907e3e58dd072c6fabe9
Make android_app modules a MultiTargets module, which means the
common variant will have a list of Targets that it needs to handle.
Collect JNI libraries for each Target, and package them into or
alongside the APK.
Bug: 80095087
Test: app_test.go
Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
prefer32 needs to be set differently for app and native modules.
Make it use lambda provided by the module type instead of trying
to make archMutator figure it out.
Test: m checkbuild
Change-Id: Ibf8af35fdd3e1721725539d1f5452f4439d2125c
* Allow module owner to specify a test_config_template in Android.bp
* The rule goes:
1. When "test_config" is set, Soong uses specified test config
2. If 1 is not true, check if "AndroidTest.xml" exist in the
directory, if so, use "AndroidTest.xml
3. If 1 and 2 are not true, check if "test_config_template" is set.
If so, use module specific template to generate test config
4. Otherwise, use Soong default template for test config for autogen
Bug: 113359343
Test: make
Change-Id: I9fb4b2b266be9e0c7cf23da4a51e1c8ae67cd857
android_test modules should have Instrument = true like android_app
modules so that they get instrumented when EMMA_INSTRUMENT=true.
Bug: 115929955
Test: m EMMA_INSTRUMENT=true
Change-Id: I2c0e8ab95d2cdc47fc28af9c7264ab544d0e7a28
android_app and android_test modules weren't getting
InitDefaultableModule called on them. Call InitJavaModule
which does both InitAndroidArchModule and InitDefaultableModule.
Test: m checkbuild
Change-Id: I26f3c04ea8bdfcacb59dcdbc63d6db5604c2598a
Files in the data property will be passed to
LOCAL_COMPATIBILITY_SUPPORT_FILES in Make.
Test: m checkbuild
Change-Id: Ifc074317f957aba8f55daa30abc5b9737d1eceac
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.
Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
These are in the AndroidTest struct, and being exported by the AndroidMk
functions, but aren't in the list given to blueprint.
Test: add test_suites to an android_test, check Android-*.mk
Change-Id: I1e46638755cbb579f28ed14638baad43fde5cb96
Move the manifest merger config to Soong, and use it to merge
manifests of static dependencies of android_library and android_app
modules.
Bug: 110848854
Test: m checkbuild
Change-Id: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Merged-In: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Merged-In: I5d055ce63b8371db500f8868fb73ab3604b8c24a
Very few java libraries need to be installed, most are statically
included in other modules. Device modules that are not installed
also don't need to be dexed, saving checkbuild time. Change the
default for java_library to not be installed, and allow libraries
that should be installed to specify installed: true. This makes
java_libary and java_library_static identical. It also simplifies
some corner cases when converting from Make to Soong if a module
is built for the host (which doesn't differentiate between static
and non-static/installable) and statically for the device, which
couldn't be represented in a single java_library in soong.
Bug: 110885583
Test: m checkbuild, compare presubmit target files
Change-Id: Idc0841c39a17cebd7bac3559c9408596d167a393
Add min_sdk_version properties and use it for aapt2
--min-sdk-version and --target-sdk-version flags. Add an sdkContext
interface that any function that needs an sdk version can take in
order to get the values for the current module.
Bug: 110848854
Test: m checkbuild
Change-Id: Ic69f1f935d8b865ec77689350407df08bfac5925
android_test module are APKs that can be run as tests, either
as standalone unit tests or as instrumentation tests for another
APK.
Test: m checkbuild
Change-Id: I16661701637e4048fd99442029c3e195ebf373a4
If a static android library lib1 has static_libs: ["lib2"] then the
R.class files for packages in lib2 will be merged into the jar for
lib1. If an app has lib1 in its static_libs it will get the R.class
files from lib2 through lib1, instead of regenerating the R.java
files with numbering that matches the resource table of the app.
Pass transtive static android library dependencies on the aapt2
command line so that aapt2 will always regenerate the R.java
constants for those packages.
Also extract the packages that have R.java files after each aapt2
invocation. This is not necessary for Soong, but is passed to
make to let it force regenerating the packages using
--extra-packages.
Bug: 78300023
Test: m checkbuild
Change-Id: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee
Export proguard flags from Android library modules, and use them
from static dependencies in Android apps when running proguard.
Also export them to Make.
Unlike Make, which concatentates all the exported flags from
dependencies, Soong dedups exported flags files.
Bug: 73724997
Test: m checkbuild
Change-Id: I8f86fecb09cbc591832ce67e8ecef551a6600349
Static android libraries should not get the product-specific
flags.
Bug: 73724997
Test: m checkbuild
Change-Id: I89e8c0a3fb788b18ee6603e9d21c9b9a5275f42f
Add support for compiling android_library modules into AARs,
and refactor app support on top of it.
Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
An upcoming change will stop exporting ProductVariables from Config, so
switch to using existing accessor functions, and add more when they're
missing.
Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7
GlobFiles had allowed results to be anywhere in the source tree,
restrict it to results within the current module directory.
Then use it for ExpandSources and other places where we only want files.
This fixes using '*' in cc_test's `data` property, which can only
support files.
The only thing this changes today is that java_resource_dirs and
java_resources no longer pass directories to soong_zip's -f argument.
core-libart previously added some icu directories, now it only passes
files.
Bug: 71906438
Test: only expected changes in out/soong/build.ninja
Test: add data: ["**/*"] to a cc_test, build successfully
Change-Id: Iff1bd8c005a48e431c740706d7e23f4f957d8b1d
Add support for android_library_import modules that take an
aar file.
Bug: 73724997
Test: m checkbuild
Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
Add -I arguments to the aapt link command line if sdk_version is
set to a numbered SDK prebuilt jar.
Test: m checkbuild
Change-Id: Ieeadf84bc131ba94e0e4ee1b9eec7d1e80b31b19
Device overlays are passed to Soong in highest priority to lowest
priority order, but aapt2 keeps the last value provided on the
command line. Reverse the order that overlayGlobResults are
collected.
Bug: 71595164
Test: app_test.go
Change-Id: Ibc6b8297f1548766c5c92f3be969b89736dc8dff
Allow apps to specify that they should be installed in priv-app,
and export the value to Make which normally handles installation.
Test: m checkbuild
Change-Id: I79a05e7bb6ec0df5c31429e2f4592c6fd57dab70
Fix two problems with Soong's aapt2 rules that occur when
TARGET_BUILD_APPS is set. Fix escaping the values passed to
--min-sdk-version, they are sometimes P-$$(cat out/build_number.txt).
Also use the correct path to the aapt2 prebuilt.
Bug: 69917341
Test: m TARGET_PRODUCT=full TARGET_BUILD_VARIANT=userdebug TARGET_BUILD_APPS=Camera2
Change-Id: I8660a62c4a87a74e0ac1b9d03d67103af93a0cbe
Ignore overlay directories that have been selected for enforced RRO
by the product, and pass them to Make instead to be converted to
an auto generated RRO package.
Bug: 69917341
Test: m checkbuild
Change-Id: I8e2677f4c600acdd8dee0869bf4fbc3d5dbc8b44
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.
Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
AConfig() now duplicates Config(). Replace the uses of AConfig()
with Config(). Leave AConfig() for now until code in other
projects is cleaned up.
Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
In Soong, a Config() method will always return a Config. Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere. Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.
Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.
Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
Use aapt2 instead of aapt to compile Android app resources.
Also generate all files into srcjars instead of individual
sources.
Test: m checkbuild
Change-Id: I5a67991a0daf0017e8159b46fcff7d5564a91468
Add support for instrumenting jars with jacoco. Unlike in Make,
Jacoco in Soong is done entirely using jars.
Instrumentation is enabled by EMMA_INSTRUMENT=true, and affects
all apps. If EMMA_INSTRUMENT_FRAMEWORK=true then it also affects
any java libraries listed in InstrumentFrameworkModules.
Bug: 69629238
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false
Change-Id: If699715b277529cd7322ffca67c23b0746e1cccd
Also adds checks that the dependencies are android.Modules and
are not disabled.
Test: m checkbuild
Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
srcFileLists was an ill-fated attempt to deal with generators that
produce a set of java sources that is not known ahead of time.
For example, the list of files produced by protoc depends on the
package statement in the .proto file. srcFileLists put the list
of generated files into a file, which was then passed to javac
using the @file syntax. This worked, but it was too easy to cause
missing dependencies, and will not work well in a future distributed
build environment.
Switch to putting generated sources into a jar, and then pass them
jar to javac using -sourcepath.
Test: m checkbuild
Change-Id: Iaab7a588a6c1239f7bf46e4f1b102b3ef517619b
If hostdex: true is specified for a java library, create an extra
Make module that copies the dex jar to a module with a -hostdex
suffix in the host output directory.
Bug: 67600882
Test: m -j checkbuild
Change-Id: I859dfaabeefdca714b566de94e00f74e03c85939
For consistency with make, rename java resources to
java_resource_dirs and android resources to resource_dirs.
Test: m -j checkbuild
Change-Id: Ie9aac50fef40f6a9093b4b98759e79cd086bb797
Forcing sdk modules to be declared explicitly is unnecessary, just
add the required dependencies on the jar and aidl files.
Test: java_test.go
Change-Id: Ib28bdc1051c5825e7c0efb6adff1f9282675560e
For consistency with libs and static_libs. And make it a *bool
so that it can be overriden when used in java_defaults modules.
Test: java_test.go
Change-Id: If0eaf5d5571dc6e565056d273b0addd960d6b33f
Split InstallFileName into InstallExecutable that does chmod +x
after copying the file. Also remove InstallFile and rename
InstallFileName to InstallFile.
Test: m -j checkbuild
Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
And make it work like bazel's java_import, using a "jars" property
instead of "srcs", and allowing multiple jars to be listed.
Test: soong tests
Change-Id: Ida2ace6412bd77b4feb423646000a1401004e0ea
Prefixing names in the java package with "java" is redundant, inside
the java package it is clear that they refer to something java
related, and outside the package they will be referred to with a
java. prefix.
Test: java_test.go
Change-Id: I9eb8eecb7ac5f6fbf8e87f5c219b3f50dbd18c87
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.
Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
Remove inheritance implemented with the bad "superclass calls
subclass through interface" pattern, and replace it with composition.
Test: builds
Change-Id: If323f89360455b3f98b40777edaaaa265bb3b5fc
Move Soong's globbing-with-dependencies support into Blueprint so it can
be used for subdirs= lines in Android.bp files.
Blueprint has a slight change in behavior around subname= lines, it now
always uses the subname and doesn't fall back to Blueprints. To support
the Blueprints files in build/blueprint, use them directly with build=.
Test: build, add source file that matches glob, rebuild
Change-Id: Ifd0b0d3bc061aae0a16d6c7ca9a1cd8672656b4d
Explicitly allow installation into the data partition instead of using
"../data" for tests. At the same time, pipe through the information
required for vendor modules.
Change-Id: I6baf9d828c285e1080e43074beef8aebdbb38875
This centralizes verification and common operations, like converting the
path to a source file to the path for a built object.
It also embeds the configuration knowledge into the path, so that we can
remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that
leads to paths like './path' instead of just 'path' like make is doing,
causing differences in compiled binaries.
Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
EarlyMutators are identical to BottomUpMutators, except they run before
DynamicDependencies. DynamicDependencies can be replaced with a
BottomUpMutator. Replace both EarlyMutators and DynamicDependencies
with BottomUpMutators, which allows setting the order between all
mutators through registration order.
Change-Id: Id1305d798d3d2da592061c89d7c10a71780b71a3
If resources and java files were compiled from the same directory,
ctx.Glob could try to create a glob file that had the same name
as the directory containing another glob file. Namespace each
call to ctx.Glob so they never conflict.
Change-Id: I4db73af568a2ff2e708e9db64798073b1ed2ff61
Improve the comments associated with properties to work better with
Blueprint's auto-documenting feature.
Make all properties structs into named types so that thet types can be
found using reflection and cross-referenced to the source code to
auto-extract docs.
Remove the leading <property>: text from properties, the documentation
will include the lowercased name of the property.
Add filter tags to the nested arch properties.
Change-Id: I4ef5db86358886fe61456c24eb2dbe6f7b876115
Make common.Glob take an interface that is the intersection of
blueprint.ModuleContext and blueprint.SingletonContext used by
Glob and GlobRule, allowing it to be called on either. Also
move ExpandSources and Glob into AndroidModuleContext.
Change-Id: I8d1a3160c5dd201033afdb37210e82d8065b137d
Add support for running aapt to generate R.java and Manifest.java,
compiling java into jar, adding resources to the jar to convert it
into an apk, signing the apk, and zipaligning the apk.
Change-Id: I7a73fef590d07f35b3d0b56a8571780c09bb10ae