Commit graph

284 commits

Author SHA1 Message Date
Inseob Kim
ac1e986c55 Create public stub for platform's sysprop_library
Java modules using SystemAPI can now link against platform owned
sysprop_library with public stub. This allows modules to use platform's
public sysprops (which should be regarded as an API) without any hidden
API usages, if using dynamic linking and boot class path.

This doesn't affect any vendor or odm owned sysprop_library.

Bug: 141246285
Bug: 145167888
Test: m
Change-Id: I99824fb24a75cc8282211c2ad6c6296ae9fca393
2019-12-19 09:35:23 +09:00
Chih-hung Hsieh
738bff96f1 Merge "Add x86 device output for Rust" 2019-12-13 22:54:10 +00:00
Paul Duffin
2f6bc09fee Separate sdk membership support out of cc/library.go
Bug: 142918168
Test: m checkbuild
Change-Id: I4a7f2af8e0b41feca2b5a431b42ad03bbfe94b0c
2019-12-13 10:43:10 +00:00
Chih-Hung Hsieh
1f202e9bbb Add x86 device output for Rust
* Copy current configuration from
  rust/config/x86_64_device.go and
  cc/config/x86_device.go.

Bug: 145608833
Test: build rust modules for aosp_x86-userdebug
Change-Id: Ie4951dd4703596f8e503d813a6c4ac03c1f20980
2019-12-12 19:18:06 -08:00
Paul Duffin
a80fdec00d Extract the cc and java sdk related tests out into their own file
Makes it easier for multiple people to work on different areas without
conflicts.

Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: I93140450c0b049946a9d0432225bccff82f5a873
2019-12-06 12:16:59 +00:00
Paul Duffin
82d90438be Separate sdk testing infrastructure from sdk tests
Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: Ib00870ddefc4c1dd9e42ca594e6ebe8e24c42e05
2019-12-06 12:16:59 +00:00
Paul Duffin
b645ec8e34 Add model to represent generated snapshot .bp file
Having each module type generate the contents of the snapshot's .bp
file results in lots of duplicated code. This adds an intermediate
model for use by the module types and then generates the .bp file
contents from that.

This not only removes the duplicated formatting code but it also
allows consistent handling of shared properties such as name further
reducing duplication. It also makes it possible to duplicate the
versioned and unversioned prebuilt modules from the same model.

Extracts generatedContents from generatedFile to allow the contents
to be populated without creating an output file, for testing.

Cleans up unused code.

Bug: 143678475
Test: m nothing
Change-Id: If21b84db0ef3fdfb5dc11ea0973ce6cb73603ea3
2019-12-02 12:59:38 +00:00
Colin Cross
09ef474b6f Merge changes I0dcc9c7b,I9bc40642
* changes:
  Move cc.imageMutator into the android package
  Make CreateVariations return []android.Module
2019-11-25 22:30:17 +00:00
Colin Cross
7228ecd5e3 Move cc.imageMutator into the android package
Prepare for making the image mutator available to all modules and
moving it between the os and arch mutators by moving it into the
android package and using an interface implemented by the module
types to control it.

Bug: 142286466
Test: No unexpected changes to out/soong/build.ninja
Change-Id: I0dcc9c7b5ec80edffade340c367f6ae4da34151b
2019-11-20 15:21:32 -08:00
Jiyong Park
09d77522fe split apex.go
apex.go is too big. Separate the build rule and android.mk generation
logic into builder.go and androidmk.go, respectively. prebuilt_apex is
moved to prebuilt.go as well.

No refactoring has been made other than the splitting.

Test: m
Change-Id: I839ab0a1ba2b70ce82d98ac1fa8e3534808b5fd3
2019-11-18 16:37:06 +09:00
Yi Kong
950e0baf2a Expand ClangExtraExternalCflags to non-Google vendor projects
Some of the warnings are too common to fix/opt-out for non-Google
projects.

Also in the change, minor clean up of duplicated code.

Test: presubmit
Bug: 139945549
Change-Id: Ic176ef1f17133405851a79592b6bef5ccb403bd9
2019-11-11 13:24:39 -08:00
Chih-Hung Hsieh
a5f22ed6b0 Add rust_test and rust_test_host.
* Rust tests are like binary files compiled with --test.
  New test.go follows binary.go code patterns and reuses
  some code in binary.go.
* Generate one test per source file as testPerSrc in cc/test.go.
  The "all tests" variation feature of cc/test.go is not copied yet.
  Fix some Stem and SubName settings to make testPerSrc work.
* Move cc.CheckDuplicate to android.CheckDuplicate,
  which is now shared by cc and rust.
* Refactor tests in binary_test.go and add new test_test.go.

Bug: 140938178
Test: mm in rust projects, added rust_test and rust_test_host
Change-Id: Ia6fec8b4cf2572fd352ab1938a1f3c7b5cca2212
2019-10-29 17:19:03 -07:00
Ivan Lozano
183a3218e2 Add a common interface for cc linkable libraries.
Adds an interface, CcLinkableInterface, for cc linkable dependencies
which come from other toolchains such as Rust.

Bug: 140726209
Test: Soong tests pass, rust modules still compile.
Change-Id: I7378a46fad94fd0b735746aaf4e265fd2c2c04d8
2019-10-28 13:45:12 -07:00
Yi Kong
00ae8b3996 Merge "Repack libgcc.a to only include required objects" 2019-10-25 08:00:58 +00:00
Yi Kong
c49c393f73 Repack libgcc.a to only include required objects
Previous solution by using objcopy uses a quirky behaviour of the GNU
objcopy and there is no equivalent option in llvm-objcopy.

Instead of removing symbols, extract and repack libgcc to only include
required objects.

Bug: 142585047
Test: presubmit
Change-Id: I58af74c18838f797e481da38c3265f0624fddf99
2019-10-24 16:34:54 -07:00
Treehugger Robot
1fd602c34a Merge "Add Rust darwin host support." 2019-10-22 03:51:31 +00:00
Ivan Lozano
1c2ff86225 Add Rust darwin host support.
Support for building Rust modules on darwin hosts.

Bug: 140640858
Test: m libremain works on darwin
Change-Id: Ieb1ff9167de34cffbebebab31fa48da07081c8a6
2019-10-21 13:15:10 -07:00
Treehugger Robot
8141c8781a Merge "Add tradefed_java_library_host" 2019-10-19 02:45:42 +00:00
Treehugger Robot
760d3d35b6 Merge "Create C-Suite config module" 2019-10-18 22:24:52 +00:00
Colin Cross
f0f2e2cf79 Add tradefed_java_library_host
Add a module type for tradefed libraries that causes an additional
copy to be installed at out/host/linux-x86/tradefed.

Bug: 122332235
Bug: 141877526
Test: m tradefed
Change-Id: Ib7160dd060ad83d2dfb81d6a7106cb0dac98553e
2019-10-18 15:14:15 -07:00
karenluo
c031819352 Create C-Suite config module
* Defined a build target csuite_config.go for C-Suite, so that C-Suite
test modules can be declare in Android.bp files.
* Modified vts_config.go to use the general Makefile
suite_host_config.mk.

Test: make csuite, forrest test for vts
Change-Id: I5f67c54e05b113ac6c5d226930618e6811e6e602
Merged-In: I5f67c54e05b113ac6c5d226930618e6811e6e602
2019-10-18 18:28:00 +00: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
Jesse Pai
4d33666639 Creation of C Flags Build Variables
Modifications made to soong/cc to look for specific C Flags used by
Android modules and store name of module into a build variable array.

Bug: 140442588
Test: Executed m dist and presubmit
Change-Id: If46a11462369c43bbcd445156aff0641514c58b1
2019-09-30 16:24:16 +00: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
Ivan Lozano
e91823e6e0 Add ARM32 device Rust toolchain.
Bug: 141207434
Test: build example rust device module.
Change-Id: I2d5b45ba09f386e1c7da7d7cdc58f13f31135863
2019-09-24 10:35:28 -07:00
Ivan Lozano
f1c8433b40 Add AArch64 device Rust toolchain.
Bug: 141207434
Test: build example rust device module.
Change-Id: I0932a614942bf4a4d4b6c153fcc4fc79c7f202bd
2019-09-24 10:35:28 -07:00
Treehugger Robot
b1102ba828 Merge "Introduce module type 'sdk'" 2019-09-23 04:38:24 +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
Ivan Lozano
e169ad70a5 Add OWNERS for Rust whitelist.
Splits out the Rust paths whitelist into a separate file
under config/ so that OWNERS can be defined for it.

Bug: 141207129
Test: m -j crosvm.experimental
Change-Id: I5effa6783e5c47560b4b1eae12ad0eb9e9ba96fe
2019-09-18 12:46:28 -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
Yi Kong
a0119f8754 Create libgcc_stripped with llvm-objcopy
llvm-objcopy now implements '--regex' option, which allows it to replace
GNU objcopy for creating libgcc_stripped archieve.

Test: build
Bug: 131631155
Change-Id: Ie1733ac8e9b3765f7652a562406dcedb4735cc1a
2019-09-03 13:44:54 -07:00
Ivan Lozano
ffee334706 Add Rust support to Soong.
Adds support to Soong for building rust modules. This currently only
supports x86_64 device and x86 linux host targets. The functionality
is sufficient to build crosvm.

Bug: 136189233
Test: Test module builds.
Test: crosvm builds.
Change-Id: I6ea04615834a6d673578ab10ea1a2eb04259fe09
2019-08-28 14:11:07 -07:00
Pete Bentley
74c9bbacb6 Allow linker scripts when building objects.
Test: m nothing
Test: TreeHugger
Bug: 134581881
Bug: 137267623

Change-Id: If1422372585ec032a9e36eab73a04e98fe1c1b6c
2019-08-22 13:21:37 -07:00
atrost
db25ac07a5 Create a module that extracts and installs compat_config.
Currently it extracts from the provided jar file compat/compat_config.xml
(generated by compat-changeid-annotation-processor) and installs on
/system/etc/sysconfig.
Future improvements:
 - Merge all the configs going for the system image into one, so that
   duplicate change ids across modules are failing the build instead of
   runtime.
 - Support uploading the config onto APEX for APEX modules.

Test: flashed device locally, config files found and read by
com.android.server.compat.CompatConfig.
Bug: 138222363

Change-Id: I64b11fdc466f746702e7e73f612794e024de2288
2019-08-06 19:21:46 +01:00
Treehugger Robot
178f8fb732 Merge "Add the cc_fuzz target." 2019-07-18 20:38:33 +00:00
Mitch Phillips
da9a463794 Add the cc_fuzz target.
Adds the cc_fuzz target via a cc_fuzz module. Also implements the
libclang runtime interface for the x86 toolchain to allow host-built
fuzzers.

Bug: 133261679
Bug: 137398545

Test: Build a fuzzer (with all topic patches), notice that you now
have a host-built fuzzer :)

Change-Id: I7fa069603415f40b3f12a002c253fca6e2aa1988
2019-07-16 16:30:53 -07:00
Jooyung Han
12df5fb471 soong: Fix AndroidMk with *Required properties
java.Module is using "Custom" function to write Android.mk.
And if "hostdex" is set to "true", it writes "hostdex" module definition
as well as original module.

As of now, Required/Host_required/Target_required props are filled in
the AndroidMkEntries structure(aosp/939505). But these are not
passed to old AndroidMkData.Custom function.

So, if a java_library declares "hostdex:true" and "required:[...]"
together, "required" is not applied to the "hostdex" variant.

This change copies *Required props from AndroidMkEntries to
AndroidMkData before calling its Custom callback.

Test: m (runs soong unit tests)
Change-Id: I5f85714f721a2a0917ab18072dbea52294c770e7
2019-07-16 02:28:29 +09:00
Paul Duffin
e2453c705f Allow default visibility to be set per package
Adds a package module type with a default_visibility property. The
package module type can only be specified once per package.

Bug: 133290645
Test: m droid
Change-Id: Ibb2fb499c9ea88ecaa662d3cd2cbde478e4b9a4b
2019-06-27 13:24:50 +01:00
Jaewoong Jung
5b425e2e20 Optionally embed NOTICE files in apks.
If embed_notices or ALWAYS_EMBED_NOTICES is set, collect NOTICE files
from all dependencies of the android_app, merge them with the app's own
one (if exists), transform it to HTML, gzip it, and put it as an asset
in the final APK output.

Bug: 135460391
Test: app_test.go
Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
2019-06-24 19:10:22 -07:00
Colin Cross
9a642dcde2 Support sharding robolectric tests
Explicitly pass the list of tests as LOCAL_ROBOTEST_FILES, and
support sharding the list of tests into multiple test runners.

Also filter out BaseRobolectricTest.java, which covers the only
use of LOCAL_ROBOTEST_FILES in Android.mk files.

Bug: 133878985
Test: m RunSettingsLibRoboTests runs the same number of tests before and after
Test: m RunSettingsLibRoboTests runs the same number of tests when sharded
Change-Id: Id85ffe03c98e722303eaa6def17812ed2244c6a6
Merged-In: Id85ffe03c98e722303eaa6def17812ed2244c6a6
2019-06-14 13:10:53 -07:00
Colin Cross
dc35e21124 Consolidate *MutatorContext and ModuleContext into BaseModuleContext
Following 99bdb2ab4fd5168a71a20aecf10611425be47ec4 in build/blueprint,
move more methods into BaseModuleContext.

This reapplies I9f8df94f1ae2b55d3cccf7b9468247f3e7cb2ebd after fixing
missing errors thrown for missing defaults modules when
AllowMissingDependencies == true.

Test: m checkbuild
Test: defaults_test.go
Change-Id: Ia17b2bcbf2bac6889c419b2e73953946f6aa40ad
2019-06-10 16:30:35 -07:00
Colin Cross
2ffb9a8d7d Share buildDir for android/soong/android tests
There is no need to create a separate buildDir for each test
file, use TestMain to create a global one for the package.

Test: all soong tests
Change-Id: I435ee7aa88b7e0bb8ccc1ba79f82833a7accf3e9
2019-06-10 15:51:06 -07:00
Colin Cross
41955e8895 Support tagged module references
There are cases where a module needs to refer to an intermediate
output of another module instead of its final output.  For example,
a module may want to use the .jar containing .class files from
another module whose final output is a .jar containing classes.dex
files.  Support a new ":module{.tag}" format in any property that
is annotated with `android:"path"`, which will query the target
module for its ".tag" output(s).

Test: path_properties_test.go, paths_test.go
Test: no unexpected changes in build.ninja
Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
2019-06-04 10:22:51 -07:00
Colin Cross
33b2fb7333 Support using cc_prebuilt_library_shared with cc_library
Allow a cc_prebuilt_library_shared to share the same name as a
cc_library by always creating static and shared variants of
prebuilts so that the variants of the source module are always
a superset of the variants of the target module.

Bug: 131709055
Test: TestPrebuilts
Change-Id: I4afd6d37e6a986d08ad25aee69eca6d994febc6b
2019-05-17 08:40:42 -07:00
Hridya Valsaraju
d61df5041e Make device_kernel_headers available to recovery and vendor
This is required to build the recovery variant of boot control HAL.

Bug: 78793464
Test: make
Bug: 34254109
Change-Id: Ia5d7b1a97926acbe4ba89df26aeb66fac6bbb1ab
Merged-In: Ia5d7b1a97926acbe4ba89df26aeb66fac6bbb1ab
(cherry picked from commit 1a3b62757c)
2019-05-08 22:58:10 -07:00
dimitry
0e55ba6dbc Mark libgcc_stripped native_bridge_supported
Test: make
Change-Id: I04e86a4deb3e743a63fc6df199ee0c1a7deb9e48
2019-05-06 10:58:10 +02:00
Treehugger Robot
ec89e4c65c Merge "Add native_bridge target to Android.bp" 2019-05-03 22:23:00 +00:00
dimitry
1f33e40972 Add native_bridge target to Android.bp
This allows us to build guest libraries for the native bridge for
arm/arm64 architectures.

Bug: http://b/77159578
Test: make
Change-Id: I35520ca456105ddadd456c78a4eb1e6de39147c5
2019-05-03 15:33:28 +02:00
Yi Kong
940ef9bc89 Merge "Strip libgcc to only keep fallback symbols" 2019-05-03 07:52:18 +00:00
Colin Cross
0ef0816727 Support robolectric_test
robolectric_test will compile a suite of tests that run in
robolectric.  For now it also generates a Run* rule, later
that will be removed in favor of atest.

Bug: 123248659
Test: m RunSettingsLibRoboTests
Change-Id: I12407d0b0d639e31c1969077ba787e8985e6a506
2019-05-01 16:41:44 -07:00
Yi Kong
acee27cd72 Strip libgcc to only keep fallback symbols
We use libgcc as fallback for symbols not present in libclang_rt
builtins, however we didn't know what exact symbols were being used,
some may not be intended to fallback.

Create libgcc_stripped, which only contains unwind symbols from libgcc.

Bug: 29275768
Test: bionic-unit-tests
Change-Id: I5b349fa6138e51663bf3b67109b880b4356da8e8
2019-04-30 10:07:00 -07:00
Paul Duffin
2e61fa6e14 Add visibility support
Implementation uploaded for review. Includes unit tests but does not
yet handle prebuilts, that will come in a future change once some
more general issues with prebuilts and namespaces is resolved.

See README.md#Visibility for details of what this does and how to use
it.

Bug: 112158820
Test: add visibility rules for core library modules, make core-tests
Change-Id: I8ec980554398ad6f2d42043ce518f811a35da679
2019-04-26 12:37:37 +01:00
Dan Willemsen
633c502295 Support RuleBuilder.Sbox to wrap commands in sbox
This essentially allows you to declare that everything in a directory
will be created by the rule, and we'll ensure that your command actually
writes out all of the claimed outputs, and remove any other files that
previously existed in that directory.

Test: built-in tests
Change-Id: I990dce2b3a0d89ebd2736ac1a0cadfb5864c6e73
2019-04-15 14:52:05 -07:00
Colin Cross
19878da6a0 Move proto compilation to RuleBuilder
Using blueprint.Rule for protoc commands was causing code duplication
because there was no good way to run the same protoc for cc, java and
python but then run custom source packaging steps for java and python.
Move most of the code into a common function that returns a
RuleBuilder, and then let java and python add their own commands at
the end of the rule.

Bug: 70706119
Test: All Soong tests
Test: m checkbuild
Change-Id: Ic692136775d273bcc4f4de99620ab4878667c83a
2019-04-02 16:38:47 +00:00
Jaewoong Jung
525443aa22 Add override_android_app module type.
This is a new implementation of overriding module types that makes use
of local variants. With this, product owners can use PRODUCT_PACKAGES to
decide which override module to include in their products.

Bug: 122957760
Bug: 123640028
Test: app_test.go
Change-Id: Ie65e97f615d006b6e9475193b6017ea9d97e8e97
2019-03-21 13:26:20 -07:00
Vic Yang
efd249e62a Add support for no-vendor-variant VNDK
When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed.  Since not all VNDK libraries will be
ready for this, we keep a list of library names in cc/vndk.go to
indicate which libraries must have their vendor variants always
installed regardless of whether no-vendor-variant VNDK is enabled.

Also add --remove-build-id option to the strip script to facilitate
the check of functional identity of the two variants.

Bug: 119423884
Test: Add a dummy VNDK library and build with
      TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding
      build/make change.

Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
2019-03-21 04:29:24 +00:00
Colin Cross
1b48842a4b Add path properties mutator
Add a mutator pass after DepsMutator that visits every property
struct in every module looking for properties that have a tag
`android:"path"`, and automatically add a SourceDepTag dependency
on any module references (":module-name") found.  Uses a cache to
store the mapping of property struct type to locations of
properties with the tag.

Test: android/path_properties_test.go
Change-Id: I38c0497843dde4890e9342c3a6f0b402c0720742
2019-03-07 18:36:24 +00:00
Colin Cross
3d7c9827d5 Add modules for converting java modules between host and device
java_device_for_host and java_host_for_device allow treating a
device module as a host module and vice versa.  They will be useful
for converting layoutlib and robolectric to Soong, as these modules
run device java code on the host.

Bug: 117920228
Test: device_host_converter_test.go
Change-Id: Ia9a371fb41a97bc16338097f3ce8b40099744167
2019-03-05 23:09:45 +00:00
Colin Cross
762286723a Add dexpreopt_bootjars_test.go
Add a test that exercises the dexpreopt_bootjars.go singleton.

Test: dexpreopt_bootjars_test.go
Change-Id: I01d4f6e22f6ff7b809af043391d7b6209dcb8675
2019-03-05 03:17:51 +00:00
Alex Light
778127a041 Add support for including py_binary and *_go_binary in apexs
These additional binary types are useful for some apexs. Add the
ability to include them. Due to the nature of the resulting artifacts
only py binaries with embedded launchers and host go binaries are
supported.

Test: m com.android.support.apexer
Bug: 119332365
Bug: 119332362
Change-Id: I27c253d3647cf7bbe15896610d7a74a5f93e8bec
2019-03-01 01:56:14 +00:00
Jaewoong Jung
acb6db331b Revert "Add override_module."
This reverts commit aa65e17016.

Reason for revert: Not compatible with PRODUCT_PACKAGES, and so has very limited use.

Change-Id: Ib141d3984a6f12bb50989e66037494c466b066f1
2019-02-28 16:22:30 +00:00
Jaewoong Jung
aa65e17016 Add override_module.
This new module type replaces the inherit-package function in make by
allowing developers to override the name, the certificate, and the
manifest package name of an android_app module.

Bug: 122957760
Fixes: 123640028
Test: app_test.go + BrowserGoogle
Change-Id: Iefe447e7078b25039233221361ef95c83a29973a
2019-02-27 14:35:39 -08:00
Colin Cross
44df581457 Refactor dexpreopt_bootjars.go to prepare for multiple boot images
Refactor dexpreopt_bootjars.go so that buildBootImage can be called
with a bootImageConfig to create rules to build the boot image in
preparation for building multiple boot images.

Test: m checkbuild
Change-Id: I7ba40a0988c8acbd6c1ee4e36f4bbb34fb4e2d24
2019-02-20 22:06:29 -08:00
Sasha Smundak
ff36da04e8 Implement vts_config module
Test: internal (see android/vts_config_test.go) + run 'm vts' and check
that host/linux-x86/vts/android-vts.zip remians the same
Change-Id: I0249a974a240e7669c3b9378c17739df8e120873
Fixes: 122617100
2019-02-19 16:58:43 -08:00
Colin Cross
e4759b9ab9 Add java/testing.go for sysprop_test.go
Share more of the setup code for java tests to sysprop_tests.go.

Test: java_test.go, sysprop_test.go
Change-Id: I0e3b287bf188c432d995a9a91a18ebef12aa47d1
Merged-In: I0e3b287bf188c432d995a9a91a18ebef12aa47d1
(cherry picked from commit b19745363f)
2019-02-16 17:08:01 -08:00
Colin Cross
800fe13146 Move dexpreopting of boot jars into Soong
Implement the dexpreopting of boot jars in singleton rules in
Soong.

Test: m checkbuild
Change-Id: Ic02ce941fa5e238b839b3eb4c06a3e10c62d98ff
2019-02-15 16:16:25 -08:00
Inseob Kim
c0907f191a Create sysprop_library soong module
A newly introduced sysprop_library soong module will generate a
java_sdk_library and a cc_library from .sysprop description files.
Both Java modules and C++ modules can link against sysprop_library
module, thus giving consistency for using generated sysprop API.

As Java controls accessibility of Internal / System properties with
@hide and @SystemApi, 2 different header files will be created. And
build system will selectively expose depending on the property owner
and the place where the client libraries go into.

Bug: 80125326
Bug: 122170616
Test: 1) Create sysprop_library module.
Test: 2) Create empty txt files under prebuilts/sdk.
Test: 3) Create api directory, make update-api, and see changes.
Test: 4) Try to link against sysprop_library with various clients.
Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags
work as intended.
Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
2019-02-13 23:32:51 +00:00
Colin Cross
f24a22a98a Move hiddenapi singleton rules to Soong
Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.

Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
2019-02-06 11:23:40 -08:00
Colin Cross
571cccfcbc Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong.  A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.

Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
2019-02-06 01:52:41 +00:00
Colin Cross
feec25b084 Move dexpreopt.Script to android.RuleBuilder
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places.  Also add tests for it.

Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
2019-02-05 13:28:43 -08:00
Dan Willemsen
b05526711e Add sh_binary[_host] for shell script that should be installed as executable
We've been putting these in cc_prebuilt_binary, but that's not really
correct. It also tries adding '.exe' to the end of windows executables,
which isn't desirable for bat files.

Test: Use sh_binary_host
Change-Id: Idd5418dceb81ac55b766c987fbb69a810aeb8a3b
2019-01-28 10:59:10 -08:00
Colin Cross
cb9880786d Optimize filterArchStruct when nothing is filtered
Runtime-created struct types have limit on the name of the type,
which is the full text of the fields in the struct.  Avoid creating
runtime struct types when filtering produces an identical struct.
Also add tests and godoc for filterArchStruct.

Test: arch_test.go
Change-Id: If7eb27ea9e72073d5252e93f2110b08889ed76b1
2019-01-25 21:26:53 +00:00
Doug Horn
c32c6b0d79 Support building for Fuchsia.
This CL adds configs for the arm64 and x64 fuchsia
device targets, sets up the necessary linker flags,
and disables some functionality that is not currently
supported on Fuchsia.

Bug: 119831161
Test: Compile walleye, internal validation against
fuchsia_arm64-eng and fuchsia_x86_64-eng.
Change-Id: I2881b99d2e3a1995e2d8c00a2d86ee101a972c94
2019-01-24 18:59:29 +00:00
Colin Cross
be9cdb8d64 Replace annotation_processors with plugins
Follow bazel's modules for annotation processors by introducing
a java_plugin module type that can contain extra metadata about
the annotation processor, the processor class and a flag to
specify if the annotation processor is compatible with the
turbine optimization.  Deprecate the annotation_processors
property, which took a list of java_library_host modules, in
favor of the plugins property, which takes a list of java_plugin
modules.  The annotation_processors property will be removed
once all uses have been replaced with plugins.

Bug: 77284273
Test: plugin_test.go
Test: m caliper
Change-Id: I37c1e80eba71ae2d6a06199fb102194a51994989
2019-01-23 20:17:51 +00:00
Colin Cross
21fc9bbe19 Move kotlin to it's own file
kapt is going to make kotlin a little more complicated, move the
rules and tests to their own files.

Bug: 122251693
Test: m checkbuild
Change-Id: Ieed78b97995ced210b710bd50c357514cc8e3bc6
2019-01-22 16:32:11 +00:00
Colin Cross
8faf8fc060 Move hiddenapi to Soong
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong.  This fixes an issue where dexpreopting was happening on
a different jar than was being installed.

Bug: 122856783
Test: m checkbuild
Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv
Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Test: cts/tests/signature/runSignatureTests.sh
Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae
2019-01-17 22:19:28 +00:00
yelinhsieh
80880a3460 Autogen python test config.
Feature request from developer, autogen python test config.

Bug:118442443

Test: $source build/envsetup.sh ; lunch
      $sed -i '/test_config/d' tools/acloud/Android.bp
      $make acloud_test
      $[ -f $ANDROID_HOST_OUT_TESTCASES/acloud_test/acloud_test.config ] && echo "Found" || echo "Not found"

Change-Id: I196230581b456afe03e67f9cd84c028d18ba08d9
2019-01-14 03:30:06 +00:00
Colin Cross
fb6d781202 Split out sdk.go from java.go
Split out SDK handling functions from java.go to sdk.go and tests
from java_test.go to sdk.go.

Test: sdk_test.go
Change-Id: I83ef48cbe5230572c1d4ecc0e89021d2f7c71b76
2019-01-10 07:09:29 +00:00
Colin Cross
638149e650 Add dexpreopt enabled tests
Add tests that verify when dexpreopt is enabled or disabled.

Test: dexpreopt_test.go
Change-Id: Ideba9c0dac30eb31e7ae29e46d1d1590202b8369
2019-01-05 22:36:13 -08:00
Colin Cross
43f08db29e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
2018-12-15 19:07:54 -08:00
Colin Cross
4ff85ebeb7 Revert "Dexpreopt soong modules inside soong"
This reverts commit 29ff88741e.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
29ff88741e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
2018-12-13 15:53:54 +00:00
Jiyong Park
25fc6a9cc9 Stubs variant is used when building for APEX
When a native module is built for an APEX and is depending on a native
library having stubs (i.e. stubs.versions property is set), the stubs
variant is used unless the dependent lib is directly included in the
same APEX with the depending module.

Example:

apex {
    name: "myapex",
    native_shared_libs: ["libX", "libY"],
}

cc_library {
    name: "libX",
    shared_libs: ["libY", "libZ"],
}

cc_library {
    name: "libY",
    stubs: { versions: ["1", "2"], },
}

cc_library {
    name: "libZ",
    stubs: { versions: ["1", "2"], },
}

In this case, libX is linking to the impl variant of libY (that provides
private APIs) while libY is linking to the version 2 stubs of libZ. This is
because libY is directly included in the same apex via
native_shared_libs property, but libZ isn't.

Bug: 112672359
Test: apex_test added
Change-Id: If9871b70dc74a06bd828dd4cd1aeebd2e68b837c
2018-12-04 17:46:22 +09:00
Jaewoong Jung
62707f79ab Add filegroup support to notice property.
Also, replace all notice file references with the parent directory
pattern(../) with filegroups. This new version has
ALLOW_MISSING_DEPENDENCIES support, so shouldn't break branches that
don't contain the libwinpthread project.

Bug: 118899640
Test: Manual build + forrest runs on previously failed branches.
Change-Id: I13e70e8dab547f82c1c8f15eccc7ae116e480ad5
2018-11-27 09:45:18 -08:00
Ivan Lozano
074ec480ef Add support for AArch64 XOM binaries.
Adds build system support for generating AArch64 binaries with
execute-only memory layouts via a new xom module property. Also adds
support for an ENABLE_XOM build flag for global builds.

Bug: 77958880
Test: make -j ENABLE_XOM=true
Change-Id: Ia2ea981498dd12941aaf5ca807648ae37527e3ee
2018-11-21 08:59:37 -08:00
Jaewoong Jung
491fe5ffd8 Revert "Add filegroup support to notice property."
This reverts commit ff7a1a47d9.

Reason for revert: Broke ART buildbot

Change-Id: I005ccfcc2c36bbcb274cb2a069fc701168faacd2
2018-11-19 16:18:54 +00:00
Jaewoong Jung
ff7a1a47d9 Add filegroup support to notice property.
Also, replace all notice file references with the parent directory
pattern(../) with filegroups.

Bug: 118899640
Test: Manual build
Change-Id: I841345d747f41a3bb5beea66ad87a979734c39a4
2018-11-16 13:26:43 -08:00
Jaewoong Jung
16c7d3d263 Revert "Revert "Revert "Revert "Export static libraries.""""
This reverts commit 555c114283.

Reason for revert: The namespace issue in the pi-dev-plus-aosp-without-vendor branch is now fixed.

Change-Id: I26ed591447797a8ee505f43bdd209162418b6c5e
2018-11-16 01:20:05 +00:00
Jaewoong Jung
555c114283 Revert "Revert "Revert "Export static libraries."""
This reverts commit eb05c2a633.

Reason for revert: Yet another broken build.

Change-Id: I4198f2dd5c7848365d71d03f6dbd598998fb9bd8
2018-11-09 22:25:37 +00:00
Jaewoong Jung
eb05c2a633 Revert "Revert "Export static libraries.""
This reverts commit 3affc07ca0.

Reason for revert: The notice dependency bug is now fixed.

Change-Id: I5424ade9d742fbe190651097c04914a29db6dfa0
2018-11-09 16:02:34 +00:00
Jaewoong Jung
3affc07ca0 Revert "Export static libraries."
This reverts commit 9d5ca159dc.

Reason for revert: This broke few builds.

Change-Id: Id9c4d7c145602a55ae07bb177f2c236e16f4fb63
2018-11-06 18:00:39 +00:00
Jaewoong Jung
9d5ca159dc Export static libraries.
Export static libraries through LOCAL_STATIC_LIBRARIES and
LOCAL_WHOLE_STATIC_LIBRARIES. This enables dependency-based NOTICE file
generation. Also, add a notice property in the libwinpthread module.

Bug: 36073965
Test: cc_test.go
Change-Id: If1ca1f9159e80cf8fbe71df7a13ca5d6a1f63b40
2018-11-05 23:48:10 +00:00
Jaewoong Jung
3e6b1fbcfb Revert "Export static libraries."
This reverts commit 5d19e1de88.

Reason for revert: Broke aosp-build-tools/darwin_mac

Change-Id: I1af36848fb5a00849aec69941ddef33769b1b536
2018-11-02 22:56:30 +00:00
Jaewoong Jung
5d19e1de88 Export static libraries.
Export static libraries through LOCAL_STATIC_LIBRARIES and
LOCAL_WHOLE_STATIC_LIBRARIES. This enables dependency-based NOTICE file
generation. Also, add a notice property in the libwinpthread module.

Bug: 36073965
Test: cc_test.go
Change-Id: Ic63ca523b40acac82bbe876f7aa40ecd495907c5
2018-11-01 22:45:59 +00:00
Jiyong Park
139a2e6935 Add filename property to prebuilt_etc
filename property is an optional property that specifies the name of the
installed file which is by default name of the module.

This will be used to APEXs to have ./etc/ld.config.txt files for their
own.

Test: m (prebuilt_etc_test.go added)
Change-Id: Ic8d0c0044c5bc2c6c33117fe2c19ef6ad75451a8
2018-10-26 22:14:59 +09:00
Colin Cross
ef35448ac5 Allow cc_genrule srcs to vary by architecture
Add arch_variant to the genrule srcs property so that cc_genrule
modules can vary the srcs and outs by architecture.

Test: cc/genrule_test.go
Change-Id: Idb17013e137d7ca21ca4cfc3e4c1fa7d89977043
2018-10-23 18:40:37 +00:00
Dan Willemsen
a0790e35c7 Rework how linux_bionic is built with LLD
In order to simplify the wrapper function, and stop using a linker
script, generate a set of flags to pass to LLD. Then run
host_bionic_inject on the linked binary in order to verify the
embedding, and give the wrapper function the address of the original
entry point (_start).

Bug: 31559095
Test: build host bionic with prebuilts/build-tools/build-prebuilts.sh
Change-Id: I53e326050e0f9caa562c6cf6f76c4d0337bb6faf
2018-10-22 15:46:03 -07:00
Jiyong Park
ff1458f670 APEX can be signed with different keys
A new module type 'apex_key' is defined to specify public and private
key pair for APEXs. An APEX can refer to the module via the property
'key'. When building the APEX, the private key from the key module is
used to sign it. In addition, the public key from the key module is
automatically installed to /system/etc/security/apex.

Bug: 115721587
Test: m apex.test; m
/apex/com.android.example.apex@1 exists

Change-Id: I82666db095bd7a09f6c1b9cbea2db57ebc076cbf
2018-10-16 09:53:11 +09:00
Jiyong Park
48ca7dc535 Add apex variants
Now, APEX-aware modules (the ones implementing android.ApexModule
interface) are created with multiple variants for each APEX that they
are included.

For example, if a module is included (either directly or indirectly -
via static linking) to two APEXs, the module is built separately for the
two APEXs (and of course separately for platform). This is a first step
to limit the symbol visibility to the modules built for APEXs; platform
private symbols and libs shouldn't be allowed for them.

In addition, the build system now tracks transitive dependencies of
the modules in APEXs. For example, if
native_shared_lib_modules:["libFoo"] then libFoo and its dependencies
are all automatically included to the APEX.

Bug: 112672359
Test: m apex.test; the built apex has additional libs (such as liblog,
libc++, ...) that are dependencies of the ones specified in Android.bp

Change-Id: Id9e3fc486dd4e7e36f8b6799dfb041868c5198d5
2018-10-11 14:24:18 +09:00
Jiyong Park
9d45299ba4 Add ApexModule interface for APEX-aware modules
ApexModule is the interface for APEX-aware modules. The module type apex
uses the interface to get APEX-specific information from other modules,
such as the list of APEXs that a module should be built for.

A module that is included in an APEX will be built specificaly for the
APEX. This is especially required for shared libraries; we shouldn't
just copy the artifacts built for platform, because they may be linking
against private (=unstable) symbols that are not available to APEXs
which are basically unbundled.

This CL, as a first step, makes cc.Module an APEX-aware module type.

Bug: 112672359
Test: m apex.test; the built apex has all the direct and transitive
shared lib dependencies of the libs and executables listed in Android.bp

Change-Id: I21f6a586654779984f0f5154b2a08b2adbf2168b
2018-10-11 11:19:07 +09:00