Commit graph

19116 commits

Author SHA1 Message Date
Paul Duffin
1110827b3f Defer \n quoting generatedContents until creating the ninja rule
Previously, when writing to generatedContents \n characters were
quoted (replaced with \\n) so as to allow them to be preserved through
ninja/rsp/bash and were unquoted (replaced \\n with \n) just before
redirecting to the output file. That meant that any code which wanted
to access the contents for other purposes, e.g. testing had to unquote
\\n.

This change moves the quoting to be part of the code that generates the
ninja rule which simplifies any other code that has to access the
contents.

Without quoting the generated Android.bp files are not formatted
properly, are all on one line and completely unreadable.

Bug: 156286550
Test: m art-module-sdk and check generated Android.bp file to make sure
      it is properly formatted.
Change-Id: I768c3b96ed08a3daf251730e2a10d9d72338c49a
2020-05-11 22:59:25 +01:00
Paul Duffin
9f10bbf4cf Merge "java_sdk_library: Specify visibility of stubs modules" 2020-05-10 18:31:56 +00:00
Paul Duffin
2346e960a9 Merge "Retry: Fix snapshot of a host/device cc_library with stubs" 2020-05-09 07:51:27 +00:00
Paul Duffin
ad5191885d Merge "Retry: Adds support for 'ignored-on-host'" 2020-05-09 07:33:50 +00:00
Paul Duffin
385378bf99 Merge "Retry: Detect invalid arch specific properties in snapshot" 2020-05-09 07:33:35 +00:00
Treehugger Robot
9c3a1291e2 Merge "Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis" 2020-05-09 02:13:42 +00:00
Colin Cross
3c007704c7 Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis
Check that jni_uses_sdk_apis and jni_uses_platform_apis are consistent
with sdk_version, and add tests that they select the right variant.

Bug: 154665579
Test: app_test.go
Change-Id: I544a4f881ba16dacd7e74cd480c095091b3cf667
2020-05-08 16:55:14 -07:00
Paul Duffin
7a1f7f32ab Retry: Fix snapshot of a host/device cc_library with stubs
Change since last attempt: Disable test that breaks on darwin.

Adds a test that fails with unknown property android.stubs.versions
and then fixes that by marking the field from which that property is
created with 'ignored-on-host' and implemented the isHostVariant on
*osTypeSpecificInfo.

Bug: 155628860
Test: m nothing
Change-Id: Ia4e744c9e799d5adaf8a2f761516f568ec363ad4
2020-05-08 22:32:08 +01: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
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
Greg Kaiser
ad913d56ac Revert "Fix snapshot of a host/device cc_library with stubs"
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: Ibccce5286605bb71c6be3b3550ba86d8b7e24fa7
2020-05-08 19:12:34 +00:00
Liz Kammer
50fc599bbc Merge "Add androidmk support for runtime_resource_overlay" 2020-05-08 18:07:01 +00:00
Paul Duffin
4911a89181 java_sdk_library: Specify visibility of stubs modules
Adds two new properties to specify the visibility of the stubs modules
(source and library) created by the java_sdk_library. Excludes
visibility property from being inherited when creating the module so it
can be properly specified by copying across the relevant property.

Test: m checkapi
Bug: 155164730
Change-Id: Iffdd9f191ff0d74646356ac577560cc38efdd790
2020-05-08 18:03:31 +01:00
Paul Duffin
f49f431c33 Merge "java_sdk_library: Add support for module_lib API surface" 2020-05-08 17:02:37 +00:00
Paul Duffin
d34bc09aa1 Merge "java_sdk_library: Control API surfaces generated" 2020-05-08 17:01:50 +00:00
Daniel Norman
ad521eeb14 Merge "Removes $(PRODUCT_OUT)/misc_info.txt on installclean." 2020-05-08 16:22:59 +00:00
Jiyong Park
18bbde1615 Merge "Revert "Prevent statically linking to a lib providing stable C APIs"" 2020-05-08 08:11:24 +00:00
Jiyong Park
5b75774004 Revert "Prevent statically linking to a lib providing stable C APIs"
This reverts commit 45b90e79c9.

Reason for revert: breakage https://android-build.googleplex.com/builds/quarterdeck?branch=aosp-master&target=run_bluetooth_host_native_tests&lkgb=6474123&lkbb=6474183&fkbb=6474137

Bug: 156046846
Change-Id: I0df395eaa4cd856ab466925031b21aa4adc3af08
Test: m on full-eng
2020-05-08 07:55:47 +00:00
Paul Duffin
8f265b9ab9 java_sdk_library: Add support for module_lib API surface
Adds api scope for the module_lib and adds that to the list of all
all available scopes. The scope is generated if and only if the
api_surfaces property contains "module_lib".

No other changes are needed as the generation of the APIs is completely
driven by the allApiScopes array and the information in its contained
apiScope structures.

Test: m checkapi
Bug: 155164730
Change-Id: I7769af6823badca8715a270f86cf53b4e954b7df
2020-05-08 07:51:00 +01:00
Paul Duffin
3375e35d99 java_sdk_library: Control API surfaces generated
Adds a per scope set of properties that allows explicit control over
the API surfaces generated.

Previously, the term active was used to determine whether it was
generated but that was a little abstract and unclear so has been
replaced by generated.

Test: m nothing
Bug: 155164730
Change-Id: I7539d89618b61f6b9d1a4b60cc3f9614b157f0d9
2020-05-08 07:51:00 +01: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
Daniel Norman
b8e7f81af6 Removes $(PRODUCT_OUT)/misc_info.txt on installclean.
misc_info.txt's build rule does not contain inputs to tell it to
refresh on an incremental build, so incremental builds (even after
installclean) were reusing this file.

With this change, misc_info.txt is removed by installclean so that an
incremental build generates the file fresh.

Test: # misc_info.txt exists; m installclean; # misc_info.txt gone
Bug: 155930200
Change-Id: Ia319925dad26f98049a988ee1ceb1e20db621353
2020-05-07 23:48:30 +00: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
Liz Kammer
74151f2c8c Add androidmk support for runtime_resource_overlay
Test: androidmk_test.go
Bug: 148673525
Change-Id: I25c277c52b91e9308e15d92364b5504a8f556c9f
2020-05-07 14:40:57 -07:00
Treehugger Robot
cf23ab4cd8 Merge "Skip dexpreopting android_test_import modules" 2020-05-07 21:37:37 +00:00
Treehugger Robot
3d60daadbc Merge "Switch java_sdk_library to use SetDefaultableHook()" 2020-05-07 20:39:05 +00:00
Colin Cross
c80828d567 Skip dexpreopting android_test_import modules
android_test_import modules should be labelled as tests so they are
not dexpreopted.

Bug: 155778135
Test: m CtsCorruptApkTests_Compressed_Q
Change-Id: I7baa5405d03df03920b01616b030ba77f882a77e
2020-05-07 12:06:14 -07:00
Colin Cross
7500f46b95 Merge "Add jni_uses_sdk_apis" 2020-05-07 18:09:47 +00:00
Colin Cross
7204cf0e6a Add jni_uses_sdk_apis
NetworkStackTests is using platform APIs for its Java code, but needs
to use portable JNI libraries.  Add a jni_uses_sdk_apis so that it
can select the SDK variants of JNI libraries even though it doesn't
set sdk_version.

(clean cherry-pick from internal branch)
Bug: 154665579
Test: atest NetworkStackTests
Merged-In: I841fb761ec1c1ab8596aac44e01eb7eb91428006
Change-Id: I841fb761ec1c1ab8596aac44e01eb7eb91428006
2020-05-07 18:09:06 +00:00
Ivan Lozano
6c4e5c05c3 Merge "Add gcov coverage support to Rust modules." 2020-05-07 17:56:43 +00:00
Paul Duffin
2af52380be Fix snapshot of a host/device cc_library with stubs
Adds a test that fails with unknown property android.stubs.versions
and then fixes that by marking the field from which that property is
created with 'ignored-on-host' and implemented the isHostVariant on
*osTypeSpecificInfo.

Bug: 155628860
Test: m nothing
Change-Id: I167b47a1374f541aa09d7e045972d740f1d9009c
2020-05-07 18:35:11 +01: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
bd7e3295dd Merge "Allow extractCommonProperties to return an error" 2020-05-07 16:17:42 +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
Treehugger Robot
4779327cf8 Merge "Remove implicit Bionic and kernel system includes." 2020-05-07 13:35:13 +00:00
Jeongik Cha
9d902cef58 Merge "Remove networkstack-aidl-interfaces-unstable-java from the whitelist" 2020-05-07 10:59:05 +00:00
Treehugger Robot
d9e4bf9840 Merge "Reduce the number of Soong invocations, and various other minor script fixes." 2020-05-07 10:36:54 +00:00
Treehugger Robot
aa71638941 Merge "java_sdk_library: Define relationship between api scopes" 2020-05-07 09:37:54 +00:00
Paul Duffin
f022920bde Switch java_sdk_library to use SetDefaultableHook()
Previously, java_sdk_library used AddLoadHook() to register a hook that
when called would create its child modules. That meant the
java_sdk_library properties that were used to create the child modules,
e.g. sdk_version could not be defaulted because the modules are created
before the defaults are applied.

This change switches java_sdk_library to use the new
SetDefaultableHook() mechanism to register the hook instead of the
AddLoadHook() mechanism.

It also prevents the child modules from being created if the module has
been disabled.

Bug: 155295806
Test: m checkapi
Change-Id: Ic6f90eb4449338e549878f64e8119e286b9aa549
2020-05-07 10:24:00 +01:00
Paul Duffin
955ade6475 Merge changes I13df3115,I825c6df0
* changes:
  Add hook to be called after defaults have been applied
  Move prebuilts mutators after defaults have been applied
2020-05-07 09:18:26 +00:00
Jiyong Park
45b90e79c9 Prevent statically linking to a lib providing stable C APIs
A lib providing stable C APIs should be available only to the APEX
containing the library. It shouldn't be available to other APEXes,
especially via static linking.

This change also fixes a bug that llndkImplDep (the dependency from
llndk stub to its implementation library) was recognized as being in the
same APEX.

Bug: 151051671
Test: m
Change-Id: Ifda7f4a367f68afcde93c86cda45a28cacd91f99
2020-05-07 16:20:00 +09: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
Yo Chiang
6345dfde49 Merge "APEX should require base module of stub libraries" 2020-05-07 06:13:49 +00:00
Martin Stjernholm
691503ea0b Reduce the number of Soong invocations, and various other minor script fixes.
-  We can pass all targets at once to build-aml-prebuilts.sh.
-  Less noise from build-mainline-modules.sh.
-  Default to the same out directory in both build scripts.
-  Addressed post-submit comments on https://r.android.com/1170907.
-  Various minor cleanups.

Test: build/soong/scripts/build-mainline-modules.sh
Change-Id: Id21ef80c2334462836e217032fc5bf63b7cd04e1
2020-05-06 22:51:15 +01:00
Paul Duffin
97486dbb4b Merge "Encapsulate getter into an extractorProperty structure" 2020-05-06 20:18:39 +00:00
Paul Duffin
11c91dc141 Merge "Encapsulate properties to be optimized in a container" 2020-05-06 20:18:22 +00:00