aboutsummaryrefslogtreecommitdiff
path: root/java/java.go
Commit message (Collapse)AuthorAgeFilesLines
...
| * | bp2build: convert paths/module refs to Bazel labelLiz Kammer2021-02-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This currently expands all globs, still need to support converting glob syntax. Test: go build_conversion_test Test: GENERATE_BAZEL_FILES=true m nothing Test: m nothing Bug: 165114590 Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
* | | `data` dependency of java_test_host can be arch-specificJiyong Park2021-02-051-1/+1
|/ / | | | | | | | | | | | | | | | | | | This allows java_test_host to have arch-specific data files. Currently, VirtualizationHostTestCases needs this to have arch-specific kernels as its data. Bug: N/A Test: m VirtualizationHostTestCases Change-Id: Ib5680ef48b613955ad92c9bc212184ac75900d3e
* / Switch hiddenapi to use OutputPath instead of ModuleOutPathPaul Duffin2021-02-021-17/+26
|/ | | | | | | | | | | | | | | | In order to allow the hiddenapi code which expects its inputs to be ModuleOutPath to consume the output from the deapexer module type (used by prebuilt_apex) this change converts the hiddenapi from using ModuleOutPath to use OutputPath instead. This is part of a general cleanup to remove ModuleOutPath that is separated out in order to avoid having the hiddenapi work dependent upon and possibly delayed by issues with that general cleanup. Bug: 178361284 Bug: 179124768 Test: m droid Change-Id: I890f775bf5e33528dbaa62b95fa4198185ff8bf8
* Enable an apex to include a java_import.Bill Peckham2021-01-191-0/+4
| | | | | | | | | | | | With the addition of the compile_dex property to the java_import module it becomes possible to include a java_import module in an apex. This change allows the dependency and adds a test. Bug: 177228901 Test: m nothing Test: new TestApexWithJavaImport Change-Id: I9336dade1857109e2fd21f7d57e1dc4abc4a402c
* Export dex implementation jars from prebuilt_apexPaul Duffin2021-01-151-27/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Dexpreopt and boot jars package check all require access to dex implementation jars created for java_library and java_sdk_library. They were available when building from source but not when building from prebuilts, even though they are embedded within the .apex files that are referenced from prebuilt_apex. This changes adds support to prebuilt_apex to export the dex implementation jars and updates java_import to use those exported dex implementation jars. In a source build dexpreopt/boot jars package check access the apex (or platform) specific variant of a java_library, e.g. core-oj, from which it retrieves the dex implementation jar path. After this change in a prebuilt build dexpreopt/boot jars package check behave in the same way except in this case they retrieve the dex implementation jar path from the apex (or platform) specific variant of the java_import, e.g. core-oj. The work to export files from a `.apex` file for use by other modules is performed by a new `deapexer` module type. It is not used directly in an `Android.bp` file but instead is created implicitly by `prebuilt_apex`, In order to do that this contains the following changes: * Adds a new `dexapexer` module type to handle the exporting of files from the `.apex` file. * Adds an exported_java_libs property to prebuilt_apex to specify the set of libraries whose dex implementation jars need exporting. * Creates apex specific variants of the libraries listed in the exported_java_libs property. * Adds the set of exported files to the ApexInfo to make them available to the apex specific variants. * Prevents the prebuilt_apex variants from being merged together as they will not be compatible. * Modifies java_import to use the exported file for variants of a prebuilt_apex. * Adds a ninja rule to unpack (using deapexer) the contents of the prebuilt_apex's apex file, verify that the required files are present and make them available as outputs for other rules to use. * Some minor refactorings to support these changes. * Adds tests to cover prebuilt only, prebuilt with source preferred, and prebuilt preferred with source. Test: m nothing Bug: 171061220 Change-Id: Ic9bed81fb65b92f0d59f64c0bce168a9ed44cfac
* Add java_boot_libs to sdkPaul Duffin2021-01-151-6/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The build has some implicit dependencies (via the boot jars configuration) on a number of modules, e.g. core-oj, apache-xml, that are part of the java boot class path and which are provided by mainline modules (e.g. art, conscrypt, runtime-i18n) but which are not otherwise used outside those mainline modules. As they are not needed outside the mainline modules adding them to the sdk/module-exports as either java_libs, or java_header_libs would end up exporting more information than was strictly necessary. This change adds the java_boot_libs property to allow those modules to be exported as part of the sdk/module_exports without exposing any unnecessary information. Some points to note: * The java_import has to have a valid file for the src property otherwise it will be disabled. * The src property is supposed to reference a jar file but the java_boot_libs property will make it reference an empty file (not an empty jar) so that any attempt to use that file as a jar, e.g. compiling against it, will cause a build failure. * The name of the file passed to the src property should make it clear that the file is not intended to be used. * The test makes sure that only the jar file is copied to the snapshot. Test: m nothing Bug: 171061220 Change-Id: I175331e4c8e3874ab70a67cdc2f76ed1576e41eb
* Merge "Remove obsolete class loader context API and update unit tests."Ulyana Trafimovich2021-01-081-1/+1
|\
| * Remove obsolete class loader context API and update unit tests.Ulya Trafimovich2021-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The removed API has been unused since https://r.android.com/1533342 (except for unit tests). Changes in the unit tests reflect the change of API in https://r.android.com/1533342: early errors caused by unknown library paths at CLC construction time have been replaced with late errors at the time of CLC validation. Bug: 132357300 Test: m nothing Change-Id: I739c7c41b6f882b7e28cdd6acd05961d754d8687
* | Add "aidl.flags:" property for cc_/java_ modulesJooyung Han2021-01-051-0/+5
|/ | | | | | | | | | | | | | | | | | | | The property can be used to pass additional flags to the AIDL compiler. For example, cc_library { .. srcs: ["Foo.aidl"], aidl: { flags: [ "-Werror", // warnings as error "-Weverything", // turn on all warnings ], }, } Bug: 168028537 Test: soong test Change-Id: I8120eeae7cd7b1acdd34c554af996a29e760a368
* Automatically set uncompress_dex for java_import.Bill Peckham2020-12-231-0/+15
| | | | | | | | | | | Setting uncompress_dex for java_import in the same way as java_library enables using a java_import as an art jar or a boot jar. Bug: 175619567 Test: m nothing Test: TestHiddenAPISingletonWithPrebuilt Change-Id: I0b552a11d1630a014cf978520ccc5977fdf74066
* Remove unnecessary snake case variables.Jaewoong Jung2020-12-221-3/+3
| | | | | Test: m nothing + TreeHugger Change-Id: I99f7162944daa6c57c6ae4763261e108bb5cb6b1
* Merge changes I6a512209,I56437f26Ulyana Trafimovich2020-12-221-54/+60
|\ | | | | | | | | | | * changes: Unify addition of class loader subcontext from dependencies. Move ClassLoaderContexts() method to UsesLibraryDependency interface.
| * Unify addition of class loader subcontext from dependencies.Ulya Trafimovich2020-12-211-53/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously CLC construction was scattered across different module types and dependency tags. This CL moves all logic to one function, which handles all special cases. This will allow to simplify CLC API and reduce the number of different ways in which CLC is constructed. Previously some of the cases failed early (at the time when a library is added to CLC) if the build/install paths were unknown. Other cases did not fail early, but were validated later before CLC was used. Late failures are necessary because some of the libraries with unknown paths still have to be processed by manifest_fixer (which doesn't need library paths), but they do not use dexpreopt (which needs library paths). This CL removes the early failures (all paths are still validated later). The CLC tests do not fail because they use a private method that toggles the "strict" flag (that enforces early/late failure mode) manually in the method call. The CL also makes a functional change in the way CLC is constructed for component libraries that have an OptionalImplicitSdkLibrary(), or libraries that are disguised as SDK libraries via `provides_uses_lib`. Previously such a component/disguised library X was added to its own CLC as a sibling element of X's own <uses-library> dependencies, which created incorrect CLC structure. Now this is handled by addCLCFromDep, when X is processed as dependency and added as a top-level CLC element with its sub-CLC properly nested under it. Bug: 132357300 Test: lunch aosp_cf_x86_phone-userdebug && m Change-Id: I6a512209b87b81d785875f10f76b21c81b2ed579
| * Move ClassLoaderContexts() method to UsesLibraryDependency interface.Ulya Trafimovich2020-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This method logically belongs with other UsesLibraryDependency methods, as it is used in the same context when computing class loader context. Previously it was part of Dependency interface, which doesn't cover SDK libraries. We do not currently have the necessary information for SdkLibraryImport (so ClassLoaderContexts() returns nil for it), but we do have it for SdkLibrary (via Library). Bug: 132357300 Test: m nothing Change-Id: I56437f260efc6a9af3f45b334e84e915244ccce1
* | Remove the return value from dexpreoptJaewoong Jung2020-12-171-2/+2
| | | | | | | | | | | | | | | | dexpreopt doesn't strip dex files from the input jar anymore, so there's no point returning the input jar path untouched. Test: m nothing + TreeHugger Change-Id: I8fde6cdc19e85a2fbc946513696417b945c5de0f
* | Assert android.ApexModule interface for types having ApexModuleBaseJiyong Park2020-12-151-0/+11
|/ | | | | | Bug: 173472337 Test: m nothing Change-Id: Idf1c6cb9fff6c18e34c4636e38a662ba4ff7d538
* Merge changes I697a65e4,Iaac6aaf6Ulyana Trafimovich2020-12-071-7/+34
|\ | | | | | | | | | | * changes: Do not propagate <uses-library> deps through static SDK component libs. Make error message more precise.
| * Do not propagate <uses-library> deps through static SDK component libs.Ulya Trafimovich2020-12-031-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Dogfood the new IR Kotlin compiler backend."Treehugger Robot2020-12-041-0/+3
|\ \
| * | Dogfood the new IR Kotlin compiler backend.Mads Ager2020-12-031-0/+3
| | | | | | | | | | | | | | | | | | | | | Test: make Test: atest com.android.systemui Change-Id: I610058001bde19554c55dee5a79ad1782abc3186
* | | Merge "Pass pctx and ctx to NewRuleBuilder"Colin Cross2020-12-031-4/+4
|\ \ \ | |/ / |/| |
| * | Pass pctx and ctx to NewRuleBuilderColin Cross2020-12-011-4/+4
| |/ | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Add java sdk library enforcement flag"JaeMan Park2020-12-021-0/+31
|\ \ | |/ |/|
| * Add java sdk library enforcement flagJaeMan Park2020-11-241-0/+31
| | | | | | | | | | | | | | | | | | | | 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
* | Remove redundant setting of DistFiles by java.LibraryPaul Duffin2020-11-271-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Differentiate between no dist tag and an empty dist tagPaul Duffin2020-11-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Assume any <uses-library> is shared, add only toplevel ones to manifest."Ulyana Trafimovich2020-11-271-6/+5
|\ \
| * | Assume any <uses-library> is shared, add only toplevel ones to manifest.Ulya Trafimovich2020-11-251-6/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Annotate dependency tags for dependencies of installed files"Colin Cross2020-11-241-3/+16
|\ \
| * | Annotate dependency tags for dependencies of installed filesColin Cross2020-11-231-3/+16
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Remove restriction on exported plugins that generate APIs"Treehugger Robot2020-11-241-11/+29
|\ \ | |/ |/|
| * Remove restriction on exported plugins that generate APIsColin Cross2020-11-231-11/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Support extra checks for ErrorProne in a dedicated property"Colin Cross2020-11-201-16/+29
|\|
| * Support extra checks for ErrorProne in a dedicated propertyColin Cross2020-11-191-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Use java host unit tests template for unit tests"Julien Desprez2020-11-201-2/+2
|\ \ | |/ |/|
| * Use java host unit tests template for unit testsJulien Desprez2020-11-191-2/+2
| | | | | | | | | | | | Test: make aoa-helper-tests Bug: 172961860 Change-Id: I2eaee277961f29adfd22e7c65248c9403bd69b81
* | Merge "java link time error improve"Treehugger Robot2020-11-191-1/+3
|\ \ | |/ |/|
| * java link time error improveSteven Moreland2020-11-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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
| * Merge changes Ic22603a5,I5330b571Colin Cross2020-11-161-3/+16
| |\ | | | | | | | | | | | | | | | * changes: Annotate dependency tags for dependencies of installed files Use the the preferred architecture symlink as the tool path if it exists
| | * Annotate dependency tags for dependencies of installed filesColin Cross2020-11-141-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "Add unit_test test option in test configs"Dan Shi2020-11-181-0/+3
|\ \ \
| * | | Add unit_test test option in test configsDan Shi2020-11-161-0/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Rename fields and methods to reflect class loader context changes.Ulya Trafimovich2020-11-161-17/+17
| | | | | | | | | | | | | | | | | | Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
* | | Do not add dependencies of shared SDK libraries to manifest_fixer.Ulya Trafimovich2020-11-161-5/+5
|/ / | | | | | | | | | | | | Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Bug: 168686456 Change-Id: Ibd9742684fa6a8f1353ca0e513f7fa814a6ec9fc
* | Add nested class loader subcontext at the proper hierarchy level.Ulya Trafimovich2020-11-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Rework class loader context implementation.Ulya Trafimovich2020-11-031-16/+20
|/ | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add ctx.ModuleDir and top level module dirs of input sources to JDK9Jingwen Chen2020-11-021-6/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | --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
* java compilation: refactor and extract javac flag computation into aJingwen Chen2020-10-301-24/+32
| | | | | | | | | | | separate function. This cleans up the internal wiring for a follow-up --patch-module functionality change. Bug: 150878007 Test: m Change-Id: Ie7d9c2b1ad40e055da8a53d632510bef408fc7d2
* Add separate dependency tags for compat libs based on SDK version.Ulya Trafimovich2020-10-271-1/+16
| | | | | | | | | | | 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
* Add empty tag support for java_importSaeid Farivar Asanjan2020-10-151-1/+1
| | | | | Test: manual Change-Id: I53d7c6bb620fa8fe7f5c3ec0a12f723eb62fca16