diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-06-03 07:23:34 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-06-03 07:23:34 +0000 |
commit | 00767fd92133af0c32863445329404283cdd9798 (patch) | |
tree | 200f599ca42aa85e4bb9af5e8ad342acba8deafe | |
parent | 5d5ac7499f000eb38a1eea1b71788b0e1275f042 (diff) | |
parent | 651fcf9089db41046473320602883ffd4a3bba60 (diff) | |
download | platform_external_doclava-00767fd92133af0c32863445329404283cdd9798.tar.gz platform_external_doclava-00767fd92133af0c32863445329404283cdd9798.tar.bz2 platform_external_doclava-00767fd92133af0c32863445329404283cdd9798.zip |
Snap for 4818534 from 651fcf9089db41046473320602883ffd4a3bba60 to pi-releaseandroid-wear-9.0.0_r9android-wear-9.0.0_r8android-wear-9.0.0_r7android-wear-9.0.0_r6android-wear-9.0.0_r5android-wear-9.0.0_r4android-wear-9.0.0_r3android-wear-9.0.0_r23android-wear-9.0.0_r22android-wear-9.0.0_r21android-wear-9.0.0_r20android-wear-9.0.0_r2android-wear-9.0.0_r19android-wear-9.0.0_r18android-wear-9.0.0_r17android-wear-9.0.0_r16android-wear-9.0.0_r15android-wear-9.0.0_r14android-wear-9.0.0_r13android-wear-9.0.0_r12android-wear-9.0.0_r11android-wear-9.0.0_r10android-wear-9.0.0_r1android-vts-9.0_r9android-vts-9.0_r8android-vts-9.0_r7android-vts-9.0_r6android-vts-9.0_r5android-vts-9.0_r4android-vts-9.0_r14android-vts-9.0_r13android-vts-9.0_r12android-vts-9.0_r11android-vts-9.0_r10android-cts-9.0_r9android-cts-9.0_r8android-cts-9.0_r7android-cts-9.0_r6android-cts-9.0_r5android-cts-9.0_r4android-cts-9.0_r3android-cts-9.0_r2android-cts-9.0_r13android-cts-9.0_r12android-cts-9.0_r11android-cts-9.0_r10android-cts-9.0_r1android-9.0.0_r9android-9.0.0_r8android-9.0.0_r7android-9.0.0_r60android-9.0.0_r6android-9.0.0_r59android-9.0.0_r58android-9.0.0_r57android-9.0.0_r56android-9.0.0_r55android-9.0.0_r54android-9.0.0_r53android-9.0.0_r52android-9.0.0_r51android-9.0.0_r50android-9.0.0_r5android-9.0.0_r49android-9.0.0_r48android-9.0.0_r3android-9.0.0_r2android-9.0.0_r18android-9.0.0_r17android-9.0.0_r10android-9.0.0_r1security-pi-releasepie-vts-releasepie-security-releasepie-s2-releasepie-release-2pie-releasepie-r2-s2-releasepie-r2-s1-releasepie-r2-releasepie-cts-release
Change-Id: Ifd0daf84a846a4e7c48c43d5d82b444a01871920
-rw-r--r-- | src/com/google/doclava/Doclava.java | 18 | ||||
-rw-r--r-- | src/com/google/doclava/Stubs.java | 28 |
2 files changed, 35 insertions, 11 deletions
diff --git a/src/com/google/doclava/Doclava.java b/src/com/google/doclava/Doclava.java index 8231471..caa44a6 100644 --- a/src/com/google/doclava/Doclava.java +++ b/src/com/google/doclava/Doclava.java @@ -183,6 +183,7 @@ public class Doclava { // Create the dependency graph for the stubs directory boolean offlineMode = false; String apiFile = null; + String dexApiFile = null; String removedApiFile = null; String removedDexApiFile = null; String exactApiFile = null; @@ -304,6 +305,8 @@ public class Doclava { sdkValuePath = a[1]; } else if (a[0].equals("-api")) { apiFile = a[1]; + } else if (a[0].equals("-dexApi")) { + dexApiFile = a[1]; } else if (a[0].equals("-removedApi")) { removedApiFile = a[1]; } else if (a[0].equals("-removedDexApi")) { @@ -558,12 +561,12 @@ public class Doclava { } // Stubs - if (stubsDir != null || apiFile != null || proguardFile != null || removedApiFile != null - || removedDexApiFile != null || exactApiFile != null || privateApiFile != null - || privateDexApiFile != null) { - Stubs.writeStubsAndApi(stubsDir, apiFile, proguardFile, removedApiFile, removedDexApiFile, - exactApiFile, privateApiFile, privateDexApiFile, stubPackages, stubImportPackages, - stubSourceOnly); + if (stubsDir != null || apiFile != null || dexApiFile != null || proguardFile != null + || removedApiFile != null || removedDexApiFile != null || exactApiFile != null + || privateApiFile != null || privateDexApiFile != null) { + Stubs.writeStubsAndApi(stubsDir, apiFile, dexApiFile, proguardFile, removedApiFile, + removedDexApiFile, exactApiFile, privateApiFile, privateDexApiFile, stubPackages, + stubImportPackages, stubSourceOnly); } Errors.printErrors(); @@ -858,6 +861,9 @@ public class Doclava { if (option.equals("-api")) { return 2; } + if (option.equals("-dexApi")) { + return 2; + } if (option.equals("-removedApi")) { return 2; } diff --git a/src/com/google/doclava/Stubs.java b/src/com/google/doclava/Stubs.java index f5eaf4b..dd2a5a7 100644 --- a/src/com/google/doclava/Stubs.java +++ b/src/com/google/doclava/Stubs.java @@ -46,15 +46,16 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; public class Stubs { - public static void writeStubsAndApi(String stubsDir, String apiFile, String keepListFile, - String removedApiFile, String removedDexApiFile, String exactApiFile, String privateApiFile, - String privateDexApiFile, HashSet<String> stubPackages, HashSet<String> stubImportPackages, - boolean stubSourceOnly) { + public static void writeStubsAndApi(String stubsDir, String apiFile, String dexApiFile, + String keepListFile, String removedApiFile, String removedDexApiFile, String exactApiFile, + String privateApiFile, String privateDexApiFile, HashSet<String> stubPackages, + HashSet<String> stubImportPackages, boolean stubSourceOnly) { // figure out which classes we need final HashSet<ClassInfo> notStrippable = new HashSet<ClassInfo>(); Collection<ClassInfo> all = Converter.allClasses(); Map<PackageInfo, List<ClassInfo>> allClassesByPackage = null; PrintStream apiWriter = null; + PrintStream dexApiWriter = null; PrintStream keepListWriter = null; PrintStream removedApiWriter = null; PrintStream removedDexApiWriter = null; @@ -72,6 +73,16 @@ public class Stubs { "Cannot open file for write."); } } + if (dexApiFile != null) { + try { + File dexApi = new File(dexApiFile); + dexApi.getParentFile().mkdirs(); + dexApiWriter = new PrintStream(new BufferedOutputStream(new FileOutputStream(dexApi))); + } catch (FileNotFoundException e) { + Errors.error(Errors.IO_ERROR, new SourcePositionInfo(dexApiFile, 0, 0), + "Cannot open file for write."); + } + } if (keepListFile != null) { try { File keepList = new File(keepListFile); @@ -239,7 +250,7 @@ public class Stubs { writeClassFile(stubsDir, notStrippable, cl); } // build class list for api file or keep list file - if (apiWriter != null || keepListWriter != null) { + if (apiWriter != null || dexApiWriter != null || keepListWriter != null) { if (packages.containsKey(cl.containingPackage())) { packages.get(cl.containingPackage()).add(cl); } else { @@ -268,6 +279,7 @@ public class Stubs { FilterPredicate apiFilter = new FilterPredicate(new ApiPredicate().setIgnoreShown(ignoreShown)); ApiPredicate apiReference = new ApiPredicate().setIgnoreShown(true); Predicate<MemberInfo> apiEmit = apiFilter.and(new ElidingPredicate(apiReference)); + Predicate<MemberInfo> dexApiEmit = memberIsNotCloned.and(apiFilter); Predicate<MemberInfo> privateEmit = memberIsNotCloned.and(apiFilter.negate()); Predicate<MemberInfo> privateReference = (x -> true); @@ -284,6 +296,12 @@ public class Stubs { apiWriter.close(); } + // Write out the current DEX API + if (dexApiWriter != null) { + writeDexApi(dexApiWriter, packages, dexApiEmit); + dexApiWriter.close(); + } + // Write out the keep list if (keepListWriter != null) { writeKeepList(keepListWriter, packages, notStrippable); |