Commit graph

3981 commits

Author SHA1 Message Date
Treehugger Robot
3dfd4aaf7f Merge "Use python2.7 instead of python2" 2017-10-02 21:17:54 +00:00
Dan Willemsen
dece58146f Change androidmk to use linux_glibc instead of linux
Test: m blueprint_tools
Test: androidmk system/core/fastboot/Android.mk
Change-Id: I7003b86f16a522f01c826092b8e45603270aa391
2017-10-02 10:55:22 -07:00
Dan Willemsen
9d6c6722a7 Rename target.linux[_x86[_64]] to target.linux_glibc[_x86[_64]]
In the future, target.linux will apply to all targets running a linux kernel
(android, linux_glibc, linux_bionic). So move all current users to the specific
linux_glibc.

There will be another cleanup pass later that will move some instances back to
target.linux if the properties should be shared with target.android and
target.linux_bionic, but target.linux needs to be removed first.

Test: out/soong/build.ninja identical before/after
Change-Id: I04e4f984781e60feb355de7adf80c54300e0d1f5
2017-10-02 10:44:42 -07:00
Colin Cross
fa5eb23df6 Add no_framework_libs property
Add a no_framework_libs property similar to no_standard_libs.
The new property will allow modules to continue to link against
the standard bootclasspath libraries that contain java.*, but
not against the framework libraries.  This avoids having to
specify the bootclasspath libraries explicitly.

Test: m -j checkbuild
Change-Id: I0be13a45cadca9b90a0fd1797885cd18c5b462e3
2017-10-01 20:34:35 -07:00
Treehugger Robot
b93479bed6 Merge "Allow modules with empty sdk_version in unbundled builds" 2017-09-30 04:15:28 +00:00
Treehugger Robot
00be2b997a Merge "Correctly set date and mode fields for MANIFEST.MF" 2017-09-30 03:16:51 +00:00
Colin Cross
8b9d37b40a Allow modules with empty sdk_version in unbundled builds
The apps build depends modules that have empty sdk_version.  Let the
behavior match make for now.

Test: m -j TARGET_BUILD_APPS=Gallery2
Change-Id: Ie5545d2cd6b1268b0b3392dc0af2e4eb3d38a588
2017-09-30 02:41:25 +00:00
Colin Cross
2825cb3f8d Correctly set date and mode fields for MANIFEST.MF
The file header returned by jar.ManifestFileContents had unset
date and mode fields.  The unset date field resulted in the
"Last Mod Time" field in the zip file being set to 0, which
OpenJDK 9's jar implementation treats as an error:
java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0

Bug: 67095392
Test: zipdetails out/host/linux-x86/framework/tradefed.jar
Change-Id: I0a818d57420f5e5de57e8ff57791951c1b538443
2017-09-29 21:52:58 +00:00
Colin Cross
0f37af0c15 Add java file resources and flag to include sources
Add a properties to allow including files as resources, including
support for filegroups.  Also add a flag that causes module sources
to be included in the final jar.

Test: java_test.go TestResources
Change-Id: Ida8ee59b28df9fe66952170f46470d3a09fd5d65
2017-09-29 14:02:22 -07:00
Colin Cross
8649b2653c Use pre-desugar classes in classpath
Follow the make change in I87aee34940937dbde33a977f55d1faf2c8054561
to use classes before desugar in the classpath.

Test: java_test.go
Change-Id: I1054f4aea1eb349b6f687e1af0adb92a944fd8c5
2017-09-29 14:02:22 -07:00
Colin Cross
59f1bb66ea Only desugar/dx installable libraries
Don't waste time running dx on libraries that will never end up
on the device.

Test: m -j checkbuild
Change-Id: Iad1750823d3261cd6ad6eb6aa00c74d45b9737a3
2017-09-29 14:02:22 -07:00
Colin Cross
40a3671416 Remove jarSpec structure
It's not doing anything anymore, and the next patch will need more
complex jar arguments.  Just remove it.

Test: m -j checkbuild
Change-Id: I96d15995e86263ec04fd5c13ab0fd54d8b85c788
2017-09-29 14:02:22 -07:00
Colin Cross
d689143f1d Move errorprone dependency to compiled classes jar
The resources jar and the combined jar are not always used, so
add the errorprone dependency to the compiled jar.

Test: m -j checkbuild
Change-Id: Iaa10a04347758c676bb704969b86f9442e6c3175
2017-09-29 14:02:22 -07:00
Colin Cross
86a63ff366 Rename resource_dirs to java_resource_dirs
For consistency with make, rename java resources to
java_resource_dirs and android resources to resource_dirs.

Test: m -j checkbuild
Change-Id: Ie9aac50fef40f6a9093b4b98759e79cd086bb797
2017-09-27 23:21:36 -07:00
Dan Willemsen
bd42549743 Don't use the platform copy of libz
We'll always provide our own.

Test: m nothing
Change-Id: I4749c0fc3ec0922e975fc5f60976bee964ed3d5e
2017-09-27 15:35:29 -07:00
Dan Willemsen
c2992232ca Merge "Add target.linux_glibc and target.bionic" 2017-09-27 22:03:02 +00:00
Dan Willemsen
866b563d4c Add target.linux_glibc and target.bionic
target.linux_glibc will apply to host builds with glibc, which is
identical to the current target.linux. In a future change, target.linux
will change to affect all targets using the Linux kernel (android,
linux_bionic, and linux_glibc).

target.bionic will apply to all OS variants using Bionic.

Bug: 31559095
Test: Add target.linux_glibc, target.bionic sections to an Android.bp, build
Test: m host
Change-Id: I677a67c22fba148fec264132311e355283f9d88d
2017-09-26 22:41:37 -07:00
Dan Willemsen
27991b7652 Add -lm to the default libs for Linux & Darwin
libm is a default library for device builds, so default it for host
builds as well.

Also removes duplicate additions of -ldl, -lpthread, -lm and -lrt.

Test: m host
Change-Id: I8f7e799d48a1f427e48dcfb1d0ccba93c5f9780b
2017-09-26 20:25:09 -07:00
jdesprez
1596e6ee11 Allow to build Android.bp in tradefed project
We want to start using some Soong Android.bp in tradefed so
enabling our project to be seen too.

Test: build a Android.bp target in tradefed
Bug: 66908811
Change-Id: Ia4543fc27d124442912e3a05d7bd3fd2f9850a1f
2017-09-26 16:10:49 -07:00
Treehugger Robot
3bea186bc5 Merge "Remove duplication of bootclasspath in DefaultLibraries" 2017-09-26 01:12:30 +00:00
Treehugger Robot
fdb573147e Merge "Add 10.13 Mac SDK to whitelist" 2017-09-26 00:37:55 +00:00
Dan Willemsen
652b383a3f Expose host AvailableLibraries to Make
Test: Check out/soong/make_vars-aosp_arm64_ab.mk
Change-Id: I8410942698f3c142b03a2e1e447c880184ab82bf
2017-09-25 22:00:41 +00:00
Dan Willemsen
7d1681a174 Use python2.7 instead of python2
Ubuntu has both aliases, but Mac only declares python2.7, not python2.

Test: `m sepolicy_tests` on internal master
Change-Id: Ia2b5d2d95195f307befbc1893a465752f14b8a7b
2017-09-25 21:48:34 +00:00
Nathan Harold
01abb0948b Add 10.13 Mac SDK to whitelist
Add the latest Mac SDK to the version
whitelist.

Test: compilation
Change-Id: I86fcbf2bb100a0af6a2cfea62f524a17ba1a67b9
2017-09-24 01:51:26 -07:00
Colin Cross
cb2c92961c Remove duplication of bootclasspath in DefaultLibraries
Don't add bootclasspath libraries as classpath dependencies too.

Test: m -j checkbuild
Change-Id: Icb45e45536ce3babab73f67d281ca593edd4ab7f
2017-09-23 22:36:16 -07:00
Treehugger Robot
968df27a9c Merge changes I28a15bcc,I86cccefc
* changes:
  Add (host|host-cross|target)[-<OS>] phony targets when not using make
  Fix mma/mmma when soong is not embedded in make
2017-09-22 19:33:08 +00:00
Pirama Arumuga Nainar
ada83ec0a6 Add PGO support to soong
Bug: http://b/63768402
Bug: http://b/65598278

Add support for the 'pgo' property to specify how a module is processed
under PGO.  A sample property is below:

pgo: {
    instrumentation: true, // could be "sampling: true" when supported
    profile_file: "pgo_simple.profdata",
    benchmarks: ["pgo_simple"],
}

1. Runtime profiles can be gathered using "sampling" or
"instrumentation".  Sampling is not supported initially.

2. If 'toolchain/pgo-profiles' project is found,
'toolchain/pgo-profiles/${profile_file}' is passed to the compiler and
linker when building this module.

3. If ANDROID_PGO_INSTRUMENT environment variable is set, and includes a
benchmark in the 'benchmarks' list, appropriate flags (for e.g.
-fprofile-generate for instrumentation) are passed to the compiler and
linker when building this module.

Test: Add example modules that specify the pgo property and verify
appropriate flags and dependencies in the Ninja file.  Some
tests/examples are in https://android-review.googlesource.com/474805

Change-Id: I6242e0c904497a115e367dea6927ba1c4b906355
2017-09-21 12:37:19 -07:00
Treehugger Robot
d685385c6b Merge "Don't generate dex jars for host modules" 2017-09-21 05:10:52 +00:00
Treehugger Robot
5012c81888 Merge "Remove android_prebuilt_sdk modules" 2017-09-21 04:42:19 +00:00
Dan Willemsen
61d88b8fca Add (host|host-cross|target)[-<OS>] phony targets when not using make
Test: m --skip-make host-linux_bionic
Test: m --skip-make host
Change-Id: I28a15bcc690245f1a544a051868340b1dc818bb3
2017-09-20 18:23:32 -07:00
Dan Willemsen
d2e95fb295 Fix mma/mmma when soong is not embedded in make
Now `mma --skip-make` works.

Test: mmma --skip-make external/googletest
Change-Id: I86cccefc3c5174773d185c6e16bc52fe2c2010b3
2017-09-20 18:23:32 -07:00
Colin Cross
a713a6f6bd Don't generate dex jars for host modules
Hostdex support isn't working yet, and we are accidentally producing
a dex jar for host modules, which confuses soong_java_prebuilt.mk.

Test: m -j checkbuild
Change-Id: Ie2c331fa697f49dab23c380a5c6e0490d67c9f74
2017-09-20 18:08:04 -07:00
Treehugger Robot
691ad1490c Merge changes from topic "host_bionic"
* changes:
  Extract the linker and embed it into host bionic binaries
  Add prefix_symbols support to cc_object
  Fix ToolchainClangCflags for host bionic
  Don't add a rpath to the linker
2017-09-21 00:46:41 +00:00
Dan Willemsen
c77a0b3f9c Extract the linker and embed it into host bionic binaries
The linux kernel requires that the ELF interpreter (runtime linker)
that's referenced by PT_INTERP be either an absolute path, or a relative
path from the current working directory. We'd prefer a relative path
from the binary, similarly to how we handle looking up shared libraries,
but that's not supported.

Instead, extract the load sections from the runtime linker ELF binary
and embed them into each host bionic binary, omitting the PT_INTERP
declaration. The kernel will treat it as a static binary, and we'll use
a special entry point (linker_wrapper) to fix up the arguments passed by
the kernel before jumping to the embedded linker. From the linker's
point of view, it looks like the kernel loaded the linker like normal.

Bug: 31559095
Test: Enable host bionic,
      out/soong/host/linux_bionic-x86/nativetest64/libdemangle_test/libdemangle_test
Change-Id: I8d0aea9790b5e86fcc3ea6e2d00cfa33907e2853
2017-09-20 15:34:33 -07:00
Colin Cross
fc3674a607 Remove android_prebuilt_sdk modules
Forcing sdk modules to be declared explicitly is unnecessary, just
add the required dependencies on the jar and aidl files.

Test: java_test.go
Change-Id: Ib28bdc1051c5825e7c0efb6adff1f9282675560e
2017-09-20 13:20:45 -07:00
Colin Cross
2acdae8853 Fix java sdk tests
Fix the java module sdk tests, and expand them to cover testing
all classpaths including for the host.

Test: java_test.go
Change-Id: I71be13cc5545f5c4d5b377c4c8de3dccbb09abf9
2017-09-20 13:20:45 -07:00
Colin Cross
4c428dfb28 Convert java tests to NewTestArchContext
Java tests will need to test code inside if ctx.Device() blocks,
switch to using TestArchConfig and NewTestArchContext.

Disable TestSdk for now, just registering modules that depend
on the SDK triggers panics because of previously untested code
that is now executed.

Test: java_test.go
Change-Id: Iff2c814af56cc830327db8d951c4350034c00361
2017-09-20 13:20:45 -07:00
Colin Cross
ae4c6180a7 Add test infrastructure for running the arch mutator
Add TestArchConfig and NewTestArchContext to create a test context
that will run the arch mutator, which is necessary to test any code
that is inside a ctx.Device() block or similar.

Test: next patch
Change-Id: Ieb1a0326bc27fc18ba88b8d37655a7e0c6870d6c
2017-09-20 13:20:45 -07:00
Colin Cross
6ade34f641 Initial device java support
First pass at java support for the device.  Adds desugar before
dx, and passes javalib.jar to make.

Test: m -j checkbuild
Change-Id: I3138d943bc4867a52c3fce8fbdb597773793988d
2017-09-20 13:20:45 -07:00
Colin Cross
635acc9446 Rearrange manifest file handling in merge_zips and soong_zip
Jar always puts default MANIFEST.MF files in if none was specified.
Copying that behavior in soong_zip causes problems with merge_zips,
because it ends up taking the default manifest from the classes.jar
instead of the user's manifest from res.jar.  We don't want the
user's manifest in the classes.jar, otherwise a change to the
manifest will cause all the class files to rebuild.  Instead,
move the manifest insertion to the final merge_zips stage.

Test: m -j checkbuild
Change-Id: Id6376961dbaf743c2fb92843f9bdf2e44b963be0
2017-09-20 13:20:45 -07:00
Dan Willemsen
efb1dd93bf Add prefix_symbols support to cc_object
Test: add cc_object with prefix_symbols, use objdump to check
Change-Id: I15eb47e6888eb1c4837734a44a7ad86205a48c02
2017-09-20 13:16:13 -07:00
Dan Willemsen
38394b962f Fix ToolchainClangCflags for host bionic
Move these flags from the normal flags to the toolchain flags, since we
want them to always apply.

Test: Add #ifdef __ANDROID__ to crtbegin.c, check to see if it's set for host bionic
Change-Id: I382dd229e3e4a889bc916f6f8e1248c7debb8fad
2017-09-20 13:16:13 -07:00
Dan Willemsen
6f91fbff76 Don't add a rpath to the linker
It doesn't need one, and doesn't handle it well either (it tries
allocating memory before the memory allocators are initialized).

Test: out/soong/host/linux_bionic-x86/bin/linker64
Change-Id: Ic4f75e8914093f13f28d53cf771f518f2b4e5d2e
2017-09-20 13:16:13 -07:00
Nan Zhang
6eebec7414 Merge "Strip extended-timestap extra block in zip2zip." 2017-09-20 19:48:27 +00:00
Nan Zhang
830f99c982 Merge "Add -stripDir and -zipToNotStrip option in merge_zips." 2017-09-20 19:48:27 +00:00
Nan Zhang
10e8e93710 Strip extended-timestap extra block in zip2zip.
The extended-timestap extra block changes between Local File Header and
Central Directory. We have to strip it out to avoid mis-filling during
zip2zip.

Bug: b/65455145
Test: add unit-test.
Change-Id: I17e3f6c10fd6a068019620b4426f6042f6fac317
2017-09-19 21:01:18 -07:00
Nan Zhang
13f4cf5c9e Add -stripDir and -zipToNotStrip option in merge_zips.
In some cases, we need delete META-INF dir to void mis-using some
classes files in the Java runtime.

For now, when we delete META-INF, we need keep Manifest file in the jar
since merge_zips doesn't have ability to add a default one.

Bug: b/65455145
Test: m clean && m -j

Change-Id: Iea44b1a98d348cd8df1fa7374907733b1add6935
2017-09-19 18:44:43 -07:00
Colin Cross
58762a606b Merge "Add -XDskipDuplicateBridges=true flag to javac" 2017-09-19 21:40:28 +00:00
Treehugger Robot
944d6b4c01 Merge "Allow exporting filegroups to make" 2017-09-19 20:17:50 +00:00
Colin Cross
945c000aac Add -XDskipDuplicateBridges=true flag to javac
Turbine leaves out bridges which can cause javac to unnecessarily insert
them into subclasses.  Setting this flag causes our custom javac to
assume that the missing bridges will exist at runtime and not recreate
them in subclasses.  If a different javac is used the flag will be
ignored and extra bridges will be inserted, which should be harmless.
The flag is implemented by https://android-review.googlesource.com/c/486427

Test: m -j checkbuild
Test: check core-libart for extra methods
Bug: 65645120
Change-Id: I6e2babe4a5a24cda4903845ae895c369343ec55b
2017-09-19 12:19:36 -07:00