Commit Graph

2277 Commits

Author SHA1 Message Date
Colin Cross d783bbbace Use unzip -DD
We put reproducible timestamps in zip files so that the artifacts
are consistent, but that leads to old timestamps in the output
directory if they are unzipped as part of the build.  Use
unzip -DD when unzipping to update the timestamps.

Bug: 161015009
Test: touch -d 2020-01-01 ref; find $OUT/system -not -newer ref
Change-Id: I70407a627cb070e24be510faa6a774e3d9eae3a8
2020-07-12 05:37:46 +00:00
Paul Duffin cee7e66b07 Ensure that sdk/module_exports depends on source members
Previously, preferring a prebuilt of an sdk/module_exports's member
would cause the sdk/module_exports to depend on the prebuilt instead
of the source and cause problems with the build.

This chance prevents the dependency from an sdk/module_exports to its
members from being replaced with prebuilts.

Bug: 160785918
Test: m nothing
Change-Id: Iee4bcd438c11929e30fb5766701b05a0e89956d9
2020-07-09 17:51:06 +01:00
Paul Duffin 80342d72d0 Restrict replacements of source dependencies with prebuilts
Previously, when java_sdk_library_import was preferred over a
java_sdk_library the latter ends up depending on the prebuilt child
modules created by the java_sdk_library_import instead of the source
child modules that it created itself. That was because all dependencies
on those source child modules were replaced with the corresponding
prebuilt child modules.

This change prevents those dependencies from being replaced to preserve
the dependencies from java_sdk_library onto its source child modules by
making the replacement conditional depending on the tag used. It also
updates the affected test.

Bug: 159902351
Test: m nothing
Change-Id: I4441b901dedfd44b9769df1ac2e248b94834cf85
2020-07-08 16:46:16 +01:00
Paul Duffin 44f1d8404b Stop java_sdk_library_import from depending on source modules
Previously, java_sdk_library_import added the dependencies on its child
components in the deps mutator after prebuilts without a matching
source module are renamed to the source module name. That meant that
the java_sdk_library_import has to use the source module name and ended
up depending on the source module unless it was preferred.

This change adds a new component deps mutator that runs before the
PrebuiltRenameMutator so that the java_sdk_library_import can add
dependencies onto the prebuilt modules. It also updates an affected
test.

Bug: 159902351
Test: m nothing
Change-Id: I3576c4873302743e51aff547ea1497bef6d748ac
2020-07-08 16:46:16 +01:00
Treehugger Robot 0ae555df1a Merge "Support kotlin multiplatform sources" 2020-07-08 00:13:01 +00:00
Colin Cross a4c8cc6471 Support kotlin multiplatform sources
Add a common_srcs property and propagate it to the module.xml file
passed to kotlinc.

Test: m checkbuild
Change-Id: Ief768bafb943513c9ffbc01e829abc078f0a72bc
2020-07-06 17:58:09 -07:00
Liz Kammer 5e07d0ccbb Add soong cc and java deps to general-tests dist
Test: m SOONG_COLLECT_CC_DEPS=true SOONG_COLLECT_JAVA_DEPS=true dist
  general-tests and verify module_bp_java_deps.json and
  module_bp_cc_deps.json is in out/dist
Test: m SOONG_COLLECT_CC_DEPS=true SOONG_COLLECT_JAVA_DEPS=true
  checkbuild dist general-tests
Bug: 154845369

Change-Id: I683fe1d7e17f7abaab40206770d09db705493ffb
2020-07-06 16:19:56 -07:00
Treehugger Robot 759ccc13af Merge "Tidy up the definition of sdkCore." 2020-07-06 12:48:44 +00:00
Ulyana Trafimovich 8fab5bcce3 Merge changes from topic "uses-libs-5"
* changes:
  Rewrite construct_context.sh in Python.
  Refactor class loader context generation.
2020-07-02 09:06:27 +00:00
Treehugger Robot 756aa63aee Merge "Rename module -> module-lib" 2020-07-01 23:58:07 +00:00
Treehugger Robot 5aff3afce2 Merge "Output apkcerts file for android_app_set." 2020-07-01 19:53:33 +00:00
Treehugger Robot 7d9deed9fd Merge changes Ib7ad715d,I3a83b5ed
* changes:
  Remove frameworkResModule from sdkCorePlatform.
  Remove the concept of useDefaultLibs from Soong.
2020-07-01 17:23:46 +00:00
Jaewoong Jung 11c1e0f94d Output apkcerts file for android_app_set.
Soong and Make have no ways to figure out what splits will be outputted
from a given android_app_set, so it's impossible for them to provide
full PACKAGES.$(LOCAL_MODULE).CERTIFICATE entries, which are required to
build a final apkcerts.txt. This change makes extract_apks produce
apkcerts.txt files for each input modules instead. The Make-side
counterpart of this change merges all local apkcerts.txt into a final
one.

Fixes: 160119159
Test: main_test.go
Test: m apkcerts-list
Merged-In: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
Change-Id: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
2020-07-01 10:03:09 -07:00
Treehugger Robot 8f70db2b48 Merge "Rename the Default* constants in java/config." 2020-07-01 14:43:46 +00:00
Pete Gillin 880f964f16 Tidy up the definition of sdkCore.
Compared to the effect of the toModule function, this (a) sets
noFrameworkLibs to true, which seems logically correct, and (b) stops
setting java9Classpath, which was redundant since the same stubs are
available in 1.9+ builds via the systemModules setting. (This brings
sdkCore into line with sdkCorePlatform in both cases.)

Test: m art.module.api.annotations
Change-Id: I61a868bc363a3bf174725b78c0a1657021cfe08a
2020-07-01 13:17:16 +01:00
Pete Gillin 7b0bdce69e Remove frameworkResModule from sdkCorePlatform.
This seems unnecessary: modules using `sdk_version: "core_platform"`
don't expect frameworks dependencies.

Test: m framework
Change-Id: Ib7ad715d1f4b4934c3c4a84839f4ead85a5abb29
2020-07-01 13:05:32 +01:00
Treehugger Robot 286d8f9972 Merge "Prepare Soong for switch to stable core/platform API." 2020-07-01 11:57:26 +00:00
Pete Gillin 0638dfcf94 Rename the Default* constants in java/config.
These values are used in two out of the many possible sdk_version
configurations, and therefore weren't really defaults in any
meaningful sense. Giving them more descriptive names makes the code
easier to follow.

Bug: 157640067
Test: m nothing
Change-Id: Icf38a9c0be2606ad0478929e1b40dfcee36cddef
2020-07-01 12:40:58 +01:00
Pete Gillin e3d44b245b Remove the concept of useDefaultLibs from Soong.
This field in the java/sdk structure was used in two of the many
possible configurations, so it wasn't really a "default". It also
meant that, to understand those configurations, the reader had to know
what was considered the default, which was only possibly by reading
the code in java.go and droiddoc.go which implemented special code
paths when useDefaultLibs was true. By eliminating that setting and
explicitly setting the required values, the code is simpler and easier
to understand.

This change is a straight refactoring, in the sense that the output of
the build should be unchanged.

Regarding the changes to the proguardRaiseTag dependency in java.go:
- This is a noop for anything which had sdkDep.useModule = true prior
  to this change, because they all had the same value for
  hasFrameworkLibs() and hasStandardLibs().
- This is a noop for anything which had sdkDep.useDefaultLibs = true
  prior to this change, because they do not use proguard settings.
- Therefore, it is a noop overall.
- Nevertheless, it is required to make sdkCorePlatform work. Without
  this change, such modules would pick up a dependency on framework
  libs via the (unused) proguardRaiseTag, which creates a circular
  dependency, because this is the sdk_version used when building
  framework libs themselves.

Bug: 157640067
Test: m java docs droid
Change-Id: I3a83b5edc1bd48c16b55f6f77e3e710fc8fbd8fa
2020-07-01 12:40:58 +01:00
Pete Gillin 40a0642385 Prepare Soong for switch to stable core/platform API.
This ensures that `m nothing` succeeds even if java/config/config.go
is changed to use `stable.core.platform.api.stubs` and
`stable-core-platform-api-stubs-system-modules` instead of the legacy
versions. (The change to stable cannot be made yet because real
targets depend on APIs only in legacy, but it is useful for the build
system to be ready for this change.)

Bug: 157640067
Test: m nothing (with and without local change mentioned above)
Change-Id: Id7562d8c592551fd0ed2b9849bcf6eb707c2a1d0
2020-07-01 11:31:30 +01:00
Ulya Trafimovich 5f364b63b8 Rewrite construct_context.sh in Python.
This allows to reuse SDK version comparison routine from other Python
scripts. With the addition of non-numeric versions comparison has become
more complex, and the deleted shell script did it incorrectly: it used
comparisons like `[[ "S" -lt 28 ]]` which results in "true" as strings
are converted to zero in numeric context. This resulted in adding legacy
libraries to class loader context of apps targeting recent SDK versions.
The error was masked because currently there is only one non-AOSP app
that uses the script (GoogleDialer), and it targets numeric SDK version.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I26e752e29b5453fd3e29d5dbfbe4d9df9c0a55b7
2020-07-01 09:44:23 +01:00
Paul Duffin cfc2df847c Merge "Track the current java_sdk_library(_import) deps" 2020-06-30 11:06:54 +00:00
Paul Duffin 452bf39014 Merge "Apply hiddenapi encoding to java_sdk_library .impl" 2020-06-30 10:41:42 +00:00
Treehugger Robot e9eacaa061 Merge "Move gen-kotlin-build-file.sh to python" 2020-06-29 21:12:45 +00:00
Paul Duffin a2058f8b7d Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
    e.g. ctx.Config().BootJars().

Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().

Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.

Bug: 159683330
Test: m framework-tethering
      dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
      Verify that there are >0 hiddenapi entries.
      Add java_sdk_library_import prefer=true for framework-tethering
      and repeat the above to verify that there are 0 hiddenapi entries.
      Apply this change, repeat above and verify that there are the same # of entries as before.
      Remove the prebuilt for framework-tethering
      Repeat the above and verify that there is no change to the # of entries
Merged-In: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
(cherry picked from commit c4422106a7)
2020-06-29 19:05:19 +01:00
Paul Duffin ca8d9a5018 Track the current java_sdk_library(_import) deps
Adds some tests to track the current dependencies between
java_sdk_library, java_sdk_library_import and their child modules in
various configurations. This is in preparation for a series of changes
that will update the dependencies to ensure that the java_sdk_library
always depends on the source modules that it creates and
java_sdk_library_import always depends on the prebuilt modules that it
creates.

Comments in the tests highlight the parts that will be affected by the
follow up changes.

Bug: 159902351
Test: m nothing
Change-Id: I8eea3ac80061f5cbbc9dec201750c4b59e224b4b
2020-06-29 13:15:33 +01:00
Roland Levillain e95eb455cc Merge "Add `soong.java.testProperties` to `java_defaults` module type." 2020-06-27 14:33:12 +00:00
Colin Cross 9b1aa0cb86 Move gen-kotlin-build-file.sh to python
Kotlin common multiplatform sources support will require more
complexity in gen-kotlin-build-file.sh, move it to python instead.

Test: m checkbuild
Change-Id: I02312160ad781877f1fec971168331c0dcecf136
2020-06-26 22:41:34 -07:00
Chris Gross 8f3386e49b Merge "Use a default exclude filter for JaCoCo in Soong." 2020-06-26 14:59:15 +00:00
Roland Levillain b5b0ff3555 Add `soong.java.testProperties` to `java_defaults` module type.
This is so that we can use some test properties in a `java_defaults`
module for ART run-tests.

Test: atest art-run-test-001-HelloWorld
Bug: 147814778
Change-Id: Ifb9817ca2f08e64f911c123a4022fbf688405547
2020-06-26 12:51:37 +01:00
Chris Gross 2f748692dd Use a default exclude filter for JaCoCo in Soong.
Instrumented builds should exclude certain classes from instrumenation
by default. (e.g. JaCoCo itself) Leverage the existing
DefaultJacocoExclusionFilter to do this.

Note: Two different default filters exist now (one for Make and one for
Soong), as they have different wildcard rules.

Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true m -j32
TeleService and inspected the resulting temporary jar that was
instrumented to confirm that anything from org/jacoco was excluded.
Bug: 159748844

Change-Id: I5466b0a03957edfbe53971d5d1a7729fdb8337db
2020-06-25 16:45:44 +00:00
Jingwen Chen 40fd90ae52 Support multiple dists per Android.bp module, and dist output selection.
This CL adds "dists" to the base property struct to support multiple
dist file configurations, and generic tag support to dist tagged outputs
of modules.

Fixes: b/152834186
Test: soong tests and `m sdk dist`

Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a
Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-25 12:42:07 +00:00
Treehugger Robot 0acb0fb2b7 Merge "Only look for profiles when we have a profile dir" 2020-06-25 01:28:52 +00:00
Jooyung Han 14a08f5b28 Merge "apex/apk: enforce min_sdk_version of all deps" 2020-06-25 01:18:52 +00:00
Dan Willemsen 78d51b00de Only look for profiles when we have a profile dir
Right now, it's looking for *.prof files at the top of the source
directory.

For devices that don't specify the profile dir (everything on AOSP,
etc), this saves a couple percent of the globs that we check during
every build (and would re-execute if you add or remove files from the
top directory)

Bug: 159845846
Test: treehugger
Change-Id: I10d43422a2b5ae25e6557d435ecc89fe43536dd7
2020-06-24 16:33:31 -07:00
Makoto Onuki 35dfb01d86 Merge "Enable check for "try to expose APIs from hidden class"" 2020-06-24 22:18:35 +00:00
Makoto Onuki f51b7af2a4 Enable check for "try to expose APIs from hidden class"
Exempt-From-Owner-Approval:Cherry-pick from goog/master
Bug: 159121253
Test: treehugger (i.e. this shouldn't trigger "API has changed" error.)
Merged-in: I6ca2d8e3967cdc41aa2a931972472174aae2a613
Change-Id: I6ca2d8e3967cdc41aa2a931972472174aae2a613
2020-06-24 12:06:37 -07:00
Treehugger Robot 29abfb7fd1 Merge "Include resources in sdk snapshot of java library impl" 2020-06-24 14:24:03 +00:00
Paul Duffin 4e77284ab4 Include resources in sdk snapshot of java library impl
Bug: 159607838
Test: m nothing
Change-Id: Ie7ddbffc3957f832abfadb27292c436e8e5dcbf3
2020-06-24 13:04:15 +01:00
Colin Cross 28d6549529 Merge "Set root dir in lint project.xml" 2020-06-23 21:44:42 +00:00
Colin Cross e176b5b92e Merge "Set ANDROID_SDK_HOME when running lint" 2020-06-23 21:44:34 +00:00
Colin Cross c31efeb25c Set root dir in lint project.xml
Set the root dir in the project.xml for lint so that the paths in the
lint report are relative to the top of the tree instead of relative
to the project.xml.

Bug: 153485543
Test: run lint
Change-Id: Ie163a4dadd976e708f798855de73e58084931a91
2020-06-23 10:27:05 -07:00
Colin Cross 977b6a822d Set ANDROID_SDK_HOME when running lint
Lint tries to create ~/.android, set ANDROID_SDK_HOME to keep it
from attempting to write to the home directory, which may not be
writable.

Test: run lint
Bug: 159676171
Change-Id: I16375b88d309a8fa416b3a8efeabe15759889ae3
2020-06-23 10:25:03 -07:00
Jooyung Han 749dc69af1 apex/apk: enforce min_sdk_version of all deps
Enforce min_sdk_version for every payload dependency of updatable
APEX/APKs.

android.CheckMinSdkVersion() calls ApexModule.ShouldSupportSdkVersion
for every transitive dependency from APEX/APK modules to see if it
meets the min_sdk_version requirements.

The common implementation for apex/android_app is provided in
android/apex.go.

Bug: 145796956
Bug: 152655956
Bug: 153333044
Test: m nothing
Change-Id: I4a947dc94026df7cebd552b6e8ccdb4cc1f67170
2020-06-24 02:00:33 +09:00
Colin Cross c9ef6ee1b7 Merge "Make native_coverage clause work with ClangCoverage" 2020-06-23 03:06:53 +00:00
Sasha Smundak e88b436883 Stem name should be fixed the same was as masterFile
Fixes: 159641682
Test: treehugger

Change-Id: Ic0300676c35821cedc693eeb7b970318790f6189
2020-06-22 16:53:33 -07:00
Treehugger Robot ea34d87759 Merge "Fix build breakages when WITHOUT_CHECK_API=true" 2020-06-22 18:39:13 +00:00
Colin Cross 1a6acd4f39 Make native_coverage clause work with ClangCoverage
Make uses NATIVE_COVERAGE to enable gcov coverage and CLANG_COVERAGE
to enable clang coverage.  NATIVE_COVERAGE is translated to the Soong
Native_coverage product variable which triggers the native_coverage
clause in Android.bp files.  The clause also needs to be triggered
for CLANG_COVERAGE.

Rename the existing Native_coverage product variable to GcovCoverage,
and regenerate Native_coverage when either GcovCoverage or
ClangCoverage are set.

Also remove NativeLineCoverage, it wasn't doing anything differently
than Native_coverage.

Bug: 159059537
Test: m checkbuild
Change-Id: I215124a9b35a2ad50ad562079d392e3d33da11f4
2020-06-22 11:13:42 -07:00
Paul Duffin 10269f1da9 Fix build breakages when WITHOUT_CHECK_API=true
Bug: 158578354
Test: export WITHOUT_CHECK_API=true
      m checkbuild
Change-Id: I7b5fff40b870c9d754f779ff1c3314bac7e42440
Merged-In: I7b5fff40b870c9d754f779ff1c3314bac7e42440
2020-06-22 12:40:24 +00:00
Yo Chiang 34753055d1 Merge "java_sdk_library: Require xml permission file only if it is generated" 2020-06-20 03:19:17 +00:00