Add support for adding kotlinc files in the module.
Some flags are unnecessary as they are added by
default (-no-jdk and -no-stdlib), or are not needed
on an Android build (-include-runtime), or may
conflict with the build (-kotlin-home and
-Xintellij-plugin-root), so the error stops the
build if they are added.
Test: part of java/java_test.go
Change-Id: If3b2777062daaa490a20c014e9b1bb4b1cb0a8df
Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sony.com>
Various "core library" targets are no longer used in
soong so the tests do not have to create fake build
rules for them.
Bug: 113148576
Test: make droid
Change-Id: Ic754b4195f1597fb599e496c08940231ecbb13f7
Switch targets that don't explicitly specify an sdk_version
to using core.platform.api.stubs instead of the core library
implementations.
Note: the old core-oj target contained the source for
core-lambda-stubs too. The new core.platform.api.stubs
does not contain core-lambda-stubs so it is explicitly
added to the boot classpath list as part of the switch over.
Bug: 113148576
Test: build
Change-Id: I689d2127f6b69b4a7034fb96f3d9cf714f801794
To migrate the default compilation over to using
"core platform api" stubs we need to make the "before"
state as close to the "after" state as possible.
The stubs will include all "core libraries" so it
makes sense to include those that contribute to the
"core platform api": okhttp, bouncycastle and conscrypt.
(apache-xml is not included because it doesn't contribute
to the core platform API).
After this change all explicit dependencies to okhttp,
bouncycastle and conscrypt in situations where the
default boot classpath is used can be removed.
A knock-on of this change is that the conscrypt, bouncycastle
and okhttp targets need to be adjusted to explicitly
depend on core-oj / core-libart with no_standard_libs: true
to avoid a cycle.
Bug: 113148576
Test: treehugger
Change-Id: I1677af8d9d48fd026874ebce4c864f39ec1a5a3d
Make android_app modules a MultiTargets module, which means the
common variant will have a list of Targets that it needs to handle.
Collect JNI libraries for each Target, and package them into or
alongside the APK.
Bug: 80095087
Test: app_test.go
Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
R8 complains when it gets dex files in the input jar, but some tests
use dex files or dex jars as resources. Keep resources separate
from classes until after r8 has been run.
Test: java_test.go
Test: m checkbuild
Change-Id: I1d9164d60d6b054ebb138648da07d80ee769177f
We don't have API exported to glob any dir outside of current module.
Any files deps outside of current module should be either a
filegroup/filegroup or a customized module.
We already have similar customized module to track droiddoc-template, so
rename it to be more generic so that it can be used by
merge_annotations_dir also.
Bug: b/111916275, b/70351683
Test: touch manual/android/support/design/widget/annotations.xml, and m
-j metalava-api-stubs-docs, and check the built output srcjar.
Change-Id: I75420ddba69785e46bea75b6dd3f189be7cfe5ad
Prebuilt jars sometime contain files that we don't want. In Make
we would delete everything in META-INF when importing jars, but
that caused problems when there were necessary files in there,
so we added LOCAL_DONT_DELETE_JAR_META_INF.
Soong does the opposite, keeping everything by default. Add
properties to allow explicitly stripping unwanted files instead.
Bug: 111389216
Test: m checkbuild
Change-Id: I6d07f519ebc7d0e1bf0af93416bb569e3c2b1500
Very few java libraries need to be installed, most are statically
included in other modules. Device modules that are not installed
also don't need to be dexed, saving checkbuild time. Change the
default for java_library to not be installed, and allow libraries
that should be installed to specify installed: true. This makes
java_libary and java_library_static identical. It also simplifies
some corner cases when converting from Make to Soong if a module
is built for the host (which doesn't differentiate between static
and non-static/installable) and statically for the device, which
couldn't be represented in a single java_library in soong.
Bug: 110885583
Test: m checkbuild, compare presubmit target files
Change-Id: Idc0841c39a17cebd7bac3559c9408596d167a393
The soong connect the prebuilt library according to LOCAL_SDK_VERSION.
But some sdk libraries has diffrent version policy with
LOCAL_SDK_VERSION. For this, we need to support direct link to the
prebuilt library instead of creating a new LOCAL_XXX_SDK_VERSION. So,
The base module name is used as the prefix for the prebuilt module name.
Remove the empty file check to support the absence of a prebuilt
library and add api_dirs property
Bug:77577799
Test: make -j
Change-Id: I1086977d26e4ddfd62e290637126d44e1b248bac
java_library, java_import, and android_library export SDK library names
that they are using directly or indirectly via its dependencies. When
building an apk, the manifest fixer uses the SDK lib names to
automatically add <uses-library> tags.
The SDK lib names are exported to the make world via
LOCAL_EXPORT_SDK_LIBRARIES flag.
Bug: 77575606
Test: m -j
Change-Id: I4fe606eb7ed23843c58eebe6a324405fe1da34e5
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number. Use the
prebuilt sdk-core-lambda-stubs when using a prebuilt SDK.
Fixes compiling modules with lambdas against the SDK.
This reapplies I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6 with fixes
and tests for unbundled builds.
Bug: 80428539
Test: java_test.go
Change-Id: Ib7aaeebb93137270d7336a7293a08ed7064a3184
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number.
Fixes compiling modules with lambdas against the SDK.
Bug: 80428539
Test: java_test.go
Change-Id: I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6
droiddoc now accepts aidl files as inputs. This in turn allows us to
feed aidl files to java_sdk_library modules. This is required as some
java_sdk_library internally uses AIDL files and thus we need to specify
*.aidl files in the srcs property. Since the srcs property is internally
given to the droiddoc module as well as the runtime library, droiddoc
should be able to handle aidl files.
Bug: 77575606
Test: java_test.go
Change-Id: If7a8559a2a1d8ac1056b061d24e3a5ee5253453f
droiddoc now supports apicheck. java_sdk_library uses it to
automatically perform apichecks against the not-yet-release API and
the latest-released API.
A module type prebuilt_apis is added. It finds api txt files and creates
filegroup modules so that it can be referenced from java_sdk_library
across the module boundary.
Bug: 77575606
Test: m -j
Test: m -j checkapi
Test: m -j update-api
Change-Id: I0ba859972eac060296e1df2e71c4e047392d4877
didn't remove the props: api_filename, removed_api_filename yet since
these two currently are used by java_sdk_library.
Bug: b/78034256
Test: m clean && m checkapi
Change-Id: Iebd014ef227487717b5b3819c80d630c34559983
prebuilt_etc_xml installs an xml file to <partition>/etc[/<subdir>] and
validates the xml file against the given DTD file before installing it.
This change also includes some fixes for prebuilt_etc which is the super
module of prebuilt_etc_xml:
1) The module is changed to arch-specific module as the prebuilts are only
for devices (installed under the etc dir), but not for hosts.
2) Dependency to android.Prebuilt is removed because android.Prebuilt is
intended to be used for the case when a module can exist as prebuilts,
source or both. These prebuilt_etc_* modules are prebuilt only.
3) srcs property which accepts a list of source files is changed to src
that only accepts single source file, which makes more sense for
prebuilts.
Bug: 65686190
Test: m -j (xml_test.go)
Change-Id: I40484f3f6615b99f6b8d43176db0c40c5bfd838e
java_sdk_library is to make a Java library that implements optional
SDK APIs to apps. It is actually a wrapper for several modules: 1) stubs
library that clients are linked against to, 2) droiddoc module that
internally generates API stubs source files, 3) the real runtime shared
library that implements the API, and 4) XML file for adding the runtime
lib to the classpath at runtime if requested via <uses-library>.
Note: this is only the initial CL for the feature. Followings are features
currently missing and under development.
1) check for API consistency
2) install stubs libs as the dist artifacts
3) ensuring that apps have appropriate <uses-library> tag
4) disallowing linking to the runtime shared lib
5) HTML generation
Bug: 77575606
Test: m -j
Change-Id: I4a4ccf6e730e041703c63bb275d8860d0de96887
Bug: http://b/64121881
Bug: http://b/78188880
- Allow filegroup's properties to be extended by a LoadHook
- Support a filegroup (':module') in a prebuilt's 'Srcs' property to
export files from a different path as the prebuilt's sources.
This change also includes a refactoring that moves genrule/filegroup.go
to android/filegroup.go so that FileGroupFactory is visible in
prebuilt_test.go.
Test: Test
https://android-review.googlesource.com/c/platform/development/+/469159
in clang-tools branch on Linux, Darwin. Test regular build in
aosp/master.
Change-Id: I3ff6215ab2e62955f039fd1086c31f1bd50ebcf6
Add support for compiling android_library modules into AARs,
and refactor app support on top of it.
Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
In preparation for unexporting ProductVariables, explicitly return a
pointer to the structure from TestConfig / TestArchConfig.
Bug: 76168832
Test: m blueprint_tools
Change-Id: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735
Expand java_resource_dirs using ctx.Glob before globbing inside it
in case it has wildcards in it. Fixes:
internal error: panic in GenerateBuildActions for module "icu4j" variant "linux_glibc_common"
path "external/icu/icu4j/main/classes/charset/src/META-INF" does not start with "external/icu/icu4j/main/classes/*/src"
Test: java_test.go
Change-Id: Icd28b7a3dd14752642fb0ec8d41bbd6e30f81a68
Now that the SDK stubs are built in Soong, undo the hack that
uses the prebuilt stubs.
Fix the linktype checks to treat the various stubs libraries as
the correct type, since they can't be annotated with sdk_version.
Bug: 70351683
Bug: 77285514
Test: m checkbuild
Change-Id: I5e870c34dd0ebc8ae3f888ec627da590c846a76f
Link-type is also checked among Java modules defined in Soong. Until
now, the check has been done in between Soong/Make and Make/Make.
With this, a Java module can't depend on another Java module built with
larger API surface. For example, a java library built with Android SDK
(sdk_version: "current") can't link to a library built without SDK.
Bug: 73829976
Test: m -j
Change-Id: I64277be6e65e8535aad951b4f08f8d10b67abe66
Merged-In: I64277be6e65e8535aad951b4f08f8d10b67abe66
(cherry picked from commit f3586661e8)
Added new CompilerProperty flag, rename_kotlin_stdlib, which
allow to build kotlin libraries/binaries that use platform internal
version of kotlin stdlib (com.android.kotlin.*). This way, app-provided
kotlin standard library won't collide with version used internaly.
+ remove kotlinc-build.xml after compilation so it won't end up in the
result jar file
+ remove *.kotlin_module and *.kotlin_bultin filesfrom result jar file.
These files are needed only by kotlin-reflect library and
need more work to support kotlin-stdlib renaming.
Bug: 73281388
Test: java_test.go
Change-Id: Iae7ccb919e2ae9853b3f30f3dd447ebd01a1bed0
We prefer not to use absolute paths in modules, but to reference modules
that have associated paths. This a few benefits:
* it's easier to move a module than to update all the references
* if the module doesn't exist, we treat it as a normal missing
dependency, not having to deal with the missing dependency in path.go
* implementing visibility(etc) in the future would be simpler if there
was a module attached to the reference, so we don't have to do various
path-based lookups to try and match things up.
So define a `droiddoc_template` module, which takes a path, and will run
the glob once in that module. All of the `droiddoc` modules can then
specify it through the `custom_template` property, which will pull the
necessary data.
Also fix that htmldirs should be references from the local path, the
htmldir2 argument never being specified, and complain if more than two
htmldirs are specified, or if the custom template isn't specified.
Test: m core-docs
Test: out/soong/build.ninja is nearly identical
- line numbers in comments
- adds directories to droiddoc template dependency lists, which
is more correct, since we need to rerun on added or removed
files too.
Change-Id: Iff630bddb3818b8eeed439de7e41fc7fbe7cdcb0
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet
based droiddoc compilation output is a "real" stubs.jar instead of a
directory of java files and a timestamp file.
The std doclet based javadoc compilation output is a "empty" stubs.jar
instead of a timestamp file.
The stubs.jar will be exported to
out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar
and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar
A $(LOCAL_MODULE).zip file will be generated also, and is exported to
out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set
to false.
Bug: b/70351683
Test: unittest + convert libcore docs Android.mk to Soong manually.
Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f
(cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
This reverts commit 606e9de344.
Reason for revert: <try to fix the broken build yesterday>
Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5
Test: unittest
core_current is a pseudo SDK version which is a core Java API subset of
the Android API. It is expected to be mainly used for external Java
projects which are agnostic to Android; such as junit, guava, etc.
A module built with this SDK version can only link to java modules of
the same kind. It can't depend on modules built with other sdk (e.g.
current) or without sdk.
Bug: 72206056
Test: m -j
Change-Id: I778e7b4fcb9456a12b418ffd633ea78e29951e84
PLATFORM_SYSTEMSDK_VERSIONS is the list of System SDK versions that the
platform is supporting. Contrary to the public SDK where platform
essentially supports all previous SDK versions, platform support only a
few recent System SDK versions, since some of old System APIs are
gradually deprecated, removed from the following SDKs and then finally
deleted from the platform. This will be part of the framework manifest.
The list can be specified by setting PLATFORM_SYSTEMSDK_MIN_VERSION. If
it is set to an old version number, then System SDKs from the version
to the current version (PLATFORM_SDK_VERSION) are considered to be
supported by the platform. If PLATFORM_SYSTEMSDK_MIN_VERSION is not set,
only the latest System SDK version is supported.
Next, BOARD_SYSTEMSDK_VERSIONS is the list of System SDK versions that
the device is using. This is put to the device compatibility matrix
device is using. The device and the platform is considered as compatible
only BOARD_SYSTEMSDK_VERSIONS in the device compatibility matrix are
in the PLATFORM_SYSTEMSDK_VERSIONS in the framework manifest.
When BOARD_SYSTEMSDK_VERSIONS is set, a Java app or library in vendor or
odm partitions which didn't specify LOCAL_SDK_VERSION is forced to use
System SDK. Also, the build system does the additional integrity check
to ensure that LOCAL_SDK_VERSION is within BOARD_SYSTEMSDK_VERSIONS or
PLATFORM_SYSTEMSDK_VERSIONS (if BOARD_SYSTEMSDK_VERSIONS isn't set).
Bug: 69088799
Test: m -j
Test: BOARD_SYSTEMSDK_VERSIONS=P m -j
Change-Id: Id38f02b4be86710411be22bc28109e6894f8a483
Follow the Make change in I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92
to explicitly pass the OpenJDK 8 bootclasspath when targeting <= 1.8.
Bug: 70862583
Test: java_test.go
Test: javap -c -p out/soong/.intermediates/external/guava/guava/linux_glibc_common/javac/classes/com/google/common/hash/AbstractStreamingHashFunction\$AbstractStreamingHasher.class | grep ByteBuffer.flip
shows java/nio/Buffer return type in signature.
Change-Id: Ief66bbf6e3a4220b3afb2e02009bd0157d4c7fae
The kotlinc build rules were missing dependencies on the jars in
the classpath.
Test: TestKotlin in java_test.go
Change-Id: I56681785289f942b1070751b7dc5944e7a995b7f
Add a common_first multilib type and use it for java.Binary
so that the java part is compiled as a "common" arch type
but the wrapper script is installed as a "linux_glibc" arch
type. This allows java_binary to be used as a tool dependency
for a genrule.
Bug: 68397812
Test: TestJavaBinary
Change-Id: I809060839ce8878300da3fb76426ceb1ea6b0e8e
Add a java_genrule that has the right multilib flags to be a
dependency of a java rule. Make java libraries implement
SourceFileProducer so that their classes jar can be used as an
input to a java_genrule. Allow libs and static_libs dependencies
to be a java_genrule.
Test: TestJarGenrules
Change-Id: Ib1b31ef9c0b7e72eeed2c9ecc4ce8a1088e0b1c9
Instead of passing all the options to testJavaWithEnvFs, split it
up into testConfig, testContext, and run. Tests that don't need
any special options can continue to use testJava, more complicated
tests can call the three functions manually. This gives more
flexibility in complicated tests for the next patch.
Test: soong java tests
Change-Id: Ifd5dcb40cf08e4cbf69bf8e02c5698adbfbcdcb3
The system_$(VER) is added for vendor, similar to sdk.
Bug: 67724799
Test: build
Merged-In: I2545c92707591ca278066870c74e9f49e9825855
Change-Id: I2545c92707591ca278066870c74e9f49e9825855
(cherry picked from commit b8baff1fa3)
Update app support enough to build framework-res.apk, link
framework.jar against its generated files, and export it to
make.
Bug: 69917341
Test: m checkbuild tests docs
Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
Use aapt2 instead of aapt to compile Android app resources.
Also generate all files into srcjars instead of individual
sources.
Test: m checkbuild
Change-Id: I5a67991a0daf0017e8159b46fcff7d5564a91468
Move the java test resources from res to java-res to avoid confusion
with Android app resources that are implicitly expected in res.
Also allow tests to provide extra files.
Test: java_test.go
Change-Id: I13349a21da5c6d449cd23947c2628efbed3eb230