Some `java_sdk_library` and `droidstubs` modules already specify
`--error UnflaggedApi` but they are currently ignored because they are
added before the `--error-when-new UnflaggedApi` automatically added by
Soong and Metalava uses the last setting. That means adding
`--error-when-new UnflaggedApi` in change https://r.android.com/3248013
actually reduced the severity of the issue for those modules making it
more likely that they would be missed.
This change only adds the `--error-when-new UnflaggedApi` if it does
not already appear in the metalava command.
Bug: 361582214
Test: m checkapi
Change-Id: I499183276c7520605cca7acc6e6e9ab535feaa86
The `UnflaggedApi` issue is only reported when doing API linting and
defaults to `Severity.HIDDEN` because AndroidX (among other users) do
not support using `@FlaggedApi` annotations. This change switches it to
be warning by default in the Android build as there are some existing
instances of it, but will be treated as an error by the "Build Warnings
Aye Aye Analyzer" in a Gerrit change if it occurs on lines that are
modified/added by that change.
Bug: 361582214
Test: m checkapi
Change-Id: Ie5ed23d00dd49454aeb5b43ccd8ad027d9d34fd2
This will eventually allow us to build devices by skipping `katiBuild`
and moving straight to `katiPackaging`.
Implementation details
- Replace ctx.PackageFile with ctx.InstallFile. These makes these rules
available to both make and soong packaging systems. This will be done
inside d.dexpreopt function
- Add InstallDepNeeded on the dependency tags in this chain
(apex --> sscp_fragment --> (java_library|java_sdk_library)). This is
necessary for the soong packaging system.
- Remove `LOCAL_SOONG_INSTALLED_MODULE=""`. A non-empty string ensures
that kati honors the installation rules generated by soong.
Bug: 355509400
Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug (mainline source)
Test: lunch cf_x86_64_only_phone-ap3a-userdebug (mainline prebuilts)
(no diff in system_intermediates/file_list.txt in both cases)
Change-Id: I190a919e9480e7d9981a6b9b96a50d9c33ceea02
Currently, the (from-text) stub jar depends on the check api timestamp
of the same api scope droidstubs. However, building the top level
sdk_library phony target does not trigger check api, as the top level
java_sdk_library "depends" on the stub submodules but the top level
phony target does not build the stubs generated by its submodule, nor
the top level java_sdk_library generate any output files.
In order to support the user's workflow of observing checkapi failure
after modifying the api by running `m <java_sdk_library name>`, this
change adds the paths to the stub jars as dependencies as the top level
java_sdk_library phony target.
Bug: 234113632
Test: modify source file api, run m <java_sdk_library name> and observe checkapi failure
Change-Id: Iccd42c8ef7d5de20f71c347455c1a90d83a6c70c
This change prevents non-stub modules with stub suffix from being
determined as the stub module, and instead makes the check more robust
by determining the condition based on the user-hidden
`Stub_contributing_api` property, which is only set for the stub
submodules generated by `java_sdk_library`.
Test: m nothing --no-skip-soong-tests
Bug: 361179822
Change-Id: I28a599c5b4fe1e8460e60580c0535aaf19e39ba3
Apps share these classes from the BCP, so even if
they are changed, they stay in sync.
Bug: 258850063
Test: build
Change-Id: I50b6a928c29f5d9eca9496b91363a8fc5d397b00
The current R8 dex pipeline gathers transitive header jars to avoid
issues with missing class definitions. While this is benign for
platform targets not using a stable SDK, it can introduce issues
for stable targets (e.g., duplicate class defs for mainline framework
modules).
Bypass this transitive jar referencing for such targets that should
reference explicit, stable, stub API libraries. A follow-up change
will resolve specific issues with mainline system server targets.
Bug: 360905238
Test: m
Change-Id: I11a136d33ca9dd0dfff436c7045bf1807d17b1e7
The jni_libs property of java_binary is documented to only install
the jni libraries on host. However, it was adding installable
deptag deps on those libraries, even if they were for device. This
caused soong to emit installation rules for the jni libraries, causing
them to be installed to the staging directory, but not emitting
proper information to make, so they wouldn't be included on the built
partitions.
Only install them if the module is built for host, so that they don't
erroneously appear in the staging directory.
Bug: 344695913
Test: Presubmits
Change-Id: Ic40b4fc6d7dbd51c03b08e28037be5428db49c33
Unstable container marks modules that are static reverse dependencies of
"framework-minus-apex". These modules contain unstable implementation
details of the platform, and should not be accessed by the CTS tests.
Test: m nothing
Bug: 338660802
Change-Id: Ia0e1b3070f0f7b2c1b9c27306323e2428d9722ca
These exception functions allow restriction to be loosened for some
inter-container dependencies.
Note that these functions are still no-op. Restriction enforcement will
be done in the child change.
Test: m nothing
Bug: 338660802
Change-Id: I63c7c33e33f271d4c2a84cc6070eb4896e030ab4
Ravenizer is a new tool to preprocess ravenwood tests.
It can optionally be applied to other java targets (for analyzing them,
etc).
The actual tool is being implemented internally, so in AOSP, we just
use a script that copies the jar file as a replacement.
Test: manual -- run `m RavenwoodBivalentTest` and make sure the ravenizer
log message shows up.
Flag: EXEMPT host test change only
Bug: 360390999
Change-Id: I6d1f81e7c425397b16c37e7c30267957097387fd
java_import currently collects the "implementation and resource jar"
from each of its dependencies. This results in different resource
conflict resolution than other java modules, which collect
implementation jars and resource jars separately. Modify java_import
to match the other module types.
Flag: EXEMPT refactor
Test: all soong tests pass
Change-Id: I06134e2621582799b3a525d2c12b900b8d86d171
Similar to I40f28075ce151e4be80d6cfc7ec173dfa46f9bbf, convert
more long-lived WritablePaths to Paths.
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I9be448f811694fe0524fbbd7c5d4553cf69d533a
This is to limit the direct accesses to the internal fields of a
module in order to better support incremental caching. To access
the install files data from singleton context or other modules'
context use providers thru the provided wrapper; to access it
from the same module inside GenerateBuildActions use ctx which is
short-lived only inside this method.
Bug: 358425833
Test: CI
Change-Id: I337b07a2ef95fb2a898ac2f9277160a3f76a603c
The kotlin standard library was added with a custom dependency tag,
which then required special handling later. We know up front whether
it will be treated the same as a static_libs or libs dependency, so
just reuse staticLibTag or libTag, and remove all the special handling.
Bug: 308016794
Test: TestKotlin
Flag: exempt REFACTOR
Change-Id: I2c5601faec284d88f28e13378d9cbffc24560efa
java_sdk_library is not instrumented as it does not perform any
compilation actions. Instead, its submodule impl lib (with .impl suffix)
is instrumented.
Test: CI
Bug: 355514682
Bug: 339901608
Change-Id: I2f7b4a8cf14a592d268b6f5d44f72e43700b4907
Turbine rules that run in RBE fail when they have long lists of
flags. They work locally because the list of flags is placed in
an RSP file, but the list of inputs still appears on the command
line when RBE is enabled to pass them to rewrapper.
When the list of srcjars or classpath arguments are too long,
move the list of files into an rsp file, and pass the rsp file to
RBE instead of the list of files.
Bug; 308016794
Test: builds
Flag: EXEMPT refactor
Change-Id: I5ee610a91302ce94ec77b6f13b28a29bc63fd962
Replace the SystemModulesProvider interface with Provider
Test: all soong tests
Flag: EXEMPT refactor
Change-Id: If313580b28094d55b71f1635259bafa850ef7af5
Add a helper function that creates a test fixture preparer that
sets a build flag, and use it everywhere that was setting build flags
manually.
Test: all soong tests
Flag: EXEMPT refactor
Change-Id: I68d50d68787a30d091f0827e8caa51f5c5a762ef
jarjar can be used to repackage a java_library. e.g. Foo.java in package
com.android might get repackaged to prefix.com.android.Foo in the
resultant jar. To allow code completion of rdeps, we should use the
repackaged jar instead of the src files.
This CL sets dpInfo.Jars to the header jar _only_ when jarjar_rules is
not empty. We could probably set `Jars` to the header jar even for non
jarjar-d libraries and get rid of `Srcs`, `SrcJars` altogether, but that
would likely slow down any tools that index
out/soong/module_bp_java_deps.json for code completion.
Test: go test ./java
Bug: 356572093
Change-Id: Ib45810799a479cb315aed011a34351d386a21357
libraries and apps can depend on the top-level java_sdk_library like
such
```
java_library {
name: "mylib",
libs: ["somesdklib"],
}
```
and soong will automatically resolve mylib's classpath to either the
stub or impl library based on the api container these libraries are in.
Since the top-level java_sdk_library has no compilation actions, code
completion of `mylib` is not feasible today via
`module_bp_java_deps.json`. This CL adds support for this code
completion by registering the .impl (or public stubs) as a transtive
dependency of `mylib`.
The implication of this change is that implementation symbols of the sdk
library will be surfaced during code-completion of mylib, even when
mylib is in a different container. Long term, this should go away when
all the library dependencies are made explicit in Android.bp files.
Test: go build ./java
Test: verified that symbols of android.car.builtin (a java_sdk_library)
can be resolved with the repro instructions in b/356572093#comment5
Bug: 356572093
Bug: 358613520
Change-Id: Ia3887bae34bbd25b8c6346f43602835da32af84a
java modules that link against a versioned sdk (sdk_version: <num>) get
the appropriate stub jar on its classpath, but the dependency is not
registered in its build graph. This CL registers this dependency for
module_bp_java_deps.json. Ideally, we should move this to `decodeSdkDep`
so that this dependendency becomes known to other tools that analyze
soong's module graph (e.g. soongdbg)
Test: go test ./java
Bug: 358608607
Bug: 356572093
Change-Id: Iab6efe7826d18dedfadbe4d34d78e7eb2888bd8d
`Jars` property in module_bp_java_deps.json should be relative to the
android build top, and not relative to the Android.bp file
Bug: 356572093
Test: m out/soong/module_bp_java_deps.json and verified that `jars` in
an arbitrary java_import module is relative to android top
Change-Id: Ifc905b14500dfa4254b27505fcc8af8f18349587
The information will be used for IDE autocompletion.
Test: {
"jars": [
"out/soong/.intermediates/prebuilts/misc/common/androidx-test/androidx.test.core-nodeps/android_common/turbine-combined/androidx.test.core-nodeps.jar",
"out/soong/.intermediates/prebuilts/misc/common/androidx-test/androidx.test.core-nodeps/android_common/busybox/R.jar"
],
"path": [
"prebuilts/misc/common/androidx-test"
]
}
Bug: 356572093
Change-Id: I62166c6d5cfa1cf0c49adf42d5d8b4ca40ab5a11
Support long classpaths by passing the classpath in a file to the script
that generates build.xml.
Bug: 308016794
Test: builds
Flag: EXEMPT refactor
Change-Id: Ib238a83a26acba7ede8e55298397dbeb9a57a866
A future CL is going to change transitive classpath behavior when
jarjar is enabled. In preparation, split the jarjar rules out
of compileJavaHeader into a separate jarjarIfNecessary method, and
use it on the classes and resource jars too.
Also tweak the naming of the output files in repackageFlagsIfNecessary
to be prettier.
Bug: 308016794
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I2b182cd30631f2bd7925341b9171e6b3c0e8d450
A future CL is going to treat local jars separately from dependency
jars. Rearrange the order of the kotlin standard library jars to
come after the local jars produced by javac, which will better match
the future ordering and ease ninja file comparisions.
Bug: 308016794
Test: all soong tests pass
Flag: EXEMPT refactor
Change-Id: I9ed6a649350451bf1788077752db5222f50c0247
Convert JavaInfoProvider to return a *JavaInfo instead of a JavaInfo.
This will reduce copying when reading the provider, and also allows
JavaInfo to recursively contain a depset of JavaInfos from
dependencies.
Bug: 308016794
Test: go test ./java/...
Flag: EXEMPT refactor
Change-Id: Ibf6d9b797f760ad1fe815d59839839fdfad91733