Commit Graph

2196 Commits

Author SHA1 Message Date
Colin Cross 9855207d0e Define Soong phony rules in Make
To support dist-for-goals in Soong, we need to define all phony rules
in Make so that dist-for-goals can insert additional dependencies on
them.  Collect all the phony rules in phonySingleton and write them
out as Make rules when Soong is embedded in Make, or as blueprint.Phony
rules when Soong is run standalone.

Bug: 153485543
Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
Merged-In: I68201eff30744b0f487fc4f11f033767b53a627d
(cherry picked from commit c3d87d3112)
2020-06-15 09:46:31 -07:00
Colin Cross f77c720b08 Allow tests to bypass PathForSource existence checks
Forcing every test to specify every file it wants to pass to
PathForSource or PathForModuleSrc is painful to maintain and
doesn't add any value.  Allow tests to reference paths through
PathForSource and PathForModuleSrc without specifying them in
the mock FS.

Bug: 153485543
Test: all soong tests
Change-Id: Ia8a8fd965a338d0645b3721314bf91f50146ad21
Merged-In: Ia8a8fd965a338d0645b3721314bf91f50146ad21
(cherry picked from commit 5e6a797982)
2020-06-15 09:46:31 -07:00
Roland Levillain ada1270ef8 Introduce product variables to select Java code coverage paths in Soong.
Introduce product variables `JavaCoveragePaths` and
`JavaCoverageExcludePaths` (resp. populated from environment variables
`JAVA_COVERAGE_PATHS` and `JAVA_COVERAGE_EXCLUDE_PATHS`). Use them to
control which Java modules are candidate for instrumentation based on
their source path. By default (when `JavaCoveragePaths` is empty),
have all Java module be candidate for instrumentation, to preserve the
existing behavior.

Test: export EMMA_INSTRUMENT=true \
        && export EMMA_INSTRUMENT_FRAMEWORK=true \
        && export JAVA_COVERAGE_PATHS=art \
        && m
Bug: 158212027
Bug: 156284897
Change-Id: Ibe9c1f41ed6110867411952689c5a7ad6536f277
2020-06-15 11:57:31 +01:00
Roland Levillain 5e303f1b31 Merge "Rename native code coverage paths product variables in Soong." am: 2752d926a9 am: c052ef7d33
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1326320

Change-Id: I1a54d986c3e3080588011bab7469f38144a3d748
2020-06-15 10:37:09 +00:00
Roland Levillain 2752d926a9 Merge "Rename native code coverage paths product variables in Soong." 2020-06-15 10:12:10 +00:00
Colin Cross 973d6813cd manual merge of 2ef16cfcd4 to rvc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: I768c3fe568fee764cb0b533e73a3fef719adf30c
2020-06-12 17:49:09 -07:00
Treehugger Robot 6db2306c57 Merge "Use inclusive language in build/soong" 2020-06-12 03:19:02 +00:00
Jaewoong Jung 1d6d3f5901 Merge "Make override modules compatible with prebuilts." am: 3d14ab7b2b am: 3bec2b0468
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1332075

Change-Id: I5b45f6a95217552af1b24c34b94c3dc321531a8b
2020-06-12 01:39:30 +00:00
Jaewoong Jung e50fe61acc Make override modules compatible with prebuilts.
Prebuilt's prefer flag doesn't work against override modules because
override modules are sort of virtual modules that delegate all the work
to their base modules. Therefore, even if a prebuilt module suppresses
installation of its src-counterpart override module, the actual build
actions are still performed in the base module.

This change fixes it by filtering out override modules that are being
replaced by prebuilts.

Test: prebuilt_test.go
Fixes: 152155285
Change-Id: I859b35c0629b2b6258dd1ec5e020ba2c77ff9612
Merged-In: I859b35c0629b2b6258dd1ec5e020ba2c77ff9612
2020-06-11 18:16:50 -07:00
Jaewoong Jung 3d14ab7b2b Merge "Make override modules compatible with prebuilts." 2020-06-12 01:15:45 +00:00
Jaewoong Jung fb25a64fdd Make override modules compatible with prebuilts.
Prebuilt's prefer flag doesn't work against override modules because
override modules are sort of virtual modules that delegate all the work
to their base modules. Therefore, even if a prebuilt module suppresses
installation of its src-counterpart override module, the actual build
actions are still performed in the base module.

This change fixes it by filtering out override modules that are being
replaced by prebuilts.

Test: prebuilt_test.go
Bug: 152155285
Change-Id: I859b35c0629b2b6258dd1ec5e020ba2c77ff9612
2020-06-11 16:01:30 -07:00
Colin Cross 440e0d0542 Use inclusive language in build/soong
Test: m checkbuild
Change-Id: Id07890b7cbc2397291a658ca00e86b43c743aafc
2020-06-11 15:33:16 -07:00
Colin Cross 0f7b0d3652 Merge changes from topics "dist-for-goals", "soong-dist", "tests-PathForSource" am: 1adc63ec3d am: 09420fb0a4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1128033

Change-Id: If7ae1d8ddd1af750688626ef330349d67ac808ef
2020-06-11 20:47:07 +00:00
Colin Cross 4aa6fbc9d5 Define Soong phony rules in Make am: c3d87d3112 am: 970fd93b92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325397

Change-Id: I44eba43a7c316b9cb9696d02962a84d0c1d8ebed
2020-06-11 20:47:03 +00:00
Colin Cross 300b266264 resolve merge conflicts of a73ffc21e0 to rvc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: Ie8ad8a9e91bf4a86c90060b15dc88f9860539637
2020-06-11 12:12:30 -07:00
Colin Cross 970fd93b92 Define Soong phony rules in Make am: c3d87d3112
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325397

Change-Id: Ia6a1f96c75c660525127c25472327dd78ba58124
2020-06-11 18:42:02 +00:00
Colin Cross 439675bf9d Allow tests to bypass PathForSource existence checks am: 5e6a797982
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325394

Change-Id: Iba9e38624aef891770a7e64f10ca691462c498b8
2020-06-11 18:41:55 +00:00
Colin Cross 1adc63ec3d Merge changes from topics "dist-for-goals", "soong-dist", "tests-PathForSource"
* changes:
  Add DistForGoal to MakeVarsContext
  Define Soong phony rules in Make
  Remove paths from cc.TestConfig
  Remove most paths from java.TestConfig
  Allow tests to bypass PathForSource existence checks
2020-06-11 18:36:18 +00:00
Elliott Hughes f48d50bfb7 Merge "Remove TARGET_PREFER_32_BIT support." am: a82ad479a4 am: 274a80c492
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1289612

Change-Id: I8862a464aa374922dadedd68e47d1705b8ce5836
2020-06-10 18:36:54 +00:00
Elliott Hughes a82ad479a4 Merge "Remove TARGET_PREFER_32_BIT support." 2020-06-10 18:07:06 +00:00
Roland Levillain 4f5297b438 Rename native code coverage paths product variables in Soong.
Rename `CoveragePath` and `CoverageExcludePaths` as
`NativeCoveragePath` and `NativeCoverageExcludePaths` (resp.).
Also rename function `android.CoverageEnabledForPath` as
`android.NativeCoverageEnabledForPath`.

Test: m nothing
Bug: 158212027
Change-Id: Id2c11a638e88088096420b537effa866d7667304
2020-06-10 13:00:07 +01:00
Colin Cross 3cda0d8df9 Add DistForGoal to MakeVarsContext
Add methods to MakeVarsContext to allow Singletons to dist
artifacts without manually adding $(dist-for-goals) in Make.

Test: m checkbuild
Change-Id: Ia5ddb31afe29329f2df0ae1297ed963c8c28e590
2020-06-09 14:38:51 -07:00
Colin Cross c3d87d3112 Define Soong phony rules in Make
To support dist-for-goals in Soong, we need to define all phony rules
in Make so that dist-for-goals can insert additional dependencies on
them.  Collect all the phony rules in phonySingleton and write them
out as Make rules when Soong is embedded in Make, or as blueprint.Phony
rules when Soong is run standalone.

Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
2020-06-09 14:38:50 -07:00
Victor Khimenko 78f654c6cf Make it possible to specify separate rules for native_bridge case
This change make it possible to specify separate rules for native-bridge
case and non-native-bridge case.

Bug: http://b/153609531

Test: build 4arch product

Change-Id: I60145bbb9c94318f14af3cabd9f5960fc9ee62de
Merged-In: I60145bbb9c94318f14af3cabd9f5960fc9ee62de
2020-06-09 23:35:37 +02:00
Colin Cross 5e6a797982 Allow tests to bypass PathForSource existence checks
Forcing every test to specify every file it wants to pass to
PathForSource or PathForModuleSrc is painful to maintain and
doesn't add any value.  Allow tests to reference paths through
PathForSource and PathForModuleSrc without specifying them in
the mock FS.

Test: all soong tests
Change-Id: Ia8a8fd965a338d0645b3721314bf91f50146ad21
2020-06-09 14:23:11 -07:00
Victor Khimenko a7ce2945bd Merge "Make it possible to specify separate rules for native_bridge case" am: bf488e10e8 am: b9b5662e3f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1306133

Change-Id: I86837a0a58d6c7e55715da551b7fd0c5e54df19e
2020-06-09 18:04:06 +00:00
Victor Khimenko bf488e10e8 Merge "Make it possible to specify separate rules for native_bridge case" 2020-06-09 17:41:28 +00:00
Yo Chiang bba545e039 VNDK listing contains device modules only
Fix a bug where host-only modules were incorrectly listed as VNDK.
Also refactor VndkMutator() / apexVndkDepsMutator() module skipping
logic.

Bug: 158543482
Test: Add unit test to cc/cc_test.go
Change-Id: I50b09f526cbc081149d8241c2a091e3ee48ef4d7
2020-06-09 22:10:53 +08:00
Victor Khimenko c26fcf4947 Make it possible to specify separate rules for native_bridge case
This change make it possible to specify separate rules for native-bridge
case and non-native-bridge case.

Bug: http://b/153609531

Test: build 4arch product

Change-Id: I60145bbb9c94318f14af3cabd9f5960fc9ee62de
2020-06-09 13:31:37 +02:00
Elliott Hughes 79ae341d4b Remove TARGET_PREFER_32_BIT support.
Bug: https://issuetracker.google.com/138812821
Test: builds
Change-Id: If96cccbd82ba1311165d61c947c928c6e7cd5593
2020-06-08 16:37:13 -07:00
David Srbecky 07656410df Add SrcPath to InstallHookContext
Needed by ART to find the intermediate files so that it
can also install them in testcases directory for tests.

Change-Id: If1b2ad132632c5dc7c6c7573b56680e2f422594a
2020-06-04 01:26:16 +01:00
Orion Hodson 4a19d08d39 Merge "Add some app modules to the allowed whitelist." 2020-06-03 07:29:51 +00:00
Jaewoong Jung fccad6b098 Soong package structure refactoring
Give prebuilt_etc and sh_binary their own packages and split the
gigantic main Android.bp up to small, per-package ones.

(This is a cherry-pick change.)

Test: m nothing, TreeHugger
Bug: 156980228
Change-Id: I7b00cd344b9f16861f1ff39edf0029f016b853d0
Merged-In: I7b00cd344b9f16861f1ff39edf0029f016b853d0
2020-06-02 14:35:04 -07:00
Jaewoong Jung 8066ebc38f Merge "Soong package structure refactoring" am: 264700345d am: ca9ed9158d
Original change: undetermined

Change-Id: I5cd95c02ab8af420dc2b7166ba24bdf0c7dc6496
2020-06-02 16:57:16 +00:00
Jaewoong Jung 4b79e98a6e Soong package structure refactoring
Give prebuilt_etc and sh_binary their own packages and split the
gigantic main Android.bp up to small, per-package ones.

Test: m nothing, TreeHugger
Bug: 156980228
Change-Id: I7b00cd344b9f16861f1ff39edf0029f016b853d0
2020-06-01 13:44:48 -07:00
Treehugger Robot a034aecb73 Merge "Improved formatting of a module list in a panic message." am: a91b64d3ee am: 31771f8f14
Change-Id: I5a7fdb194011300b86a42f8dd8b8dfcf95e6d3d3
2020-06-01 16:58:01 +00:00
Treehugger Robot a91b64d3ee Merge "Improved formatting of a module list in a panic message." 2020-06-01 16:20:50 +00:00
Jiyong Park 327b057e84 Merge "Notice file embededd in APEX is deterministic" into rvc-dev 2020-05-30 22:35:47 +00:00
Jiyong Park 402ace6c25 Notice file embededd in APEX is deterministic
Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 157724521
Test: m
Merged-In: I25f6cd9dd0679af6acfc2594314d11fa53ae2151
(cherry picked from commit 33c7736936)
Change-Id: I25f6cd9dd0679af6acfc2594314d11fa53ae2151
2020-05-30 12:11:16 +00:00
Treehugger Robot 94d161a3c7 Merge "Notice file embededd in APEX is deterministic" am: 9980c6e111 am: bd7f948507
Change-Id: I2cf22542513eff83fefef1503954015ffd3be6a9
2020-05-30 08:30:11 +00:00
Treehugger Robot 9980c6e111 Merge "Notice file embededd in APEX is deterministic" 2020-05-30 07:54:31 +00:00
TreeHugger Robot 42ffc3f000 Merge "Refactor RBE support for Javac/R8/D8 to use the remoteexec package." into rvc-dev 2020-05-29 19:33:20 +00:00
Paul Duffin 05bf1191fa Merge "Fix prebuilt test on mac" am: 75ab309e33 am: 36c5664a30
Change-Id: I9a7e0e98152b00a8178e5c4fa9520b080c7f7e79
2020-05-29 13:57:25 +00:00
Yo Chiang da0ce643af Merge "Add symlinks support for prebuilt_etc modules" am: cb240bc9c1 am: 6a63341a93
Change-Id: If9bfe3e9b4df1f10b4075f9ed48e603264d378a8
2020-05-29 13:57:04 +00:00
Jiyong Park 33c7736936 Notice file embededd in APEX is deterministic
Bug: 157724521
Test: m
Change-Id: I25f6cd9dd0679af6acfc2594314d11fa53ae2151
2020-05-29 22:00:16 +09:00
Orion Hodson 6c27abd294 Merge "Add some app modules to the allowed whitelist." into rvc-dev-plus-aosp 2020-05-29 11:16:40 +00:00
Dan Albert 555760552b Add some app modules to the allowed whitelist.
Test: treehugger
Bug: 152482542
Change-Id: Ia7adf690cd6dca1408ae0a340860eaeae6c1d4b4
Merged-In: Ia7adf690cd6dca1408ae0a340860eaeae6c1d4b4
(cherry picked from commit 6b6d387a75)
Exempt-From-Owner-Approval: already +2'ed by owner
2020-05-29 11:08:38 +00:00
Paul Duffin 69304cf655 Fix prebuilt test on mac
Bug: 157707511
Test: m nothing
Change-Id: I350fe00040e0c8be8e4fa625798c3c7653d72037
2020-05-29 08:01:00 +01:00
Yo Chiang cb240bc9c1 Merge "Add symlinks support for prebuilt_etc modules" 2020-05-29 06:36:19 +00:00
Martin Stjernholm b9243e921f Merge "Fall back to the source module for variants that the corresponding prebuilt doesn't define." am: 1b2bae1ba5 am: 45f0028d13
Change-Id: Iccd954c014135ecd1a6e38f44cc5d943b39992fb
2020-05-28 20:43:49 +00:00
Martin Stjernholm 009a9dc4ac Fall back to the source module for variants that the corresponding
prebuilt doesn't define.

Test: m
Test: "m" on a platform tree with prebuilts/runtime in the manifest
Bug: 151303681
Change-Id: I8e10579c5daa79e82009a0c3060cde76cdf520e9
2020-05-28 13:17:21 +01:00
Artur Satayev 07d215215b Merge changes I4ab7e1a3,Ib525b2f5,I2d4c54fb into rvc-dev
* changes:
  Generate combined deps-info for all updatable modules.
  Remove ApexBundleDepsInfo.MinSdkVersion()
  Add "updatable" property to ApexModule interface.
2020-05-27 20:58:27 +00:00
Artur Satayev 2b4b7bbe82 Generate combined deps-info for all updatable modules.
Introduce a singleton apex rule to merge contents of individual
deps-info results into a single output file.

Bug: 149622332
Test: m
Change-Id: I4ab7e1a3527fead97a81a5a2cb0e1e93a429117c
Merged-In: I4ab7e1a3527fead97a81a5a2cb0e1e93a429117c
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 849f844252)
2020-05-27 17:51:18 +01:00
Jooyung Han 93a06c10e9 Remove ApexBundleDepsInfo.MinSdkVersion()
For java.AndroidApp app, app.MinSdkVersion() was selected from
ApexBundleDepsInfo, not from java.Module.
This caused app.MinSdkVersion() to return "" always.

Besides, having two embeded fields and relying on depth to choose one of
them makes it hard to read.

Bug: 156537348
Test: m
Merged-In: Ib525b2f5132c596db8e33492d0a565ea23e91d1c
Change-Id: Ib525b2f5132c596db8e33492d0a565ea23e91d1c
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 98d63e1cc7)
2020-05-27 17:51:14 +01:00
Ulya Trafimovich c0eb0b1ae5 Add "updatable" property to ApexModule interface.
For a given variant of a module that implements ApexModule interface,
the "updatable" property tests if this variant comes from an updatable
apex. For platform variants it is always false.

Test: lunch aosp_walleye-userdebug && m nothing
Bug: 138994281
Merged-In: I2d4c54fb397e29dc9b3203be7fb17be4536529f7
Change-Id: I2d4c54fb397e29dc9b3203be7fb17be4536529f7
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 7c140d828a)
2020-05-27 17:50:51 +01:00
David Srbecky 38b2a86091 Merge "Allow the user to explicitly set the java Uncompress_dex property." 2020-05-27 13:45:29 +00:00
Dan Albert e2054a9f9d Add some app modules to the allowed whitelist.
Test: treehugger
Bug: 152482542
Change-Id: Ia7adf690cd6dca1408ae0a340860eaeae6c1d4b4
Merged-In: Ia7adf690cd6dca1408ae0a340860eaeae6c1d4b4
(cherry picked from commit 6b6d387a75)
2020-05-27 14:15:57 +01:00
Yo Chiang 3d64d494d2 Add symlinks support for prebuilt_etc modules
Filenames specified in the "symlinks" property are passed to
LOCAL_MODULE_SYMLINKS, and kati would install these symlinks.

For example:
```
prebuilt_etc {
  name: "foo",
  symlinks: [
    "bar",
    "baz",
  ],
}
```

Installs these files on device:
- system/etc/foo
- system/etc/bar -> foo
- system/etc/baz -> foo

Bug: 157537895
Test: Add some symlinks to a prebuilt_etc module and check artifact
Change-Id: If50844e8a212a966be931117cfdff5bf73aadf25
2020-05-27 17:56:39 +08:00
Lukács T. Berki eff43bf1cf Merge "Call Delve using exec() instead of "dlv attach"." am: ad37304762 am: bb751686ae
Change-Id: I57bfe2cc7afa88b83d54162c18fdae24fa825857
2020-05-27 09:05:02 +00:00
Lukács T. Berki ad37304762 Merge "Call Delve using exec() instead of "dlv attach"." 2020-05-27 08:33:32 +00:00
Treehugger Robot eb8c84ed4e Merge "AIDEGen: Add path attribute to okhttp module." am: c7c7e466ac am: d3205312ed
Change-Id: I229231b44e448f72d896545ef525a6c2f39a5e1f
2020-05-27 07:42:54 +00:00
Treehugger Robot c7c7e466ac Merge "AIDEGen: Add path attribute to okhttp module." 2020-05-27 07:18:19 +00:00
TreeHugger Robot e5138b82ab Merge "Allow the user to explicitly set the java Uncompress_dex property." into rvc-dev am: 6270b775de
Change-Id: If73110d3028a1accf0cf61e6baa3b265f443f763
2020-05-27 04:58:51 +00:00
satayev 84ff6be8e9 Merge "Generate combined deps-info for all updatable modules." am: ede18549e5 am: 3a0a6427bd
Change-Id: I2ae338e9f883695260d922e6607c73770a4c8c04
2020-05-26 14:03:00 +00:00
satayev ede18549e5 Merge "Generate combined deps-info for all updatable modules." 2020-05-26 13:28:28 +00:00
Treehugger Robot ac80afa642 Refactor RBE support for Javac/R8/D8 to use the remoteexec package.
Bug: b/156613606
Test: build with and without RBE_JAVAC/RBE_R8/RBE_D8 set.
Change-Id: I1607f8cfb4d2c3cbb3672152bbeb561d9968bc60
Merged-In: I1607f8cfb4d2c3cbb3672152bbeb561d9968bc60
2020-05-25 10:57:47 -04:00
David Srbecky 98c71228f1 Allow the user to explicitly set the java Uncompress_dex property.
ART tests need to explicitly control the compression.

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:02:02 +00:00
David Srbecky e033cbae40 Allow the user to explicitly set the java Uncompress_dex property.
ART tests need to explicitly control the compression.

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
Merged-In: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:59:25 +01:00
bralee 1fbf44089e AIDEGen: Add path attribute to okhttp module.
Bug: 157115477
Test: 1. aidegen Settings -n
         open merged_module_info.json
	 "okhttp": {
	     ...
	     "path": ["external/okhttp"]
         },
	 modules: "mimemap-testing-res.jar", "mimemap-res.jar"
                  "services.core.priorityboosted", "framework-tethering"
                  "bouncycastle_ike_digests",
                  "robolectric-sqlite4java-native"
                  have the 'path' attribute.
Change-Id: If3628887866c29dcc948dd427727f175a5199edc
2020-05-21 11:25:51 +08:00
Ulyana Trafimovich 6697660b60 Merge "Raise an error instead of panic in SplitApexJarPairs." am: 7645764e58 am: 2a6f9587de
Change-Id: I575e690660b78c8eeb89525408b8cb90c0bcf1d5
2020-05-20 08:57:32 +00:00
Ulyana Trafimovich 7645764e58 Merge "Raise an error instead of panic in SplitApexJarPairs." 2020-05-20 08:28:43 +00:00
Paul Duffin d9951cf9ce Merge "Syntax check generated Android.bp snapshot" am: 6b3ca917b0 am: 2b90c4a463
Change-Id: I844998d95917a4526f07887a5c2a5432450d6c20
2020-05-19 08:31:04 +00:00
Paul Duffin 6b3ca917b0 Merge "Syntax check generated Android.bp snapshot" 2020-05-19 07:53:27 +00:00
Lukacs T. Berki a5e0f710c2 Call Delve using exec() instead of "dlv attach".
"dlv attach":

- Spams the terminal
- Requires sysctl -w kernel.yama.ptrace_scope=0
- Apparently, does not allow the debugger to inspect variables

Test: Manual.
Change-Id: I625369effaf5abda2b5d884c8ce5bde7247774eb
2020-05-18 09:50:18 +02:00
Felix a20a875fa9 android/: Rename Plat->SystemExt*SepolicyDirs
Align with changes in system/sepolicy and build/make.

Signed-off-by: Felix <google@ix5.org>
Change-Id: I326962648a78e68e8cc83fdc22d8274eaecb8c8c
2020-05-17 18:28:35 +02:00
Martin Stjernholm adb189529a Fix special case when appending a visibility rule to //visibility:private.
Test: m nothing
Bug: 151303681
Merged-In: Ibe7e953219e4660c653063e87cb08407a2cb513d
Change-Id: Ibe7e953219e4660c653063e87cb08407a2cb513d
(cherry picked from commit 64aeaaddef)
2020-05-16 12:07:03 +01:00
Martin Stjernholm f8533bc636 Add explicit visibility on the self package in EffectiveVisibilityRules.
Modules in a package is implicitly visible within the same package.
When making effective visibility rules which work from another location
that visibility needs to be mentioned explicitly. In practice this
allows prebuilts to remain visible to other modules in the source
package when the prebuilts are preferred.

Test: m nothing
Test: m conscrypt-module-sdk, check that the snapshot Soong modules give
  visibility to //external/conscrypt
Bug: 151303681
Merged-In: I404f6e5ca7021974a8c7be5e4d6b4982c050b8a5
Change-Id: I404f6e5ca7021974a8c7be5e4d6b4982c050b8a5
(cherry picked from commit 0641d189d0)
2020-05-16 12:07:03 +01:00
Martin Stjernholm 68e9d96d61 Don't print :__pkg__ for package rules, since that's the default.
To reduce clutter a little.

// Added for rvc-dev. Used this bug as it is the bug that needs all the build changes.
Bug: 155164730

Test: m nothing
Merged-In: I0d2d86f00c3d38e603d6f58c4b1dd9a4170bf819
Change-Id: I0d2d86f00c3d38e603d6f58c4b1dd9a4170bf819
(cherry picked from commit 01407c525a)
2020-05-16 12:06:54 +01:00
Artur Satayev 849f844252 Generate combined deps-info for all updatable modules.
Introduce a singleton apex rule to merge contents of individual
deps-info results into a single output file.

Bug: 149622332
Test: m
Change-Id: I4ab7e1a3527fead97a81a5a2cb0e1e93a429117c
2020-05-15 19:10:19 +01:00
Colin Cross eb03296b57 Don't use SDK variant for vendor JNI libraries
Vendor JNI libraries already have stable APIs enforced by the VNDK,
they shouldn't use SDK variants.

Bug: 156225490
Test: TestJNISDK
Change-Id: I21ba67e8e9fb05016caf5888129adc1a939545c2
Merged-In: I21ba67e8e9fb05016caf5888129adc1a939545c2
(cherry picked from commit c2d24050c5)
2020-05-15 10:13:42 -07:00
Treehugger Robot bd61b834eb Merge "Fix special case when appending a visibility rule to //visibility:private." am: e3fa145692 am: 0b951c0822
Change-Id: Ifc41f68442fe3a7511646afe91a68af419f3d109
2020-05-15 14:41:46 +00:00
Treehugger Robot e3fa145692 Merge "Fix special case when appending a visibility rule to //visibility:private." 2020-05-15 14:08:24 +00:00
Jooyung Han b442db2b39 Merge "Remove ApexBundleDepsInfo.MinSdkVersion()" am: b9d65417c3 am: 06febdf2bb
Change-Id: Ie3f0e84cca29f26bd607e43a96592e078c62ead3
2020-05-15 00:17:57 +00:00
Colin Cross 13f9a2ec06 Merge "Don't use SDK variant for vendor JNI libraries" am: cb1d161666 am: d75524f322
Change-Id: I5684f17281e31e8d6ffc9d0c7541d55c1bbd0bba
2020-05-15 00:17:18 +00:00
Jooyung Han b9d65417c3 Merge "Remove ApexBundleDepsInfo.MinSdkVersion()" 2020-05-14 23:13:21 +00:00
Colin Cross cb1d161666 Merge "Don't use SDK variant for vendor JNI libraries" 2020-05-14 22:59:47 +00:00
Martin Stjernholm 9d28688c08 Merge changes I404f6e5c,I0d2d86f0 am: 08f72a9709 am: 52deb9ba96
Change-Id: I840a2f106fa2a04b4f4c8d5d905d820e1ae6e52f
2020-05-14 22:22:26 +00:00
Martin Stjernholm 64aeaaddef Fix special case when appending a visibility rule to //visibility:private.
Test: m nothing
Bug: 151303681
Change-Id: Ibe7e953219e4660c653063e87cb08407a2cb513d
2020-05-14 16:52:24 +01:00
Martin Stjernholm 0641d189d0 Add explicit visibility on the self package in EffectiveVisibilityRules.
Modules in a package is implicitly visible within the same package.
When making effective visibility rules which work from another location
that visibility needs to be mentioned explicitly. In practice this
allows prebuilts to remain visible to other modules in the source
package when the prebuilts are preferred.

Test: m nothing
Test: m conscrypt-module-sdk, check that the snapshot Soong modules give
  visibility to //external/conscrypt
Bug: 151303681
Change-Id: I404f6e5ca7021974a8c7be5e4d6b4982c050b8a5
2020-05-14 16:50:59 +01:00
Martin Stjernholm 01407c525a Don't print :__pkg__ for package rules, since that's the default.
To reduce clutter a little.

Test: m nothing
Change-Id: I0d2d86f00c3d38e603d6f58c4b1dd9a4170bf819
2020-05-14 16:50:59 +01:00
Jooyung Han 98d63e1cc7 Remove ApexBundleDepsInfo.MinSdkVersion()
For java.AndroidApp app, app.MinSdkVersion() was selected from
ApexBundleDepsInfo, not from java.Module.
This caused app.MinSdkVersion() to return "" always.

Besides, having two embeded fields and relying on depth to choose one of
them makes it hard to read.

Bug: 156537348
Test: m
Change-Id: Ib525b2f5132c596db8e33492d0a565ea23e91d1c
2020-05-14 07:44:03 +09:00
Paul Duffin dd89a28104 java_sdk_library_import: Propagate prefer to child modules
Bug: 155164730
Test: m nothing
Merged-In: Idb06d79baf346ac570beada79880814c5ef6bb50
Change-Id: Idb06d79baf346ac570beada79880814c5ef6bb50
(cherry picked from commit 38b5785e3f)
2020-05-13 23:39:01 +01:00
Paul Duffin 06ccf23389 java_sdk_library_import: Propagate prefer to child modules am: 38b5785e3f am: b08ba780c5
Change-Id: I88dbbef53348faa9dfdaa0cbe41f4fb2e5c7fd24
2020-05-13 22:15:17 +00:00
Paul Duffin 38b5785e3f java_sdk_library_import: Propagate prefer to child modules
Bug: 155164730
Test: m nothing
Change-Id: Idb06d79baf346ac570beada79880814c5ef6bb50
2020-05-13 20:40:53 +01:00
Colin Cross c2d24050c5 Don't use SDK variant for vendor JNI libraries
Vendor JNI libraries already have stable APIs enforced by the VNDK,
they shouldn't use SDK variants.

Bug: 156225490
Test: TestJNISDK
Change-Id: I21ba67e8e9fb05016caf5888129adc1a939545c2
2020-05-13 11:10:38 -07:00
Paul Duffin 1f4ad0e44d Remove unused Module.visibility() method
Bug: 155787200
Test: m nothing
Merged-In: Iee7a9ab9d816ed1948e2c7cde23f9907cfda337d
Change-Id: Iee7a9ab9d816ed1948e2c7cde23f9907cfda337d
(cherry picked from commit 36c5b8d0b8)
2020-05-13 13:50:34 +01:00
Paul Duffin 31c43e7fb3 Add //visibility:override to allow control over inheritance
Visibility rules can be 'inherited' in one of two ways. Either from
defaults or from a module that called ctx.CreateModule(...).
Previously, in both cases the inheriting module could only append
additional visibility rules to the end of the inherited rules. That
made it impossible to restrict the visibility by removing or ignore
inherited rules.

The //visibility:override rectifies that by allowing the inheriting
module to ignore all the rules that they would have inherited. It can
only go at the beginning of a list of rules specified in a module but
after defaults are applied it can end up in the middle of a list of
rules. In that case it behaves as if all the rules up to and including
the //visibility:override rule were discarded.

It can be used with //visibility:private to override
//visibility:public and vice versa.

Bug: 155787200
Test: m nothing
Merged-In: I8a9c9c5a1bdceaee387c08864ae2b34629e0d46f
Change-Id: I8a9c9c5a1bdceaee387c08864ae2b34629e0d46f
(cherry picked from commit 51084ff6cf)
2020-05-13 13:50:34 +01:00
Treehugger Robot 8c30912b64 Merge "Remove unused Module.visibility() method" am: 717e50c630 am: 5c9c0e79e0
Change-Id: Iebd9e08a399a827bda6441326d7884ae5cd1bbf7
2020-05-13 12:22:59 +00:00
Treehugger Robot ecc80fce50 Merge "Add //visibility:override to allow control over inheritance" am: 5bc07e59e3 am: 290ae01f42
Change-Id: I4018d83a19e854d5ba38452ac76f784b3fe78061
2020-05-13 12:22:52 +00:00
Treehugger Robot 717e50c630 Merge "Remove unused Module.visibility() method" 2020-05-13 11:53:49 +00:00
Treehugger Robot 5bc07e59e3 Merge "Add //visibility:override to allow control over inheritance" 2020-05-13 11:53:43 +00:00
Paul Duffin cd9b6971c4 Allow sdk_version: "none" to be used in prebuilts/
Bug: 156354511
Test: m nothing
Merged-In: Iffce78cbce88a8341146bf19e78acf25fc69f2b0
Change-Id: Iffce78cbce88a8341146bf19e78acf25fc69f2b0
(cherry picked from commit e5c3b85ee5)
2020-05-13 11:27:44 +01:00
Treehugger Robot c13cd601e8 Merge "Allow sdk_version: "none" to be used in prebuilts/" am: 46c907627b am: 16574cdea8
Change-Id: I0eda60684cd36ebd4174a26fbef8f03f05e0e2c1
2020-05-13 08:01:09 +00:00
Martin Stjernholm 4c0212453a Improved formatting of a module list in a panic message.
Test: m nothing
Change-Id: I8816359232ef0d8e2352d2f47bf6182fb3c57768
2020-05-13 02:36:24 +01:00
Paul Duffin 36c5b8d0b8 Remove unused Module.visibility() method
Bug: 155787200
Test: m nothing
Change-Id: Iee7a9ab9d816ed1948e2c7cde23f9907cfda337d
2020-05-12 20:07:46 +01:00
Paul Duffin 51084ff6cf Add //visibility:override to allow control over inheritance
Visibility rules can be 'inherited' in one of two ways. Either from
defaults or from a module that called ctx.CreateModule(...).
Previously, in both cases the inheriting module could only append
additional visibility rules to the end of the inherited rules. That
made it impossible to restrict the visibility by removing or ignore
inherited rules.

The //visibility:override rectifies that by allowing the inheriting
module to ignore all the rules that they would have inherited. It can
only go at the beginning of a list of rules specified in a module but
after defaults are applied it can end up in the middle of a list of
rules. In that case it behaves as if all the rules up to and including
the //visibility:override rule were discarded.

It can be used with //visibility:private to override
//visibility:public and vice versa.

Bug: 155787200
Test: m nothing
Change-Id: I8a9c9c5a1bdceaee387c08864ae2b34629e0d46f
2020-05-12 20:07:46 +01:00
Paul Duffin e5c3b85ee5 Allow sdk_version: "none" to be used in prebuilts/
Bug: 156354511
Test: m nothing
Change-Id: Iffce78cbce88a8341146bf19e78acf25fc69f2b0
2020-05-12 15:33:52 +01:00
Ulya Trafimovich 8640ab9c26 Raise an error instead of panic in SplitApexJarPairs.
Test: aosp_walleye-userdebug boots
Change-Id: I9a1c4ec5c8862b1936820b3cee6db9a85015cb0e
2020-05-12 12:27:50 +01:00
Paul Duffin f88d8e032f Syntax check generated Android.bp snapshot
Checks the syntax of the Android.bp file generated for the sdk
snapshot. While this will not detect all possible problems with the
generated Android.bp file it will detect some and it is far better to
detect those issues during generation than when it is unpacked and
used.

Bug: 155628860
Test: m nothing
Change-Id: Ieec86a7a49fa2e3bd8b9f83aca540114232a3476
2020-05-12 09:52:41 +01:00
Paul Duffin 4d125bd8ad Retry: Adds support for 'ignored-on-host'
Adds a filter mechanism that can exclude property values from being
included in the common value extraction. That is needed to prevent the
snapshot mechanism from generating invalid output for properties that
are ignored on host (and have their values cleared) and which are not
tagged with `android:"arch_variant"`.

Changes:
* Updates the documentation of SdkMemberType to explain what effect
  the 'ignored-on-host' tag has.
* Adds some tests for this new mechanism.

Bug: 155628860
Test: m nothing
Merged-In: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
Change-Id: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
(cherry picked from commit c459f89fb4)
2020-05-10 23:56:28 +01:00
Paul Duffin 08385bf9ac Retry: Detect invalid arch specific properties in snapshot
Previously, the snapshot code did not know whether a specific property
could be arch specific or not and assumed that they all were which
meant that it could generate snapshots containing arch specific values
for properties that are not arch specific and so would fail when
unpacked.

This change requires arch specific fields in SdkMemberProperties to be
tagged as such using `android:"arch_variant"` (just as in module input
property structures). Any property without that must have properties
that are common across all variants.

Bug: 155628860
Test: m nothing
Merged-In: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
Change-Id: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
(cherry picked from commit 864e1b45db)
2020-05-10 23:56:18 +01:00
Paul Duffin 688803a2b9 Merge "Retry: Adds support for 'ignored-on-host'" am: ad5191885d am: 69f446d04a
Change-Id: Id0ac010aa67ab3e628adc2068a676eaf5410d5e4
2020-05-09 07:59:37 +00:00
Paul Duffin 765e7b7407 Merge "Retry: Detect invalid arch specific properties in snapshot" am: 385378bf99 am: ba539d0faf
Change-Id: I8bec9a34eef34bf78c44f7836aba2496b117086f
2020-05-09 07:59:24 +00:00
Paul Duffin c459f89fb4 Retry: Adds support for 'ignored-on-host'
Adds a filter mechanism that can exclude property values from being
included in the common value extraction. That is needed to prevent the
snapshot mechanism from generating invalid output for properties that
are ignored on host (and have their values cleared) and which are not
tagged with `android:"arch_variant"`.

Changes:
* Updates the documentation of SdkMemberType to explain what effect
  the 'ignored-on-host' tag has.
* Adds some tests for this new mechanism.

Bug: 155628860
Test: m nothing
Change-Id: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
2020-05-08 22:32:02 +01:00
Paul Duffin 864e1b45db Retry: Detect invalid arch specific properties in snapshot
Previously, the snapshot code did not know whether a specific property
could be arch specific or not and assumed that they all were which
meant that it could generate snapshots containing arch specific values
for properties that are not arch specific and so would fail when
unpacked.

This change requires arch specific fields in SdkMemberProperties to be
tagged as such using `android:"arch_variant"` (just as in module input
property structures). Any property without that must have properties
that are common across all variants.

Bug: 155628860
Test: m nothing
Change-Id: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
2020-05-08 22:31:56 +01:00
Greg Kaiser 3f1d51dc7e Merge changes from topic "revert-1302576-NGVCIVIIJO" am: a71fe150fa am: 010e45aa06
Change-Id: Idfb961746c35d4efceda1e0da4fc453b92101f3f
2020-05-08 19:51:28 +00:00
Greg Kaiser a71fe150fa Merge changes from topic "revert-1302576-NGVCIVIIJO"
* changes:
  Revert "Detect invalid arch specific properties in snapshot"
  Revert "Adds support for 'ignored-on-host'"
  Revert "Fix snapshot of a host/device cc_library with stubs"
2020-05-08 19:18:40 +00:00
Greg Kaiser e509447c93 Revert "Detect invalid arch specific properties in snapshot"
Revert submission 1302576

Bug: 156054601
Reason for revert: Presumed root cause of build break.
Reverted Changes:
Ifc8116e11:Detect invalid arch specific properties in snapsho...
I7ebd33307:Adds support for 'ignored-on-host'
I167b47a13:Fix snapshot of a host/device cc_library with stub...

Change-Id: Id7eba0bdde5c579e10e9b42d94a7cfab5f34995f
2020-05-08 19:12:34 +00:00
Greg Kaiser e08e03fa96 Revert "Adds support for 'ignored-on-host'"
Revert submission 1302576

Bug: 156054601
Reason for revert: Presumed root cause of build break.
Reverted Changes:
Ifc8116e11:Detect invalid arch specific properties in snapsho...
I7ebd33307:Adds support for 'ignored-on-host'
I167b47a13:Fix snapshot of a host/device cc_library with stub...

Change-Id: I2a7ac0ef0232177eefc26542c11dc675d6f4cab2
2020-05-08 19:12:34 +00:00
Jiyong Park 18d4b2b708 Add GetPathString am: 1c7e962957 am: abf09b50e4
Change-Id: I079dd1d4394b494c225c054d46c5a5eb7fc4f113
2020-05-08 02:48:28 +00:00
Jiyong Park abf09b50e4 Add GetPathString am: 1c7e962957
Change-Id: Iada405f160d8178ec90a1634f22a50cb18215938
2020-05-08 02:35:11 +00:00
Jiyong Park 06938a0a16 Merge changes from topic "no_staticlinking_to_stubs"
* changes:
  Prevent statically linking to a lib providing stable C APIs
  Add GetPathString
2020-05-08 02:12:58 +00:00
Paul Duffin 7bca3ddc0e Merge changes I167b47a1,I7ebd3330,Ifc8116e1 am: af6fbcbcca am: 4b99ceccd6
Change-Id: Id1001db2b0f09868529b3f7b87ddd3e822c14d49
2020-05-07 22:21:06 +00:00
Paul Duffin d7acc7b73e Remove reference to obsolete BuildSnapshot()
Bug: 155628860
Test: m nothing
Merged-In: If673d482e8318b5fbb86780236123b0bd59eb5d3
Change-Id: If673d482e8318b5fbb86780236123b0bd59eb5d3
(cherry picked from commit 425b0eacaa)
2020-05-07 22:59:55 +01:00
Paul Duffin af6fbcbcca Merge changes I167b47a1,I7ebd3330,Ifc8116e1
* changes:
  Fix snapshot of a host/device cc_library with stubs
  Adds support for 'ignored-on-host'
  Detect invalid arch specific properties in snapshot
2020-05-07 21:58:14 +00:00
Ivan Lozano 7c3358dd60 Merge "Add gcov coverage support to Rust modules." am: 6c4e5c05c3 am: acdf2ac701
Change-Id: Id236afb83e583a93020803302a61dbf46904c295
2020-05-07 18:41:29 +00:00
Ivan Lozano 6c4e5c05c3 Merge "Add gcov coverage support to Rust modules." 2020-05-07 17:56:43 +00:00
Paul Duffin 12f67bcf42 Adds support for 'ignored-on-host'
Adds a filter mechanism that can exclude property values from being
included in the common value extraction. That is needed to prevent the
snapshot mechanism from generating invalid output for properties that
are ignored on host (and have their values cleared) and which are not
tagged with `android:"arch_variant"`.

Changes:
* Updates the documentation of SdkMemberType to explain what effect
  the 'ignored-on-host' tag has.
* Adds some tests for this new mechanism.

Bug: 155628860
Test: m nothing
Change-Id: I7ebd333079619dba546bc8c4911d567e0287b676
2020-05-07 18:35:11 +01:00
Paul Duffin ee20962378 Detect invalid arch specific properties in snapshot
Previously, the snapshot code did not know whether a specific property
could be arch specific or not and assumed that they all were which
meant that it could generate snapshots containing arch specific values
for properties that are not arch specific and so would fail when
unpacked.

This change requires arch specific fields in SdkMemberProperties to be
tagged as such using `android:"arch_variant"` (just as in module input
property structures). Any property without that must have properties
that are common across all variants.

Bug: 155628860
Test: m nothing
Change-Id: Ifc8116e11d987cfe7aec2eeaa964f3bbf36b5dc2
2020-05-07 18:35:11 +01:00
Paul Duffin 6b0635adf1 Merge changes If673d482,I98b575b8 am: 38e2fbdc90 am: 6b178d6f7b
Change-Id: I19d639148a482fc950bd9f877359164822047128
2020-05-07 16:15:10 +00:00
Paul Duffin 38e2fbdc90 Merge changes If673d482,I98b575b8
* changes:
  Remove reference to obsolete BuildSnapshot()
  Correct order of parameters to AssertDeepEquals
2020-05-07 15:50:06 +00:00
Paul Duffin 1b115d32b4 Add hook to be called after defaults have been applied
Previously, the only way for a module type to create modules (other
than defining its own mutator) was to register a LoadHook. However,
that is called before defaults are applied so any properties used in
that hook cannot take advantage of defaults, e.g. java_sdk_library
cannot use defaults to set its sdk_version property and have that
affect its child modules.

This change adds a new SetDefaultableHook() to DefaultableModule to
register a hook that is called after any defaults have been applied.

Also adds some tests to ensure that errors in the visibility property
introduced in a DefaultableHook are reported in the gather phase of
visibility processing.

A follow up change will switch java_sdk_library to use that instead
of the AddLoadHook() mechanism.

Bug: 155295806
Test: m checkapi
Merged-In: I13df3115f9e225f7324b6725eaeb16a78cc2538a
Change-Id: I13df3115f9e225f7324b6725eaeb16a78cc2538a
(cherry picked from commit afa9fa104d)
2020-05-07 11:36:57 +01:00
Paul Duffin eedf3f1f4a Move prebuilts mutators after defaults have been applied
A follow up change will add a mechanism for a module to register a hook
that is called after any defaults have been applied. That is intended
for use by modules like java_sdk_library that create child modules that
are dependent upon properties that could be supplied by defaults.

Creating those child modules after prebuilts mutators are run will
cause problems if those child modules clash with prebuilts modules.
Moving the prebuilts mutators after the defaults mutators will fix
that.

Tests are currently being run with the mutators in different orders so
this change also cleans that up so they are consistent with the actual
code that is being run.

Bug: 155295806
Test: m checkbuild
Merged-In: I825c6df09058fb3a45db196661959eb332aca2f3
Change-Id: I825c6df09058fb3a45db196661959eb332aca2f3
(cherry picked from commit c988c8e202)
2020-05-07 11:36:44 +01:00
Paul Duffin 509bb9b7ff Merge changes I13df3115,I825c6df0 am: 955ade6475 am: 4bfed659d9
Change-Id: I62fc47243b57a0423815f74cd94340f66b897e1d
2020-05-07 09:51:20 +00:00
Jiyong Park 1c7e962957 Add GetPathString
The method is a thin wrapper around GetWalkPath and GetTagPath to make
it easy to construct a string representation of the current path.

It was originally inlined in the apex package. This change makes it a
function and moves it to the android package so make it more useful.

Bug: N/A
Test: m
Change-Id: I7e2bc2074baed759d67d9097151c9ac10e34ed31
2020-05-07 16:12:13 +09:00
TreeHugger Robot 93f1d81cc0 Merge "Simplify package by using LoadHook instead of mutators" into rvc-dev 2020-05-07 06:56:29 +00:00
Paul Duffin 425b0eacaa Remove reference to obsolete BuildSnapshot()
Bug: 155628860
Test: m nothing
Change-Id: If673d482e8318b5fbb86780236123b0bd59eb5d3
2020-05-06 18:40:41 +01:00
Artur Satayev 388d39ba9a Introduce min_sdk_version to deps info.
Bug: 149622332
Test: m
Change-Id: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
Merged-In: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 480e25b74f)
2020-05-06 15:01:14 +00:00
Artur Satayev fb0a636f6d Merge "Introduce flat deps info list." into rvc-dev 2020-05-06 13:45:16 +00:00
Paul Duffin afa9fa104d Add hook to be called after defaults have been applied
Previously, the only way for a module type to create modules (other
than defining its own mutator) was to register a LoadHook. However,
that is called before defaults are applied so any properties used in
that hook cannot take advantage of defaults, e.g. java_sdk_library
cannot use defaults to set its sdk_version property and have that
affect its child modules.

This change adds a new SetDefaultableHook() to DefaultableModule to
register a hook that is called after any defaults have been applied.

Also adds some tests to ensure that errors in the visibility property
introduced in a DefaultableHook are reported in the gather phase of
visibility processing.

A follow up change will switch java_sdk_library to use that instead
of the AddLoadHook() mechanism.

Bug: 155295806
Test: m checkapi
Change-Id: I13df3115f9e225f7324b6725eaeb16a78cc2538a
2020-05-06 08:55:19 +01:00
Paul Duffin c988c8e202 Move prebuilts mutators after defaults have been applied
A follow up change will add a mechanism for a module to register a hook
that is called after any defaults have been applied. That is intended
for use by modules like java_sdk_library that create child modules that
are dependent upon properties that could be supplied by defaults.

Creating those child modules after prebuilts mutators are run will
cause problems if those child modules clash with prebuilts modules.
Moving the prebuilts mutators after the defaults mutators will fix
that.

Tests are currently being run with the mutators in different orders so
this change also cleans that up so they are consistent with the actual
code that is being run.

Bug: 155295806
Test: m checkbuild
Change-Id: I825c6df09058fb3a45db196661959eb332aca2f3
2020-05-06 08:55:16 +01:00
Paul Duffin a43e13e5d4 Simplify package by using LoadHook instead of mutators
This was not previously possible due to LoadHooks being run after the
module was registered.

Bug: 155462403
Test: m nothing
Merged-In: Ia8383b9d1272bb12c8a83948753a0e4b0d98a650
Change-Id: Ia8383b9d1272bb12c8a83948753a0e4b0d98a650
(cherry picked from commit cdfcec98bb)
2020-05-06 08:21:39 +01:00
Paul Duffin 6615b30812 Document preArch mutators
Bug: 155295806
Test: m checkbuild
Merged-In: I4cd6647a8707f49363d297a3b3082ef19ba93868
Change-Id: I4cd6647a8707f49363d297a3b3082ef19ba93868
(cherry picked from commit aa4162e71e)
2020-05-06 08:20:34 +01:00
Martin Stjernholm fcb99e07fc Add SDK member support for cc_object.
Test: m nothing
Test: Add
    sdk {
        name: "runtime-module-sdk",
        native_shared_libs: [
            "libc",
            "libdl",
            "libm",
            "ld-android",
        ],
        native_objects: [
            "crtbegin_dynamic",
            "crtbegin_static",
            "crtend_android",
        ],
    }
  to bionic/apex/Android.bp. Then:
    build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
  Take the generated runtime-module-sdk-current.zip and unzip into a
  master-art tree without bionic/, edit the generated Android.bp to
  extend cc_prebuilt_* modules with:
    nocrt: true,
    stl: "none",
    system_shared_libs: [],
    apex_available: ["//apex_available:anyapex"],
    recovery_available: true,
    vendor_available: true,
    ramdisk_available: true,
  Then "m com.android.art.debug". This passes Soong but fails in the
  build step because more members are required.
Bug: 148934017
Merged-In: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
(cherry picked from commit cd07bce437)
2020-05-06 08:17:10 +01:00
Treehugger Robot f1d26b7d78 Merge "Simplify package by using LoadHook instead of mutators" am: 00789cc58b am: c11d79fe52
Change-Id: I6e6a45b00b8f3cbc8967d2474958ae555adf8dc1
2020-05-06 02:53:57 +00:00
Paul Duffin cdfcec98bb Simplify package by using LoadHook instead of mutators
This was not previously possible due to LoadHooks being run after the
module was registered.

Bug: 155462403
Test: m nothing
Change-Id: Ia8383b9d1272bb12c8a83948753a0e4b0d98a650
2020-05-05 20:47:04 +01:00
Artur Satayev 5e7c32d6cb Introduce flat deps info list.
Compared to full list, flat list drops dependency edges and simply
lists all transitive dependencies for a top-level apex bundle.

Bug: 149622332
Test: m, manually build flatlist
Change-Id: Ibd521c96b7aeab90b95965c1b524e0a0152aaf5a
Merged-In: Ibd521c96b7aeab90b95965c1b524e0a0152aaf5a
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit a8bd113a69)
2020-05-05 17:28:41 +00:00
Artur Satayev 334b51730a Export depsInfo into android package.
Move depsInfo into android for easier sharing with APK code.

Bug: 149622332
Test: m, diff'ing outputs for conscrypt module.
Change-Id: If0ee967d37425540e69b4ce9304229d9f2cd86bd
Merged-In: If0ee967d37425540e69b4ce9304229d9f2cd86bd
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 872a144dca)
2020-05-05 16:19:07 +00:00
Paul Duffin 910e564c08 Merge "Document preArch mutators" am: d0666441b5 am: 300c238638
Change-Id: Ib65a5f8e15812637a68aa6c5e2802ce5e8713f6c
2020-05-05 15:49:45 +00:00
Paul Duffin d0666441b5 Merge "Document preArch mutators" 2020-05-05 15:24:16 +00:00
Ivan Lozano a0cd8f9acb Add gcov coverage support to Rust modules.
This adds gcov coverage support for Rust device library and binary
modules (including test modules). Support is provided to pass Rust
static library gcno files to CC modules and visa versa.

Additional changes:
 * Begin mutator added for Rust modules.
 * SuffixInList added to android package.
 * CoverageEnabled added to Coverage interface.
 * CoverageFiles added to LinkableLibrary interface.
 * Fix in coverage mutator for non-CC modules which marked the wrong
   variant as the coverage variant.
 * Added coverage libraries to the cc.GatherRequiredDepsForTest.

Bug: 146448203
Test: NATIVE_COVERAGE=true COVERAGE_PATHS='*' m -j <rust_module>
Change-Id: If20728bdde42a1dd544a35a40f0d981b80a5835f
2020-05-05 10:30:15 -04:00
satayev 49ad72d4ef Merge changes Ie6568cb8,Ibd521c96 am: 292e7c0721 am: a07f9df5d7
Change-Id: I4dcd1f47b080a71a97db0b10c1ebfc45b8d59bdb
2020-05-05 13:14:14 +00:00
satayev 292e7c0721 Merge changes Ie6568cb8,Ibd521c96
* changes:
  Introduce min_sdk_version to deps info.
  Introduce flat deps info list.
2020-05-05 12:47:48 +00:00
Paul Duffin aa4162e71e Document preArch mutators
Bug: 155295806
Test: m checkbuild
Change-Id: I4cd6647a8707f49363d297a3b3082ef19ba93868
2020-05-05 11:35:43 +01:00
satayev d82f528fa3 Merge "Export depsInfo into android package." am: 57769e469b am: ed11483aa6
Change-Id: I103c2e1f0eada4b1cd516cc1a24625d680627824
2020-05-05 10:30:28 +00:00
satayev 57769e469b Merge "Export depsInfo into android package." 2020-05-05 10:00:41 +00:00
Paul Duffin b33d21bdaf Report visibility errors in both check and gather phases
Previously, errors that were found when splitting visibility rules were
only reported in the check phase and simply ignored during the gather
phase. That was because every visibility property that was processed in
the gather phase had already been checked in the check phase. However,
that is not strictly true as it has always been possible to add a
mutator between the check and gather phases that creates a module with
invalid visibility properties that will just be ignored. Fortunately,
that has not happened.

A follow up commit will add the capability to create modules after the
defaults have been applied which means the chances of invalid visibility
properties being ignored will increase.

This change makes both phases report any errors they find. It will not
have any impact on existing code as if any errors are reported in the
check phase then the build will exit before the gather phase. It will
prevent any invalid visibility errors from being ignored.

Bug: 155295806
Test: m nothing
Merged-In: I101fa6b03d2530b16e4394a9e466fead48be0ff0
Change-Id: I101fa6b03d2530b16e4394a9e466fead48be0ff0
(cherry picked from commit 0c83aba28e)
2020-05-05 10:34:55 +01:00
Paul Duffin abc9a647a2 Reduce duplication in visibility property management
Adds a couple of new methods to manage visibility property instances to
reduce duplication and encapsulate the implementation slightly better.

The AddVisibilityProperty method is exported as it will be needed by
other packages in follow up commits.

Bug: 155295806
Test: m nothing
Merged-In: Ic1a9bb1e151fc6ae65761344fd210b4e4ba74fbc
Change-Id: Ic1a9bb1e151fc6ae65761344fd210b4e4ba74fbc
(cherry picked from commit 5ec73ecc08)
2020-05-05 10:34:30 +01:00
Artur Satayev 480e25b74f Introduce min_sdk_version to deps info.
Bug: 149622332
Test: m
Change-Id: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
2020-05-04 19:44:28 +01:00
Treehugger Robot 5b001c96dd Merge "Report visibility errors in both check and gather phases" am: e661212b76 am: deaf0b2d07
Change-Id: Ib6f0f04e565bb1d1920ddba5e4b38b2b0b7feb94
2020-05-04 17:58:23 +00:00
Treehugger Robot 4ed2f14dbc Merge "Reduce duplication in visibility property management" am: b6b0ca1d87 am: 5879210577
Change-Id: I63fcee81adbd2a0c6b2a86d69fbf6e633f9e1914
2020-05-04 17:58:06 +00:00
Treehugger Robot e661212b76 Merge "Report visibility errors in both check and gather phases" 2020-05-04 17:25:45 +00:00
Treehugger Robot b6b0ca1d87 Merge "Reduce duplication in visibility property management" 2020-05-04 17:25:29 +00:00
Artur Satayev a8bd113a69 Introduce flat deps info list.
Compared to full list, flat list drops dependency edges and simply
lists all transitive dependencies for a top-level apex bundle.

Bug: 149622332
Test: m, manually build flatlist

Change-Id: Ibd521c96b7aeab90b95965c1b524e0a0152aaf5a
2020-05-04 18:01:11 +01:00
Artur Satayev 872a144dca Export depsInfo into android package.
Move depsInfo into android for easier sharing with APK code.

Bug: 149622332
Test: m, diff'ing outputs for conscrypt module.
Change-Id: If0ee967d37425540e69b4ce9304229d9f2cd86bd
2020-05-04 18:01:09 +01:00
Ulyana Trafimovich f1e207c738 Merge "Use two-column format for PRODUCT_BOOT_JARS components." am: 2aa8e0be11 am: 728f0c5dae
Change-Id: I0ac57804b7c9f3bc5a4f3433e7e2e6d7011cc935
2020-05-04 09:08:11 +00:00
Ulyana Trafimovich 2aa8e0be11 Merge "Use two-column format for PRODUCT_BOOT_JARS components." 2020-05-04 08:57:47 +00:00
Svet Ganov ec83fd0642 Updating platform SDK version for R
* Update SDK versions

Test: build + boot

 bug:150281259

Change-Id: I30d7cda3c95327c4080e279e876129eb9e6a8091
Merged-In: I30d7cda3c95327c4080e279e876129eb9e6a8091
2020-05-03 09:41:41 -07:00
Svet Ganov 3b0b84b8a7 Updating platform SDK version for R
* Update SDK versions

Test: build + boot

 bug:150281259

Exempt-From-Owner-Approval: merge conflict resolution

Change-Id: I30d7cda3c95327c4080e279e876129eb9e6a8091
Merged-In: I30d7cda3c95327c4080e279e876129eb9e6a8091
2020-05-02 14:39:14 -07:00
Colin Cross 2a5fb91370 Merge changes from topic "sdk_version_variant" into rvc-dev
* changes:
  Add sdk mutator for native modules
  Require apps built against the SDK to use JNI built against the NDK
2020-05-02 01:41:18 +00:00
Paul Duffin 0c83aba28e Report visibility errors in both check and gather phases
Previously, errors that were found when splitting visibility rules were
only reported in the check phase and simply ignored during the gather
phase. That was because every visibility property that was processed in
the gather phase had already been checked in the check phase. However,
that is not strictly true as it has always been possible to add a
mutator between the check and gather phases that creates a module with
invalid visibility properties that will just be ignored. Fortunately,
that has not happened.

A follow up commit will add the capability to create modules after the
defaults have been applied which means the chances of invalid visibility
properties being ignored will increase.

This change makes both phases report any errors they find. It will not
have any impact on existing code as if any errors are reported in the
check phase then the build will exit before the gather phase. It will
prevent any invalid visibility errors from being ignored.

Bug: 155295806
Test: m nothing
Change-Id: I101fa6b03d2530b16e4394a9e466fead48be0ff0
2020-05-01 18:35:07 +01:00
Paul Duffin 5ec73ecc08 Reduce duplication in visibility property management
Adds a couple of new methods to manage visibility property instances to
reduce duplication and encapsulate the implementation slightly better.

The AddVisibilityProperty method is exported as it will be needed by
other packages in follow up commits.

Bug: 155295806
Test: m nothing
Change-Id: Ic1a9bb1e151fc6ae65761344fd210b4e4ba74fbc
2020-05-01 18:35:05 +01:00
Ulya Trafimovich 50c4a4b19f Use two-column format for PRODUCT_BOOT_JARS components.
The first component is the apex name, or a special name "platform"
if the boot jar is a platform jar rather than a part of some apex.
This is a prerequisite change for moving core-icu4j to a separate
com.android.i18n apex.

Old one-column format is still supported, but all unqualified
components of PRODUCT_BOOT_JARS get "platform:" prepended to them
after reading the product makefiles.

Test: aosp_walleye-userdebug boots
Bug: 138994281
Change-Id: Ic229159fdcdaf6182210a53b63850a389dd786fc
2020-04-30 14:42:32 +01:00
Evgenii Stepanov 19ff3c9bb8 [soong] Zero and pattern initialization of heap memory.
Bug: 155227507
Test: build with and without MALLOC_PATTERN_FILL_CONTENTS, MALLOC_ZERO_CONTENTS
Change-Id: I79a675e1b20897e8f88e89b1b2d6758e8b91f0be
2020-04-29 15:33:07 -07:00
TreeHugger Robot 99899b3582 Merge "Fix RuleBuilder remoteable actions running in the local pool." into rvc-dev 2020-04-28 19:54:47 +00:00
Ramy Medhat 1dcc27e47c Refactor RBE support for Javac/R8/D8 to use the remoteexec package.
Test: build with and without RBE_JAVAC/RBE_R8/RBE_D8 set.
Change-Id: I1607f8cfb4d2c3cbb3672152bbeb561d9968bc60
2020-04-28 11:37:20 -04:00
Jiyong Park f0d01b7c98 Add test_for property
This change adds 'test_for' property to cc_test_* types. The property is
used to mark a module as a test for one or more APEXes, in which case
the module has accecss to the private part of the listed APEXes. For
example, the module is linked with the actrual shared library in the
APEX instead of the stub of the shared library.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 129539670
Bug: 153046163
Test: m
Merged-In: I45ed0d7a15540b0d69b2a3b8d9c4cb202adff6f2
(cherry picked from commit 62304bbeec)
Change-Id: I45ed0d7a15540b0d69b2a3b8d9c4cb202adff6f2
2020-04-28 21:35:40 +09:00
Jiyong Park 6a9ddc37a9 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 153073816
Test: m
Test: remove "//apex_available:platform" from libmdnssd (it is currently
installed to /system/lib), and check that `m system_image` fails

Merged-In: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
(cherry picked from commit 89e850ab84)
Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
2020-04-28 09:27:24 +09:00
Colin Cross 01fd7ccbc7 Add sdk mutator for native modules
Compiling native modules against the NDK disables platform features
like ASAN.  For anything shipped on the system image there is no
reason to compile against the NDK.  Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant.  The
SDK variant will be used for embedding in APKs that may be installed
on older platforms.  Apexes use their own variants that enforce
backwards compatibility.

Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
Merged-In: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
(cherry picked from commit 82e192c3ae)
2020-04-27 14:45:05 -07:00
Ramy Medhat 79c4fcce32 Fix RuleBuilder remoteable actions running in the local pool.
This CL fixes a bug with RuleBuilder's handling of remoteable actions.
It adds a new type of pool to identify remoteable rules by the android
module context. The pool is then set to nil to actually run actions at
NINJA_REMOTE_NUM_JOBS parallelism.

Bug: b/154712413
Test: built aosp crosshatch userdebug
Change-Id: I29452f6fc7a161b94189731e3e3cc1f34907b80c
Merged-In: I29452f6fc7a161b94189731e3e3cc1f34907b80c
2020-04-27 18:54:45 +00:00
Treehugger Robot 01db260858 Merge "mark platform un-availability" 2020-04-27 12:37:45 +00:00
Jiyong Park 62304bbeec Add test_for property
This change adds 'test_for' property to cc_test_* types. The property is
used to mark a module as a test for one or more APEXes, in which case
the module has accecss to the private part of the listed APEXes. For
example, the module is linked with the actrual shared library in the
APEX instead of the stub of the shared library.

Exempt-From-Owner-Approval: already +2'ed by owner

Bug: 129539670
Bug: 153046163
Test: m
Change-Id: I45ed0d7a15540b0d69b2a3b8d9c4cb202adff6f2
2020-04-25 06:25:42 +00:00
Jooyung Han 28a49820e4 Merge "Apex: support codenames for min_sdk_version" 2020-04-25 04:41:44 +00:00
Jiyong Park 89e850ab84 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

Bug: 153073816
Test: m
Test: remove "//apex_available:platform" from libmdnssd (it is currently
installed to /system/lib), and check that `m system_image` fails

Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
2020-04-24 21:40:13 +09:00
TreeHugger Robot 416b811742 Merge changes Ib8025019,I7d58d104,I9dd4312c,I995ed389,Iba2a8a5a, ... into rvc-dev
* changes:
  Allow droidstubs to not generate any stubs
  Remove conscrypt.module.intra.core.api.stubs from apex white list
  Ignore PrebuiltDepTag when processing APEX contents
  Stop requiring apex_available on java_library members of sdks
  Add dependency tags to apex available errors
  Extract DepIsInSameApex and RequiredSdks interfaces
2020-04-23 15:19:41 +00:00
TreeHugger Robot 4586da2aae Merge changes Ie883eb45,If46a2f74,I8f4c5395,Ic4eb169d,I2b2408ef, ... into rvc-dev
* changes:
  Replace references to droiddoc with droidstubs
  Allow walkPayloadDeps visitor to control walk flow
  Add apex_available to sysprop_library
  Improve missing apex_available message
  Split TestApexAvailable into separate tests
  Use reflect.Zero(type) to get value to clear field
  Sdk snapshot set compile_multilib per OsType
  Remove old SdkMemberType API for creating snapshot modules
  Improve consistency of handling java snapshot properties
  Make new module creation API more flexible
  Add abstraction for tracking compile multilib usages
  Add support for using cc_library in sdk/module_exports
  Extract the osTypeSpecificInfo code from module creation loop
  Extract archTypeSpecificInfo code from module creation loop
  Clean up the main module creation loop
  Add support for cc_prebuilt_library
  Refactor prebuilt to use srcs supplier function
  Output properties before sets in snapshot module
  Remove SdkMemberType.FinalizeModule
  Follow up a review comment that was missed
  Copy shared_libs and system_shared_libs to module snapshot
  Support extracting common values from embedded structures
  Refactor common value extraction
  Copy white listed apex available settings into snapshot
  Disable installation for sdk snapshot versioned prebuilts
  Remove special handling of test_ apexes
  Remove special handling of com.android.art.debug/release
  Allow sdk members to vary by os type
  Add support for multiple os types
  Copy sdk_version to cc library snapshots
  Refactor java_library/java_test snapshot processing
  Refactor snapshot module creation
  Enable androidmk processing in sdk testing
  Add a nice install paths for module SDKs and exports.
  Copy apex_available properties to snapshot modules
  Improve documentation of CompileMultiTargets and related properties
  Only check copy rules into the snapshot directory
  Simplify java library sdk member code
  Add CommonOS variant for sdk
  Fix bug in error reporting when adding duplicate properties
  Avoid invoking sdk member to add empty list of dependencies
  Add windows to the list of available OS's in sdk tests
  Add support for cc_library_headers in sdk/module_exports
  Prune any empty property sets from the modules before transforming
  Simplify cc library sdk snapshot handling of include dirs/headers
  Add support for transforming a property set after its contents
  Fix issues with bp transformation
2020-04-23 15:19:26 +00:00
Ulya Trafimovich 7c140d828a Add "updatable" property to ApexModule interface.
For a given variant of a module that implements ApexModule interface,
the "updatable" property tests if this variant comes from an updatable
apex. For platform variants it is always false.

Test: lunch aosp_walleye-userdebug && m nothing
Bug: 138994281
Change-Id: I2d4c54fb397e29dc9b3203be7fb17be4536529f7
2020-04-23 11:58:53 +01:00
Paul Duffin 3766cb7b6a Ignore PrebuiltDepTag when processing APEX contents
When a source and a prebuilt module are present in the same build a
dependency is added from the source module to the prebuilt module.
Previously, the code for generating the APEX did not recognize that
tag and in some cases (e.g. for cc_(prebuilt_)library_shared) will
fail the build.

This change:
1) Adds a test to reproduce the problem.
2) Improves the debug message by pretty printing the tag.
3) Adds a new ExcludeFromApexContents interface that can be implemented
   by a tag to declare that it should be excluded from the APEX
   contents.
4) Ignores tags that implement that interface when generating APEX
   contents.
5) Implements that interface on prebuiltDependencyTag to fix the
   test.

Bug: 153326844
Bug: 153306490
Test: m nothing
Merged-In: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
Change-Id: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
2020-04-22 12:51:52 +01:00
Paul Duffin f020796cad Add dependency tags to apex available errors
Having dependency tags in the dependency path that shows why a specific
module is considered part of an apex makes it easier to understand why
that is the case and detect possible issues.

Bug: 152762638
Bug: 153306490
Test: m nothing
Merged-In: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
Change-Id: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
2020-04-22 12:51:51 +01:00
Paul Duffin 03e7d0ca9c Extract DepIsInSameApex and RequiredSdks interfaces
The DepIsInSameApex() and RequiredSdks() methods were defined in a few
places to avoid having to depend on the whole ApexModule/SdkAware
interfaces directly. However, that has a couple of issues:
1) It duplicates functionality making it difficult to change, changes
   to the definitions outside the main interfaces do not cause compile
   time failures, instead they result in a runtime change in behavior
   which can be difficult to debug.
2) IDE navigation (specifically in Intellij) does not detect that the
   duplicate definitions can resolve to the definitions in the main
   interface.

This change extracts the methods into their own interfaces and reuses
those interfaces instead of duplicating the methods to fix both of
these issues.

Bug: 152878661
Bug: 153306490
Test: m nothing
Merged-In: I0cfdf342a14eb0bfb82b1bd17e0633d81c7facfb
Change-Id: I0cfdf342a14eb0bfb82b1bd17e0633d81c7facfb
2020-04-22 12:51:50 +01:00
Paul Duffin 93520edca2 Remove old SdkMemberType API for creating snapshot modules
Migrates system modules and droid stubs over to use the new API for
creating the snapshot modules and removes the old API.

Bug: 153306490
Test: m nothing
Merged-In: Ia825767f1f7ee77f68cfe00f53e09e6f6bfa027f
Change-Id: Ia825767f1f7ee77f68cfe00f53e09e6f6bfa027f
2020-04-22 12:51:45 +01:00
Paul Duffin c9103930a4 Improve consistency of handling java snapshot properties
Previously, java snapshot properties (java_library and java_test)
relied on the properties not being optimized when there was a single os
type and instead being added directly to the common os type properties.
However, that means that the behavior is inconsistent for other member
types depending on whether there was one os type or not.

This change updates the java sdk member handling to support
optimization. This involved:
1) Adding AidlIncludeDirs field to librarySdkMemberProperties to
   specify the aidl include dirs instead of extracting that from the
   library field.

2) Renaming jarToExport to JarToExport (in both
   library/testSdkMemberProperties)to allow it to be optimized.

3) Adding MemberType() and Name() methods to SdkMemberPropertiesContext
   to avoid having to store the former in the properties struct and
   retrieve the latter from the library/test fields.

4) Removing the now unused library/test fields from the properties
   structures.

5) Separating the processing of the jar/test config in
   AddToPropertySet(...) as they may be optimized separately.

6) Ditto for the jar/aidl include dirs.

7) While doing this work I noticed that although the contents of the
   aidl include dirs are copied into the snapshot the java_import does
   not make use of them. Raised bug 151933053 and added TODO to track
   that work.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iba9799e111ca5672b2133568163d8c49837ba9cd
Change-Id: Iba9799e111ca5672b2133568163d8c49837ba9cd
2020-04-22 12:51:44 +01:00
Paul Duffin 17ab883cb0 Make new module creation API more flexible
Previously passing additional information to the implementations of
AddPrebuiltModule() or the SdkMemberProperties interface would have
required making changes to the API. This change added an
SdkMemberContext object into which additional information can easily
be added without requiring changes to existing implementations.

The BuildSnapshot() method was not modified because it is deprecated
and will be removed in a follow up change.

It also switches the API from passing variants as android.SdkAware to
android.Module. That is for a couple of reasons:
1) SdkAware is designed for managing the relationship between the
   module and the SDK, not for generating the output snapshot. As such
   there is nothing in SdkAware that is needed for generating the
   output snapshot.
2) Accepting android.Module instead makes it easier to use the
   underlying code for generating the snapshot module as well as the
   individual member modules.

This is in preparation for a number of improvements and bug fixes in
both the snapshot creation code and implementations to address found
while trying to built the platform against ART prebuilts.

Bug: 151937654
Bug: 153306490
Test: m nothing
Merged-In: Iac10f1200c0f283aa35402167eec8f9aeb65a38e
Change-Id: Iac10f1200c0f283aa35402167eec8f9aeb65a38e
2020-04-22 12:51:44 +01:00
Paul Duffin 6cb8f172b8 Add support for using cc_library in sdk/module_exports
Added link type support in module creation code as cc_prebuilt_library
has to provide both shared and static libraries.

Had to add some calls to FirstUniquePaths() around the include dirs
settings in library_sdk_member as otherwise the shared variant contains
duplicate include dirs (presumably because it gets one set from its
dependency on the static variant and one set of its own). That
difference in include dirs causes problems in the generated
cc_prebuilt_library.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
Change-Id: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
2020-04-22 12:51:43 +01:00
Paul Duffin 406ea1c393 Refactor prebuilt to use srcs supplier function
Previously, prebuilt had two ways to provide the src value, as a
pointer to an []string and using reflection. That meant that any code
that needed to check the src to use had to understand the two ways of
accessing it.

This change refactors the code to abstract the origin of the src values
being a supplier function. That insulates the callers from having to
know the details and makes it easy to add new suppliers in future.

Bug: 153306490
Test: m nothing
Bug: 142918168
Merged-In: I5cc7517c46cce96924c9f34ba1b046b468f7684a
Change-Id: I5cc7517c46cce96924c9f34ba1b046b468f7684a
2020-04-22 12:51:40 +01:00
Paul Duffin 2bdbe83ec9 Remove SdkMemberType.FinalizeModule
This was only being used to set the "stl" property for cc library sdk
member type and so that functionality was moved to AddPrebuiltModule()
and FinalizeModule was removed.

Required a few test changes to move the property to the correct
position in the generated module.

Bug: 142918168
Bug: 153306490
Test: m nothing
Merged-In: If6400189833d4ff3285e7a7adf63a9b509e2a03b
Change-Id: If6400189833d4ff3285e7a7adf63a9b509e2a03b
2020-04-22 12:51:39 +01:00
Paul Duffin 206433a1fa Copy shared_libs and system_shared_libs to module snapshot
This change ensures that the runtime dependencies between a
binary/shared library are correctly specified in the snapshot so that
the build can ensure that shared libraries are built before the targets
that use them.

It adds support for differentiating between references that are
required to refer to another sdk member (required) and those that may
refer to either an sdk member or a non-sdk member (optional). The
latter is used for shared library references as the libraries used by
an sdk member may be provided from outside the sdk. e.g. liblog is not
part of the ART module but is used by some members of the ART sdk.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ia8509ffe79b208c23beba1880fe9c8a92b732685
Change-Id: Ia8509ffe79b208c23beba1880fe9c8a92b732685
2020-04-22 12:51:38 +01:00
Paul Duffin 49096815fe Support extracting common values from embedded structures
This change also added support for excluding properties from common
value extraction by using a struct tag of `sdk:"keep"` That was needed
to prevent the fields in SdkMemberPropertiesBase from having their
values cleared.

The purpose of this change is to make it easier to share functionality
across sdk member types.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ie5160a8f854056920e411801ca20721eab7c8578
Change-Id: Ie5160a8f854056920e411801ca20721eab7c8578
2020-04-22 12:51:38 +01:00
Paul Duffin 404db3f4e8 Copy white listed apex available settings into snapshot
Makes sure that the module snapshots do not rely on the white list
of apex available settings so that when those lists are removed it is
not necessary to update any snapshots.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
Change-Id: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
2020-04-22 12:51:37 +01:00
Paul Duffin 9b358d7a58 Add support for multiple os types
Updates the member snapshot creation code to support multiple os types.
It basically sorts the variants by os type, then applies the code to
optimize the arch properties and then it optimizes the properties that
are common across architectures and extracts any properties that are
common across os types.

The java and cc member types needed to be modified to make the location
of the generated files within the snapshot os type dependent when there
is more than one os type. That was done by adding an OsPrefix() method
to the SdkMemberPropertiesBase which returns the os prefix to use when
there is > 1 os type and otherwise returns an empty string.

Added three tests, one for cc shared libraries, one for cc binary and
one for java header libraries.

Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
2020-04-22 12:51:34 +01:00
Paul Duffin 33cedcc421 Refactor snapshot module creation
Generalize the processing of arch specific properties to reduce
duplication in snapshot module creation and simplify addition of
support for handling multiple os types.

Supporting multiple os types with the current method for building
snapshot modules would require every affected module type to add
support for it. Rather than duplicate multiple os type handling code
across those module types this work generalizes the process cc modules
use for handling arch types as it can be used as a basis for handling
multiple os types. Migrating module types over to this new process
will insulate them from having to handle multiple os types.
OB
SdkMemberType changes:
* BuildSnapshot is deprecated in favour of the new AddPrebuiltModule()
  method.
* Additional methods, CreateVariantPropertiesStruct() and
  FinalizeModule() are added.
* A new interface SdkMemberProperties, is defined that handles
  extracting information from the variant (prior to common value
  optimization) and adding properties to a property set.

The sdk module type uses these new methods and types to delegate the
member type specific processing to the relevant member types while
handling the behavior that is common across all members types, e.g.
extracting common values across multiple architectures. A future change
will leverage this processing to add support for multiple os types.

This change also refactors the cc module processing to use the new
process.

Bug: 150451422
Bug: 153306490
Test: m nothing
Merged-In: If6ab2498407b17f50391d062cd9afc01b5e01af4
Change-Id: If6ab2498407b17f50391d062cd9afc01b5e01af4
2020-04-22 12:51:33 +01:00
Paul Duffin 22595f9370 Enable androidmk processing in sdk testing
Previously, while sdk tests would pass the sdk code would often fail
in androidmk processing. This change makes the tests more realistic
and will catch the errors earlier.

Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
Change-Id: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
2020-04-22 12:51:32 +01:00
Nicolas Geoffray a40f0b5db9 Add a nice install paths for module SDKs and exports.
Following how NDK also creates its own install path.

Bug: 142935992
Bug: 153306490
Test: cc_sdk_test.go, java_sdk_test.go
Merged-In: I98a3656903f37f6d7c90e6cf609431b2461a6161
Change-Id: I98a3656903f37f6d7c90e6cf609431b2461a6161
2020-04-22 12:51:31 +01:00
Paul Duffin 3a6c095145 Copy apex_available properties to snapshot modules
Bug: 142935992
Bug: 153306490
Test: m nothing
Merged-In: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
Change-Id: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
2020-04-22 12:51:30 +01:00
Paul Duffin 28d70c74db Improve documentation of CompileMultiTargets and related properties
Bug: 153306490
Test: m nothing
Merged-In: I1e3f0bf7e2a1303d2519d8405a228e9234235514
Change-Id: I1e3f0bf7e2a1303d2519d8405a228e9234235514
2020-04-22 12:51:30 +01:00
Paul Duffin b0cbec3ada Add CommonOS variant for sdk
Adds a CommonOS variant for sdk that depends on the os specific
variants and is used to generate a single sdk for multiple OsTypes,
e.g. host linux and android.

At the minute the member types only support a single OsType but the
basic mechanism for managing the CommonOS variant and collating the
variants across all of them is there.

The only visible effect of this change is that the location of the
generated snapshot is changed, it is no longer os specific and instead
is in the same location irrespective of which os it is built for.

A lot of tests needed to be changed to specify "common_os" as the
variant type instead of the specific os type. As that is the same across
all tests it is hard coded in CheckSnapshot method.

Bug: 153306490
Test: m nothing
Bug: 150451422
Merged-In: If36be39b06d6910453649f7c288c2d34f688b2f4
Change-Id: If36be39b06d6910453649f7c288c2d34f688b2f4
2020-04-22 12:51:28 +01:00
Jeongik Cha 8691f3f75c Apply EnforceRROExemptedTargets in Soong
As PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS is defined in make, define it in
soong accordingly

Bug: 150820813
Test: m
Change-Id: I309482b6ad439a7602127f68f2f7ffa856b9e192
Merged-In: I309482b6ad439a7602127f68f2f7ffa856b9e192
2020-04-20 14:02:23 +00:00
Artur Satayev b39ea9b61c Allow defining neverallow in packages other than android.
This exposes test func on ValueMatcher and helpers relevant for testing neverallows.

Bug: 153333044
Test: m
Change-Id: Ied07cd33afa537f9d7aa3c33e59f4ac985901a0f
Merged-In: Ied07cd33afa537f9d7aa3c33e59f4ac985901a0f
Exempt-From-Owner-Approval: clean cherry-pick
(cherry picked from commit c5570ac9b1)
2020-04-16 13:34:31 +00:00
Artur Satayev c5570ac9b1 Allow defining neverallow in packages other than android.
This exposes test func on ValueMatcher and helpers relevant for testing neverallows.

Bug: 153333044
Test: m
Change-Id: Ied07cd33afa537f9d7aa3c33e59f4ac985901a0f
2020-04-15 12:06:13 +01:00
Jooyung Han e5fce6cdbf Merge "Remove PLATFORM_VERSION_FUTURE_CODENAMES" 2020-04-14 04:00:03 +00:00
Jooyung Han 03302eee13 Remove PLATFORM_VERSION_FUTURE_CODENAMES
It has been wrong to split ALL_VERSIONS into exclusive two sets of
before/after TARGET_PLATFORM_VERSION.

And PLATFORM_VERSION_ALL_CODENAMES supports all *active* list of
non-finalized codenames.

Bug: 152960049
Test: m
Exempt-From-Owner-Approval: cp from master
Merged-In: I78ca88758998e440bea72ba2d56d90eea3ec99ae
Change-Id: I78ca88758998e440bea72ba2d56d90eea3ec99ae
(cherry picked from commit 424175d72a)
2020-04-14 02:06:57 +00:00
TreeHugger Robot a59774eb49 Merge "soong config: add value_variable substitution" into rvc-dev 2020-04-11 17:24:57 +00:00
TreeHugger Robot a6ffd8b141 Merge "Make the names of 'soong_config_module_type_import' modules unique." into rvc-dev 2020-04-10 21:09:21 +00:00
Sasha Smundak 227d5675c5 Make the names of 'soong_config_module_type_import' modules unique.
blueprint.writeAllModuleActions attemts to sort modules by name, and
sorting them assumes that each module's name is unique. Although
soong_config_module_type_import modules will not generate anything,
their names should be unique, too for that reason.

Fixes: 150421585
Test: m nothing
Change-Id: I6782e42c129dc3b0fc7649ce97d5f94effc63fa7
Merged-In: I6782e42c129dc3b0fc7649ce97d5f94effc63fa7
2020-04-10 13:54:07 -07:00
Anton Hansson 846101ace0 Merge "Expand neverallow for sdk_version: none" into rvc-dev 2020-04-10 18:53:30 +00:00
Anton Hansson fec6c23734 Expand neverallow for sdk_version: none
Allow the platform stubs to specify sdk_version: none,
and add generic support for a regexp matcher.

Bug: 144149403
Test: m
Change-Id: Icaece0d9797bace8ae9741f7a029b9ea57fcbbb9
Merged-In: Icaece0d9797bace8ae9741f7a029b9ea57fcbbb9
2020-04-10 15:02:35 +01:00
Anton Hansson d0615e7019 Merge "Expand neverallow for sdk_version: none" 2020-04-10 14:00:16 +00:00
Dan Willemsen ec8d490d58 soong config: add value_variable substitution
There are some cases that aren't handled with the existing variable
types for booleans or known lists of strings. Similarly to our
product_variables that uses %s / %d for things like
PLATFORM_SDK_VERSION, allow vendors to define their own config variables
to be substituted into properties.

For example, some of the makefiles that I've attempted to convert had
the option to pass in version numbers from the board, or the default
display size:

  -DDISPLAY_VERSION=550
  -DDISP_H=1080

These examples happen to be integers, but since our configuration
language (make) doesn't support numbers, %s works just as well.

This change will allow the above to be represented using:

  soong_config_module_type {
      name: "acme_cc_defaults",
      module_type: "cc_defaults",
      config_namespace: "acme",
      value_variables: [
          "DISPLAY_VERSION",
	  "DISP_H",
      ],
      properties: ["cflags"],
  }

  acme_cc_defaults {
      name: "my_defaults",
      soong_config_variables: {
          DISPLAY_VERSION: {
	      cflags: ["-DDISPLAY_VERSION=%s"],
	  },
	  DISP_H: {
	      cflags: ["-DDISP_H=%s"],
	  }
      },
  }

Bug: 153161144
Test: built-in tests
Change-Id: I18f35746b5cc39c304a136980249e886d38c6df6
Merged-In: I18f35746b5cc39c304a136980249e886d38c6df6
(cherry picked from commit b0935db8c3)
2020-04-09 13:30:38 -07:00
Treehugger Robot 1062943c8a Merge "soong config: add value_variable substitution" 2020-04-09 20:16:08 +00:00
Julien Desprez 0eb91f4e91 Merge "Add support for order-only dependencies to RuleBuilder" into rvc-dev 2020-04-09 18:56:01 +00:00
Julien Desprez 741f48413c Merge "Add an order-only dependency on the build number file" into rvc-dev 2020-04-09 18:56:01 +00:00
Automerger Merge Worker 82f316b8db Add support for order-only dependencies to RuleBuilder
Test: TestRuleBuilder
Change-Id: I1609a790dd4d0a03c8308b6e552622fe33fa2499
Bug: 153071808
Merged-In: Icfa98d6840b1dc2e273ba29c33011635d1cf93b1
2020-04-09 08:17:32 -07:00
Automerger Merge Worker c372774b1a Add an order-only dependency on the build number file
Remote execution and other tools can be confused by references to
build_number.txt without a dependency.  Add an order-only dependency,
which maintains the current behavior.

Test: BUILD_NUMBER=1 && m aapt && aapt version # shows 1
      BUILD_NUMBER=2 && m aapt && aapt version # shows 1
      rm out/soong/.intermediates/frameworks/base/tools/aapt/aapt/linux_glibc_x86_64/aapt
      BUILD_NUMBER=2 && m aapt && aapt version # shows 2
Change-Id: Icfa98d6840b1dc2e273ba29c33011635d1cf93b1
Bug: 153071808
Merged-In: I1609a790dd4d0a03c8308b6e552622fe33fa2499
2020-04-09 08:16:44 -07:00
Anton Hansson 453764070d Expand neverallow for sdk_version: none
Allow the platform stubs to specify sdk_version: none,
and add generic support for a regexp matcher.

Bug: 144149403
Test: m
Change-Id: Icaece0d9797bace8ae9741f7a029b9ea57fcbbb9
2020-04-09 14:59:16 +01:00
Ulya Trafimovich cc21bba967 Forbid generating boot image files for jars in updatable modules.
This is to guard against the potential situation when someone adds
updatable modules to the list of boot jars by mistake.

Test: aosp_walleye-userdebug builds.

Test: Manually break the checks and observe the errors:
  - move updatable module 'conscrypt' from
    PRODUCT_UPDATABLE_BOOT_JARS to ART_APEX_JARS:
      internal error: module 'conscrypt' from updatable apex 'com.android.conscrypt' is not allowed in the ART boot image

  - add updatable module 'conscrypt' to ART_APEX_JARS
    (but do not remove it from PRODUCT_UPDATABLE_BOOT_JARS):
      error: A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but conscrypt is.

  - move updatable module 'framework-tethering' from
    PRODUCT_UPDATABLE_BOOT_JARS to PRODUCT_BOOT_JARS:
      internal error: module 'framework-tethering' from updatable apex 'com.android.tethering' is not allowed in the framework boot image

  - add non-updatable (in AOSP) module 'android.net.ipsec.ike'
    to PRODUCT_BOOT_JARS:
      internal error: failed to find a dex jar path for module 'com.android.ipsec.ike', note that some jars may be filtered out by module constraints

Bug: 147579140

Exempt-From-Owner-Approval: cherry-pick, approved in AOSP.

Change-Id: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
Merged-In: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
(cherry picked from commit b28cc3758c)
2020-04-09 14:50:21 +01:00
Jooyung Han aed150d6ed Apex: support codenames for min_sdk_version
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.

Bug: 152655956
Test: m
Merged-In: I077ad7b2ac5d90b4c8708921e43846206f05ba70
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
(cherry picked from commit 29e91d2121)
2020-04-09 16:04:17 +09:00
Colin Cross ff550f3e13 Merge "Revert^2 "Add sdk mutator for native modules"" 2020-04-08 18:29:30 +00:00
Treehugger Robot 9e06bb64ca Merge "Make the names of 'soong_config_module_type_import' modules unique." 2020-04-08 17:39:42 +00:00
Paul Duffin 846e60dbc7 Merge "Ignore PrebuiltDepTag when processing APEX contents" 2020-04-08 14:28:47 +00:00
Ulyana Trafimovich 0d8f61640e Merge "Forbid generating boot image files for jars in updatable modules." 2020-04-08 12:15:47 +00:00
Paul Duffin dddd5469ad Ignore PrebuiltDepTag when processing APEX contents
When a source and a prebuilt module are present in the same build a
dependency is added from the source module to the prebuilt module.
Previously, the code for generating the APEX did not recognize that
tag and in some cases (e.g. for cc_(prebuilt_)library_shared) will
fail the build.

This change:
1) Adds a test to reproduce the problem.
2) Improves the debug message by pretty printing the tag.
3) Adds a new ExcludeFromApexContents interface that can be implemented
   by a tag to declare that it should be excluded from the APEX
   contents.
4) Ignores tags that implement that interface when generating APEX
   contents.
5) Implements that interface on prebuiltDependencyTag to fix the
   test.

Bug: 153326844
Test: m nothing
Change-Id: I9dd4312c4f995c816c0a31d8d733eb5d7f56e1ea
2020-04-08 08:40:44 +01:00
Paul Duffin c519244cd5 Add dependency tags to apex available errors
Having dependency tags in the dependency path that shows why a specific
module is considered part of an apex makes it easier to understand why
that is the case and detect possible issues.

Bug: 152762638
Test: m nothing
Change-Id: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
2020-04-08 08:40:44 +01:00
Jooyung Han 424175d72a Remove PLATFORM_VERSION_FUTURE_CODENAMES
It has been wrong to split ALL_VERSIONS into exclusive two sets of
before/after TARGET_PLATFORM_VERSION.

And PLATFORM_VERSION_ALL_CODENAMES supports all *active* list of
non-finalized codenames.

Bug: 152960049
Test: m
Change-Id: I78ca88758998e440bea72ba2d56d90eea3ec99ae
2020-04-08 09:25:20 +09:00
Colin Cross c511bc50dc Revert^2 "Add sdk mutator for native modules"
f8e80229fe

Change-Id: Ic30ab6b844684bfc3e8ece5a1913980d5fbf8de2
2020-04-07 16:50:32 +00:00
Ulya Trafimovich b28cc3758c Forbid generating boot image files for jars in updatable modules.
This is to guard against the potential situation when someone adds
updatable modules to the list of boot jars by mistake.

Test: aosp_walleye-userdebug builds.

Test: Manually break the checks and observe the errors:
  - move updatable module 'conscrypt' from
    PRODUCT_UPDATABLE_BOOT_JARS to ART_APEX_JARS:
      internal error: module 'conscrypt' from updatable apex 'com.android.conscrypt' is not allowed in the ART boot image

  - add updatable module 'conscrypt' to ART_APEX_JARS
    (but do not remove it from PRODUCT_UPDATABLE_BOOT_JARS):
      error: A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but conscrypt is.

  - move updatable module 'framework-tethering' from
    PRODUCT_UPDATABLE_BOOT_JARS to PRODUCT_BOOT_JARS:
      internal error: module 'framework-tethering' from updatable apex 'com.android.tethering' is not allowed in the framework boot image

  - add non-updatable (in AOSP) module 'android.net.ipsec.ike'
    to PRODUCT_BOOT_JARS:
      internal error: failed to find a dex jar path for module 'com.android.ipsec.ike', note that some jars may be filtered out by module constraints

Bug: 147579140

Change-Id: I25ca2f52530fcfa1f9823b2cfa3485db9c0d0db1
2020-04-07 17:09:59 +01:00
Paul Duffin 923e8a5e9e Extract DepIsInSameApex and RequiredSdks interfaces
The DepIsInSameApex() and RequiredSdks() methods were defined in a few
places to avoid having to depend on the whole ApexModule/SdkAware
interfaces directly. However, that has a couple of issues:
1) It duplicates functionality making it difficult to change, changes
   to the definitions outside the main interfaces do not cause compile
   time failures, instead they result in a runtime change in behavior
   which can be difficult to debug.
2) IDE navigation (specifically in Intellij) does not detect that the
   duplicate definitions can resolve to the definitions in the main
   interface.

This change extracts the methods into their own interfaces and reuses
those interfaces instead of duplicating the methods to fix both of
these issues.

Bug: 152878661
Test: m nothing
Change-Id: I0cfdf342a14eb0bfb82b1bd17e0633d81c7facfb
2020-04-07 15:26:06 +01:00
Colin Cross f8e80229fe Revert "Add sdk mutator for native modules"
Revert submission 1242911-sdk_version_variant

Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...

Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
2020-04-07 04:21:21 +00:00
Treehugger Robot dd22225b3a Merge "Add product_variables.eng.optimize.enabled" 2020-04-06 04:09:54 +00:00
Jooyung Han 95148f607e Merge "Apex: support codenames for min_sdk_version" into rvc-dev 2020-04-05 00:14:37 +00:00
TreeHugger Robot 909eaf5282 Merge "soong_config: bool_variables shortcut" into rvc-dev 2020-04-03 21:27:22 +00:00
Ramy Medhat ff6231920d Merge "Fix RuleBuilder remoteable actions running in the local pool." 2020-04-03 20:28:41 +00:00
Dan Willemsen 1934adc077 soong_config: bool_variables shortcut
Using a lot of boolean variables can become very verbose without adding
really any new information:

      variables: ["a", "b", "c"],
  }

  soong_config_bool_variable {
      name: "a",
  }

  soong_config_bool_variable {
      name: "b",
  }

  soong_config_bool_variable {
      name: "c",
  }

Now turns into:

      bool_variables: ["a", "b", "c"],
  }

Bug: 153161144
Test: built-in tests
Change-Id: If5455a38433431c7ecbce1e5b32cfbb47f42602a
Merged-In: If5455a38433431c7ecbce1e5b32cfbb47f42602a
(cherry picked from commit 2b8b89cfa2)
2020-04-03 08:57:41 -07:00
Treehugger Robot 4066e5e882 Merge "soong_config: bool_variables shortcut" 2020-04-03 15:43:42 +00:00
Yi Kong e6a9e64f70 Add platform-wide sampling PGO option
This causes the compiler to emit some additional debug infomation that
will be used for sampling PGO. These debug infomation will get stripped
so it only affects intermediate files.

Test: build
Bug: 79161490
Bug: 153039105
Change-Id: Ie4d1d5ffbd311ba6e268cb94a618f5272be246ef
Merged-In: Ie4d1d5ffbd311ba6e268cb94a618f5272be246ef
(cherry picked from commit ceb5b76c91)
2020-04-03 12:00:04 +00:00
Sasha Smundak 116ec92e0e Make the names of 'soong_config_module_type_import' modules unique.
blueprint.writeAllModuleActions attemts to sort modules by name, and
sorting them assumes that each module's name is unique. Although
soong_config_module_type_import modules will not generate anything,
their names should be unique, too for that reason.

Fixes: 150421585
Test: m nothing
Change-Id: I6782e42c129dc3b0fc7649ce97d5f94effc63fa7
2020-04-02 20:26:22 +00:00
Bill Peckham 1c610cfed1 Include partition tag in apexkeys.txt.
The partition tag helps merge_target_files.py determine
which apexkeys.txt to select from the framework partial
target files and which to select from the vendor partial
target files. The partition tag is the pysical partition
name, for example, a system_ext module on a device where
system_ext is at system/system_ext has a system
partition tag.

Bug: 138942268
Change-Id: Ia07887b34f1aa77dae94ef23610dfef83c1a5849
Merged-In: Ia07887b34f1aa77dae94ef23610dfef83c1a5849
2020-04-02 17:15:47 +00:00
Jooyung Han 29e91d2121 Apex: support codenames for min_sdk_version
Apex can use codenames like "Q", "R" for its min_sdk_version property.
Also, cc_library can use codenames for its stubs.versions.

Bug: 152655956
Test: vendor/google/build/build_mainline_modules.sh
Change-Id: I077ad7b2ac5d90b4c8708921e43846206f05ba70
2020-04-02 23:26:41 +09:00
Anton Hansson 66e365565f Merge "Remove neverallow rules for framework-mediaprovider" into rvc-dev 2020-04-02 11:07:17 +00:00
Jooyung Han 7556839772 Enforce apex.min_sdk_version for bundled builds
Previously, when Q-targeting apexes are bundled-built, they are built
against the latest stubs.

It was because unwinder is linked dynamically in R and APIs are provided
by libc while Q apexes should run on Q where libc doesn't provide those
APIs. To make Q apexes run on Q device, libc++ should be linked with
static unwinder. But, because libc++ with static unwinder may cause problem
on HWASAN build, Q apexes were built against the latest stubs for bundled
build.

However, Q apexes should be built against Q stubs.

Now, only for HWASAN builds, Q apexes are built against the latest stubs
(and native modules are not linked with static unwinder).

Bug: 151912436
Test: TARGET_SANITIZE=hwaddress m
      => Q apexes(media, resolv, ..) are linked with the latest stubs
      m
      => Q apexes are linked with Q stubs,
         and Q apexes' libc++ is linked with static unwinder
Merged-In: If32f1b547e6d93e3955c7521eec8aef5851f908c
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
(cherry picked from commit 7406660685)

Exempt-From-Owner-Approval: cp from internal
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
2020-04-02 03:34:30 +00:00
Colin Cross 82e192c3ae Add sdk mutator for native modules
Compiling native modules against the NDK disables platform features
like ASAN.  For anything shipped on the system image there is no
reason to compile against the NDK.  Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant.  The
SDK variant will be used for embedding in APKs that may be installed
on older platforms.  Apexes use their own variants that enforce
backwards compatibility.

Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
2020-04-01 16:09:05 -07:00
Jooyung Han 42d7718086 Merge "Enforce apex.min_sdk_version for bundled builds" into rvc-dev 2020-04-01 15:37:23 +00:00
Felka Chang f13642ef24 Add product_variables.eng.optimize.enabled
The default build is to enable optimization for all of module.
In order to have the feasibility to the owners of the modules,
to create product_variables.eng.optimize.enabled let the owners
to have the choice to decide whether the build enable the optimization
or not.

Test: atest -m # build soong
Test: # follow Developing for Soong & setup GOPATH
      # to run the new tests in variables_test.go
    cd $GOPATH; \
    go test android/soong/android
Test: #1. change frameworks/base/packages/SystemUI/Android.bp to change
          product_variables.eng.optimize.enabled = false;
      #2. source build/setupenv.sh;
      #3. lunch aosp_x86-eng; make -j16 SystemUI
      #4. lunch aosp_x86-userdebug; make -j16 SystemUI
      #5. aosp_x86-eng should be bigger than aosp_x86-userdebug
Bug: 130259652

Change-Id: Ie62c35458ca91d66ec65bda58d315fb971139849
2020-04-01 12:23:12 +00:00
Ramy Medhat 944839a88a Fix RuleBuilder remoteable actions running in the local pool.
This CL fixes a bug with RuleBuilder's handling of remoteable actions.
It adds a new type of pool to identify remoteable rules by the android
module context. The pool is then set to nil to actually run actions at
NINJA_REMOTE_NUM_JOBS parallelism.

Test: built aosp crosshatch userdebug
Change-Id: I29452f6fc7a161b94189731e3e3cc1f34907b80c
2020-03-31 22:18:40 -04:00
Dan Shi 1a9a9127b1 Merge "Rename VTS to VTS10" am: 7182c45fe7 am: 4058983c0c am: 8989420fee am: 2d2a3643f5
Bug: 151896491
Test: none

Change-Id: Iee9324c4edefef56171ecfac64fd11a9595e5f7c
Merged-In: Iadad4ba96bf9a7f3b1d12c9d4eeb90fb1ed0841d
Merged-In: Iee9324c4edefef56171ecfac64fd11a9595e5f7c
(cherry picked from commit ee3ec387b0)
2020-03-31 23:20:53 +00:00
Anton Hansson a5cb6fe9bb Remove neverallow rules for framework-mediaprovider
We actually want some targets (in particular, the MediaProvider apk)
to link against framework-mediaprovider.

The gist of what the neverallow rule achieves (disallow general use)
is achieved equally well with visibility rules, which
framework-mediaprovider already has.

Bug: 152891096
Test: m nothing
Change-Id: Ic4b0a571985b9ad1dfdd56d45035f224a622700e
2020-03-31 20:37:26 +01:00
Dan Shi 7182c45fe7 Merge "Rename VTS to VTS10" 2020-03-31 17:32:34 +00:00
Bill Peckham fff3f8a3f8 Include partition tag in apexkeys.txt.
The partition tag helps merge_target_files.py determine
which apexkeys.txt to select from the framework partial
target files and which to select from the vendor partial
target files. The partition tag is the pysical partition
name, for example, a system_ext module on a device where
system_ext is at system/system_ext has a system
partition tag.

Bug: 138942268
Change-Id: Ia07887b34f1aa77dae94ef23610dfef83c1a5849
2020-03-30 22:33:50 +00:00
Dan Shi 984c129c84 Rename VTS to VTS10
Bug: 151896491
Test: m -j vts10
Change-Id: I7b70b13401678d70e4b46f9e7eb9d844bcfa315e
2020-03-28 16:42:17 -07:00
Jooyung Han 7406660685 Enforce apex.min_sdk_version for bundled builds
Previously, when Q-targeting apexes are bundled-built, they are built
against the latest stubs.

It was because unwinder is linked dynamically in R and APIs are provided
by libc while Q apexes should run on Q where libc doesn't provide those
APIs. To make Q apexes run on Q device, libc++ should be linked with
static unwinder. But, because libc++ with static unwinder may cause problem
on HWASAN build, Q apexes were built against the latest stubs for bundled
build.

However, Q apexes should be built against Q stubs.

Now, only for HWASAN builds, Q apexes are built against the latest stubs
(and native modules are not linked with static unwinder).

Bug: 151912436
Test: TARGET_SANITIZE=hwaddress m
      => Q apexes(media, resolv, ..) are linked with the latest stubs
      m
      => Q apexes are linked with Q stubs,
         and Q apexes' libc++ is linked with static unwinder
Change-Id: If32f1b547e6d93e3955c7521eec8aef5851f908c
2020-03-27 02:58:20 +09:00
Dan Willemsen b0935db8c3 soong config: add value_variable substitution
There are some cases that aren't handled with the existing variable
types for booleans or known lists of strings. Similarly to our
product_variables that uses %s / %d for things like
PLATFORM_SDK_VERSION, allow vendors to define their own config variables
to be substituted into properties.

For example, some of the makefiles that I've attempted to convert had
the option to pass in version numbers from the board, or the default
display size:

  -DDISPLAY_VERSION=550
  -DDISP_H=1080

These examples happen to be integers, but since our configuration
language (make) doesn't support numbers, %s works just as well.

This change will allow the above to be represented using:

  soong_config_module_type {
      name: "acme_cc_defaults",
      module_type: "cc_defaults",
      config_namespace: "acme",
      value_variables: [
          "DISPLAY_VERSION",
	  "DISP_H",
      ],
      properties: ["cflags"],
  }

  acme_cc_defaults {
      name: "my_defaults",
      soong_config_variables: {
          DISPLAY_VERSION: {
	      cflags: ["-DDISPLAY_VERSION=%s"],
	  },
	  DISP_H: {
	      cflags: ["-DDISP_H=%s"],
	  }
      },
  }

Test: built-in tests
Change-Id: I18f35746b5cc39c304a136980249e886d38c6df6
2020-03-24 07:15:16 -07:00
Yi Kong ceb5b76c91 Add platform-wide sampling PGO option
This causes the compiler to emit some additional debug infomation that
will be used for sampling PGO. These debug infomation will get stripped
so it only affects intermediate files.

Test: build
Bug: 79161490
Change-Id: Ie4d1d5ffbd311ba6e268cb94a618f5272be246ef
2020-03-24 07:04:54 -07:00
Dan Willemsen 2b8b89cfa2 soong_config: bool_variables shortcut
Using a lot of boolean variables can become very verbose without adding
really any new information:

      variables: ["a", "b", "c"],
  }

  soong_config_bool_variable {
      name: "a",
  }

  soong_config_bool_variable {
      name: "b",
  }

  soong_config_bool_variable {
      name: "c",
  }

Now turns into:

      bool_variables: ["a", "b", "c"],
  }

Test: built-in tests
Change-Id: If5455a38433431c7ecbce1e5b32cfbb47f42602a
2020-03-23 22:42:32 -07:00
Paul Duffin 495ffb9ff9 Remove old SdkMemberType API for creating snapshot modules
Migrates system modules and droid stubs over to use the new API for
creating the snapshot modules and removes the old API.

Test: m nothing
Change-Id: Ia825767f1f7ee77f68cfe00f53e09e6f6bfa027f
2020-03-23 08:48:03 +00:00
Paul Duffin a551a1c2f9 Improve consistency of handling java snapshot properties
Previously, java snapshot properties (java_library and java_test)
relied on the properties not being optimized when there was a single os
type and instead being added directly to the common os type properties.
However, that means that the behavior is inconsistent for other member
types depending on whether there was one os type or not.

This change updates the java sdk member handling to support
optimization. This involved:
1) Adding AidlIncludeDirs field to librarySdkMemberProperties to
   specify the aidl include dirs instead of extracting that from the
   library field.

2) Renaming jarToExport to JarToExport (in both
   library/testSdkMemberProperties)to allow it to be optimized.

3) Adding MemberType() and Name() methods to SdkMemberPropertiesContext
   to avoid having to store the former in the properties struct and
   retrieve the latter from the library/test fields.

4) Removing the now unused library/test fields from the properties
   structures.

5) Separating the processing of the jar/test config in
   AddToPropertySet(...) as they may be optimized separately.

6) Ditto for the jar/aidl include dirs.

7) While doing this work I noticed that although the contents of the
   aidl include dirs are copied into the snapshot the java_import does
   not make use of them. Raised bug 151933053 and added TODO to track
   that work.

Bug: 142935992
Test: m nothing
Change-Id: Iba9799e111ca5672b2133568163d8c49837ba9cd
2020-03-23 08:48:03 +00:00
Paul Duffin 3a4eb50829 Make new module creation API more flexible
Previously passing additional information to the implementations of
AddPrebuiltModule() or the SdkMemberProperties interface would have
required making changes to the API. This change added an
SdkMemberContext object into which additional information can easily
be added without requiring changes to existing implementations.

The BuildSnapshot() method was not modified because it is deprecated
and will be removed in a follow up change.

It also switches the API from passing variants as android.SdkAware to
android.Module. That is for a couple of reasons:
1) SdkAware is designed for managing the relationship between the
   module and the SDK, not for generating the output snapshot. As such
   there is nothing in SdkAware that is needed for generating the
   output snapshot.
2) Accepting android.Module instead makes it easier to use the
   underlying code for generating the snapshot module as well as the
   individual member modules.

This is in preparation for a number of improvements and bug fixes in
both the snapshot creation code and implementations to address found
while trying to built the platform against ART prebuilts.

Bug: 151937654
Test: m nothing
Change-Id: Iac10f1200c0f283aa35402167eec8f9aeb65a38e
2020-03-23 08:47:38 +00:00
Paul Duffin 9b76c0b65a Add support for using cc_library in sdk/module_exports
Added link type support in module creation code as cc_prebuilt_library
has to provide both shared and static libraries.

Had to add some calls to FirstUniquePaths() around the include dirs
settings in library_sdk_member as otherwise the shared variant contains
duplicate include dirs (presumably because it gets one set from its
dependency on the static variant and one set of its own). That
difference in include dirs causes problems in the generated
cc_prebuilt_library.

Test: m nothing
Bug: 142918168
Change-Id: Ie7f23fc2341c83c7814cc98e3970df4f5d4c8423
2020-03-20 16:55:24 +00:00
Martin Stjernholm 71da478f51 Merge changes I2ab8f6aa,I53d58100
* changes:
  Add SDK member support for cc_object.
  Add cc_prebuilt_object.
2020-03-20 16:53:51 +00:00
Martin Stjernholm cd07bce437 Add SDK member support for cc_object.
Test: m nothing
Test: Add
    sdk {
        name: "runtime-module-sdk",
        native_shared_libs: [
            "libc",
            "libdl",
            "libm",
            "ld-android",
        ],
        native_objects: [
            "crtbegin_dynamic",
            "crtbegin_static",
            "crtend_android",
        ],
    }
  to bionic/apex/Android.bp. Then:
    build/soong/scripts/build-aml-prebuilts.sh runtime-module-sdk
  Take the generated runtime-module-sdk-current.zip and unzip into a
  master-art tree without bionic/, edit the generated Android.bp to
  extend cc_prebuilt_* modules with:
    nocrt: true,
    stl: "none",
    system_shared_libs: [],
    apex_available: ["//apex_available:anyapex"],
    recovery_available: true,
    vendor_available: true,
    ramdisk_available: true,
  Then "m com.android.art.debug". This passes Soong but fails in the
  build step because more members are required.
Bug: 148934017
Change-Id: I2ab8f6aadb1440b325697cae4a8ed761c62d15d2
2020-03-20 00:16:14 +00:00
Jooyung Han 67b141d459 Fix forwarding a vararg parameter
vararg parameter is passed without unpacking, which prints
not-so-useful value.

Bug: 151963308
Test: m
Merged-In: I03f011557d10c6e2bc06813491cd8df2cce7c6ea
Change-Id: I03f011557d10c6e2bc06813491cd8df2cce7c6ea
(cherry picked from commit cd87c69de4)
2020-03-19 20:00:36 +00:00
Treehugger Robot 4726b9c8a0 Merge "Apply EnforceRROExemptedTargets in Soong" 2020-03-19 01:47:54 +00:00
Paul Duffin 175ef303a3 Merge "Refactor prebuilt to use srcs supplier function" 2020-03-17 09:55:58 +00:00
Elliott Hughes cc868de8a7 Merge "Remove unused mips workarounds." 2020-03-16 21:06:13 +00:00
Paul Duffin dcb4bd6fb4 Refactor prebuilt to use srcs supplier function
Previously, prebuilt had two ways to provide the src value, as a
pointer to an []string and using reflection. That meant that any code
that needed to check the src to use had to understand the two ways of
accessing it.

This change refactors the code to abstract the origin of the src values
being a supplier function. That insulates the callers from having to
know the details and makes it easy to add new suppliers in future.

Test: m nothing
Bug: 142918168
Change-Id: I5cc7517c46cce96924c9f34ba1b046b468f7684a
2020-03-16 19:27:11 +00:00
Paul Duffin 2c73260636 Merge "Remove SdkMemberType.FinalizeModule" 2020-03-16 11:04:26 +00:00
Jooyung Han 23b0adf4ce apex: Deprecate legacy_android10_support prop
min_sdk_version = 29 implies that the module should support Android10.

Bug: 150431944
Test: m
Merged-In: Iad90a239898f59456900ae7816b90379b1b43406
Change-Id: Iad90a239898f59456900ae7816b90379b1b43406
(cherry picked from commit 5417f775e5)

Exempt-From-Owner-Approval: cp from aosp
2020-03-16 10:57:51 +00:00
Jooyung Han 5417f775e5 apex: Deprecate legacy_android10_support prop
min_sdk_version = 29 implies that the module should support Android10.

Bug: 150431944
Test: m
Change-Id: Iad90a239898f59456900ae7816b90379b1b43406
2020-03-14 16:03:24 +09:00
Paul Duffin 0174d8d2c9 Remove SdkMemberType.FinalizeModule
This was only being used to set the "stl" property for cc library sdk
member type and so that functionality was moved to AddPrebuiltModule()
and FinalizeModule was removed.

Required a few test changes to move the property to the correct
position in the generated module.

Bug: 142918168
Test: m nothing
Change-Id: If6400189833d4ff3285e7a7adf63a9b509e2a03b
2020-03-13 17:25:16 +00:00
Paul Duffin 13f0271478 Copy shared_libs and system_shared_libs to module snapshot
This change ensures that the runtime dependencies between a
binary/shared library are correctly specified in the snapshot so that
the build can ensure that shared libraries are built before the targets
that use them.

It adds support for differentiating between references that are
required to refer to another sdk member (required) and those that may
refer to either an sdk member or a non-sdk member (optional). The
latter is used for shared library references as the libraries used by
an sdk member may be provided from outside the sdk. e.g. liblog is not
part of the ART module but is used by some members of the ART sdk.

Bug: 142935992
Test: m nothing
Change-Id: Ia8509ffe79b208c23beba1880fe9c8a92b732685
2020-03-13 11:14:07 +00:00
Paul Duffin b07fa51196 Support extracting common values from embedded structures
This change also added support for excluding properties from common
value extraction by using a struct tag of `sdk:"keep"` That was needed
to prevent the fields in SdkMemberPropertiesBase from having their
values cleared.

The purpose of this change is to make it easier to share functionality
across sdk member types.

Bug: 142935992
Test: m nothing
Change-Id: Ie5160a8f854056920e411801ca20721eab7c8578
2020-03-13 10:47:14 +00:00
Jooyung Han 0c4e016428 apex: choose stub according to min_sdk_version
Native modules within APEX should be linked with proper stub version
according to its min_sdk_version.

For example, when min_sdk_version is set to "29", libfoo in the apex
would be linked to libbar of version 29 from platform, even if it has
a newer version like 30.

Bug: 145796956
Test: m nothing (soong tests)
Merged-In: I4a0b2002587bc24b7deeb5d59b6eeba5e1db5b1f
Change-Id: I4a0b2002587bc24b7deeb5d59b6eeba5e1db5b1f
(cherry picked from commit 03b5185b88)

Exempt-From-Owner-Approval: got ORV already.
2020-03-12 14:07:05 +00:00
Paul Duffin 7d74e7bea3 Copy white listed apex available settings into snapshot
Makes sure that the module snapshots do not rely on the white list
of apex available settings so that when those lists are removed it is
not necessary to update any snapshots.

Bug: 142935992
Test: m nothing
Change-Id: Iedcff7dfc2646a4da77258d16e06657dd2f411f9
2020-03-11 18:31:45 +00:00
Paul Duffin a04c107bfa Add support for multiple os types
Updates the member snapshot creation code to support multiple os types.
It basically sorts the variants by os type, then applies the code to
optimize the arch properties and then it optimizes the properties that
are common across architectures and extracts any properties that are
common across os types.

The java and cc member types needed to be modified to make the location
of the generated files within the snapshot os type dependent when there
is more than one os type. That was done by adding an OsPrefix() method
to the SdkMemberPropertiesBase which returns the os prefix to use when
there is > 1 os type and otherwise returns an empty string.

Added three tests, one for cc shared libraries, one for cc binary and
one for java header libraries.

Bug: 150451422
Test: m nothing
Change-Id: I08f5fbdd7852b06c9a9a2f1cfdc364338a3d5bac
2020-03-09 15:54:31 +00:00
Paul Duffin b3c763711a Merge "Refactor snapshot module creation" 2020-03-09 11:02:29 +00:00
Jeongik Cha b9b1327c2d Apply EnforceRROExemptedTargets in Soong
As PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS is defined in make, define it in
soong accordingly

Bug: 150820813
Test: m
Change-Id: I309482b6ad439a7602127f68f2f7ffa856b9e192
2020-03-09 16:06:19 +09:00
Elliott Hughes da3a071eaa Remove unused mips workarounds.
This was never really finished, and hasn't been supported for years.

Test: treehugger
Change-Id: I21d4c3112aa8cf0c56e59f0cc19ff8725ef714b9
2020-03-06 18:15:44 -08:00
Jooyung Han 03b5185b88 apex: choose stub according to min_sdk_version
Native modules within APEX should be linked with proper stub version
according to its min_sdk_version.

For example, when min_sdk_version is set to "29", libfoo in the apex
would be linked to libbar of version 29 from platform, even if it has
a newer version like 30.

Bug: 145796956
Test: m nothing (soong tests)
Change-Id: I4a0b2002587bc24b7deeb5d59b6eeba5e1db5b1f
2020-03-07 03:12:45 +09:00
Paul Duffin 8c3fec4c37 Enable androidmk processing in sdk testing
Previously, while sdk tests would pass the sdk code would often fail
in androidmk processing. This change makes the tests more realistic
and will catch the errors earlier.

Bug: 142935992
Test: m nothing
Change-Id: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
2020-03-06 09:45:54 +00:00
Paul Duffin 88f2fbe92e Refactor snapshot module creation
Generalize the processing of arch specific properties to reduce
duplication in snapshot module creation and simplify addition of
support for handling multiple os types.

Supporting multiple os types with the current method for building
snapshot modules would require every affected module type to add
support for it. Rather than duplicate multiple os type handling code
across those module types this work generalizes the process cc modules
use for handling arch types as it can be used as a basis for handling
multiple os types. Migrating module types over to this new process
will insulate them from having to handle multiple os types.
OB
SdkMemberType changes:
* BuildSnapshot is deprecated in favour of the new AddPrebuiltModule()
  method.
* Additional methods, CreateVariantPropertiesStruct() and
  FinalizeModule() are added.
* A new interface SdkMemberProperties, is defined that handles
  extracting information from the variant (prior to common value
  optimization) and adding properties to a property set.

The sdk module type uses these new methods and types to delegate the
member type specific processing to the relevant member types while
handling the behavior that is common across all members types, e.g.
extracting common values across multiple architectures. A future change
will leverage this processing to add support for multiple os types.

This change also refactors the cc module processing to use the new
process.

Bug: 150451422
Test: m nothing
Change-Id: If6ab2498407b17f50391d062cd9afc01b5e01af4
2020-03-05 13:00:26 +00:00
Nicolas Geoffray 8f20563514 Merge "Add a nice install paths for module SDKs and exports." 2020-03-05 09:25:33 +00:00
Paul Duffin befa4b91d7 Copy apex_available properties to snapshot modules
Bug: 142935992
Test: m nothing
Change-Id: I1cdaae5b4e13a89dc46541dacd34ef5a44735b6a
2020-03-05 08:29:02 +00:00
Treehugger Robot 5d95387398 Merge "Make a soong-only copy of generate-notice-files.py" 2020-03-04 21:56:04 +00:00
Nicolas Geoffray 1228e9c0ba Add a nice install paths for module SDKs and exports.
Following how NDK also creates its own install path.

Bug: 142935992
Test: cc_sdk_test.go, java_sdk_test.go
Change-Id: I98a3656903f37f6d7c90e6cf609431b2461a6161
2020-03-04 14:20:46 +00:00
Justin Yun 98df0d1c63 Enable vndk-ext for product variants
To build vndk-ext for product variants use `vndk.extends` property
with `product_specific: true` as for the vndk-ext for vendor
variants. For example:
cc_library {
    name: "libvndk_ext_product",
    product_specific: true,
    vndk: {
        enabled: true,
        extends: "libvndk",
    },
}

It will install the vndk-ext libs for product variants in
product/lib[64]/vndk/

Test: m nothing
Bug: 147778025
Change-Id: If1ee5be93c579abad302f44f18e6316f27e70019
Merged-In: If1ee5be93c579abad302f44f18e6316f27e70019
(cherry picked from commit 0ecf0b223f)
2020-03-04 04:37:02 +00:00
Justin Yun 0ecf0b223f Enable vndk-ext for product variants
To build vndk-ext for product variants use `vndk.extends` property
with `product_specific: true` as for the vndk-ext for vendor
variants. For example:
cc_library {
    name: "libvndk_ext_product",
    product_specific: true,
    vndk: {
        enabled: true,
        extends: "libvndk",
    },
}

It will install the vndk-ext libs for product variants in
product/lib[64]/vndk/

Test: m nothing
Bug: 147778025
Change-Id: If1ee5be93c579abad302f44f18e6316f27e70019
2020-03-04 01:22:16 +00:00
Bob Badour 3911e6a1c4 Make a soong-only copy of generate-notice-files.py
This is an unchanged copy of build/make/tools/generate-notice-files.py

After this change, the make implementation of generate-notice-files.py
will change to take a required parameter for $(PRODUCT_OUT) and will
only include notices for files built under $(PRODUCT_OUT).

Because soong has the ability to walk dependency trees, the soong
version will likely change in the future to use that ability causing
both versions to move in different directions.

After those changes are complete, we can look into factoring out any
remaining shared logic.

Test: run manually and system image notices checked for changes

Change-Id: Id139a66503457615548b46e7996349ca0817e831
2020-03-03 13:50:53 -08:00
Colin Cross 1a0f984d43 Merge "Optimize FirstUniqueStrings and FirstUniquePaths" 2020-03-03 20:48:35 +00:00
Colin Cross 27027c765e Optimize FirstUniqueStrings and FirstUniquePaths
FirstUniquePaths is called on some long lists where the O(n^2)
behavior is problematic.  Use a map-based implementation for
longer lists.

Test: TestFirstUniqueStrings
Change-Id: I7181aba869e5ccc0f99c2fa7b8f03839f06e4307
2020-03-02 15:00:15 -08:00
Paul Duffin ca7f0efc2d Improve documentation of CompileMultiTargets and related properties
Test: m nothing
Change-Id: I1e3f0bf7e2a1303d2519d8405a228e9234235514
2020-03-02 19:32:40 +00:00
Paul Duffin 1356d8c0f3 Add CommonOS variant for sdk
Adds a CommonOS variant for sdk that depends on the os specific
variants and is used to generate a single sdk for multiple OsTypes,
e.g. host linux and android.

At the minute the member types only support a single OsType but the
basic mechanism for managing the CommonOS variant and collating the
variants across all of them is there.

The only visible effect of this change is that the location of the
generated snapshot is changed, it is no longer os specific and instead
is in the same location irrespective of which os it is built for.

A lot of tests needed to be changed to specify "common_os" as the
variant type instead of the specific os type. As that is the same across
all tests it is hard coded in CheckSnapshot method.

Test: m nothing
Bug: 150451422
Change-Id: If36be39b06d6910453649f7c288c2d34f688b2f4
2020-03-02 19:31:26 +00:00
Colin Cross 9403e4b704 Merge "Collect metrics from inside soong_build" 2020-02-28 23:23:29 +00:00