aboutsummaryrefslogtreecommitdiff
path: root/java/java_test.go
Commit message (Collapse)AuthorAgeFilesLines
...
| * Fix prebuilt_stubs_sources to work with no stubs sourcesPaul Duffin2020-11-191-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The framework-sdkextension java_sdk_library module defines an API for public, system and module_lib API surfaces but the public API is empty. The empty public API results in an empty .srcjar being repackaged and merged into the sdkextension-sdk snapshot and results in no directory for the public API stubs sources being created. Unfortunately, the Android.bp file in the snapshot is created by Soong and it does not know that the public API will be empty and so it creates an Android.bp file that references the directory into which the stubs sources should be added but which ends up not existing in the snapshot. Referencing a non-existent directory causes a build failure. This change fixes that issue by using PathForModuleSrc with no path components to get the path to the module directory (which must exist) and then resolving the module relative local src directory against that. The local src directory is globbed to find all the files, which will return an empty set of paths if the directory does not exist. Finally, the file paths are passed as an rsp file to soong_zip to avoid exceeding any command line limits. Many other different approaches were considered: * Adding a property to the java_sdk_library to indicate that the public API was actually empty. That would require extra maintenance by developers and would require some extra checks to be performed after generating the stubs source to ensure that it was empty which would complicate the build process. * Creating a directory with some placeholder file (empty directories don't work well with git) that would force the creation of the directory. That file would most likely be created whether the API was empty or not, would need to be stored in git alongside the source and could be quite confusing to reviewers. Bug: 173508731 Test: m nothing - to run new tests Build sdkextension-sdk, unpack it and then build the .srcjar files for the public, system and module_lib API surfaces. Without this change the build failed, reporting that the stubs_sources directory for the public API did not exist. With this change the build succeeded. Checked the contents of the resulting .srcjar files and made sure that the public one was empty and the others contained the SdkExtensions.java class and a package-info.java file. Change-Id: Ia468a3f37349f2dbc21db67744bda6461498d515
* | Merge "java link time error improve"Treehugger Robot2020-11-191-2/+2
|\ \ | |/ |/|
| * java link time error improveSteven Moreland2020-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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 Iba57c949,Ief43ff51,Ib1809a4d,I2ab64f36Treehugger Robot2020-11-181-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | * changes: Store ndkKnownLibs in the config Register the kythe singleton on the Context instead of globally Store ninja file deps from PackageVarContext in the config Store SingletonMakeVarsProviders in the config
| * | Store SingletonMakeVarsProviders in the configColin Cross2020-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Store SingletonMakeVarsProviders in the config instead of a global variable to avoid races between tests running in parallel. Test: all soong tests Change-Id: I2ab64f368b5ac673fd985399d4421ed018abc562
* | | Move genrule on top of RuleBuilderColin Cross2020-11-171-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | In preparation for more complicated sandboxing support in sbox, use a single implementation of the sbox sandboxing by moving genrule to use RuleBuilder's sbox support instead of creating an sbox rule directly. Also move genrule's input list hash support into RuleBuilder. Test: genrule_test.go Test: rule_builder_test.go Change-Id: I292184d02743c7e6887ebbcd232ba565db2ab0cc
* | Merge changes Iebfbf2ff,Ibd974268Ulyana Trafimovich2020-11-171-1/+1
|\ \ | | | | | | | | | | | | | | | * changes: Rename fields and methods to reflect class loader context changes. Do not add dependencies of shared SDK libraries to manifest_fixer.
| * | Rename fields and methods to reflect class loader context changes.Ulya Trafimovich2020-11-161-1/+1
| | | | | | | | | | | | | | | | | | Test: lunch aosp_cf_x86_phone-userdebug && m Bug: 132357300 Change-Id: Iebfbf2ffdac5ee48476d2aac312b3b8f4471fc85
* | | Merge "Revert "Annotate dependency tags for dependencies of installed files""Colin Cross2020-11-171-0/+2
|\ \ \ | |_|/ |/| |
| * | Revert "Annotate dependency tags for dependencies of installed files"Colin Cross2020-11-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 62a0cfd05460d0e760ce9133690e48861bb57eee. Reason for revert: b/173475545 Change-Id: I4e834200c8e68dfa1b8144dfd1fa95ca68554980
* | | Merge changes Ic22603a5,I5330b571Colin Cross2020-11-161-2/+0
|\| | | | | | | | | | | | | | | | | * 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-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "Rework class loader context implementation."Ulyana Trafimovich2020-11-161-2/+2
|\ \ \ | |/ / |/| / | |/
| * Rework class loader context implementation.Ulya Trafimovich2020-11-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Pass Config to NewTestContext instead of ctx.RegisterColin Cross2020-11-121-8/+8
|/ | | | | | | | | | | Prepare for using Config when adding singletons by passing Config to NewTestContext and NewContext instead of to ctx.Register. This will enable a followup change to store SingletonMakeVarsProviders registered on the Context in the Config, which is necessary to run multiple tests in parallel without data races. Test: all soong tests Change-Id: Id229629a4e42ff4487d317241673837726c075fc
* Add ctx.ModuleDir and top level module dirs of input sources to JDK9Jingwen Chen2020-11-021-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | --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
* Make highmem classification of metalava optionalAnton Hansson2020-10-261-20/+21
| | | | | | | | | | | | | We have added a lot of metalava invocations since the highmem differentation was added, most of which do not use a lot of memory. By collecting data of max rss per process we have narrowed down the set of highmem modules to a smaller set, and will annotate the relevant modules as such. Bug: 170701554 Test: NINJA_HIGHMEM_NUM_JOBS=3 m checkapi (no long tail of metalava) Change-Id: Ic9c8c91388b02889111ef596fc6fd8bde9b42b9d
* Merge changes Ieeca3c39,Iddeea2d0,I8d66a5d3Colin Cross2020-10-131-3/+18
|\ | | | | | | | | | | | | * changes: Add jni_libs to host java binaries Make java_binary common variant a dependency Replace jniDependencyTag with a value
| * Add jni_libs to host java binariesColin Cross2020-10-091-0/+16
| | | | | | | | | | | | | | | | | | Add a property to support dependencies on JNI libraries for host java binaries. Fixes: 170389375 Test: TestBinary Change-Id: Ieeca3c3997615f0b17ae1f058b94e6c9ba929cab
| * Make java_binary common variant a dependencyColin Cross2020-10-091-3/+2
| | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Apply PRODUCT_ENFORCE_RRO_TARGETS to dependencies."Jaewoong Jung2020-10-121-0/+4
|\ \
| * | Apply PRODUCT_ENFORCE_RRO_TARGETS to dependencies.Jaewoong Jung2020-10-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, users don't need to figure out which libraries actually hold the resources to be overlaid when targetting apps with a core lib dependency (e.g. Settings, SystemUI). Fixes: 169898727 Test: app_test.go Change-Id: I3c3b9dc0a377b1828db1199858a73d080a173205
* | | Merge "Add a Impl_only_libs prop for sdk_library"Anton Hansson2020-10-121-0/+33
|\ \ \ | |_|/ |/| |
| * | Add a Impl_only_libs prop for sdk_libraryAnton Hansson2020-10-091-0/+33
| |/ | | | | | | | | | | | | | | | | | | | | | | Similar to Stubs_only_libs, this allows being a bit more specific about what libs compile against what. In my usecase, it allows removing a platform dependency from the appsearch stubs, which allows the platform to depends on the stubs. Bug: 169304493 Test: m Change-Id: Ie997462819cd5266a761b2d415e81806c7877967 Merged-In: Ie997462819cd5266a761b2d415e81806c7877967
* | Revert "Make lots of tests run in parallel"Colin Cross2020-10-091-45/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
* | Merge "Make lots of tests run in parallel"Colin Cross2020-10-071-0/+45
|\ \
| * | Make lots of tests run in parallelColin Cross2020-10-061-0/+45
| |/ | | | | | | | | | | | | | | | | | | Putting t.Parallel() in each test makes them run in parallel. Additional t.Parallel() could be added to each subtest, although that requires making a local copy of the loop variable for table driven tests. Test: m checkbuild Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
* / Allow access to the class jar for java_import using {.jar} tagPaul Duffin2020-10-061-1/+25
|/ | | | | | | | | | | | | 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
* Add support for using sdk_version: "module_<ver>"Paul Duffin2020-09-301-0/+13
| | | | | | | | Fixes a panic when trying to build something with sdk_version: "module_30". Test: m nothing Change-Id: I9b2ce50957f59e2bead335ffa58888e15cda1f78
* Merge "Revert "Revert "Remove create_stubs and checkapi from droiddoc"""Treehugger Robot2020-09-101-20/+46
|\
| * Revert "Revert "Remove create_stubs and checkapi from droiddoc""Liz Kammer2020-09-101-20/+46
| | | | | | | | | | | | | | | | This reverts commit 3666c7023f129fa4c38a11918e6e9e9a3a554b31. Reason for revert: This was originally reverted because it caused a breakage (b/167405890) in a branch that is no longer relevant. Change-Id: I81063cd47b816b5b3c0ab8427432730d6b881a3f
* | Merge "Add compile_dex for java_import"Treehugger Robot2020-09-021-2/+17
|\ \ | |/ |/|
| * Add compile_dex for java_importLiz Kammer2020-09-011-2/+17
| | | | | | | | | | | | | | Test: go java tests Test: m Bug: 160455085 Change-Id: I2db95dfe565e78b630007adc3360a58614d0127e
* | Revert "Remove create_stubs and checkapi from droiddoc"Steve Kim2020-09-011-46/+20
|/ | | | | | | | This reverts commit 3a55c91f9de31fdb2a7bba2360ddba347c11112e. Reason for revert: build failed. Guess this is the cause but needs to confirm. Creating a revert per instructions Change-Id: I30f1c8cd63e5ab84dba5d21ed354a42695c24ec4
* Remove create_stubs and checkapi from droiddocLiz Kammer2020-08-311-20/+46
| | | | | | | | Test: m docs Test: go java tests Bug: 144248501 Bug: 143136634 Change-Id: Ic0da89332f3ed2e5e1bb36d00cb9cbd1f6282b45
* Use common helper functions for getting sorted map keys.Ulya Trafimovich2020-08-201-1/+1
| | | | | | | Add a new helper SortedIntKeys similar to SortedStringKeys. Test: lunch aosp_cf_x86_phone-userdebug && m Change-Id: I08a43ec2cae7d1a82531295aca1a0658e3a0dd6f
* Collect paths to transitive SDK Java library dependencies.Ulya Trafimovich2020-08-191-3/+1
| | | | | | | | | | | | 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
* Add property api_levels_jar_filename to droidstubsLiz Kammer2020-08-041-0/+56
| | | | | | | | | | | The default is android.jar to maintain current behavior but allows users to specify a different filepath to support generating api-versions for docs other than the platform (e.g. auto). Bug: 162552181 Test: m doc Test: go test java_test Change-Id: I9e51abaf7d5451d68ca782157d9b739f76c5da82
* Merge "Default to not creating stubs for droiddoc"Treehugger Robot2020-07-311-2/+7
|\
| * Default to not creating stubs for droiddocLiz Kammer2020-07-311-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This will allow us to remove `create_stubs: false` throughout the codebase easily, then remove the functionslity to create stubs from droiddoc. Test: m docs Test: m checkapi Test: m updateapi Bug: 144248501 Bug: 143136634 Change-Id: Ib95f68bc064fbe1475e4b25433bee6292bc005dc
* | Fix prebuilt mutator ordering in testsPaul Duffin2020-07-311-0/+2
|/ | | | | | | | | | | | | | | | | Previously, the prebuilt mutators were added by the cc.RegisterRequiredBuildComponentsForTest() function as a convenience but unfortunately it lead to some of the mutators being in a different order in the tests than in the normal build. This change: * Extracts the RegisterPrebuiltMutators() call from cc.RegisterRequiredBuildComponentsForTest() * Makes sure that the prebuilt mutators are registered before the visibility gatherer and enforcer mutators. Bug: 162505935 Test: m nothing Change-Id: I7d959b558200b502f0a5e4653c41ea01414e142a
* Update language to comply with inclusive guidanceLiz Kammer2020-07-281-1/+1
| | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: m nothing Change-Id: I13f42b680c6b819a2708c973e7718267c121f862
* Add `data_native_bins` property to java_test_hostLiz Kammer2020-07-271-0/+28
| | | | | | | | | | | | | 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
* Add array type property flags, equivalent to argsLiz Kammer2020-07-131-1/+37
| | | | | | | | | | The property args is currently a string, but represents a collection of arguments to metalava/doclava. This has resulted in variables being used rather than default modules to share arguments. Test: go test java_tests Bug: 145644363 Change-Id: I670235e8f1cf19bfe8909049c4765637d0accd47
* Ensure that sdk/module_exports depends on source membersPaul Duffin2020-07-091-21/+6
| | | | | | | | | | | | | Previously, preferring a prebuilt of an sdk/module_exports's member would cause the sdk/module_exports to depend on the prebuilt instead of the source and cause problems with the build. This chance prevents the dependency from an sdk/module_exports to its members from being replaced with prebuilts. Bug: 160785918 Test: m nothing Change-Id: Iee4bcd438c11929e30fb5766701b05a0e89956d9
* Restrict replacements of source dependencies with prebuiltsPaul Duffin2020-07-081-2/+1
| | | | | | | | | | | | | | | | | | Previously, when java_sdk_library_import was preferred over a java_sdk_library the latter ends up depending on the prebuilt child modules created by the java_sdk_library_import instead of the source child modules that it created itself. That was because all dependencies on those source child modules were replaced with the corresponding prebuilt child modules. This change prevents those dependencies from being replaced to preserve the dependencies from java_sdk_library onto its source child modules by making the replacement conditional depending on the tag used. It also updates the affected test. Bug: 159902351 Test: m nothing Change-Id: I4441b901dedfd44b9769df1ac2e248b94834cf85
* Stop java_sdk_library_import from depending on source modulesPaul Duffin2020-07-081-1/+2
| | | | | | | | | | | | | | | | | Previously, java_sdk_library_import added the dependencies on its child components in the deps mutator after prebuilts without a matching source module are renamed to the source module name. That meant that the java_sdk_library_import has to use the source module name and ended up depending on the source module unless it was preferred. This change adds a new component deps mutator that runs before the PrebuiltRenameMutator so that the java_sdk_library_import can add dependencies onto the prebuilt modules. It also updates an affected test. Bug: 159902351 Test: m nothing Change-Id: I3576c4873302743e51aff547ea1497bef6d748ac
* Track the current java_sdk_library(_import) depsPaul Duffin2020-06-291-0/+121
| | | | | | | | | | | | | | | | | Adds some tests to track the current dependencies between java_sdk_library, java_sdk_library_import and their child modules in various configurations. This is in preparation for a series of changes that will update the dependencies to ensure that the java_sdk_library always depends on the source modules that it creates and java_sdk_library_import always depends on the prebuilt modules that it creates. Comments in the tests highlight the parts that will be affected by the follow up changes. Bug: 159902351 Test: m nothing Change-Id: I8eea3ac80061f5cbbc9dec201750c4b59e224b4b
* Do not override "-g:source,lines" for host java binaries when ↵Alex Humesky2020-06-151-0/+34
| | | | | | | PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set. Test: Ran unittests Change-Id: Ic061b4bf107bcd931813d69f6d72b521d79fbc35
* java_sdk_library: Add system-server scopePaul Duffin2020-06-151-0/+32
| | | | | | | | Bug: 155164730 Test: m nothing Merged-In: I49a2dab5c064b05f16691a3fae65f2b4ffc53bfd Change-Id: I49a2dab5c064b05f16691a3fae65f2b4ffc53bfd (cherry picked from commit 5a757b1ebbf52825e032b99ffc9f86474d0a8558)