Commit graph

1541 commits

Author SHA1 Message Date
Colin Cross
6cef481ee7 Use java language 1.9 for sdk_version: "current"
Java language was set for 1.8 for anything building against the
current SDK because the stubs were not built in Soong, so the
system modules could not be built.  The stubs have been built
in Soong since Iabd32b30954b3f4a6d9a779fde52a032b684807e, but
I5e870c34dd0ebc8ae3f888ec627da590c846a76f missed updating
this TODO.

Use 1.9 when building against the stubs, but continue using
1.8 for unbundled builds until we have prebuilt system modules.

Always use the core-current-stubs-system-modules to avoid
splitting android.* packages between the system modules and
the classpath, which would cause new classes in android.*
packages in classpath jars to be ignored.  Add a new
java9Classpath field to sdkDep that will contain the stubs jar
when targeting Java language level 1.9, and plumb it through
to javac and turbine.  Rename the modules field to bootclasspath.

Bug: 142896162
Test: m checkbuild
Change-Id: Icfd32d0a863b2303a997c7cf03cb3708aade4724
2019-10-29 13:35:39 -07:00
Colin Cross
6d8d8c6a91 Remove special case for sdk_version: "none"
The dependency handling for sdk_version: "none" (which propagated to
!sdkDep.hasStandardLibs()) was very similar to the normal useModule
case.  Combine the cases by making decodeSdkDep set useModule: true
and put the system modules in modules for the sdk_version: "none"
case.

Test: TestClasspath
Change-Id: Icc9ff4d43a38da25cc0e3628be95951d61773ad5
2019-10-29 13:35:39 -07:00
Colin Cross
bf3119ee35 Use system modules for turbine
turbine supports taking system modules on the command line,
now that we target Java language level 1.9 and use system modules
by default switch turbine to match javac.

Test: m javac-check
Change-Id: Ieee07502151da0d5693bb8929213d495c039106b
2019-10-29 13:35:39 -07:00
Colin Cross
1e7438524b Make javaVersion an enum
Remove the hardcoded checks against "1.9" by making javaVersion
an enum and implementing javaVersion.usesJavaModules().

Test: TestClasspath
Change-Id: I559eeb1f45880bb8177269c6d977ee4dfbadce57
2019-10-28 14:55:03 -07:00
Colin Cross
74362a4d5e Move TestConfig sdk versions forward
The SDK version in TestConfig is very old, move it forward to trigger
the newer javaVersion code paths.

Bug: 142896162
Test: all Soong tests
Change-Id: Iaf2a6f6dfef43b006b0a09f193fbc2d2e103d90d
2019-10-28 14:55:03 -07:00
Colin Cross
617b1451b4 Split java 8 and 9 classpaths in TestClasspath
In preparation for adding the system modules jars to the classpath
for java 9, split the expected java 8 and java 9 classpaths into
separate fields.  Also replace the system: "bootclasspath" special
case with a bool that specifies that the module will always be
built using a java 8 style command line.

Test: TestClasspath
Change-Id: I661ec50d77a039c435c03bc8e6443cc5a57c206e
2019-10-28 14:55:03 -07:00
Treehugger Robot
05491b4861 Merge "Default to compiling lite protos" 2019-10-28 15:21:02 +00:00
Pete Gillin
ef99a4b06e Merge "Remove support for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9." 2019-10-28 10:28:19 +00:00
Treehugger Robot
d3f11c13b1 Merge "add stem property to java modules" 2019-10-28 06:23:32 +00:00
Colin Cross
0f97adae5f Default to compiling lite protos
Soong was incorrectly defaulting to compiling for full protos but
using the lite runtime.  Switch to compiling lite protos by default.

Fixes: 119714316
Test: m checkbuild
Change-Id: I0832b854f01f2acb10682e68ce7cc68753ca9dda
2019-10-26 20:35:13 +00:00
Pete Gillin
a1c9e9da55 Remove support for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.
Prior to this change, setting that to "false" turned the default Java
language level back to 8. This change removes that option.

Bug: 115604102
Test: m java droid docs tests cts
Change-Id: I97bfd0dc8d941008b4071c6efe1c0c24950c4f1f
2019-10-25 16:55:06 +01:00
Jiyong Park
4c4c02400f add stem property to java modules
java_library, java_import and dex_import now support stem property to
set the output file name.

Bug: 139391334
Test: m
Merged-In: I11146badf558e524a973806114b9cb1344db4a6e
(cherry picked from commit 62c7829595c0df53e96addcd347c11ac01012eee)
Change-Id: I11146badf558e524a973806114b9cb1344db4a6e
2019-10-25 10:40:56 +09:00
Ulya Trafimovich
18263381ed Deduplicate config generation for boot images.
Both default and apex configs are used for dexpreopting bootclasspath
jars. The difference between the two configs is in the naming (default
paths contain "boot", and apex paths contain "apex"). Another
difference is that apex config does not have a zip archive.

Test: m
Test: `find $ANDROID_BUILD_TOP/out -name '*.art' | sort`
    returns the same list of files before and after the patch

Change-Id: I5b2e8d83ab94fd0b1b3d4dc3f0db243ef70bfb08
2019-10-23 17:19:17 +01:00
Pete Gillin
e195591829 Merge "Refactor and strengthen sdk_test.go." 2019-10-22 10:46:27 +00:00
Nicolas Geoffray
43118dc1fc Merge "Remove support for stripping dex." 2019-10-22 09:48:06 +00:00
Pete Gillin
bdf5d7170a Refactor and strengthen sdk_test.go.
This change:

- Removes usage of the EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false option
  from tests, since it is going to be removed. The java_version
  property is used instead.

- Commons up some of the assertions between the tests for language
  levels 8 and 9 in sdk_test.go.

- In commoning the code up, some additional assertions are made in the
  language level 9 cases, strengthening the tests.

Test: m nothing
Bug: 115604102

Change-Id: I693c5d299b5592b851c44dde4434d92a931f15cd
2019-10-21 14:36:41 +01:00
Jerome Gaillard
8436ccea9c Merge "Update droidstubs build target" 2019-10-21 09:32:12 +00:00
Treehugger Robot
8141c8781a Merge "Add tradefed_java_library_host" 2019-10-19 02:45:42 +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
Nicolas Geoffray
c1bf724207 Remove support for stripping dex.
Stripping is incompatible with ART module updatability.

Bug: 65154345
Bug: 138851227

Test: build and observe no change in output (stripping is not used by
default).

Change-Id: I4bbc01d9979605b7dd2f73ee99a74c1e817c3e8c
2019-10-18 14:52:16 +01:00
Jerome Gaillard
0f59903d09 Update droidstubs build target
This allows to use Metalava to generate metadata files useful for
Android Studio as part of a droidstubs target.
Once those files have been created in a new metadata folder, they are
zipped to make it easier to transfer them into the
out/target/common/obj/PACKAGING folder where they can then be picked up
by the SDK build to be included there.

Bug: 142480924
Test: m sdk
Change-Id: I4be1c9e78369c65ee9cd94706c6d20ab0df6b797
2019-10-18 14:21:55 +01:00
Treehugger Robot
d091c6a67a Merge "Support privleged app in APEX" 2019-10-18 01:30:39 +00:00
Treehugger Robot
c5bba642f1 Merge "Prohibit dependencies outside of uses_sdks" 2019-10-18 00:30:18 +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
Jiyong Park
f7487318ac Support privleged app in APEX
privileged apps are installed to priv-app dir in APEX

Test: m
Change-Id: I8141e1c20e9486655606fa43b949783f11da09f4
2019-10-17 12:54:30 +09:00
Jiyong Park
a7bc8ad0b9 Prohibit dependencies outside of uses_sdks
When an APEX is built with uses_sdks, any depedndency from the APEX to
the outside of the APEX should be from the SDKs that the APEX is built
against.

Bug: 138182343
Test: m

Change-Id: I1c2ffe8d28ccf648d928ea59652c2d0070bf10eb
2019-10-17 11:19:53 +09:00
Treehugger Robot
d7d5e5a1ac Merge "Create scripts to update and freeze a module SDK" 2019-10-17 01:02:16 +00: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
Adrian Roos
49a1384b11 Merge "API Lint: Apply Javadoc.args when invoking api lint" 2019-10-16 12:07:52 +00: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
Treehugger Robot
d90d208628 Merge "AIDEGen: Remove the duplicate *.srcjar from srcs" 2019-10-15 01:51:37 +00:00
Adrian Roos
cab4a2c84a API Lint: Apply Javadoc.args when invoking api lint
Bug: 142459906
Test: make checkapi
Change-Id: I64c83a8064491303088cca713537c391f1a3d876
Merged-In: I64c83a8064491303088cca713537c391f1a3d876
2019-10-14 16:33:08 +02:00
patricktu
242faad111 AIDEGen: Remove the duplicate *.srcjar from srcs
AIDEGen collects the complied sources which are generated from build
system, the sources includes not only java/kt files but also srcjar
files. Since the srcjar files are record in srcjars parameter in json
file, we should keep only java or kt files in the srcs parameter.

The size diff of module_bp_java_deps.json:
Without this patch: 15,298,369 Bytes
With this patch: 15,044,804 Bytes

The build time diff:
Without this patch: 2m31.345
With this patch: 2m32.662

Bug: 141528361
Test: 1. m clean -j
      2. aidegen tradefed
      3. Open out/soong/module_bp_java_deps.json
      4. Find the module CtsSyncManagerCommon and check the
         sync_manager_cts.srcjar files doesn't exist in srcs but exists
         in srcjars section.

Change-Id: I43fc5c05b657473054e632cae4795220907dc711
2019-10-14 10:16:17 +08:00
Paul Duffin
e25c644f1e Add system_modules to droidstubs
This allows droidstubs to use the same system modules to create the
stubs that will be used to compile them. It improves consistency and
avoids droidstubs having to duplicate the libraries that make up the
system modules on its libs property.

Adds systemModules() to the sdkContext which allows consistent error
checking behavior between droidstubs and java_library.

Bug: 142534789
Test: m checkbuild
Change-Id: Ib2006906d9528a900f16851f50b62152ffb51a1b
2019-10-11 16:38:14 +01:00
Adrian Roos
075eedc38d droidstubs: Add API lint via metalava
Bug: 142459906
Test: make checkapi
Change-Id: I12fe864ef568ff6f5565106f7f24349f129decd7
2019-10-10 12:09:40 +00:00
Pete Gillin
1f52e93db2 Add experimental option to use OpenJDK 11 toolchain.
With this change, setting the environment variable
EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=true switches from the OpenJDK 9
toolchain to the OpenJDK 11 one (prebuilts/jdk/jdk11).

Since the version of the java.base module has to match the version of
the jlink tool which consumes it, the --module-version argument to the
jmod create call is also switched.

Test: make
Test: EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN make
Bug: 131683177
Change-Id: I606d22538165f309fe5537bd67a26390b1dd5771
2019-10-09 18:38:14 +01:00
Pete Gillin
df7dc82a04 Remove the moduleName parameter to jarsToSystemModules.
This rule takes a moduleName parameter which only ever has the value
java.base. What's more, the assuption that the value will always be
java.base is baked into the rule in other ways (most significantly,
the module created with this name is passed to jlink, and jlink
requires a java.base module).

This change removes the parameter and hard-codes java.base everywhere,
on the basis that it's better to have it completely hard-coded than
partially configurable and partially hard-coded.

Test: make
Change-Id: Ib42cda92f623c5a1f929b5a99248ca8919e4700c
2019-10-09 17:09:38 +01:00
Treehugger Robot
c6136c9d65 Merge "Remove old-style support for translated second architectures" 2019-10-07 20:48:07 +00:00
Colin Cross
c080617c8b Shard aidl compiles into srcjars
Group aidl files into groups of 50 and compile them together into a
srcjar.

Bug: 124333557
Test: m checkbuild
Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
2019-10-04 14:00:36 -07:00
Colin Cross
9516a6c3f2 Shard java proto files into groups of 100
Group protoc calls to generate java files into groups of 100
to avoid having a srcjar for every proto file.

Test: m checkbuild
Change-Id: I72a5efaabad24c975282df321d00ec2d7900645e
2019-10-04 14:00:36 -07: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
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
Jaewoong Jung
9dc1756484 Merge changes I3d6506f5,I3667eac9
* changes:
  Fix split apk paths.
  Fix android_test install path.
2019-10-01 16:54:40 +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
Jaewoong Jung
7dd4ae2fb9 Fix split apk paths.
Soong has been outputting incorrect Android.mk entries for split apks.
soong_app_prebuilt.mk expects LOCAL_SOONG_BUILT_INSTALLED to contain a
list of <split apk path>:<on device install path> pairs whereas Soong
outputs <split apk path>:$(LOCAL_MODULE_PATH)/<split apk filename> pairs.

This also adds a missing underscore in split apk filenames.

Test: m Split
Bug: 140795853
Change-Id: I3d6506f5e12106174fbbaef34749a272b5e1b90c
2019-09-27 17:13:15 -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
Treehugger Robot
318c9c5d17 Merge "Pass filename mappings to C++ and Java extractors." 2019-09-27 20:00:44 +00:00