Commit Graph

3511 Commits

Author SHA1 Message Date
Jingwen Chen
cda22c9bb9 Refactor 'in_make' to mean Kati is not skipped.
In Nougat and before, Make wrote a marker file to indicate that
soong_build was invoked from Make to change certain behaviors of Soong
at build time.
https://cs.android.com/android/platform/superproject/+/android-7.1.2_r36:build/core/soong.mk;l=70-73;drc=ae18638b0406ad107b0882a02a13cdd8b92f2a4e

Things have changed, and now soong_build is invoked from soong_ui, which
supports a --skip-make configuration flag:
https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/build.go;l=31-33;drc=680387bf1d3ce7cbc77f535be7c42cec411b1687

Thus, the various remnants of 'EmbeddedInMake' and 'inMake'
configuration are misleading, since soong_build is no longer invoked
from Make. This CL refactors all instances to actually mean that
Kati is enabled (not skipped with --skip-make), and will run after
soong_build finishes, so Kati-specific behavior like the AndroidMk
singleton should run.

Test: TH presubmit

Change-Id: I576ab8e54f99f5c8ddf9feaf9a828019b279e266
2020-11-23 00:29:18 -05:00
Paul Duffin
3131025d61 java_sdk_library: Allow dist artifacts to be named
Unless no_dist: true is specified the java_sdk_library will
automatically copy the stubs jar and the API specification file (but
not the removed API specification file) for each scope to the apistubs/
directory in the dist from which the sub-directories in prebuilts/sdk
are populated. Previously, the name of those artifacts was based on the
name of the module. This change adds the dist_stem property to allow
the name of those artifacts to be specified separately to the module.

The purpose of this is to allow the art.module.public.api,
conscrypt.module.public.api and i18n.module.public.api java_sdk_library
modules to use a different name when copying to the dist,
e.g. conscrypt.module.public.api should use conscrypt.

Additionally, as the artifacts in the dist end up being copied verbatim
to prebuilts/sdk and the prebuilt_apis module uses those names to
create a filegroup referencing the latest released version of the API
and removed API specification files the dist_stem property is also
used in constructing the name of those filegroups.

Bug: 173715943
Test: lunch sdk-eng && m dist sdk
      Compare the results of the above before and after the change to
      ensure that this change does not affect the contents of the dist.
      See the topic's other change in external/conscrypt for testing
      the behavior of this new property.
Change-Id: Ie81345021991ff91ca55fec15b02627135293308
2020-11-20 22:43:21 +00:00
Paul Duffin
6b11d02597 Merge "java_sdk_library: Stop disabling copy to dist when sdk_version: none" am: 05c2f3e29a am: d94bd1ddff am: b2c13926b1 am: 1b8d0482ba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1506239

Change-Id: Ie73854634a2efd6bc953bfd5007baae46adabda4
2020-11-20 14:19:11 +00:00
Paul Duffin
50780b62b7 Merge "java_sdk_library: Allow no_dist to be explicitly set in .bp file" am: de6df73b44 am: fb873a3048 am: ee09b2228f am: ca5c6a4b42
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1506238

Change-Id: Idbe5601fef234c199af59d003f418be0a90248cd
2020-11-20 14:18:59 +00:00
Paul Duffin
05c2f3e29a Merge "java_sdk_library: Stop disabling copy to dist when sdk_version: none" 2020-11-20 12:48:11 +00:00
Paul Duffin
de6df73b44 Merge "java_sdk_library: Allow no_dist to be explicitly set in .bp file" 2020-11-20 12:47:43 +00:00
Paul Duffin
4fb01c1b0d Merge "java_sdk_library: Remove unused SetNoDist method" am: defa9403a3 am: 21ba518097 am: dad85cd671 am: 822b1b62f0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1506237

Change-Id: I9afa81cebb3c15523207808200737698ad289662
2020-11-20 11:42:54 +00:00
Paul Duffin
defa9403a3 Merge "java_sdk_library: Remove unused SetNoDist method" 2020-11-20 10:02:13 +00:00
Colin Cross
c29c94ed5a Merge "Support extra checks for ErrorProne in a dedicated property" am: 18e3e8fbc2 am: b742386721 am: c9ec32e084 am: 13186ae8ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1506659

Change-Id: I1f6bae93f48d348c5dfdb565af8a75d1c37e2fc0
2020-11-20 04:10:05 +00:00
Julien Desprez
07659d70a7 Merge "Use java host unit tests template for unit tests" am: 62aa21508c am: 706ee179ae am: efff25ce93 am: 6c2b0d1c65
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1505512

Change-Id: I7b15989b29bd7d36af59e2a5a7b49f0be491e1e1
2020-11-20 02:51:25 +00:00
Colin Cross
18e3e8fbc2 Merge "Support extra checks for ErrorProne in a dedicated property" 2020-11-20 02:06:19 +00:00
Julien Desprez
62aa21508c Merge "Use java host unit tests template for unit tests" 2020-11-20 00:07:41 +00:00
Colin Cross
748b2d829a Support extra checks for ErrorProne in a dedicated property
Previous extra checks for ErrorProne were added using the plugins
proeprty to get them into the -processorpath argument.  This works
fine for java-only modules, but fails for mixed java+kotlin modules
because the processorpath is given to kapt and not javac.

Add a dedicated errorprone.extra_check_modules property (mirroring
the lint.extra_check_modules property), and add that to a separate
processorpath that is used only for errorprone rules and not cleared
when kotlin is used.

Test: TestKapt/errorprone
Change-Id: Id6ef02ce758532d1df8b8d969fad83bb44fe93ab
2020-11-19 14:20:12 -08:00
Paul Duffin
7f3e705ef2 Merge changes from topic "fix-stubs-source-snapshot" am: b479459ac9 am: 5248161eaf am: e3ec3ea345 am: 69cc037aa3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1503793

Change-Id: I21cf147c846d687f14a712080f424359306a6be8
2020-11-19 20:36:23 +00:00
Treehugger Robot
9af7306361 Merge "java link time error improve" am: e63ab5ea02 am: a5fc86f799 am: 4b4b9c5498 am: b5912057ec
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1501002

Change-Id: I12794167b7b56fd68d959ff7417e5d86015d25ed
2020-11-19 20:36:15 +00:00
Paul Duffin
3aef8d2c1f java_sdk_library: Stop disabling copy to dist when sdk_version: none
Previously, setting "sdk_version: none" would have a side effect of
disabling copying to dist by default. This change removes that behavior
and will copy to dist by default unless explicitly specified.

This will have no impact on the dist because all java_sdk_library
modules that relied on the previous behavior to disable copying to
dist have been modified to explicitly disable copying to dist.

Test: lunch sdk-eng && m dist sdk
      compare out/dist/apistubs directories before and after this
      change to make sure that they have not changed.
Bug: 173715943
Change-Id: I376546b5a8b03de6c944961f7408dad22184fe49
2020-11-19 19:28:10 +00:00
Paul Duffin
4f5c1ef229 java_sdk_library: Allow no_dist to be explicitly set in .bp file
Currently, the no_dist property cannot be set in a .bp file and
defaults to true if the sdk_version property is set to none. That
behavior was added to prevent the output files from the libcore,
conscrypt and icu java_sdk_library modules from being copied to the
dist. It worked because they were the only java_sdk_library modules to
set "sdk_version: none".

Unfortunately, that default behavior is no longer required because
we want to be able to convert "conscrypt" module to a java_sdk_library
and have its public API output files be copied to the dist
automatically. This change allows the no_dist property to be explicitly
set in the .bp file so that those modules that rely on the implicit
behavior can explicitly specify it and allow the default behavior to
be removed.

This change:
* Removes the `blueprint:"mutated"` tag from the No_dist property which
  allows it to be specified in a .bp file.
* Only sets the default if the property has not been explicitly
  specified in a .bp file.

Test: lunch sdk-eng && m dist sdk
      compare out/dist/apistubs directories before and after this
      change to make sure that they have not changed.
Bug: 173715943
Change-Id: I8a1c97b690ae05bfe71ea72acc0831fa51aca7e9
2020-11-19 19:28:10 +00:00
Paul Duffin
e3ecd6c7a8 java_sdk_library: Remove unused SetNoDist method
This method was added for use in sysprop_library.go but it is no longer
used there. So, this change removes it.

Bug: 173715943
Test: m nothing
Change-Id: I0c2ae8a8d515faf2692eca2aaed63475fdb6a196
2020-11-19 19:28:05 +00:00
Paul Duffin
b479459ac9 Merge changes from topic "fix-stubs-source-snapshot"
* changes:
  Fix prebuilt_stubs_sources to work with no stubs sources
  Revert "Use glob for java_sdk_library_import stub_srcs"
2020-11-19 18:39:02 +00:00
Treehugger Robot
e63ab5ea02 Merge "java link time error improve" 2020-11-19 18:38:16 +00:00
Julien Desprez
70898c4006 Use java host unit tests template for unit tests
Test: make aoa-helper-tests
Bug: 172961860
Change-Id: I2eaee277961f29adfd22e7c65248c9403bd69b81
2020-11-19 09:44:39 -08:00
Paul Duffin
1a39332cf6 Fix prebuilt_stubs_sources to work with no stubs sources
The framework-sdkextension java_sdk_library module defines an API for
public, system and module_lib API surfaces but the public API is empty.
The empty public API results in an empty .srcjar being repackaged and
merged into the sdkextension-sdk snapshot and results in no directory
for the public API stubs sources being created. Unfortunately, the
Android.bp file in the snapshot is created by Soong and it does not
know that the public API will be empty and so it creates an Android.bp
file that references the directory into which the stubs sources should
be added but which ends up not existing in the snapshot. Referencing a
non-existent directory causes a build failure.

This change fixes that issue by using PathForModuleSrc with no path
components to get the path to the module directory (which must exist)
and then resolving the module relative local src directory against
that. The local src directory is globbed to find all the files, which
will return an empty set of paths if the directory does not exist.
Finally, the file paths are passed as an rsp file to soong_zip to avoid
exceeding any command line limits.

Many other different approaches were considered:
* Adding a property to the java_sdk_library to indicate that the public
  API was actually empty. That would require extra maintenance by
  developers and would require some extra checks to be performed after
  generating the stubs source to ensure that it was empty which would
  complicate the build process.
* Creating a directory with some placeholder file (empty directories
  don't work well with git) that would force the creation of the
  directory. That file would most likely be created whether the API
  was empty or not, would need to be stored in git alongside the source
  and could be quite confusing to reviewers.

Bug: 173508731
Test: m nothing - to run new tests
      Build sdkextension-sdk, unpack it and then build the .srcjar
      files for the public, system and module_lib API surfaces.
      Without this change the build failed, reporting that the
      stubs_sources directory for the public API did not exist.
      With this change the build succeeded.
      Checked the contents of the resulting .srcjar files and made
      sure that the public one was empty and the others contained
      the SdkExtensions.java class and a package-info.java file.
Change-Id: Ia468a3f37349f2dbc21db67744bda6461498d515
2020-11-19 12:42:18 +00:00
Paul Duffin
ab5ac8f169 Revert "Use glob for java_sdk_library_import stub_srcs"
This reverts commit 7f97957ded.

Reason for revert: breaks sdk snapshots b/173508731
Bug: 173508731
Test: Ran prebuilts/runtime/update.py and then m nothing
      Before revert it failed
      After revert it worked

Change-Id: I9c081681fac589e37788a0d592435e3224011c58
2020-11-19 12:03:51 +00:00
Joseph Murphy
fdb9f7f449 Revert "Adds a workaround to fix version inconsistency"
This reverts commit bc98d2ffe8.

Reason for revert: It was much to my chagrin that I realized the main purpose of this build target is an actually an internal branch which has the changes which make S the default for Robolectric.  This will complicate things a little bit in the short term, but in principle, this revert can be merged over with those changes down the line.

Change-Id: I053a32d89bfdf33486d95a30b145eb3b6f57df1d
2020-11-19 01:00:34 +00:00
Treehugger Robot
f828c49069 Merge changes Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36 am: b08a091502 am: 3f57de54b2 am: a088bff723 am: 6c4cdb0bb2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1480605

Change-Id: Ie0876cdaf142dbd75c094f9e680849efb4105b28
2020-11-18 23:35:27 +00:00
Colin Cross
dcc3c42355 Merge "Move genrule on top of RuleBuilder" am: d4a63eaeb7 am: 9fffe4cd19 am: e2732d4c9d am: dea73f7535
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498170

Change-Id: I798a24001dd1e8e0bcc6fb0d2770294bed384dea
2020-11-18 21:23:22 +00:00
Treehugger Robot
b08a091502 Merge changes Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36
* changes:
  Store ndkKnownLibs in the config
  Register the kythe singleton on the Context instead of globally
  Store ninja file deps from PackageVarContext in the config
  Store SingletonMakeVarsProviders in the config
2020-11-18 20:00:31 +00:00
Colin Cross
d4a63eaeb7 Merge "Move genrule on top of RuleBuilder" 2020-11-18 18:44:19 +00:00
Dan Shi
cf10c9c69d Merge "Add unit_test test option in test configs" am: ebb51503a4 am: fdd23ce534 am: b71498a327 am: d95774301f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498167

Change-Id: I9b1a21f70ed9e615ab4ef2bbf2b0138d8c7c8665
2020-11-18 05:59:01 +00:00
Dan Shi
ebb51503a4 Merge "Add unit_test test option in test configs" 2020-11-18 04:40:37 +00:00
Steven Moreland
0029898a84 java link time error improve
Asked about error message including "against private API.Adjust
sdk_version", which is a bit hard to parse due to missing space. Also
tried to make error message less verbose, so that it is more clear what
to do, and fixed a grammar mistake.

Bug: N/A
Test: N/A
Change-Id: Ib9a30d86b5cb0e9b3b7d5576ecb9498a9b316042
2020-11-17 21:57:23 +00:00
Colin Cross
3d68051218 Move genrule on top of RuleBuilder
In preparation for more complicated sandboxing support in sbox, use
a single implementation of the sbox sandboxing by moving genrule to
use RuleBuilder's sbox support instead of creating an sbox rule
directly.

Also move genrule's input list hash support into RuleBuilder.

Test: genrule_test.go
Test: rule_builder_test.go
Change-Id: I292184d02743c7e6887ebbcd232ba565db2ab0cc
2020-11-17 11:23:45 -08:00
Colin Cross
95f1ca07ce Store ndkKnownLibs in the config
Storing ndkKnownLibs prevents multiple tests from running in parallel
as one may be writing to the list while another is reading from it.
Store it in the config so each test has its own copy.

Test: go test -race ./apex
Change-Id: Iba57c9494012c9e0ae9e5ffaa63b9b2bd2c77492
2020-11-17 10:50:19 -08:00
Colin Cross
06fa588d1a Store SingletonMakeVarsProviders in the config
Store SingletonMakeVarsProviders in the config instead of a global
variable to avoid races between tests running in parallel.

Test: all soong tests
Change-Id: I2ab64f368b5ac673fd985399d4421ed018abc562
2020-11-17 10:47:24 -08:00
Ulyana Trafimovich
cdcfd6e711 Merge changes Iebfbf2ff,Ibd974268 am: d8d8e726a5 am: c4232f60d6 am: f0c0057668 am: cd1d3a2141
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1478656

Change-Id: I128e7ce333b29eb55c478e1df7010cb196701dc1
2020-11-17 12:23:17 +00:00
Ulyana Trafimovich
d8d8e726a5 Merge changes Iebfbf2ff,Ibd974268
* changes:
  Rename fields and methods to reflect class loader context changes.
  Do not add dependencies of shared SDK libraries to manifest_fixer.
2020-11-17 10:22:00 +00:00
Colin Cross
17f97caac1 Merge "Revert "Annotate dependency tags for dependencies of installed files"" am: e3d308b5a5 am: 1e9bf4a2d4 am: 1c4a64d945 am: e0d4766afe
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1500597

Change-Id: Ic89cbe63f9c323d64d5f937ee8f8d9ec08da1af8
2020-11-17 07:55:11 +00:00
Colin Cross
e3d308b5a5 Merge "Revert "Annotate dependency tags for dependencies of installed files"" 2020-11-17 06:32:57 +00:00
Colin Cross
b5ae193b8f Revert "Annotate dependency tags for dependencies of installed files"
This reverts commit 62a0cfd054.

Reason for revert: b/173475545

Change-Id: I4e834200c8e68dfa1b8144dfd1fa95ca68554980
2020-11-17 06:32:06 +00:00
Joseph Murphy
9103539bf5 Merge "Adds a workaround to fix version inconsistency" am: bac4ee008b am: 10fa2d924e am: bb47531ab0 am: 905594face
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1402212

Change-Id: I267d32ba8da5c933dd2fa9719a6d2e4a4e06100a
2020-11-17 03:23:02 +00:00
Colin Cross
b1ed155759 Merge "Replace android.WriteFile rule with android.WriteFileRule" am: 1af783fae7 am: e37a8e2d51 am: 104085c573 am: ba9cb68851
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1498169

Change-Id: I46cf9e2375924e1ac47f2163587f87aa70e2c940
2020-11-17 01:49:26 +00:00
Colin Cross
fcd0274015 Merge changes Ic22603a5,I5330b571 am: f15c0558bf am: 6ae2d3dc85 am: 24e1b2cff9 am: b8ef5aa2aa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1494957

Change-Id: Idfa7e78b42d6dcab2cee46fdf7f4a9ddd5ab20e6
2020-11-17 01:48:55 +00:00
Joseph Murphy
bac4ee008b Merge "Adds a workaround to fix version inconsistency" 2020-11-17 01:23:39 +00:00
Colin Cross
1af783fae7 Merge "Replace android.WriteFile rule with android.WriteFileRule" 2020-11-16 23:11:41 +00:00
Colin Cross
f15c0558bf Merge changes Ic22603a5,I5330b571
* changes:
  Annotate dependency tags for dependencies of installed files
  Use the the preferred architecture symlink as the tool path if it exists
2020-11-16 23:11:10 +00:00
Ulyana Trafimovich
1d32f9e847 Merge "Add nested class loader subcontext at the proper hierarchy level." am: 0066864a02 am: c5bb9fe652 am: ce8cd22021 am: c5e7aed796
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1486218

Change-Id: I370f20ee9533c0383a7b58abaa3d277200bf5563
2020-11-16 21:17:03 +00:00
Dan Shi
d79572f73e Add unit_test test option in test configs
This change allows a test (native, java, rust or python) to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 172006742
Test: m host-unit-tests
Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
2020-11-16 11:05:00 -08:00
Ulyana Trafimovich
0066864a02 Merge "Add nested class loader subcontext at the proper hierarchy level." 2020-11-16 17:17:29 +00:00
Ulyana Trafimovich
2372c183d4 Merge "Rework class loader context implementation." am: af335a4694 am: 2084c86c1f am: 0d8cbed1b3 am: 250f8f4eb0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1450818

Change-Id: I70e28401eda541bd43af48ac72fa81968255901a
2020-11-16 16:13:47 +00:00
Ulya Trafimovich
b23d28c6e2 Rename fields and methods to reflect class loader context changes.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
2020-11-16 14:59:07 +00:00