From 8f55941ebcce7cd0e306a3f660b4101c3b2fe9b0 Mon Sep 17 00:00:00 2001 From: Tobias Thierer Date: Wed, 22 May 2019 20:17:49 +0100 Subject: [PATCH] Refactoring: Rewrite links in Metalava instead of carrying patches. Another CL in this topic introduces the metalava feature flag --replace-documentation to perform regex replacements in the documentation of some elements. This CL uses that feature to re-write links in libcore/ojluni/ documentation that previously carried patches. Since .bp files don't appear to support String literals that are not (un)escaped, \ and $ occurring in the regexp/replacement parameters need to be escaped in the .bp file. Bug: 129765390 Test: Manually checked that this CL topic does not affect the result of "make ds-docs offline-sdk-docs" Change-Id: Idb7366530c4ab255c1348cf48881cf2bde31be1e --- Android.bp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Android.bp b/Android.bp index a04455509944..c46f092ccbfb 100644 --- a/Android.bp +++ b/Android.bp @@ -1155,7 +1155,22 @@ metalava_framework_docs_args = "--manifest $(location core/res/AndroidManifest.x "--hide RequiresPermission " + "--hide MissingPermission --hide BroadcastBehavior " + "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " + - "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo" + "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo " + +// http://b/129765390 Rewrite links to "platform" or "technotes" folders +// which are siblings (and thus outside of) {@docRoot}. +// +// We have to escape \ as \\ and $ as $$ here because they get resolved by +// different layers of the build tooling. The arguments are wrapped in '' so +// that the shell doesn't add yet another level of escaping. +metalava_framework_docs_args += " --replace-documentation " + + // packages whose descendants to apply replacement to (all packages from + // libcore/ojluni/src/main/java that contribute to documentation). + "com.sun:java:javax:jdk.net:sun " + + // regex of the string to replace + "'(' " + + // replacement (with $1, $2 backreferences to the regex groups) + "'$$1https://docs.oracle.com/javase/8/docs/$$2\">' " stubs_defaults { name: "framework-doc-stubs-default",