Commit graph

328 commits

Author SHA1 Message Date
Paul Duffin
d8aed4b275 droidstubs: Remove unnecessary setting of DistFiles
Instead of setting DistFiles to use the api stub (if present) as the
default dist file this simply makes OutputFiles(tag) return the api
stub file for the DefaultDistTag.

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: I39d615c5bf8d20d59db7eeb98d942210ec0aa8ba
2020-11-30 17:20:09 +00:00
Paul Duffin
1a39332cf6 Fix prebuilt_stubs_sources to work with no stubs sources
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
2020-11-19 12:42:18 +00:00
Paul Duffin
a3cb6cf2e5 Remove support for droidstubs in sdk/module_exports
The droidstubs support in sdk/module_exports was a temporary measure
to work around the fact that some APIs were being defined by direct use
of droidstubs instead of java_sdk_library.

This change removes that support as those APIs have all been switched
from droidstubs to use java_sdk_library so droidstubs support is no
longer needed.

Bug: 168301990
Test: m nothing
Change-Id: I3517bed29b030438a0423a6cb8c248992a988222
2020-11-10 13:55:17 +00:00
Anton Hansson
52ac73d21e Make highmem classification of metalava optional
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
2020-10-26 11:38:40 +00:00
Paul Duffin
bc0fe96be3 Support building WITHOUT_CHECK_API=true
When WITHOUT_CHECK_API=true the check api process is not run which
means that the current.txt and removed.txt files are not generated by
the build. In that case this change causes the droidstubs module to
fallback to exporting the source files instead.

An additional removedApiFilePath property (to match apiFilePath) was
added to hold the exported path as removedApiFile has to be a
WritablePath and source paths are not writable.

Bug: 169034951
Test: m WITHOUT_CHECK_API=true nothing
      fails without this fix, passes with it.
Change-Id: If6b09dd67c8533368b71405143f524d66350703f
2020-10-13 15:37:10 +01:00
Anton Hansson
746be9ca1e Remove jdiff support from droiddoc
There are no users of this flag anymore.

Bug: 158465496
Test: m
Change-Id: I8e4af0a7863f6f4ebfc21997c9d72a6745081433
2020-10-08 19:07:39 +01:00
Anton Hansson
ecf5435590 Add outputfiles tags for droidstubs api txts
These can then easily be used in genrules to merge txt files.

Bug: 169034951
Test: m combined-dex-api
Change-Id: Id49739c90a2ab52a72094b76696a4e5211c8d742
2020-10-06 10:01:29 +01:00
Paul Duffin
6877e6d951 Output Javadoc comments for public API
When generating stubs source for contributions to the public API keep
the Javadoc comments from the input source so that the stubs source can
be used as input to the metalava invocation that creates the stubs from
which the public Javadoc is generated.

This is needed to fix an issue with conscrypt's contributions to the
public API, i.e. SSLEngines and SSLSockets where the Javadoc comments
were not present in the generated Javadoc.

Test: Built offline-sdk-docs with and without the change and
      diffed them. The only difference was the timestamp.js
      file and they now included proper documentation for the
      SSLEngines/SSLSockets classes.
Bug: 169162018
Change-Id: I1b50cff3b91766ce261b2f8e798b77ebc6faac70
2020-09-25 20:23:37 +01:00
Anton Hansson
a6906e2329 Merge "Make API lint warnings errors for system & testapi" 2020-09-25 06:52:57 +00:00
Anton Hansson
b30f593da4 Make API lint warnings errors for system & testapi
They used to be listed to not have this treatment, but we are
baselining the existing warnings and making them errors instead.

Bug: 154317059
Test: m
Change-Id: I306b5a07d1b771cc0061aaac44f881f40fbe85ed
Merged-In: I306b5a07d1b771cc0061aaac44f881f40fbe85ed
2020-09-24 13:51:29 +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
Aurimas Liutikas
4c5efde049 Suppress reflection warnings when running metalava
Intellij PSI/UAST reflects into java.base causing
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/mnt/ssd1/out/master/soong/host/linux-x86/framework/metalava.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

Upstream bug https://youtrack.jetbrains.com/issue/IDEA-210683

Bug: 168689341
Test: make checkapi
Change-Id: Ibc8954d83d5962b3cd0ea1bac9a62f6ccfc88c6c
2020-09-21 11:35:10 -07:00
Liz Kammer
9ed7915f01 Updates checkapi filename properties behavior
Previously Api_filename and Removed_api_filename were treated as
booleans based on whether they were non-empty, the supplied filenames
are used.

Test: go tests
Test: m
Bug: 143135631

Change-Id: I72c86eaf3b314eb2eb3afd0b2acf7d4b102ddb03
2020-09-11 07:49:45 -07:00
Treehugger Robot
b8e35ca4a4 Merge "Revert "Revert "Remove create_stubs and checkapi from droiddoc""" 2020-09-10 20:52:55 +00:00
Xin Li
80dc4f137a Merge "Merge Android R" 2020-09-10 17:22:09 +00:00
Liz Kammer
e1ab250ec8 Revert "Revert "Remove create_stubs and checkapi from droiddoc""
This reverts commit 3666c7023f.

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
2020-09-10 15:29:25 +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
Steve Kim
3666c7023f Revert "Remove create_stubs and checkapi from droiddoc"
This reverts commit 3a55c91f9d.

Reason for revert: build failed. Guess this is the cause but needs to confirm. Creating a revert per instructions

Change-Id: I30f1c8cd63e5ab84dba5d21ed354a42695c24ec4
2020-09-01 17:58:01 +00:00
Liz Kammer
3a55c91f9d Remove create_stubs and checkapi from droiddoc
Test: m docs
Test: go java tests
Bug: 144248501
Bug: 143136634
Change-Id: Ic0da89332f3ed2e5e1bb36d00cb9cbd1f6282b45
2020-08-31 08:16:22 -07: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
Dan Willemsen
9f43597ff7 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.

Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
2020-08-11 01:11:44 +00:00
Liz Kammer
3d894b728a Add property api_levels_jar_filename to droidstubs
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
2020-08-04 09:55:13 -07:00
Liz Kammer
1e2ee12ff4 Default to not creating stubs for droiddoc
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
2020-07-31 10:11:25 -07:00
Liz Kammer
20ebfb46fc Update language to comply with inclusive guidance
See https://source.android.com/setup/contribute/respectful-code for
reference

Bug: 161896447
Test: m nothing
Change-Id: Ie1d0d63d27f1b1b48680922b7202aa6df04f4696
2020-07-28 11:37:31 -07:00
Makoto Onuki
d786b6bffe Merge "Repeat metalava errors at the end to make it easy to find them" am: d3cd2f5793 am: 0742acdc4b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1365957

Change-Id: Ifca7b65f4e27bf14cdc30f72f790b0de90130bae
2020-07-18 03:17:41 +00:00
Makoto Onuki
0df103ae71 Repeat metalava errors at the end to make it easy to find them
Also suppress "unresolved import" messages.

Bug: 161374683
Test: Introduce a lint error, run "m update-api" and make sure the
    error shows up at the end.
Change-Id: Ib5250f7f9593dc4f89f9e7f6dc614e230a966e8f
2020-07-17 15:38:10 -07:00
Treehugger Robot
fd0111b26a Merge "Add array type property flags, equivalent to args" am: aeaffeb710 am: 95393f8df1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1356166

Change-Id: Ia322c48a1f213998a70c6d0b8c07df67342b7eec
2020-07-13 21:16:39 +00:00
Liz Kammer
585cac22d9 Add array type property flags, equivalent to args
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
2020-07-13 08:57:49 -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
Makoto Onuki
35dfb01d86 Merge "Enable check for "try to expose APIs from hidden class"" 2020-06-24 22:18:35 +00:00
Makoto Onuki
f51b7af2a4 Enable check for "try to expose APIs from hidden class"
Exempt-From-Owner-Approval:Cherry-pick from goog/master
Bug: 159121253
Test: treehugger (i.e. this shouldn't trigger "API has changed" error.)
Merged-in: I6ca2d8e3967cdc41aa2a931972472174aae2a613
Change-Id: I6ca2d8e3967cdc41aa2a931972472174aae2a613
2020-06-24 12:06:37 -07:00
Makoto Onuki
dbc0adad52 Enable check for "try to expose APIs from hidden class"
Exempt-From-Owner-Approval:Cherry-pick from goog/master
Bug: 159121253
Test: treehugger (i.e. this shouldn't trigger "API has changed" error.)
Merged-in: I6ca2d8e3967cdc41aa2a931972472174aae2a613
Change-Id: I6ca2d8e3967cdc41aa2a931972472174aae2a613
2020-06-24 18:02:14 +00:00
Treehugger Robot
ea34d87759 Merge "Fix build breakages when WITHOUT_CHECK_API=true" 2020-06-22 18:39:13 +00:00
Paul Duffin
ff6e55b301 Merge "Fix build breakages when WITHOUT_CHECK_API=true" into rvc-dev am: 4c21463f04
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/11931085

Change-Id: Ibf4d31078a4a206c7296241aef8c06cfa7b0becb
2020-06-22 12:50:21 +00:00
Paul Duffin
10269f1da9 Fix build breakages when WITHOUT_CHECK_API=true
Bug: 158578354
Test: export WITHOUT_CHECK_API=true
      m checkbuild
Change-Id: I7b5fff40b870c9d754f779ff1c3314bac7e42440
Merged-In: I7b5fff40b870c9d754f779ff1c3314bac7e42440
2020-06-22 12:40:24 +00:00
Paul Duffin
4c21463f04 Merge "Fix build breakages when WITHOUT_CHECK_API=true" into rvc-dev 2020-06-22 12:39:41 +00:00
Ramy Medhat
0b85c50817 Merge "Add sandbox property to the javadoc rule." am: 997a2f5b4e am: a195919e38
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1335053

Change-Id: I31135dccd6451355fdaff3f86db309f45fc2a2a7
2020-06-20 01:58:49 +00:00
Ramy Medhat
997a2f5b4e Merge "Add sandbox property to the javadoc rule." 2020-06-20 01:33:24 +00:00
Paul Duffin
86672f6f4e Fix build breakages when WITHOUT_CHECK_API=true
Bug: 158578354
Test: export WITHOUT_CHECK_API=true
      m checkbuild
Change-Id: I7b5fff40b870c9d754f779ff1c3314bac7e42440
2020-06-19 19:15:29 +01:00
Makoto Onuki
4ef6bce3cf Merge "Disable "show member in hidden parent" metalava error" am: 56ecbaef4c am: 7d91b8867c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1340546

Change-Id: Ibcd5a9333017685404f5a97b18bb490ad0fc600f
2020-06-18 23:18:28 +00:00
Makoto Onuki
56ecbaef4c Merge "Disable "show member in hidden parent" metalava error" 2020-06-18 22:57:48 +00:00
Makoto Onuki
1d5b713275 Disable "show member in hidden parent" metalava error
There are a quite few violations unfortunately, so let's disable it for now.
The plan is to fix all the issues in the internal master and enable it.

Bug: 159121253
Test: build / Tree hugger
Change-Id: I0b0ce937ecd17853b3bb32f7605310b21be77b31
2020-06-18 13:34:19 -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
Ramy Medhat
2f99eec459 Add sandbox property to the javadoc rule.
The sandbox property indicates whether metalava should only read
inputs explicitly specified on the command line. This CL adds the
property and sets the appropriate configuration for RBE depending
on whether the sandbox is set or not.

Test: built aosp_crosshatch-userdebug with/without RBE_METALAVA.
Change-Id: I7256d29f18e0af18dbe65d1c7dbbf62fd3d65f4c
2020-06-17 22:57:42 -04: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
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
Colin Cross
f5f663b0c3 Remove most paths from java.TestConfig
Now that tests don't need to specify every path passed to
PathForSource or PathForModuleSrc, remove most of them from
java.TestConfig.  Leave a few that are globbed by lots of tests,
and move a few that are globbed by a single test into the tests.

Bug: 153485543
Test: all soong tests
Change-Id: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
Merged-In: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
(cherry picked from commit 238c1f3903)
2020-06-15 09:46:31 -07:00
Colin Cross
300b266264 resolve merge conflicts of a73ffc21e0 to rvc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: Ie8ad8a9e91bf4a86c90060b15dc88f9860539637
2020-06-11 12:12:30 -07:00
Ramy Medhat
7f2006c091 Turn on metalava sandbox warning in all droiddoc metalava invocations.
Bug: b/156613606
Test: built aosp crosshatch userdebug with RBE_METALAVA=1 and dependency
file support.

Change-Id: I5ca637984429df12fe05bb07f5db154be9b24f97
Merged-In: I5ca637984429df12fe05bb07f5db154be9b24f97
2020-06-11 17:57:22 +00:00
Ramy Medhat
8e9b63b6ff Add support for Metalava implicit dependencies for remote execution.
Bug: b/156613606
Test: built aosp crosshatch userdebug with RBE_METALAVA=1
Change-Id: Ic64d98785e34717ef9bdad62b4885085f84f132a
Merged-In: Ic64d98785e34717ef9bdad62b4885085f84f132a
2020-06-11 17:57:12 +00:00
Ramy Medhat
46bad760ec Add sourcepath to inputs of remoteable metalava action.
Bug: b/156613606
Test: presubmit
Change-Id: Idd77abddac0a676302226eb62883c74d5d7489af
Merged-In: Idd77abddac0a676302226eb62883c74d5d7489af
2020-06-11 17:55:36 +00:00
Ramy Medhat
1fb3cd8496 Add support for the remote execution of metalava actions.
Bug: b/156613606
Test: built aosp crosshatch userdebug with RBE_METALAVA=1
Change-Id: I3d42d75b4522f99ff95ce8c997ead782e4322f6e
Merged-In: I3d42d75b4522f99ff95ce8c997ead782e4322f6e
2020-06-11 00:52:07 -04:00
Colin Cross
238c1f3903 Remove most paths from java.TestConfig
Now that tests don't need to specify every path passed to
PathForSource or PathForModuleSrc, remove most of them from
java.TestConfig.  Leave a few that are globbed by lots of tests,
and move a few that are globbed by a single test into the tests.

Test: all soong tests
Change-Id: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
2020-06-09 14:38:39 -07:00
Ramy Medhat
578c91fe13 Merge "Turn on metalava sandbox warning in all droiddoc metalava invocations." am: 4e372f7841 am: 9ec9b60463
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1323176

Change-Id: Icb4ad192227710eef30455409f7b0d99e2c128e1
2020-06-09 12:46:56 +00:00
Ramy Medhat
4e372f7841 Merge "Turn on metalava sandbox warning in all droiddoc metalava invocations." 2020-06-09 12:17:38 +00:00
Anton Hansson
9d7c3fb4da Don't require merge_annotations_dir for annotations_enabled
As far as I can tell, annotations_enabled does not require use of
merge_annotations_dir (although it may have done in the past).

Bug: 157010342
Test: m
Change-Id: I6705522774203b4566f58679bbc2f0c17422c1dd
Merged-In: I6705522774203b4566f58679bbc2f0c17422c1dd
(cherry picked from commit c5e13279ad)
2020-06-05 15:16:16 +01:00
Ramy Medhat
c8d60bc7c6 Turn on metalava sandbox warning in all droiddoc metalava invocations.
Test: built aosp crosshatch userdebug with RBE_METALAVA=1 and dependency
file support.

Change-Id: I5ca637984429df12fe05bb07f5db154be9b24f97
2020-06-04 01:54:07 -04:00
Ramy Medhat
53af664bc5 Merge "Add support for Metalava implicit dependencies for remote execution." am: f1665501e8 am: 230dbb7e09
Change-Id: Ida1b0097baf7ee35348ab17e96c6f1751fa95745
2020-05-27 23:54:42 +00:00
Ramy Medhat
c7965cda05 Add support for Metalava implicit dependencies for remote execution.
Test: built aosp crosshatch userdebug with RBE_METALAVA=1
Change-Id: Ic64d98785e34717ef9bdad62b4885085f84f132a
2020-05-27 06:52:46 -04:00
Paul Duffin
174b26e7d3 Switch droiddoc to use SdkHeaderJars()
Previously, droiddoc was using SdkImplementationJars() to get a JAR to
add to the classpath in order to resolve unknown references in the
source.

Given that SdkHeaderJars() returns jars created by Turbine which are
(for compilation at least) functionally identical to the implementation
jars there is no point in using the implementation jars.

Bug: 148080325
Test: m nothing
Merged-In: I2b718cc1445c04e849dcb0b1f53bba2b0bd90c95
Change-Id: I2b718cc1445c04e849dcb0b1f53bba2b0bd90c95
(cherry picked from commit 649dadfb87)
2020-05-27 07:41:18 +01:00
Paul Duffin
d5bd8f82aa Switch droiddoc to use SdkHeaderJars() am: 649dadfb87 am: 033f903c76
Change-Id: Ib386420ed0ea9492272019528d445fbf3b1c39a4
2020-05-26 22:08:39 +00:00
Paul Duffin
649dadfb87 Switch droiddoc to use SdkHeaderJars()
Previously, droiddoc was using SdkImplementationJars() to get a JAR to
add to the classpath in order to resolve unknown references in the
source.

Given that SdkHeaderJars() returns jars created by Turbine which are
(for compilation at least) functionally identical to the implementation
jars there is no point in using the implementation jars.

Bug: 148080325
Test: m nothing
Change-Id: I2b718cc1445c04e849dcb0b1f53bba2b0bd90c95
2020-05-26 18:32:44 +01:00
Paul Duffin
fe32fd9c02 Merge changes from topic "retry-jsl-stuff" into rvc-dev am: 88ef9fb76e
Change-Id: I84b895c8cfca46cc1e114fdb87fce16127217279
2020-05-25 14:53:54 +00:00
Paul Duffin
533f9c78cd Retry: "java_sdk_library: Improve consistency with ..._import"
The scopePaths struct is used by both java_sdk_library and its prebuilt
but was not populated in the same way. This change addresses those
discrepancies in preparation for a follow up change which will allow
access to some of those fields through OutputFileProvider.

Changes:
* Document the scopePaths field and struct.
* Switch those fields that may not be fully populated from Paths to
  OptionalPath to make that 100% clear and protect against unchecked
  use.
* Switch java_sdk_library_import to use the dependency extraction
  mechanism driven by the dependency tag. This should actually have
  been part of the change that added that mechanism.
* Only create prebuilt_stubs_sources if sources have been provided.
* Add dependencies from java_sdk_library_import on its stubs source
  child modules if sources have been provided. That will ensure the
  stubsSrcJar field is updated.
* Updates current/removedApiFilePath if provided for the scope in
  java_sdk_library_import.
* Extracts ApiStubsSrcProvider from ApiStubsProvider to allow it to
  be implemented by PrebuiltStubsSources so that it can provide access
  to the stubs src jar that it creates.

Test: m nothing
Bug: 148080325
Bug: 155164730
(cherry picked from commit 0f8faffdc0)
Change-Id: Ib56ca608d6fc1357d3d89e9c4cfed6ff8da11735
2020-05-25 10:40:50 +01:00
Anton Hansson
8584de91c8 Merge "Don't require merge_annotations_dir for annotations_enabled" into rvc-dev am: 601fdd97b6
Change-Id: I78569c89258c20334111d7942fe5d4aca800e506
2020-05-25 09:14:54 +00:00
Remi NGUYEN VAN
57f5f23478 Revert "java_sdk_library: Improve consistency with ..._import" am: 2ee93a5de9
Change-Id: Idae767fd444f6ad716f0730289020387c48b0e97
2020-05-25 04:13:22 +00:00
Remi NGUYEN VAN
2ee93a5de9 Revert "java_sdk_library: Improve consistency with ..._import"
This reverts commit dce3fe78f0.

Reason for revert: Broke presubmit: b/157231582

Change-Id: I638e0e090f3242ed5a9a3134cbe380e872411247
2020-05-25 02:07:31 +00:00
Paul Duffin
dce3fe78f0 java_sdk_library: Improve consistency with ..._import
The scopePaths struct is used by both java_sdk_library and its prebuilt
but was not populated in the same way. This change addresses those
discrepancies in preparation for a follow up change which will allow
access to some of those fields through OutputFileProvider.

Changes:
* Document the scopePaths field and struct.
* Switch those fields that may not be fully populated from Paths to
  OptionalPath to make that 100% clear and protect against unchecked
  use.
* Switch java_sdk_library_import to use the dependency extraction
  mechanism driven by the dependency tag. This should actually have
  been part of the change that added that mechanism.
* Only create prebuilt_stubs_sources if sources have been provided.
* Add dependencies from java_sdk_library_import on its stubs source
  child modules if sources have been provided. That will ensure the
  stubsSrcJar field is updated.
* Updates current/removedApiFilePath if provided for the scope in
  java_sdk_library_import.
* Extracts ApiStubsSrcProvider from ApiStubsProvider to allow it to
  be implemented by PrebuiltStubsSources so that it can provide access
  to the stubs src jar that it creates.

Test: m nothing
Bug: 148080325
Bug: 155164730
Merged-In: Ic5bf884b2b1e79841843e7c3b4642796ecd49f5d
Change-Id: Ic5bf884b2b1e79841843e7c3b4642796ecd49f5d
(cherry picked from commit 0f8faffdc0)
2020-05-21 14:53:38 +01:00
Anton Hansson
c5e13279ad Don't require merge_annotations_dir for annotations_enabled
As far as I can tell, annotations_enabled does not require use of
merge_annotations_dir (although it may have done in the past).

Bug: 157010342
Test: m
Change-Id: I6705522774203b4566f58679bbc2f0c17422c1dd
2020-05-21 11:29:22 +01:00
Treehugger Robot
e47eefa464 Merge "java_sdk_library: Improve consistency with ..._import" am: 4e1f005046 am: 12eaf6e62e
Change-Id: I535aa55e6ebe2cbfbc3131d7f1e620d6d47ae857
2020-05-21 08:10:53 +00:00
Paul Duffin
0f8faffdc0 java_sdk_library: Improve consistency with ..._import
The scopePaths struct is used by both java_sdk_library and its prebuilt
but was not populated in the same way. This change addresses those
discrepancies in preparation for a follow up change which will allow
access to some of those fields through OutputFileProvider.

Changes:
* Document the scopePaths field and struct.
* Switch those fields that may not be fully populated from Paths to
  OptionalPath to make that 100% clear and protect against unchecked
  use.
* Switch java_sdk_library_import to use the dependency extraction
  mechanism driven by the dependency tag. This should actually have
  been part of the change that added that mechanism.
* Only create prebuilt_stubs_sources if sources have been provided.
* Add dependencies from java_sdk_library_import on its stubs source
  child modules if sources have been provided. That will ensure the
  stubsSrcJar field is updated.
* Updates current/removedApiFilePath if provided for the scope in
  java_sdk_library_import.
* Extracts ApiStubsSrcProvider from ApiStubsProvider to allow it to
  be implemented by PrebuiltStubsSources so that it can provide access
  to the stubs src jar that it creates.

Test: m nothing
Bug: 148080325
Bug: 155164730
Change-Id: Ic5bf884b2b1e79841843e7c3b4642796ecd49f5d
2020-05-20 18:00:45 +01:00
Anton Hansson
18a289560d Fix API lint copy command
The space after the backtick prevents it working when copy-pasting it
into the shell.

Test: create lint error => m => cp/pasted command runs successfully
Merged-In: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
Change-Id: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
(cherry picked from commit 3361a294c0)

// Added for rvc-dev. Used this bug as it is the bug that needs all the build changes.
Bug: 155164730
Change-Id: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
2020-05-16 11:03:46 +00:00
Paul Duffin
8986cc947c Enable api_lint in java_sdk_library
Adds api_lint.enabled property to control whether API linting should be
performed.

Test: m checkapi
Bug: 156126315
Merged-In: I87ca5a942228cf6af1a9939f0334d6fc46c39a63
Change-Id: I87ca5a942228cf6af1a9939f0334d6fc46c39a63
(cherry picked from commit 160fe41c39)
2020-05-13 11:27:44 +01:00
Treehugger Robot
aaf54ecb48 Merge "Enable api_lint in java_sdk_library" am: c0320878e6 am: 3bab3bd9d1
Change-Id: I693e9857ec13ba1e553df6d04f1c0b5d275f1d8b
2020-05-13 08:01:01 +00:00
Treehugger Robot
c0320878e6 Merge "Enable api_lint in java_sdk_library" 2020-05-13 07:35:15 +00:00
Treehugger Robot
c6e48b7dad Merge "Add sourcepath to inputs of remoteable metalava action." am: e72da7f63c am: 0452efbd16
Change-Id: Ib78a89ee437500a6f347d0c746bb56fae97e4a15
2020-05-12 04:41:37 +00:00
Treehugger Robot
e72da7f63c Merge "Add sourcepath to inputs of remoteable metalava action." 2020-05-12 04:15:16 +00:00
Ramy Medhat
0a5c8dea01 Add sourcepath to inputs of remoteable metalava action.
Test: presubmit
Change-Id: Idd77abddac0a676302226eb62883c74d5d7489af
2020-05-11 16:49:37 -04:00
Anton Hansson
71d2ffd153 Merge "Fix API lint copy command" am: 432f75c61a am: d39d5a6935
Change-Id: I3ee57adeb11e10a8d19977c78703769eaa2e594c
2020-05-11 19:30:42 +00:00
Paul Duffin
160fe41c39 Enable api_lint in java_sdk_library
Adds api_lint.enabled property to control whether API linting should be
performed.

Test: m checkapi
Bug: 156126315
Change-Id: I87ca5a942228cf6af1a9939f0334d6fc46c39a63
2020-05-11 18:05:45 +01:00
Anton Hansson
3361a294c0 Fix API lint copy command
The space after the backtick prevents it working when copy-pasting it
into the shell.

Test: create lint error => m => cp/pasted command runs successfully
Change-Id: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
2020-05-11 15:40:30 +01:00
Makoto Onuki
ba15f14271 Merge "Merge the "big 3" metalava invocations into one" into rvc-dev 2020-05-08 21:23:53 +00:00
Paul Duffin
75dcc80396 Export API files as part of the java_sdk_library
Bug: 153443117
Test: m nothing

Merged-In: I9d6f5b91a7cc25019e2eb9e3c138f0874d2831de
Change-Id: I9d6f5b91a7cc25019e2eb9e3c138f0874d2831de
(cherry picked from commit 1fd005d5b3)
2020-05-08 19:38:57 +01:00
Paul Duffin
f488ef2a3c Export stub sources as part of the java_sdk_library
Minor refactoring of checkMergeZip(string) -> checkMergeZips(...string)
to allow testing of multiple merge zips.

Bug: 153443117
Test: m nothing
Merged-In: I8db00f611ced15f8476ba16f2834a72e8c913596
Change-Id: I8db00f611ced15f8476ba16f2834a72e8c913596
(cherry picked from commit 3d1248ceb6)
2020-05-08 19:34:30 +01:00
Makoto Onuki
b850a9deaa Merge the "big 3" metalava invocations into one
This CL merges the biggest three metalava invocations --
stub and signature file generation, api lint, and "check released" --
into one call.

For each of the existing separate rules for api lint and check released this change:
1) Stopped creating a separate rule containing its own metalava invocation.
2) Moved the code for creating the rule earlier so it can add extra flags to the combined metalava command.
3) Moved the message handling into metalava, allowing the message to be passed in.
4) Added a flag to record whether the specific check was needed so that you can separate the timestamp file creation out to run after the merged metalava command.

A couple of minor bug fixes and clarifications.

Bug: 151160048
Test:  "m" and treehugger

Test: Apply https://android-review.googlesource.com/c/platform/frameworks/base/+/1295541 and run `NINJA_ARGS="-k 999" m checkapi`
-> Make sure there are 4 kinds of lint failures ("AddedFinal" and "VisiblySynchronized") with the valid error messages, from:
- api-stubs-docs
- system-api-stubs-docs
- test-api-stubs-docs
- module-lib-api-

Test: Run the 4 cp commands shown by lint
-> Make sure the following 4 baseline files are updated:
frameworks/base/api/lint-baseline.txt
frameworks/base/api/module-lib-lint-baseline.txt
frameworks/base/api/system-lint-baseline.txt
frameworks/base/api/test-lint-baseline.txt

Test: Then run `NINJA_ARGS="-k 999" m checkapi` again.
-> Make sure the API lint errors are gone
-> Make sure "api-stubs-docs" shows the "You have tried to change the API from what has been
previously released in ..." error. (because of "AddedFinal")
-> Make sure it the other 3 API surfaces show the "You have tried to change the API from
what has been previously approved" error.

Test: Remove "final" from Intent.java and run "NINJA_ARGS="-k 999" m checkapi" again.
-> This time, all the 4 API surfaces say "You have tried to change the API from
what has been previously approved" error."

Test: Run the 4 "make *-update-current-api" commands shown in the above errors and "NINJA_ARGS="-k 999" m checkapi"
-> The exact command is:
$ make \
  module-lib-api-update-current-api \
  api-stubs-docs-update-current-api \
  test-api-stubs-docs-update-current-api \
  system-api-stubs-docs-update-current-api

-> Make sure frameworks/base/api/*-current.txt are properly updated.

Test: Run "m update-api"
-> Make sure no text signature files get updated.

Test: Run "m droid".
-> Make sure everything builds fine.

Change-Id: Ia1a5510b57d58748b4655473d4585636deb7f45e
Merged-in: Ia1a5510b57d58748b4655473d4585636deb7f45e
2020-05-08 10:47:12 -07:00
Makoto Onuki
88b9905d74 Merge the "big 3" metalava invocations into one
This CL merges the biggest three metalava invocations --
stub and signature file generation, api lint, and "check released" --
into one call.

For each of the existing separate rules for api lint and check released this change:
1) Stopped creating a separate rule containing its own metalava invocation.
2) Moved the code for creating the rule earlier so it can add extra flags to the combined metalava command.
3) Moved the message handling into metalava, allowing the message to be passed in.
4) Added a flag to record whether the specific check was needed so that you can separate the timestamp file creation out to run after the merged metalava command.

A couple of minor bug fixes and clarifications.

Bug: 151160048
Test:  "m" and treehugger

Test: Apply https://android-review.googlesource.com/c/platform/frameworks/base/+/1295541 and run `NINJA_ARGS="-k 999" m checkapi`
-> Make sure there are 4 kinds of lint failures ("AddedFinal" and "VisiblySynchronized") with the valid error messages, from:
- api-stubs-docs
- system-api-stubs-docs
- test-api-stubs-docs
- module-lib-api-

Test: Run the 4 cp commands shown by lint
-> Make sure the following 4 baseline files are updated:
frameworks/base/api/lint-baseline.txt
frameworks/base/api/module-lib-lint-baseline.txt
frameworks/base/api/system-lint-baseline.txt
frameworks/base/api/test-lint-baseline.txt

Test: Then run `NINJA_ARGS="-k 999" m checkapi` again.
-> Make sure the API lint errors are gone
-> Make sure "api-stubs-docs" shows the "You have tried to change the API from what has been
previously released in ..." error. (because of "AddedFinal")
-> Make sure it the other 3 API surfaces show the "You have tried to change the API from
what has been previously approved" error.

Test: Remove "final" from Intent.java and run "NINJA_ARGS="-k 999" m checkapi" again.
-> This time, all the 4 API surfaces say "You have tried to change the API from
what has been previously approved" error."

Test: Run the 4 "make *-update-current-api" commands shown in the above errors and "NINJA_ARGS="-k 999" m checkapi"
-> The exact command is:
$ make \
  module-lib-api-update-current-api \
  api-stubs-docs-update-current-api \
  test-api-stubs-docs-update-current-api \
  system-api-stubs-docs-update-current-api

-> Make sure frameworks/base/api/*-current.txt are properly updated.

Test: Run "m update-api"
-> Make sure no text signature files get updated.

Test: Run "m droid".
-> Make sure everything builds fine.

Change-Id: Ia1a5510b57d58748b4655473d4585636deb7f45e
Merged-In: Ia1a5510b57d58748b4655473d4585636deb7f45e
2020-05-06 13:00:01 +01:00
Makoto Onuki
194c43f5a7 Merge the "big 3" metalava invocations into one
This CL merges the biggest three metalava invocations --
stub and signature file generation, api lint, and "check released" --
into one call.

For each of the existing separate rules for api lint and check released this change:
1) Stopped creating a separate rule containing its own metalava invocation.
2) Moved the code for creating the rule earlier so it can add extra flags to the combined metalava command.
3) Moved the message handling into metalava, allowing the message to be passed in.
4) Added a flag to record whether the specific check was needed so that you can separate the timestamp file creation out to run after the merged metalava command.

A couple of minor bug fixes and clarifications.

Bug: 151160048
Test:  "m" and treehugger

Test: Apply https://android-review.googlesource.com/c/platform/frameworks/base/+/1295541 and run `NINJA_ARGS="-k 999" m checkapi`
-> Make sure there are 4 kinds of lint failures ("AddedFinal" and "VisiblySynchronized") with the valid error messages, from:
- api-stubs-docs
- system-api-stubs-docs
- test-api-stubs-docs
- module-lib-api-

Test: Run the 4 cp commands shown by lint
-> Make sure the following 4 baseline files are updated:
frameworks/base/api/lint-baseline.txt
frameworks/base/api/module-lib-lint-baseline.txt
frameworks/base/api/system-lint-baseline.txt
frameworks/base/api/test-lint-baseline.txt

Test: Then run `NINJA_ARGS="-k 999" m checkapi` again.
-> Make sure the API lint errors are gone
-> Make sure "api-stubs-docs" shows the "You have tried to change the API from what has been
previously released in ..." error. (because of "AddedFinal")
-> Make sure it the other 3 API surfaces show the "You have tried to change the API from
what has been previously approved" error.

Test: Remove "final" from Intent.java and run "NINJA_ARGS="-k 999" m checkapi" again.
-> This time, all the 4 API surfaces say "You have tried to change the API from
what has been previously approved" error."

Test: Run the 4 "make *-update-current-api" commands shown in the above errors and "NINJA_ARGS="-k 999" m checkapi"
-> The exact command is:
$ make \
  module-lib-api-update-current-api \
  api-stubs-docs-update-current-api \
  test-api-stubs-docs-update-current-api \
  system-api-stubs-docs-update-current-api

-> Make sure frameworks/base/api/*-current.txt are properly updated.

Test: Run "m update-api"
-> Make sure no text signature files get updated.

Test: Run "m droid".
-> Make sure everything builds fine.

Change-Id: Ia1a5510b57d58748b4655473d4585636deb7f45e
2020-05-06 12:03:18 +01:00
Ramy Medhat
7aee9d536d Merge "Add support for the remote execution of metalava actions." am: a1ffd53fe4 am: aacf301e75
Change-Id: I0457d9fd9a931a3b5c0f78b2565feaef60f686ec
2020-05-05 22:16:03 +00:00
Ramy Medhat
a1ffd53fe4 Merge "Add support for the remote execution of metalava actions." 2020-05-05 21:53:26 +00:00
Anton Hansson
2ddb61f72c Merge "Treat lint warnings as errors" into rvc-dev am: 3292836210
Change-Id: I54329e9e9bb7689d44526e6453aff0bcbca11c94
2020-05-05 10:17:28 +00:00
Anton Hansson
e714565ce8 Treat lint warnings as errors
Warnings get lost in the build spam and never get fixed. Right now is
the best time to do this, because we only track the warnings/errors
since the last released API. The API has just been frozen, so the number
of warnings is at an all-time low.

Whitelist the car lib and test stubs for now, which produce a lot of
warnings.

Bug: 154317059
Test: presubmit
Change-Id: I9aa7cb1b947c6c664f15e2bd5835d76eaac1237a
2020-05-04 21:47:34 +01:00
Anton Hansson
422530f04f Merge "Fix soong crashing when there's no baseline file" into rvc-dev am: 8b9273d99e
Change-Id: Ibd30b9ef0800d98bd242d0c39c343d9a646242af
2020-05-02 10:29:12 +00:00
Anton Hansson
75ac71eea2 Fix soong crashing when there's no baseline file
Soong was referencing the baseline file regardless of whether it was
valid or not.

Also update the lint message to match the one metalava itself prints,
which only suggests whitelisting the error if it's not possible to fix
it properly.

Bug: 154616909
Test: m (with lint error)
Change-Id: I4c6ec327a59aefe74825b4c4719393dd267ba3aa
Merged-In: I4c6ec327a59aefe74825b4c4719393dd267ba3aa
(cherry picked from commit 34ced82d2a)
2020-05-02 11:23:34 +01:00
Anton Hansson
34ced82d2a Fix soong crashing when there's no baseline file
Soong was referencing the baseline file regardless of whether it was
valid or not.

Also update the lint message to match the one metalava itself prints,
which only suggests whitelisting the error if it's not possible to fix
it properly.

Bug: 154616909
Test: m (with lint error)
Change-Id: I4c6ec327a59aefe74825b4c4719393dd267ba3aa
2020-05-01 17:12:36 +01:00
Ramy Medhat
427683cad7 Add support for the remote execution of metalava actions.
Test: built aosp crosshatch userdebug with RBE_METALAVA=1
Change-Id: I3d42d75b4522f99ff95ce8c997ead782e4322f6e
2020-04-30 03:24:48 -04:00