Commit graph

787 commits

Author SHA1 Message Date
Ulyana Trafimovich
678ddb9d24 Merge changes I697a65e4,Iaac6aaf6
* changes:
  Do not propagate <uses-library> deps through static SDK component libs.
  Make error message more precise.
2020-12-07 10:01:40 +00:00
Treehugger Robot
cf8b2ee16e Merge "Dogfood the new IR Kotlin compiler backend." 2020-12-04 00:05:07 +00:00
Colin Cross
897a5ad507 Merge "Pass pctx and ctx to NewRuleBuilder" 2020-12-03 20:07:30 +00:00
Ulya Trafimovich
65b031910b Do not propagate <uses-library> deps through static SDK component libs.
If some Java library/app depends on an SDK component library (e.g. stubs
library), then it transitively depends on the SDK library itself
(because the component library has a dependency on its SDK library).

Previously having this transitive dependency resulted in adding the SDK
library to the <uses-library> dependencies of the library/app. However,
this doesn't make sense if the app has a *static* dependency on the
component library. This patch stops adding <uses-library> dependency in
that case.

Bug: 132357300
Test: m nothing
Test: added new Soong test that would previously fail with an error:
   invalid build path for <uses-library> "fred"
Change-Id: I697a65e461037c95ec56b6c321afa4ec52ccbbec
2020-12-03 16:50:22 +00:00
Mads Ager
ad2bfda285 Dogfood the new IR Kotlin compiler backend.
Test: make
Test: atest com.android.systemui

Change-Id: I610058001bde19554c55dee5a79ad1782abc3186
2020-12-03 12:23:55 +01:00
JaeMan Park
a4d314c91c Merge "Add java sdk library enforcement flag" 2020-12-02 04:39:10 +00:00
Colin Cross
f1a035e6be Pass pctx and ctx to NewRuleBuilder
Enable the RuleBuilder and RuleBuilderCommand methods to access
the BuilderContext by passing it to NewRuleBuilder instead of
RuleBuilder.Build.

Test: genrule_test.go
Test: rule_builder_test.go
Test: m checkbuild
Change-Id: I63e6597e19167393876dc2259d6f521363b7dabc
2020-12-01 16:22:16 -08:00
Paul Duffin
620680516d Remove redundant setting of DistFiles by java.Library
A previous change handles dist properties automatically for all module
types and as a result has made the java.Library setting of DistFiles
redundant so this change removes that and the tests that duplicate
tests of the general mechanism.

Test: m nothing
      m dist sdk - before and after this change, compare result to
      make sure that there are no significant differences.
Bug: 174226317
Change-Id: Ib79a3bdd46897efd84a9c456c37c374bd6036303
2020-11-27 15:17:44 +00:00
Paul Duffin
74f05598eb Differentiate between no dist tag and an empty dist tag
Change https://r.android.com/1335521 added tag property to the Dist
struct so that it could be used to select one of a number of different
output files to copy to the dist instead of the single file that the
module type made available for dist. The output files were selected
by passing the tag to OutputFiles(tag).

Module types that wanted to support this new approach had to explicitly
set AndroidMkEntries.DistFiles = GenerateTaggedDistFiles(module).
Unfortunately, doing that had a side effect of changing the behavior of
dist entries without a tag.

That was because the change treated a tag that was not specified, as
being the same as "". So, prior to the change no tag meant use the
default dist file but after it meant use the paths returned by
OutputFiles(""). That changed the behavior of the java.Library type
which affected the behavior of the android_app module type.

Prior to the change the java_library would make the
Library.outputFile available for dist when no tag was specified. After
that change it would make Library.outputFile plus
Library.extraOutputFiles. The latter is usually empty except for
android_app which adds some extra files into there which will now be
copied to the dist. That change may have been intentional but there
was no mention of it in the change or the bug. Even if it wasn't
intentional it may still be beneficial.

Any module type that wants to add support for tags in dist runs the
risk of introducing similar changes in behavior. This change
differentiates between the tag not being set and the tag being set to
"" to avoid that possibility and to make the default behavior
explicit for those module types that have switched.

It does so as follows:
* Adds a DefaultDistTag constant that is used when the tag is not set.
  It is a string that is unlikely to be used as an actual tag as it
  does not start with a . and uses some special characters.
* The DefaultDistTag is used in MakeDefaultDistFiles(paths) to indicate
  that the supplied paths are the default ones and and also in
  GenerateTaggedDistFiles() for Dist structures that have no tag
  property set.
* The DefaultDistTag is passed to OutputFiles(tag) just in case the
  module type has explicitly defined the paths to associate with that
  tag in there. If it has then it overrides the legacy behavior. If it
  has not then it is just ignored and falls back to using the previous
  behavior.
* The java.Library.OutputFiles(tag) method explicitly handles the
  DefaultDistTag and returns Library.outputFile for it which restores
  the behavior from before the change that added dist.tag support.
* Similar change was made to apexBundle.OutputFiles(tag) in order to
  preserve its previous behaviour.
* The customModule used by TestGetDistContributions has been modified
  to also preserve its previous behavior after this change.

Test: m nothing
      m dist sdk - before and after this change, compare result to
      make sure that there are no significant differences.
      Test the effect on the apex by following instructions in
      http://b/172951145
Bug: 174226317
Change-Id: Ib8f0d9307751cc2ed34e3d9a5538d3c144666f6d
2020-11-27 15:17:44 +00:00
Ulyana Trafimovich
af07f732e6 Merge "Assume any <uses-library> is shared, add only toplevel ones to manifest." 2020-11-27 10:44:54 +00:00
Ulya Trafimovich
78a7155c17 Assume any <uses-library> is shared, add only toplevel ones to manifest.
This patch reworks the approach introduced in
https://r.android.com/1450819. That patch based the decision which
libraries should be added to the manifest <uses-library> tags by the
manifest_fixer on the "shared" status of the library.

That approach is incorrect for two reasons:

  - It doesn't make sense to have a non-shared library in class loader
    context ("shared" libraries are those specified in
    frameworks/base/data/etc/platform.xml, and they are the only ones
    that PackageManager knows about).

  - It doesn't make sense to add anything but the top-level of the
    class loader context tree to the manifest, because this part of the
    tree is flattened to a sequence, and PackageManager cannot restore
    it to the previous tree shape (there is an information loss).

This patch removes the "shared" bit of information from class loader
context elements and assumes that all libraries that end up in class
loader context are shared. Consequently, only the top-level libraries
should be passed to manifest_fixer.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: I902690f0f38f1047fa79cf6ccbe956077eceaab0
2020-11-25 14:47:05 +00:00
Colin Cross
e5218b6be6 Merge "Annotate dependency tags for dependencies of installed files" 2020-11-24 16:01:35 +00:00
JaeMan Park
ff71556a53 Add java sdk library enforcement flag
Add java sdk library enforcement for inter-partition library
dependency, for ensuring backward-compatible libraries for
inter-partition dependencies.

Test: m nothing
Bug: 168180538
Change-Id: I6bfac54c3499b03003a3bc6c2bb62b165b4ce5f9
2020-11-24 17:56:15 +09:00
Treehugger Robot
547471cffc Merge "Remove restriction on exported plugins that generate APIs" 2020-11-24 05:06:40 +00:00
Colin Cross
e9fe2949b8 Annotate dependency tags for dependencies of installed files
Relands Ic22603a5c0718b5a21686672a7471f952b4d1017 with a minor
change to track libc++ dependencies for python hosts and after
a fix to an internal genrule that depended on transitively
installed java libraries (ag/13068670).

Soong currently assumes that installed files should depend on
installed files of all transitive dependencies, which results
in extra installed file dependencies through genrules, static
libs, etc.

Annotate dependency tags for dependencies for which the
installed files are necessary such as shared libraries
and JNI libraries.

This avoids extra installed files, and is also a first step
towards genrules using their own copy of tools instead of
the installed copy.

Bug: 124313442
Test: m checkbuild
Test: java.TestBinary
Test: cc.TestInstallSharedLibs
Test: deptag_test.go
Change-Id: I725871249d561428e6f67bba6a7c65b580012b72
2020-11-23 18:06:08 -08:00
Colin Cross
c9fe10f5b8 Remove restriction on exported plugins that generate APIs
hilt_android requires seven separate annotation processors, which
is only feasible to support using exported_plugins to avoid having
to list all seven in every module that uses it.  Unfortunately they
all set generates_api: true.  Turbine is already disabled for modules
that directly use a plugin that sets generates_api: true, because
turbine doesn't run annotation processors.  Also add support for
disabling turbine if a module transitively uses a plugin that
generates APIs via exported_plugins.

Bug: 173397767
Test: TestExportedPlugins
Change-Id: If70354a3dd67efb4ce88bc9c934d41ccb6241b28
2020-11-23 11:42:26 -08:00
Colin Cross
18e3e8fbc2 Merge "Support extra checks for ErrorProne in a dedicated property" 2020-11-20 02:06:19 +00:00
Julien Desprez
62aa21508c Merge "Use java host unit tests template for unit tests" 2020-11-20 00:07:41 +00:00
Colin Cross
748b2d829a Support extra checks for ErrorProne in a dedicated property
Previous extra checks for ErrorProne were added using the plugins
proeprty to get them into the -processorpath argument.  This works
fine for java-only modules, but fails for mixed java+kotlin modules
because the processorpath is given to kapt and not javac.

Add a dedicated errorprone.extra_check_modules property (mirroring
the lint.extra_check_modules property), and add that to a separate
processorpath that is used only for errorprone rules and not cleared
when kotlin is used.

Test: TestKapt/errorprone
Change-Id: Id6ef02ce758532d1df8b8d969fad83bb44fe93ab
2020-11-19 14:20:12 -08:00
Treehugger Robot
e63ab5ea02 Merge "java link time error improve" 2020-11-19 18:38:16 +00:00
Julien Desprez
70898c4006 Use java host unit tests template for unit tests
Test: make aoa-helper-tests
Bug: 172961860
Change-Id: I2eaee277961f29adfd22e7c65248c9403bd69b81
2020-11-19 09:44:39 -08:00
Dan Shi
ebb51503a4 Merge "Add unit_test test option in test configs" 2020-11-18 04:40:37 +00:00
Steven Moreland
0029898a84 java link time error improve
Asked about error message including "against private API.Adjust
sdk_version", which is a bit hard to parse due to missing space. Also
tried to make error message less verbose, so that it is more clear what
to do, and fixed a grammar mistake.

Bug: N/A
Test: N/A
Change-Id: Ib9a30d86b5cb0e9b3b7d5576ecb9498a9b316042
2020-11-17 21:57:23 +00:00
Colin Cross
f15c0558bf Merge changes Ic22603a5,I5330b571
* changes:
  Annotate dependency tags for dependencies of installed files
  Use the the preferred architecture symlink as the tool path if it exists
2020-11-16 23:11:10 +00:00
Dan Shi
d79572f73e Add unit_test test option in test configs
This change allows a test (native, java, rust or python) to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 172006742
Test: m host-unit-tests
Change-Id: I69d3eb5b51198c549e2e6914ceac3a4fc33c3cf2
2020-11-16 11:05:00 -08:00
Ulya Trafimovich
b23d28c6e2 Rename fields and methods to reflect class loader context changes.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
2020-11-16 14:59:07 +00:00
Ulya Trafimovich
a8c28e27bc Do not add dependencies of shared SDK libraries to manifest_fixer.
Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: Ibd9742684fa6a8f1353ca0e513f7fa814a6ec9fc
2020-11-16 14:58:11 +00:00
Ulya Trafimovich
18554243de Add nested class loader subcontext at the proper hierarchy level.
When adding a subcontext in a class loader context tree, there are two
possible cases: 1) the root of the subcontext is itself a <uses-library>
and should be present as a node in the tree, or 2) the root is not a
<uses-library>, but some of its dependencies are -- in that case they
should be disconnected from the root, and the resulting forrest should
be added at the top-level.

Example:

  1) C is a <uses-library>:

     A
     ├── B
     └── C
         ├── D
         └── E
             └── F

  2) C is not a <uses-library>:

     A
     ├── B
     ├── D
     └── E
         └── F

Before the patch subcontexts for transitive dependencies were added
before the subcontext for the direct dependency (even if it was a
<uses-library>, resulting in case-2 hierarchy when case-1 should have
been used. Previosuly this didn't matter because class loader context
was a flat set of libraries, but now it matters because class loader
context is a tree.

This patch changes the order in which libraries are added, so that
direct dependencies are added before transitive ones. The context adding
method now accepts an "implicit root" parameter, so that when adding
transitive dependencies it can check if the corresponding direct
dependency is a <uses-library> and already present in the context.

Partially constructed class loader context is now propagated top-down
into aapt.buildActions, so that the method can use existing part of the
context to decide where the missing part should be connected.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I649aff9e27494306885a4f4fc90226c399636b57
2020-11-16 14:57:05 +00:00
Colin Cross
62a0cfd054 Annotate dependency tags for dependencies of installed files
Soong currently assumes that installed files should depend on
installed files of all transitive dependencies, which results
in extra installed file dependencies through genrules, static
libs, etc.

Annotate dependency tags for dependencies for which the
installed files are necessary such as shared libraries
and JNI libraries.

This avoids extra installed files, and is also a first step
towards genrules using their own copy of tools instead of
the installed copy.

Bug: 124313442
Test: m checkbuild
Test: java.TestBinary
Test: cc.TestInstallSharedLibs
Test: deptag_test.go
Change-Id: Ic22603a5c0718b5a21686672a7471f952b4d1017
2020-11-14 16:24:10 -08:00
Ulya Trafimovich
8cbc5d269b Rework class loader context implementation.
The old representation consisted of a list of libraries (UsesLibraries),
a list of optional libraries (OptionalUsesLibraries) and a mapping from
library name to its build/install paths (LibraryPaths). The separation
into lists and map was necessary because of special handling of
compatibility libraries, which is now unified with normal libraries.

The new representation is a mapping from target SDK version to a tree
structure ClassLoaderContext. Each node of the tree represents a library
and contains library name, build/install paths and a slice of
subcontexts for dependencies. The same library may occur in the tree
multiple times in case it is a dependency of multiple libraries. The
order in which libraries are added matters (the resulting tree shape may
be different).

Test results have to be updated, as the resulting <uses-library> list is
reodered (previously it was a sorted list of map keys, and now it is
formed by a depth-first preorder traversal of the class loader tree).

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Bug: 168686456
Change-Id: I11be8cd2967f004fd58753d7c5fb99fed179cd63
2020-11-03 15:15:46 +00:00
Jingwen Chen
5136a6e5aa Add ctx.ModuleDir and top level module dirs of input sources to JDK9
--patch-module lookup.

javac --patch-module accepts a list of directories and/or jars for JDK9
module patching (see bug for more details). In Bazel-Ninja execution,
Bazel executes the javac action in its own execution root working
directory, unlike Ninja, which works in the Android top level directory.
The Bazel execution root is formed of a symlink forest of top level
directories. This symlink forest is a problem for javac because it
doesn't traverse into symlinks.

To support Bazel executing these javac actions, we explicitly encode the
module directory, and the top level directory of any other source file
inputs into the --patch-module javac flag.

For example, the "core-all" libcore module compiles into `java.base`,
and depends on filegroups outside of `libcore` (`tools`). This CL adds
`tools` to the --patch-module lookup dir, on top of `libcore`.

See java_test.go for more details.

Bug: 150878007
Fixes: 150878007
Test: m
Test: bazel build droid (aosp_flame)
Change-Id: Id95b0a9a675fc75678f7b5e600344b4403f0c518
2020-11-02 17:49:57 -05:00
Jingwen Chen
9cb8d1b37b java compilation: refactor and extract javac flag computation into a
separate function.

This cleans up the internal wiring for a follow-up --patch-module
functionality change.

Bug: 150878007
Test: m
Change-Id: Ie7d9c2b1ad40e055da8a53d632510bef408fc7d2
2020-10-30 00:55:58 -04:00
Ulya Trafimovich
b521811d7b Add separate dependency tags for compat libs based on SDK version.
The version in the tag is the SDK version that in which compatibility
library was added as a separate libary. Using distinct tags makes it
possible to differentiate between dependencies for different SDK
versions (this will be needed in subsequent CLs).

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I72296c05d6649e811ddc701aaeb84f91d1ba66cb
2020-10-27 17:05:30 +00:00
Saeid Farivar Asanjan
128fe5c1f5 Add empty tag support for java_import
Test: manual
Change-Id: I53d7c6bb620fa8fe7f5c3ec0a12f723eb62fca16
2020-10-15 17:55:24 +00:00
Colin Cross
89226d9ef9 Add jni_libs to host java binaries
Add a property to support dependencies on JNI libraries for host
java binaries.

Fixes: 170389375
Test: TestBinary
Change-Id: Ieeca3c3997615f0b17ae1f058b94e6c9ba929cab
2020-10-09 19:27:34 -07:00
Colin Cross
c179ea6812 Make java_binary common variant a dependency
ctx.PrimaryModule() is wrong in the case of a java_binary that
supports both host and device, use an explicit dependency instead.
Once the dependency exists there is no need to manually request
the jar be installed, it will automatically be installed by the
host installation rules for dependencies.

Test: TestBinary
Change-Id: Iddeea2d08bc574c79d42139020558cd70d718ca1
2020-10-09 19:27:34 -07:00
Colin Cross
de78d138a1 Replace jniDependencyTag with a value
Support GetDirectDepsWithTag on JNI deps by replacing the
jniDependencyTag type with a jniLibTag value.

Test: app_test.go
Change-Id: I8d66a5d3f433562e131a1fbafce75891d1b094dd
2020-10-09 19:24:05 -07:00
Colin Cross
43159bd1b7 Merge "Remove global state from apex modules" 2020-10-07 17:58:00 +00:00
Paul Duffin
a87ea4587d Merge "Allow access to the class jar for java_import using {.jar} tag" 2020-10-07 17:16:43 +00:00
Ulyana Trafimovich
9f701fa348 Merge changes from topic "uses-libs-24"
* changes:
  Fail the build if dexpreopt cannot find path to a <uses-library>.
  Add dependency on implementation <uses-library> for modules that depend on component libraries.
2020-10-07 09:18:02 +00:00
Colin Cross
56a8321c21 Remove global state from apex modules
A global variant was used to store the global mapping between
modules and APEXes.  Replace it with storing pointers to APEX
contents inside each module so that they can query the contents
of any APEXes they belong to.

Bug: 146393795
Test: all Soong tests
Test: single line change to build.ninja host install dependency ordering
Test: no Android-${TARGET_PRODUCT}.mk, make_vars-${TARGET_PRODUCT}.mk or late-${TARGET_PRODUCT}.mk
Change-Id: Id2d7b73ea27f8c3b41d30820bdd86b65c539bfa4
2020-10-06 13:39:57 -07:00
Paul Duffin
aa55f74505 Allow access to the class jar for java_import using {.jar} tag
Layoutlib requires access to the jar file (containing .class) files for
a number of libraries including "core-libart". It does that using the
{.jar} output tag, e.g. "core-libart{.jar}".

This change makes sure that works when "core-libart" is provided as a
java_import instead of a java_library.

Bug: 142938164
Test: m nothing
Change-Id: I605019d680c28e4a33f0ca14279d63fa62b9774b
2020-10-06 17:48:37 +01:00
Ulya Trafimovich
39b437b25f Add dependency on implementation <uses-library> for modules that depend on component libraries.
If a dexpreopted Java module depends on a component library (such as
stubs), it must be dexpreopted against the implementation library,
because that is what it will use at run time. Therefore dexpreopt needs
to know about the implementation library.

One of the subtests of TestUsesLibraries is removed. This is because the
subtest was previosuly split in two variants with the only difference
that the first variant had dependency on a stubs library, and the second
one had dependency on the implementation. The latter caused dexpreopt to
be disabled because Soong couldn't find the implementation (it had only
the name, but no access to the module). Now that there is a dependency
on the implementation, the problem goes away and the two subtest
variants can be merged into one.

Add a method for getting the name of the implementation library for the
optional SDK library. Currently it is the same as the SDK library name,
but it may change in future.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I584df4b6db874c7ae3c478231fc51572a46929b1
2020-10-06 14:04:49 +01:00
Dan Albert
4f378d75aa Convert more versions in config to ApiLevel.
The test case I removed is invalid. The codename has had its int
assigned, but the config claims it is not final.

If this ever does need to be supported it's just a matter of making
sure the Q -> 29 mapping (or whatever) in the finalized codenames map
in android/api_levels.go.

Test: treehugger
Bug: http://b/154667674
Change-Id: I4f42ec2fd4a37750519ee3937938a1c65b6bb1e8
2020-09-22 16:01:56 -07:00
Dan Albert
c8060536e8 Replace ApiStrToNum uses with ApiLevel.
Test: treehugger
Bug: http://b/154667674
Change-Id: I2954bb21c1cfdeb305f25cfb6c8711c930f6ed50
2020-09-22 15:04:48 -07:00
Liz Kammer
88d593d942 Merge "Add hidden_api for java_import" 2020-09-14 13:57:09 +00:00
Ulya Trafimovich
663dc53c94 Consistently use default install path for compatibility <uses-library>.
Previously default install path was provided only for comatibility
libraries that are added explicitly via `uses_libs`/`optional_uses_libs`
properties. This didn't take into account compatibility libraries that
are added by Soong when it computes transitive closure of SDK library
dependencies. As a result, install path in such cases remained unknown,
and the corresponding compatibility library was omitted from class
loader context, which caused 'ClassLoaderContext shared library size
mismatch' errors at first boot on device.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If661272f46803299c8640f7f5ef161c8217d07e4
2020-09-11 11:31:22 +01:00
Xin Li
80dc4f137a Merge "Merge Android R" 2020-09-10 17:22:09 +00:00
Liz Kammer
5ca3a6293e Add hidden_api for java_import
Test: go java tests
Test: m
Bug: 160455085
Change-Id: Ib6e826e32ca73ceea0799b26145ad06b1e62a1bf
2020-09-10 07:56:03 -07:00
Ulyana Trafimovich
79a94a27b6 Merge "Replace is_uses_lib property with provides_uses_lib." 2020-09-10 14:34:20 +00:00
Ulya Trafimovich
54027b572e Replace is_uses_lib property with provides_uses_lib.
The previous property was boolean-valued and provided only the
information whether the library should be treated as <uses-library>
by Soong. The new property is an optional string, which is the name of
the <uses-library>. The name can be different from the module name, as
in the case of "qcrilhook" module which provides <uses-library>
"com.qualcomm.qcrilhook".

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I65b68e6f7c420ab9c443a76de4c917d31fcd8c8f
2020-09-10 10:47:41 +01:00
Kousik Kumar
3e0b9c031c Merge "Check UseRBE is set before replacing any template with the RE version." 2020-09-10 09:24:17 +00:00
Ulyana Trafimovich
0f13eff149 Merge "Be more strict about unknown install <uses-library> paths." am: 117a5ef307
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1418529

Change-Id: Ib28e902e7f8ec57a15ef50692024cd37a96696bc
2020-09-08 15:34:50 +00:00
Ulya Trafimovich
045e11ad0d Be more strict about unknown install <uses-library> paths.
Allow default install paths only for compatibility libraries. For other
libraries that are explicitly specified in `uses_libs` and
`optional_uses_libs` unknown install path should be an error.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I2209c90a939a8aa46c42e13bb42d09c07e4d0895
2020-09-07 13:58:51 +01:00
Ulyana Trafimovich
99bd329274 Merge "Allow non-SDK Java libraries to masquerade as <uses-library>." am: bb3467d297
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1417188

Change-Id: If25aaa0174091e966cc5c6b16063b6486a7b4ab6
2020-09-07 10:23:53 +00:00
Ulyana Trafimovich
bb3467d297 Merge "Allow non-SDK Java libraries to masquerade as <uses-library>." 2020-09-07 09:49:07 +00:00
Ramy Medhat
16f23a4038 Check UseRBE is set before replacing any template with the RE version.
Test: presubmit
Change-Id: I6df58b4e700f0d231367af2710672d731d20a736
2020-09-03 01:29:49 -04:00
Treehugger Robot
6346ec0f46 Merge "Add compile_dex for java_import" am: e263af74db
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1392497

Change-Id: I9fbbd7e1f02a64f5e0ed9b583a61e64fd4306362
2020-09-02 02:02:32 +00:00
Liz Kammer
d6c31d274e Add compile_dex for java_import
Test: go java tests
Test: m
Bug: 160455085
Change-Id: I2db95dfe565e78b630007adc3360a58614d0127e
2020-09-01 12:34:08 -07:00
Ulya Trafimovich
21a7375205 Allow non-SDK Java libraries to masquerade as <uses-library>.
Extend usesLibraryProperties with a boolean is_uses_lib property and
move these properties from java.AndroidApp to java.Module to allow
java.Library modules set the new propery and be recognized as
<uses-library> by Soong.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I01cd5e0da3dd543c1c0597249d37d0914b213ca7
2020-09-01 17:45:39 +01:00
Xin Li
65cb5c69ea Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Ifca7b65f4e27bf14cdc30f72f790b0de90130bae
Change-Id: I3a39be5f0b8736de4822c6a14072c78d4e4ad89d
2020-08-29 01:17:45 -07:00
Ulya Trafimovich
fc24ad3d4e Propagate transitive SDK Java library dependencies to dexpreopt.
For some dependencies, like stubs, the SDK library may not be found at
build time (either because the implementation library is not among the
dependencies of the dexpreopted module, or because it's part of a
prebuilt, or because it's missing from the build altogether). In such
cases dexpreopt is useless, because dex2oat does not have access to the
full classpath (unless the &-classpath is used). Therefore do not
dexpreopt in such cases.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If289088cfd103011ccb16165e95a97b30fd31b81
2020-08-27 11:47:15 +01:00
Liz Kammer
9c07d24477 Merge "Add imports_sdk_version to prebuilt_apis" 2020-08-24 16:50:51 +00:00
Treehugger Robot
ec7a91f9fa Merge "Add extra_test_configs option" 2020-08-21 16:22:43 +00:00
Liz Kammer
2d2fd859bb Add imports_sdk_version to prebuilt_apis
This allows setting the prebuilt sdk's generated java_imports
sdk_version to "none".

Test: go tests
Test: m
Bug: 160455085
Change-Id: Id24aca811f0f09692971e63418da6685d8351737
2020-08-20 09:48:50 -07:00
Ulyana Trafimovich
9ce2221791 Merge "Collect paths to transitive SDK Java library dependencies." 2020-08-20 10:37:58 +00:00
Dan Shi
95d19422a6 Add extra_test_configs option
Bug: 163344047
Test: m -j HelloWorldHostTest hello_world_test HelloWorldTests
Change-Id: I237e3aa3f40df1f6387ba8ff6a16e56535cdeae9
2020-08-19 15:27:03 -07:00
Ulya Trafimovich
31e444e101 Collect paths to transitive SDK Java library dependencies.
Previously only the names were collected, and later used in the
manifest_fixer to add missing <uses-library> entries to the manifest.
Now we also need to collect build-time and on-device paths, to be used
in class loader context for dexpreopt. This commit only collects paths,
but does not pass them to dexpreopt yet.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I34b229ee68f16ba215ba03770feadb4d890ec2bf
2020-08-19 13:51:21 +01:00
Anton Hansson
85f59b7b54 Merge "Remove special-cased stub deps on framework-res" 2020-08-18 11:58:57 +00:00
Anton Hansson
8f903f30ff Remove special-cased stub deps on framework-res
This dep is now possible to express in native Android.bp syntax,
which makes the build easier to understand.

Bug: 161214753
Test: build sdk, diff out/dist before and after
Change-Id: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce
Merged-In: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce
2020-08-17 11:00:03 +01:00
Colin Cross
e07f2316b7 Rename ApexName to ApexVariationName
In preparation for reusing the same variation for multiple apexes,
rename ApexName to ApexVariationName.

Bug: 164216768
Test: all soong tests
Change-Id: I88f2c5b192ffa27acd38e01952d0cefd413222a0
2020-08-13 17:50:29 -07:00
Liz Kammer
a7a64f3c5b Refactor java compileDex
We want to support a compile_dex property for java_import. This splits
dex-related properties into a dexer struct which can be embedded in
relevant modules.

Test: m
Test: soong tests
Bug: 160455085
Change-Id: If56a51dac43f630d49483a36db29cd50e9ccd529
2020-08-04 10:15:04 -07:00
Liz Kammer
dd849a81f3 Add data_native_bins property to java_test_host
When multiple os/arch variants are supported, java_test_host could not
find a matching arch due to java having arch:common, whereas native
binaries support a specific architecture. This change adds the property
`data_native_bins` in order to support binaries with the appropriate
os/arch variants.

Test: m FirmwareDtboVerification with data_native_bins
Test: forrest
Bug: 153848038
Change-Id: I45adebff0fde2811d5ef5620c697b97b768c951f
2020-07-27 09:14:06 -07:00
Colin Cross
08dca38eb0 Build transitive lint reports for apex modules
Build and export transitive lint report zips for apex modules.

Bug: 153485543
Test: m TARGET_BUILD_APPS=com.google.android.wifi lint-check dist
Change-Id: I5a1805440452301a7e2c4ca91482b989638b54fb
2020-07-22 20:16:14 -07:00
Treehugger Robot
0add164d0e Merge "Pass unstripped JNI libraries to Make" am: bf81ed4fd1 am: 9a6d827dc3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1356262

Change-Id: I99a111aafcab5a8a8a5b704b9dd67904c93b0aea
2020-07-16 23:19:16 +00:00
Colin Cross
403cc15f1b Pass unstripped JNI libraries to Make
Pass a list of unstripped JNI libraries to Make so that they can be
installed into the symbols directory.

Bug: 159726429
Test: forrest
Change-Id: Ieb4bffbb3d0a09f476da011399c5b8b1611929d7
2020-07-10 13:44:32 -07:00
Treehugger Robot
3f1520570e Merge "Support kotlin multiplatform sources" am: 0ae555df1a am: 202dbc4ec0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1351108

Change-Id: Icbd63ed880b0df404170466c55b295aa4deb821c
2020-07-08 00:42:53 +00:00
Colin Cross
a4c8cc6471 Support kotlin multiplatform sources
Add a common_srcs property and propagate it to the module.xml file
passed to kotlinc.

Test: m checkbuild
Change-Id: Ief768bafb943513c9ffbc01e829abc078f0a72bc
2020-07-06 17:58:09 -07:00
Treehugger Robot
12d1bde698 Merge changes Ib7ad715d,I3a83b5ed am: 7d9deed9fd am: 5befecfe64
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353932

Change-Id: Ic5de5a55a939f2a1ae8ce922c31e52b6f7c443e3
2020-07-01 17:51:31 +00:00
Treehugger Robot
7d9deed9fd Merge changes Ib7ad715d,I3a83b5ed
* changes:
  Remove frameworkResModule from sdkCorePlatform.
  Remove the concept of useDefaultLibs from Soong.
2020-07-01 17:23:46 +00:00
Treehugger Robot
8034eafbed Merge "Rename the Default* constants in java/config." am: 8f70db2b48 am: 98d8ee9bd8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353886

Change-Id: Ibf0533b6bd01244d30c5df89aa849a7f8da6f777
2020-07-01 15:25:53 +00:00
Treehugger Robot
8f70db2b48 Merge "Rename the Default* constants in java/config." 2020-07-01 14:43:46 +00:00
Pete Gillin
0638dfcf94 Rename the Default* constants in java/config.
These values are used in two out of the many possible sdk_version
configurations, and therefore weren't really defaults in any
meaningful sense. Giving them more descriptive names makes the code
easier to follow.

Bug: 157640067
Test: m nothing
Change-Id: Icf38a9c0be2606ad0478929e1b40dfcee36cddef
2020-07-01 12:40:58 +01:00
Pete Gillin
e3d44b245b Remove the concept of useDefaultLibs from Soong.
This field in the java/sdk structure was used in two of the many
possible configurations, so it wasn't really a "default". It also
meant that, to understand those configurations, the reader had to know
what was considered the default, which was only possibly by reading
the code in java.go and droiddoc.go which implemented special code
paths when useDefaultLibs was true. By eliminating that setting and
explicitly setting the required values, the code is simpler and easier
to understand.

This change is a straight refactoring, in the sense that the output of
the build should be unchanged.

Regarding the changes to the proguardRaiseTag dependency in java.go:
- This is a noop for anything which had sdkDep.useModule = true prior
  to this change, because they all had the same value for
  hasFrameworkLibs() and hasStandardLibs().
- This is a noop for anything which had sdkDep.useDefaultLibs = true
  prior to this change, because they do not use proguard settings.
- Therefore, it is a noop overall.
- Nevertheless, it is required to make sdkCorePlatform work. Without
  this change, such modules would pick up a dependency on framework
  libs via the (unused) proguardRaiseTag, which creates a circular
  dependency, because this is the sdk_version used when building
  framework libs themselves.

Bug: 157640067
Test: m java docs droid
Change-Id: I3a83b5edc1bd48c16b55f6f77e3e710fc8fbd8fa
2020-07-01 12:40:58 +01:00
Paul Duffin
a2058f8b7d Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
    e.g. ctx.Config().BootJars().

Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().

Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.

Bug: 159683330
Test: m framework-tethering
      dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
      Verify that there are >0 hiddenapi entries.
      Add java_sdk_library_import prefer=true for framework-tethering
      and repeat the above to verify that there are 0 hiddenapi entries.
      Apply this change, repeat above and verify that there are the same # of entries as before.
      Remove the prebuilt for framework-tethering
      Repeat the above and verify that there is no change to the # of entries
Merged-In: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
(cherry picked from commit c4422106a7)
2020-06-29 19:05:19 +01:00
Roland Levillain
a22054eed5 Merge "Add soong.java.testProperties to java_defaults module type." am: e95eb455cc am: 64b188b28f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1235127

Change-Id: Ibada0f3a014aeb37c28e704e89721d9c67453b83
2020-06-27 14:53:03 +00:00
Paul Duffin
420c026efd Apply hiddenapi encoding to java_sdk_library .impl am: c4422106a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/11988739

Change-Id: I9e257b70bc401b8b69273c787b74d0f4c04870f1
2020-06-26 20:11:30 +00:00
Paul Duffin
c4422106a7 Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
    e.g. ctx.Config().BootJars().

Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().

Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.

Bug: 159683330
Test: m framework-tethering
      dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
      Verify that there are >0 hiddenapi entries.
      Add java_sdk_library_import prefer=true for framework-tethering
      and repeat the above to verify that there are 0 hiddenapi entries.
      Apply this change, repeat above and verify that there are the same # of entries as before.
      Remove the prebuilt for framework-tethering
      Repeat the above and verify that there is no change to the # of entries
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
2020-06-26 18:14:18 +01:00
Roland Levillain
b5b0ff3555 Add soong.java.testProperties to java_defaults module type.
This is so that we can use some test properties in a `java_defaults`
module for ART run-tests.

Test: atest art-run-test-001-HelloWorld
Bug: 147814778
Change-Id: Ifb9817ca2f08e64f911c123a4022fbf688405547
2020-06-26 12:51:37 +01:00
Jingwen Chen
ce00ee318f Merge "Support multiple dists per Android.bp module, and dist output selection." am: d06f11ee71 am: 3779799731
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1335521

Change-Id: I2ca43562972b4d50f1e9fd4a801026aa9abb6816
2020-06-26 08:25:04 +00:00
Jingwen Chen
40fd90ae52 Support multiple dists per Android.bp module, and dist output selection.
This CL adds "dists" to the base property struct to support multiple
dist file configurations, and generic tag support to dist tagged outputs
of modules.

Fixes: b/152834186
Test: soong tests and `m sdk dist`

Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a
Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-25 12:42:07 +00:00
Jooyung Han
14135e4c26 Merge "apex/apk: enforce min_sdk_version of all deps" am: 14a08f5b28 am: afdc5239b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1287253

Change-Id: I63074e39f5f319789920e55802d4f7934b556e0a
2020-06-25 01:47:24 +00:00
Jooyung Han
14a08f5b28 Merge "apex/apk: enforce min_sdk_version of all deps" 2020-06-25 01:18:52 +00:00
Treehugger Robot
cdc27099b4 Merge "Include resources in sdk snapshot of java library impl" am: 29abfb7fd1 am: 742dfaa142
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1348682

Change-Id: I02456391e111a91721aa04be044f41f59e7d3183
2020-06-24 14:46:26 +00:00
Paul Duffin
4e77284ab4 Include resources in sdk snapshot of java library impl
Bug: 159607838
Test: m nothing
Change-Id: Ie7ddbffc3957f832abfadb27292c436e8e5dcbf3
2020-06-24 13:04:15 +01:00
Jooyung Han
749dc69af1 apex/apk: enforce min_sdk_version of all deps
Enforce min_sdk_version for every payload dependency of updatable
APEX/APKs.

android.CheckMinSdkVersion() calls ApexModule.ShouldSupportSdkVersion
for every transitive dependency from APEX/APK modules to see if it
meets the min_sdk_version requirements.

The common implementation for apex/android_app is provided in
android/apex.go.

Bug: 145796956
Bug: 152655956
Bug: 153333044
Test: m nothing
Change-Id: I4a947dc94026df7cebd552b6e8ccdb4cc1f67170
2020-06-24 02:00:33 +09:00
Paul Duffin
9ee66da850 Fix check-boot-jars when a boot jar is provided by prebuilt
Previously, when a boot jar was provided by a java_sdk_library_import
module the check-boot-jars check failed because the file it depended on
was not available. In an incremental build the build failed due to the
file in the out directory not having a rule to generate it.

That was because the module was named prebuilt_<module>.<apex> instead
of <module>.<apex>. This was fixed by simply removing prebuilt_ prefix
from the name if it was present.

After fixing that the check-boot-jars still did not work properly
because it was expecting a jar file containing .class files but instead
was given a jar file containing .dex files which meant the check did
not work properly.

This was fixed by defining a new ApexDependency interface for use by
the apex/apex.go code to use instead of java.Dependency for generating
the androidmk entries. The *SdkLibraryImport type then implemented
those, by delegating to the implementation library.

Bug: 158304459
Bug: 159112414
Test: m check-boot-jars
      m checkbuild
	  manual inspection of the .jar file used by check-boot-jars to
	  ensure it contained .class files and not .dex files.
Change-Id: I545c5c9072dd472337d2f9b4dfdf08f53c981662
Merged-In: I545c5c9072dd472337d2f9b4dfdf08f53c981662
2020-06-20 11:38:08 +01:00
Colin Cross
8a3050e50d Merge changes I25c77994,I7da78ef4,I89197d0a am: 181c2a40d8 am: 7be9f60488
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1344320

Change-Id: I8b955daa70d3348ab011dee437ce028dd8c74a2f
2020-06-19 20:23:57 +00:00
Colin Cross
205a504053 Support adding extra lint checks
Add a lint.extra_check_modules property to list modules to use as
plugins to Lint.

Bug: 153485543
Test: m checkbuild
Change-Id: I25c7799438cfec43163e757637c65b8657488d36
Merged-In: I25c7799438cfec43163e757637c65b8657488d36
(cherry picked from commit 92e4b46af5)
2020-06-19 12:53:09 -07:00
Colin Cross
aaf58061a0 Allow kotlin modules to skip packaging the kotlin stdlib
Host tools like lint may package their own version of the kotlin
stdlib, and any jars loaded by them shouldn't contain the platform
version.  Add a static_kotlin_stdlib property that defaults to true
to allow building the module without staticalling including the kotlin
stdlib.

Bug: 153485543
Test: m ApiFinder
Change-Id: I7da78ef493806ce4ab0050e4ee9e8d330b0509c8
Merged-In: I7da78ef493806ce4ab0050e4ee9e8d330b0509c8
(cherry picked from commit 0b67a8bd0f)
2020-06-19 12:53:09 -07:00
Colin Cross
3791b45f67 Fix annotation processors in kotlin modules that generate resources
The kapt rule was only keeping the generated sources, and not the
generated classes directory.  The generated classes directory will
contain resources generated by the annotation processor and needs
to be added to the final jar.

Test: m ApiFinder
Bug: 153485543
Change-Id: I89197d0afcb1eee011c01aa400f9977e66f43768
Merged-In: I89197d0afcb1eee011c01aa400f9977e66f43768
(cherry picked from commit 9ca38d22a4)
2020-06-19 12:53:09 -07:00
Colin Cross
92e4b46af5 Support adding extra lint checks
Add a lint.extra_check_modules property to list modules to use as
plugins to Lint.

Bug: 153485543
Test: m checkbuild
Change-Id: I25c7799438cfec43163e757637c65b8657488d36
2020-06-18 15:58:32 -07:00
Colin Cross
0b67a8bd0f Allow kotlin modules to skip packaging the kotlin stdlib
Host tools like lint may package their own version of the kotlin
stdlib, and any jars loaded by them shouldn't contain the platform
version.  Add a static_kotlin_stdlib property that defaults to true
to allow building the module without staticalling including the kotlin
stdlib.

Bug: 153485543
Test: m ApiFinder
Change-Id: I7da78ef493806ce4ab0050e4ee9e8d330b0509c8
2020-06-18 15:58:32 -07:00
Colin Cross
9ca38d22a4 Fix annotation processors in kotlin modules that generate resources
The kapt rule was only keeping the generated sources, and not the
generated classes directory.  The generated classes directory will
contain resources generated by the annotation processor and needs
to be added to the final jar.

Test: m ApiFinder
Bug: 153485543
Change-Id: I89197d0afcb1eee011c01aa400f9977e66f43768
2020-06-18 15:58:28 -07:00
Colin Cross
1e28e3c615 Add support for running Android lint on java and android modules.
Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.

Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
Merged-In: I5a530975b73ba767fef45b257d4f9ec901a19fcb
(cherry picked from commit 014489c1e6)
2020-06-18 11:01:47 -07:00
Colin Cross
1c14b4ecf6 Consolidate adding common java properties
Use a method to add the properties that are present on all java modules.

Bug: 153485543
Test: m checkbuild
Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
Merged-In: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
(cherry picked from commit ce6734e666)
2020-06-18 11:01:47 -07:00
Colin Cross
c65658301b Merge "Add support for running Android lint on java and android modules." am: a553358b34 am: 05394377ba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324098

Change-Id: Iae0b83aef382b116bedefa896e72d0c244046c61
2020-06-18 01:44:53 +00:00
Colin Cross
a553358b34 Merge "Add support for running Android lint on java and android modules." 2020-06-18 01:16:40 +00:00
Treehugger Robot
6b8f282d98 Merge "Consolidate adding common java properties" am: d7ffbb578d am: 6eb9a491ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1337094

Change-Id: I680fe974df8e68207c8bbb2bc0fce24635d4bdc8
2020-06-17 22:21:58 +00:00
Treehugger Robot
d7ffbb578d Merge "Consolidate adding common java properties" 2020-06-17 21:52:55 +00:00
Anton Hansson
71f093e485 Merge "Fix check-boot-jars when a boot jar is provided by prebuilt" am: 0e63a8e761 am: ac2a42054f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1341756

Change-Id: Ife514f78e7aea0b8ed05f74c21d3ce95054796cc
2020-06-17 20:02:20 +00:00
Paul Duffin
44b481b81b Fix check-boot-jars when a boot jar is provided by prebuilt
Previously, when a boot jar was provided by a java_sdk_library_import
module the check-boot-jars check failed because the file it depended on
was not available. In an incremental build the build failed due to the
file in the out directory not having a rule to generate it.

That was because the module was named prebuilt_<module>.<apex> instead
of <module>.<apex>. This was fixed by simply removing prebuilt_ prefix
from the name if it was present.

After fixing that the check-boot-jars still did not work properly
because it was expecting a jar file containing .class files but instead
was given a jar file containing .dex files which meant the check did
not work properly.

This was fixed by defining a new ApexDependency interface for use by
the apex/apex.go code to use instead of java.Dependency for generating
the androidmk entries. The *SdkLibraryImport type then implemented
those, by delegating to the implementation library.

Bug: 158304459
Bug: 159112414
Test: m check-boot-jars
      m checkbuild
	  manual inspection of the .jar file used by check-boot-jars to
	  ensure it contained .class files and not .dex files.
Change-Id: I545c5c9072dd472337d2f9b4dfdf08f53c981662
2020-06-17 16:59:43 +01:00
Colin Cross
014489c1e6 Add support for running Android lint on java and android modules.
Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.

Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
2020-06-16 15:44:16 -07:00
Alex Humesky
7072985393 Merge "Do not override "-g:source,lines" for host java binaries when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set." am: c7f8b74365 am: 849ca22fe0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1339636

Change-Id: I482dee048952846d251168df148817e5b6c0efbd
2020-06-16 20:36:44 +00:00
Alex Humesky
2070e32eb9 Do not override "-g:source,lines" for host java binaries when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set.
Test: Ran unittests
Change-Id: Ic061b4bf107bcd931813d69f6d72b521d79fbc35
2020-06-15 21:33:49 -04:00
Colin Cross
ce6734e666 Consolidate adding common java properties
Use a method to add the properties that are present on all java modules.

Bug: 153485543
Test: m checkbuild
Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
2020-06-15 18:16:10 -07:00
Roland Levillain
23db998b8a Merge "Introduce product variables to select Java code coverage paths in Soong." am: d38ab21c6e am: f76e10aa2b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1326321

Change-Id: I3f66962252aac710d66f3f26908a7b5f530fa712
2020-06-15 19:07:06 +00:00
Roland Levillain
d38ab21c6e Merge "Introduce product variables to select Java code coverage paths in Soong." 2020-06-15 18:41:03 +00:00
Chris Gross
ca7a598d67 Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." am: a7a36e22fb am: efa623c7e4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1320475

Change-Id: I2b9bca7a7d7107353541a36d5feeea492fc5ed87
2020-06-15 17:18:39 +00:00
Chris Gross
a7a36e22fb Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." 2020-06-15 16:50:59 +00:00
Colin Cross
9855207d0e Define Soong phony rules in Make
To support dist-for-goals in Soong, we need to define all phony rules
in Make so that dist-for-goals can insert additional dependencies on
them.  Collect all the phony rules in phonySingleton and write them
out as Make rules when Soong is embedded in Make, or as blueprint.Phony
rules when Soong is run standalone.

Bug: 153485543
Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
Merged-In: I68201eff30744b0f487fc4f11f033767b53a627d
(cherry picked from commit c3d87d3112)
2020-06-15 09:46:31 -07:00
Roland Levillain
ada1270ef8 Introduce product variables to select Java code coverage paths in Soong.
Introduce product variables `JavaCoveragePaths` and
`JavaCoverageExcludePaths` (resp. populated from environment variables
`JAVA_COVERAGE_PATHS` and `JAVA_COVERAGE_EXCLUDE_PATHS`). Use them to
control which Java modules are candidate for instrumentation based on
their source path. By default (when `JavaCoveragePaths` is empty),
have all Java module be candidate for instrumentation, to preserve the
existing behavior.

Test: export EMMA_INSTRUMENT=true \
        && export EMMA_INSTRUMENT_FRAMEWORK=true \
        && export JAVA_COVERAGE_PATHS=art \
        && m
Bug: 158212027
Bug: 156284897
Change-Id: Ibe9c1f41ed6110867411952689c5a7ad6536f277
2020-06-15 11:57:31 +01:00
Chris Gross
190fdc0b1a Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs.
Static coverage builds that trigger a dexpreopt target for a bootclasspath
jar can fail since coverage for jars in apexes are turned on by default
which requires jacocoagent to be present on the bootclasspath.

Fix this by using EMMA_INSTRUMENT_FRAMEWORK to conditionally instrument
framework libs in apexes.

Bug: 157737183
Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true m -j droid
Change-Id: I2c323553e08741bc46b196bc3bb860614bc3f85b
2020-06-11 23:21:47 +00:00
Colin Cross
4aa6fbc9d5 Define Soong phony rules in Make am: c3d87d3112 am: 970fd93b92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325397

Change-Id: I44eba43a7c316b9cb9696d02962a84d0c1d8ebed
2020-06-11 20:47:03 +00:00
Colin Cross
970fd93b92 Define Soong phony rules in Make am: c3d87d3112
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325397

Change-Id: Ia6a1f96c75c660525127c25472327dd78ba58124
2020-06-11 18:42:02 +00:00
Colin Cross
1adc63ec3d Merge changes from topics "dist-for-goals", "soong-dist", "tests-PathForSource"
* changes:
  Add DistForGoal to MakeVarsContext
  Define Soong phony rules in Make
  Remove paths from cc.TestConfig
  Remove most paths from java.TestConfig
  Allow tests to bypass PathForSource existence checks
2020-06-11 18:36:18 +00:00
Ulyana Trafimovich
12a10b050f Merge "Fix on-device paths to used libraries in dexpreopt." am: 69bd288409 am: 73759b9a5d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1326319

Change-Id: Iec7143aa2f61c9d5b7b61e8d9510db3a573d794a
2020-06-11 14:23:22 +00:00
Ulyana Trafimovich
69bd288409 Merge "Fix on-device paths to used libraries in dexpreopt." 2020-06-11 13:47:19 +00:00
Ulya Trafimovich
9f3052cd78 Fix on-device paths to used libraries in dexpreopt.
Test: lunch aosp_cf_x86_phone-userdebug && m
Test: Cherry-pick in internal master and check that on-device path to
    com.google.android.dialer.support.jar now is on /product partition
    (as it should be) and not on /system:
    $ oatdump \
        --instruction-set=x86 \
        --oat-file=out/target/product/vsoc_x86/product/priv-app/GoogleDialer/oat/x86/GoogleDialer.odex \
      | grep '^classpath' \
      | grep -o '[^[]*com.google.android.dialer.support.jar'
    /product/framework/com.google.android.dialer.support.jar

Bug: 132357300
Change-Id: Idf279ac713b9b29ff3a29f1b072bc1d57f48db26
2020-06-10 14:53:36 +01:00
Jiyong Park
d4873a6b68 Merge "dex_import that isn't available for platform isn't installed" 2020-06-09 23:02:10 +00:00
Colin Cross
c3d87d3112 Define Soong phony rules in Make
To support dist-for-goals in Soong, we need to define all phony rules
in Make so that dist-for-goals can insert additional dependencies on
them.  Collect all the phony rules in phonySingleton and write them
out as Make rules when Soong is embedded in Make, or as blueprint.Phony
rules when Soong is run standalone.

Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
2020-06-09 14:38:50 -07:00
Pete Gillin
811814282d Merge "Split the core/platform API into stable and legacy versions." am: d7db79cc8b am: 5dbf9e09f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1322704

Change-Id: I731da4ed59432a67bdc3df124a8939bcf316aa0c
2020-06-09 16:37:21 +00:00
Jiyong Park
3a3c871410 dex_import that isn't available for platform isn't installed am: afd3d11a79
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/11787985

Change-Id: I617bce4198e4e4b4dc6779246f0bfadcb6a442a4
2020-06-08 13:13:27 +00:00
Jiyong Park
01bca755ae dex_import that isn't available for platform isn't installed
This change fixes a bug that dex_import module is always installed to
the platform even when the module is not available to the platform.

Exempt-From-Owner-Approval: cherry-pick from AOSP

Bug: 158284983
Test: OUT_DIR=/tmp/ndk build/soong/scripts/build-ndk-prebuilts.sh
Merged-In: I85570506e700be59ee63e4f1d7902a40e36df39c
(cherry picked from commit afd3d11a79)
Change-Id: I85570506e700be59ee63e4f1d7902a40e36df39c
2020-06-08 21:53:52 +09:00
Jiyong Park
afd3d11a79 dex_import that isn't available for platform isn't installed
This change fixes a bug that dex_import module is always installed to
the platform even when the module is not available to the platform.

Bug: 158284983
Test: OUT_DIR=/tmp/ndk build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I85570506e700be59ee63e4f1d7902a40e36df39c
2020-06-08 19:59:02 +09:00
Pete Gillin
1f41dbff64 Split the core/platform API into stable and legacy versions.
For now, everything outside libcore still uses the legacy version.

Test: treehugger
Bug: 157640067
Change-Id: If5234e9ee533ff537926801a0af045d36b1caf01
2020-06-08 10:53:51 +01:00
Anton Hansson
2d0c1946fa Correct link type for module stubs
Module stubs compile against module_current, so any module depending on
them had to compile against module_current (or broader) too. Treat them
as the API surface the stubs are for.

Bug: 157010342
Test: m
Change-Id: I49b9082dc1b5afe6c22e94126e574dd8061f0f39
Merged-In: I49b9082dc1b5afe6c22e94126e574dd8061f0f39
(cherry picked from commit 0bd88d0b4e)
2020-06-05 15:16:17 +01:00
Anton Hansson
cc51a6886e Improve the structure of the link check method
Match by name first, then by kind.

Bug: 157010342
Test: m
Change-Id: Ic337a073c3bd14ac03b1d899aeb612247a708495
Merged-In: Ic337a073c3bd14ac03b1d899aeb612247a708495
(cherry picked from commit ac103461a4)
2020-06-05 15:16:17 +01:00
Ulyana Trafimovich
abbe8875b3 Revert^2 "Rename DexJar interface method to DexJarBuildPath." am: 5539e7b568 am: 0852ac9a6d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324492

Change-Id: I75dc93bb6aac621a0d90e5c5051cdeab98f5d1ef
2020-06-05 01:29:34 +00:00
Ulyana Trafimovich
5539e7b568 Revert^2 "Rename DexJar interface method to DexJarBuildPath."
This reverts commit b0dc851ff4.

Reason for revert: relanding original change. Build failures were
  caused by a race with another CL: https://r.android.com/1320920

Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Ic9016582dae7773b4d4f84a63425f1ef7a5d061f
2020-06-04 17:20:38 +01:00
Ulyana Trafimovich
7e59e8e2df Merge "Revert "Rename DexJar interface method to DexJarBuildPath."" am: c55b679e7b am: 651a63ca9d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324371

Change-Id: Ic3be6718aff2b04048bac17635b2858581fe7f8a
2020-06-04 11:13:23 +00:00
Ulyana Trafimovich
c55b679e7b Merge "Revert "Rename DexJar interface method to DexJarBuildPath."" 2020-06-04 10:47:47 +00:00
Ulyana Trafimovich
b0dc851ff4 Revert "Rename DexJar interface method to DexJarBuildPath."
This reverts commit 562c240185.

Reason for revert: breaks `lunch full-eng && m checkbuild`.

Change-Id: Id7c7d6240d98afaf8edd49b6c96cd05534b784cc
2020-06-04 10:37:36 +00:00
Ulyana Trafimovich
0cc337d35a Merge "Rename DexJar interface method to DexJarBuildPath." am: 2a08566634 am: 22cd1b5383
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1322701

Change-Id: I87a6570cc6184bb38dda1f83dac787c30d8aaa54
2020-06-04 10:36:28 +00:00
Ulyana Trafimovich
2a08566634 Merge "Rename DexJar interface method to DexJarBuildPath." 2020-06-04 10:05:33 +00:00
Jiyong Park
2cd081cf06 dex_import can be added to apex
Bug:157886942
Test: m
Change-Id: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
Merged-In: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
2020-06-04 10:28:44 +01:00
Treehugger Robot
a7f51bb3c0 Merge "dex_import can be added to apex" am: a8bf98852a am: 55110941ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1320920

Change-Id: I09342ecaf016ca85ab5ac5812c46af6932179258
2020-06-04 05:38:13 +00:00
Tej Singh
8383972ec0 Revert "Always run package check"
This reverts commit aa7359ab0c.

Reason for revert: package-check.sh doesn't work on mac

Change-Id: Ia3dcee612c1f6b4121e1351c8710638ae41bc88a
Merged-In: I50af71d54d5f1f8b516bfcf1efbcf6217e89c83a
2020-06-03 18:45:54 +00:00
Colin Cross
d89338653f Merge "Revert "Always run package check"" am: 3747336d23 am: 2f0963ecd3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1323293

Change-Id: I3592365b63fab1597b2a41aafaa68e49d6f1e0f2
2020-06-03 17:56:14 +00:00
Colin Cross
b549b77120 Revert "Always run package check"
This reverts commit 91206d9ed1.

Reason for revert: package-check.sh doesn't work on mac
Bug: 158081251
Bug: 157649935
Change-Id: I50af71d54d5f1f8b516bfcf1efbcf6217e89c83a
2020-06-03 17:15:15 +00:00