From 6d0886e27978782fa1460cc57959fa762199d2fd Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 7 Apr 2020 18:49:53 +0100 Subject: [PATCH 1/2] Replace references to droiddoc with droidstubs The java_sdk_library code used to create droiddoc and now it creates droidstubs but it still referenced droiddoc internally. This change removed all the remaining references except the ones that are visible externally. Bug: 153443117 Test: m nothing Change-Id: Ie883eb4590f9c091d4149d7b17d7d3d91b1b5c6a --- java/sdk_library.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/java/sdk_library.go b/java/sdk_library.go index 52c900489..75db2d7f0 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -458,7 +458,7 @@ func (module *SdkLibrary) createStubsLibrary(mctx android.LoadHookContext, apiSc mctx.CreateModule(LibraryFactory, &props) } -// Creates a droiddoc module that creates stubs source files from the given full source +// Creates a droidstubs module that creates stubs source files from the given full source // files func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiScope *apiScope) { props := struct { @@ -516,15 +516,15 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc props.Merge_annotations_dirs = module.sdkLibraryProperties.Merge_annotations_dirs props.Merge_inclusion_annotations_dirs = module.sdkLibraryProperties.Merge_inclusion_annotations_dirs - droiddocArgs := []string{} + droidstubsArgs := []string{} if len(module.sdkLibraryProperties.Api_packages) != 0 { - droiddocArgs = append(droiddocArgs, "--stub-packages "+strings.Join(module.sdkLibraryProperties.Api_packages, ":")) + droidstubsArgs = append(droidstubsArgs, "--stub-packages "+strings.Join(module.sdkLibraryProperties.Api_packages, ":")) } if len(module.sdkLibraryProperties.Hidden_api_packages) != 0 { - droiddocArgs = append(droiddocArgs, + droidstubsArgs = append(droidstubsArgs, android.JoinWithPrefix(module.sdkLibraryProperties.Hidden_api_packages, " --hide-package ")) } - droiddocArgs = append(droiddocArgs, module.sdkLibraryProperties.Droiddoc_options...) + droidstubsArgs = append(droidstubsArgs, module.sdkLibraryProperties.Droiddoc_options...) disabledWarnings := []string{ "MissingPermission", "BroadcastBehavior", @@ -536,7 +536,7 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc "Todo", "Typo", } - droiddocArgs = append(droiddocArgs, android.JoinWithPrefix(disabledWarnings, "--hide ")) + droidstubsArgs = append(droidstubsArgs, android.JoinWithPrefix(disabledWarnings, "--hide ")) switch apiScope { case apiScopeSystem: @@ -545,7 +545,7 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc droiddocArgs = append(droiddocArgs, " -showAnnotation android.annotation.TestApi") } props.Arg_files = module.sdkLibraryProperties.Droiddoc_option_files - props.Args = proptools.StringPtr(strings.Join(droiddocArgs, " ")) + props.Args = proptools.StringPtr(strings.Join(droidstubsArgs, " ")) // List of APIs identified from the provided source files are created. They are later // compared against to the not-yet-released (a.k.a current) list of APIs and to the From 1fb487df174d573c713d6f4276fc19dbf3cb0133 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Tue, 7 Apr 2020 18:50:10 +0100 Subject: [PATCH 2/2] Parameterize scopes with additional droidstubs args Added droidstubsArgs field to the apiscope structure to avoid switching on api scope type. Bug: 153443117 Test: m nothing Change-Id: I96f0eb033d44c6a74787ba7f1523799b05a58092 --- java/sdk_library.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/java/sdk_library.go b/java/sdk_library.go index 75db2d7f0..efee7da23 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -86,6 +86,9 @@ type apiScope struct { // *current. Older stubs library built with a numbered SDK version is created from // the prebuilt jar. sdkVersion string + + // Extra arguments to pass to droidstubs for this scope. + droidstubsArgs []string } // Initialize a scope, creating and adding appropriate dependency tags @@ -131,6 +134,7 @@ var ( moduleSuffix: sdkSystemApiSuffix, apiFileMakeVariableSuffix: "_SYSTEM", sdkVersion: "system_current", + droidstubsArgs: []string{"-showAnnotation android.annotation.SystemApi"}, }) apiScopeTest = initApiScope(&apiScope{ name: "test", @@ -138,6 +142,7 @@ var ( moduleSuffix: sdkTestApiSuffix, apiFileMakeVariableSuffix: "_TEST", sdkVersion: "test_current", + droidstubsArgs: []string{"-showAnnotation android.annotation.TestApi"}, }) allApiScopes = apiScopes{ apiScopePublic, @@ -538,12 +543,8 @@ func (module *SdkLibrary) createStubsSources(mctx android.LoadHookContext, apiSc } droidstubsArgs = append(droidstubsArgs, android.JoinWithPrefix(disabledWarnings, "--hide ")) - switch apiScope { - case apiScopeSystem: - droiddocArgs = append(droiddocArgs, "-showAnnotation android.annotation.SystemApi") - case apiScopeTest: - droiddocArgs = append(droiddocArgs, " -showAnnotation android.annotation.TestApi") - } + // Add in scope specific arguments. + droidstubsArgs = append(droidstubsArgs, apiScope.droidstubsArgs...) props.Arg_files = module.sdkLibraryProperties.Droiddoc_option_files props.Args = proptools.StringPtr(strings.Join(droidstubsArgs, " "))