Commit Graph

1300 Commits

Author SHA1 Message Date
Colin Cross d1818c8ed0 Merge "Split out osMutator from archMutator" 2019-10-17 19:04:18 +00:00
Colin Cross fb91986493 Merge "Add arch mutator test" 2019-10-17 18:52:33 +00:00
Colin Cross ad4a597c79 Merge "Add method to determine variations from a Target" 2019-10-17 18:52:20 +00:00
Pete Gillin 4fe25b05b9 Merge "Enable Java language level 9 by default." 2019-10-17 10:38:35 +00:00
Treehugger Robot d7d5e5a1ac Merge "Create scripts to update and freeze a module SDK" 2019-10-17 01:02:16 +00:00
Treehugger Robot 344eed4eb1 Merge "Add SingletonContext::VisitDirectDepths[If] to Android proxy." 2019-10-17 00:45:25 +00:00
Colin Cross a195f91471 Split out osMutator from archMutator
Split the archMutator into two mutators, osMutator to create
android/linux/darwin variants, and archMutator to then further
split them into arm/arm64, etc.  When combined with alias
variants in Blueprint this will allow us to depend on the
"android" variant without having to know what architectures
were used to build it.

Test: m checkbuild
Change-Id: I0f51d60fc440cf5ae503904ce7849ec797af5fe2
2019-10-16 15:27:23 -07:00
Colin Cross 158eeb7701 Add arch mutator test
Add a test for the arch mutator in preparation for splitting it
into two mutators.

Test: m checkbuild
Change-Id: Ifd0a146a085901d33db50e783bdfad31edd7b7a6
2019-10-16 15:27:23 -07:00
Mitch Phillips 3a7a31b0c1 Add SingletonContext::VisitDirectDepths[If] to Android proxy.
Adds the VisitDirectDepths[If] function from blueprint to the Android
SingletonContext proxy.

Bug: N/A
Test: N/A
Change-Id: I4037364ef11b545abc9a383db7e1e818854db68f
2019-10-16 15:06:32 -07:00
Colin Cross 0f7d2ef3ac Add method to determine variations from a Target
The arch variants are hardcoded in every module type.  Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.

Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
2019-10-16 14:52:30 -07:00
Pete Gillin 1b3370f5d7 Enable Java language level 9 by default.
This changes the default Java language level from 8 to 9, i.e. javac
invocations now use -source 1.9 -target 1.9.

The environment variable EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false is
added to switch back to the language level 8 behaviour. (Previously,
setting that variable to true was required to opt in to language level
9.)

Test: make droid java tests cts docs
Test: javap -v <some class file in output> | grep 'major version' (reports 53, for classes from 'benchmarks' which is in Android.bp and 'ahat' which is in Android.mk)
Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests (two main flavours of robolectric)
Test: make cts && cts-tradefed help
Test: atest CtsLibcoreTestCases (reasonably low-level device tests)
Test: atest CtsHostTzDataTests (arbitrary host test)
Bug: 115604102
Change-Id: I9de888e1df021244d5e61c40934178676f09ecc7
Merged-In: I52be1817fa7121fca3bce3d8857cb9ed0825570c
2019-10-16 11:20:13 +01:00
Jiyong Park 9b409bcd10 Create scripts to update and freeze a module SDK
`m <sdk_name>` generates two scripts each of which is use to update the
current snapshot of the SDK and to freeze ToT as a new version,
respectively. Executing the scripts will copy necessary files (stub
libraries, AIDL files, etc.) along with Android.bp into the ./<apiver>
directory under the directory where the sdk is defined.

This change also introduces a new module type 'sdk_snapshot' that
represents a snapshot of an SDK. It will be auto-generated by the above
scripts, so developers are not expected to write this manually.

The module type 'sdk' is now used to simply specify the list of modules
that an SDK has.

Finally, this change changes the version separator from '#' to '@'
because '#' confuses Make.

Bug: 138182343
Test: m

Change-Id: Ifcbc3a39a2f6ad5b4f4b200ba55a1ce3281498cf
2019-10-15 18:49:58 +09:00
Jiyong Park a90ca00786 add [static|shared].apex_available to cc_library
apex_available property can be appended differently per the linkage
type. This will be used to restrict certain libs (e.g.
libc_malloc_debug) to an APEX while allowing them to be statically
linkable from platform for testing purpose.

Test: m (apex_test amended)
Change-Id: I6dec23129c5ac93a3ef06fea28f26f240c0ba410
2019-10-15 15:28:07 +09:00
Orion Hodson 4b5438a9ea Make apex_available respect AllowMissingDependencies
When SOONG_ALLOW_MISSING_DEPENDENCIES is defined in the build, don't
fail if an apex_available entry is not available. This is for smaller
Android manifests that may not include all APEX projects (e.g. master-art).

Bug: 142300164
Test: able to build from master-art manifest.
Change-Id: Ice1274f7dd143c4b1bf756e2cde93e217266affa
2019-10-08 10:40:51 +01:00
Treehugger Robot e89b8fb919 Merge "Remove no_apex in favor or apex_available" 2019-10-08 05:33:29 +00:00
Colin Cross 2334757d24 Merge "Filter product variable property structs" 2019-10-07 20:53:44 +00:00
Treehugger Robot c6136c9d65 Merge "Remove old-style support for translated second architectures" 2019-10-07 20:48:07 +00:00
Colin Cross 8b0dc4be07 Merge "Add symlinks to sh_binary in soong" 2019-10-07 17:47:45 +00:00
Rashed Abdel-Tawab 6a34131da4
Add symlinks to sh_binary in soong
This allows us to change `logpersist.start` to `sh_binary` and unblocks
breakpad symbol uploading

Test: convert logpersist.start to sh_binary and verify symlinks are correct
Change-Id: I1b86c512df73a336205ca35216445a08e43bb879
2019-10-04 20:51:44 -07:00
Treehugger Robot 96ce6ab143 Merge "Use localPool consistently for UseGoma() == true" 2019-10-04 18:36:07 +00:00
Colin Cross ff6c33d885 Replace RelPathString() with ToMakePath()
Add a ToMakePath() method that returns a new path that points out
out/ instead of out/soong/, and replace the
"$(OUT_DIR)/" + path.RelPathString()
pattern with
path.ToMakePath().String()

Bug: 141877526
Test: m checkbuild
Change-Id: I391b9f2ed78c83a58d905d48355ce9b01d610d16
2019-10-03 10:07:53 -07:00
Colin Cross 70dda7e3da Separate InstallPath from OutputPath
Create a new type InstallPath that is similar to OutputPath to
differentiate intermediates output paths from installed output
paths.

RelPathString is a poorly defined, undocumented function that is
primarily used to get an install path relative to out/soong to
generate an equivalent install path for Make relative to $(OUT_DIR).
Move it to InstallPath for now, and fix the one remaining user on
OutputPath.

Add a method to create an NDK install path so that ndk_sysroot.go
doesn't have to do it manually with PathForOutput.

Bug: 141877526
Test: m checkbuild
Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
2019-10-03 10:07:53 -07:00
Colin Cross 90ba5f4e98 Add InstallInRoot to allow modules to install into root partition
If InstallInRoot() returns true the module will be installed to
$OUT/root or $OUT/recovery/root.

Bug: 141877526
Test: m checkbuild
Test: no change to build.ninja or Android-${TARGET_PRODUCT}.mk
Test: TestPathForModuleInstall
Change-Id: Id6e435c6019f11eeb5806528fd464dbf220b88d9
2019-10-03 10:07:46 -07:00
Treehugger Robot 2f429160c1 Merge changes from topic "filter_arch_properties"
* changes:
  Make CreateModule return the newly created module
  Move arch properties to proptools.FilterPropertyStruct
2019-10-02 18:53:54 +00:00
Jiyong Park 7916bfc3cc Remove no_apex in favor or apex_available
This change reverts following three changes to remove the no_apex
property. no_apex: true is equivalent to apex_available:
["//apex_available:platform"].

Revert "fix: "no_apex" can be put in defaults"
This reverts commit cc372c5b1d.

Revert "Add no_apex check for static library"
This reverts commit 2db7f46d0c.

Revert "Add no_apex property"
This reverts commit 4f7dd9b4db.

Bug: 139870423
Bug: 128708192
Test: m

Change-Id: Ia4b094e371e9f8adff94ae6dc3ebb8e081381d4e
2019-10-02 14:12:16 +09:00
Jiyong Park 127b40b316 Add apex_available to control the availablity of a module to APEXes
apex_available property controls the availability of a module to APEXes.
For example, `apex_available: ["myapex", "otherapex"]` makes the module
available only to the two APEXes: myapex and otherapex, and nothing
else, even to the platform.

If the module is intended to be available to any APEX, then a pseudo
name "//apex_available:anyapex" can be used.

If the module is intended to be available to the platform, then another
pseudo name "//apex_available:platform" is used.

For now, if unspecified, this property defaults to ["//apex_available:platform",
"//apex_available:anyapex"], which means the module is available to everybody.
This will be reduced to ["//apex_available:platform"], when marking for
apex_available for existing modules are finished.

Bug: 139870423
Bug: 128708192
Test: m
Change-Id: Id4b233c3056c7858f984cbf9427cfac4118b2682
2019-10-02 14:12:16 +09:00
Yo Chiang fdc9afa15b Merge "Change RRO enforcement logic" 2019-10-02 02:34:35 +00:00
Colin Cross 2e2dbc250a Use localPool consistently for UseGoma() == true
Remove the distinction between pctx.StaticRule and
pctx.AndroidStaticRule so that all of the local rules correctly
get assigned to the localPool.  Also put Module and Singleton
rules into the localPool.

Test: compare out/soong/build.ninja
Change-Id: Id2bb38eff3c7209340fe55bc9006f00bd3661d81
2019-10-01 14:11:20 -07:00
Treehugger Robot f856c005cb Merge changes from topic "soong_c_flags"
* changes:
  Creation of C Flags Build Variables
  Move sharding functions for reuse
2019-10-01 19:25:50 +00:00
Yo Chiang 4ebd06aa57 Change RRO enforcement logic
Change RRO logic from
"Enforce RRO for all modules when PRODUCT_ENFORCE_RRO_TARGETS is '*'"
to
"Enforce RRO for all modules when PRODUCT_ENFORCE_RRO_TARGETS includes '*'"

Bug: b/137727426
Test: test build on local machine
Change-Id: I5df1a776d324c92c0c8bbf79b4f24536cb9b5c21
2019-10-01 15:08:56 +08:00
Colin Cross 0a2f719bca Move sharding functions for reuse
Move shardPaths and shardTests to android.ShardPaths and
android.ShardStrings for reuse in other packages.

Test: m checkbuild
Change-Id: I868802872c73616b80f56cbf11f959c01a8b793a
2019-09-29 23:26:37 -07:00
Jaewoong Jung 0949f31657 Fix android_test install path.
Test: m nothing + diff soong mk and ninja files.
Bug: 140795853
Change-Id: I3667eac951dea7e447cf73219ff89199fca9ed63
2019-09-27 16:42:20 -07:00
Jaewoong Jung 9a1e8bdd0b Migrate java/androidmk.go to new system #2
This change migrates remaining AndroidMk()s in java/androidmk.go to
AndroidMkEntries().

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: Ib1107fafb175fdfd8539bf6158548224e4c87a6d
2019-09-27 08:10:39 -07:00
Jaewoong Jung 2784fda152 Merge "Migrate java/androidmk.go to new system #1" 2019-09-27 14:40:24 +00:00
Colin Cross 18c46807c9 Filter product variable property structs
For each module, take the default product variable properties and
create a new type that contains only the properties that exist in
the current module.  This will provide better errors when attemping
to set product variable properties that will never get used for
a module, and fixes errors when a module attempts to use a product
variable that also contains properties that don't apply to the
current module.

Fixes: 79249983
Test: TestProductVariables
Test: m checkbuild
Change-Id: I4dc24f7781b8ce798651cfc8bf3563005a92c13d
2019-09-26 15:03:07 -07:00
Colin Cross e003c4abdd Make CreateModule return the newly created module
Allow mutators to modify properties of the newly created module
by returning it.

Test: m checkbuild
Change-Id: I682caca86c0c8f7c3ae815a494d4c75962c8e2e8
2019-09-26 15:03:07 -07:00
Colin Cross 7444910e93 Move arch properties to proptools.FilterPropertyStruct
Test: m checkbuild
Change-Id: I85c5e6c86aea4ccf5bcddc2e5d468d66e0b38671
2019-09-26 15:03:07 -07:00
Colin Cross 84dfc3d331 Make CreateModule take an android.ModuleFactory
Reduce the boilerplate required to call CreateModule by taking an
android.ModuleFactory instead of a blueprint.ModuleFactory.

Test: m checkbuild
Change-Id: I1259d2dd3f7893b5319c333bc180727ac40f9e91
2019-09-26 17:19:26 +00:00
Jiyong Park d1063c1586 Introduce module type 'sdk'
This change introduces a new module type named 'sdk'. It is a logical
group of prebuilt modules that together provide a context (e.g. APIs)
in which Mainline modules (such as APEXes) are built.

A prebuilt module (e.g. java_import) can join an sdk by adding it to the
sdk module as shown below:

sdk {
    name: "mysdk#20",
    java_libs: ["myjavalib_mysdk_20"],
}

java_import {
    name: "myjavalib_mysdk_20",
    srcs: ["myjavalib-v20.jar"],
    sdk_member_name: "myjavalib",
}

sdk {
    name: "mysdk#21",
    java_libs: ["myjavalib_mysdk_21"],
}

java_import {
    name: "myjavalib_mysdk_21",
    srcs: ["myjavalib-v21.jar"],
    sdk_member_name: "myjavalib",
}

java_library {
    name: "myjavalib",
    srcs: ["**/*/*.java"],
}

An APEX can specify the SDK(s) that it wants to build with via the new
'uses_sdks' property.

apex {
    name: "myapex",
    java_libs: ["libX", "libY"],
    uses_sdks: ["mysdk#20"],
}

With this, libX, libY, and their transitive dependencies are all built
with the version 20 of myjavalib (the first java_import module) instead
of the other one (which is for version 21) and java_library having the
same name (which is for ToT).

Bug: 138182343
Test: m (sdk_test.go added)
Change-Id: I7e14c524a7d6a0d9f575fb20822080f39818c01e
2019-09-22 08:21:27 +09:00
Colin Cross 3b19f5d71d Remove old-style support for translated second architectures
Translated second architectures now go in NativeBridgeArch instead
of DeviceSecondaryArch.

This reapplies I568046330abc002d4eed582cb999b62a5eaba790 with
ctx.Config().HasMulitlibConflict() added to fix the NDK build,
which has arm64, arm, x86_64, and x86 architectures enabled.

Test: m checkbuild
Test: OUT_DIR=out_ndk build/soong/scripts/build-ndk-prebuilts.sh
Test: no change to build.ninja or Android-aosp_cf_x86_phone.mk
Change-Id: Iadcafbd64bfb9579ae7c86914927c43a062b0c8e
2019-09-19 12:54:32 -07:00
Treehugger Robot 1f6c94a3ac Merge "Add "apex_vndk" module type" 2019-09-17 17:14:48 +00:00
Jaewoong Jung b0c127cfd7 Migrate java/androidmk.go to new system #1
This change migrates some of AndroidMk()s in java/androidmk.go to
AndroidMkEntries(), mainly focusing on deduping test-related helper
funcs.

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: I7810085521600d9ea2df078837688ade41c04825
2019-09-10 07:38:31 -07:00
Ivan Lozano 022a73b9ad Move splitFileExt to the android package.
Both Rust and cc use this function, so move it over to android
package's util.go and export it.

Bug: 140734195
Test: m -j

Change-Id: Ibe8b7a94592e402468a027ad6027b187f29c8e07
2019-09-09 20:29:31 -07:00
Jooyung Han 344d5439c1 Add "apex_vndk" module type
"apex_vndk" is a variant of "apex" module.

apex_vndk {
  name: "com.android.vndk",
  ..
}

This rule is used to produce a VNDK APEX per vndk version.
It supports automatic inclusion of vndk libs.

If "vndk_version" property is set, the prebuilt vndk libs of
the version will be included in the apex bundle.

apex_vndk {
  name: "com.android.vndk.v29"
  vndk_version: "29",
  ...
}

Otherwise, platform's vndk version is used.

This will replace /system/{lib}/vndk-{ver} and vndk-sp-{ver}.

Bug: 134357236
Bug: 139772411
Test: m com.android.vndk
Change-Id: Ib5c86e625839389670d13c683a7427198ef6852f
2019-09-10 11:22:59 +09:00
Steven Moreland 349cd474ef CreateModule also inherits variableProperties.
Bug: N/A
Test: manual
Change-Id: Ic5ecbeac04841d4016c0caa8710a6adae1ec2bd6
2019-09-06 18:28:58 -07:00
Dan Willemsen f80ef34c80 Merge "Rewrite depfile from sbox to stay reproducible"
am: e2ce551909

Change-Id: I2a51549dfb4419b9b6444d33104d35e655c82f4f
2019-09-04 12:38:05 -07:00
Dan Willemsen e2ce551909 Merge "Rewrite depfile from sbox to stay reproducible" 2019-09-04 19:16:01 +00:00
Paul Duffin 7322b5271a Allow per test rules in neverallow_test.go
am: 115445b5d6

Change-Id: I6e7ce7fc42e2fbd186ed4e37fa362faf8cc30fac
2019-09-03 05:44:15 -07:00
Paul Duffin 115445b5d6 Allow per test rules in neverallow_test.go
Makes testing individual rules easier by allowing them to be specified
per test rather than having to add them to the global defaults.

Bug: 138428610
Test: m nothing
Change-Id: Ic65a55dee2a02b6d33254753c047295dd5804408
2019-09-03 10:33:29 +01:00
Paul Duffin 91e3819335 Support multiple expected errors in neverallow_test.go
Extracted some common code used by visibility_test.go and
neverallow_test.go into a new function CheckErrorsAgainstExpectations
in testing.go.

Bug: 138428610
Test: m nothing
Change-Id: I6996fa52968c387e38b4a67ffa59cd07c2d524e8
Merged-In: Iafbadf12c6ffdc4d9128fcfe7f15792df5cfd020
2019-09-03 10:33:29 +01:00