Remove implicit dependency from <x> -> <x>-hiddenapi
It can be removed as all implicit dependencies have been replaced with explicit ones so it is no longer needed. Test: m droid Verified that hiddenapi files (both aggregated ones and for the individual modules) are not affected by this change. Change-Id: I3da5fcb3b244a295502f2cacc94a504250d4d616
This commit is contained in:
@@ -15,8 +15,6 @@
|
|||||||
package java
|
package java
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
@@ -29,8 +27,8 @@ var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", bl
|
|||||||
|
|
||||||
type hiddenAPI struct {
|
type hiddenAPI struct {
|
||||||
// The name of the module as it would be used in the boot jars configuration, e.g. without any
|
// The name of the module as it would be used in the boot jars configuration, e.g. without any
|
||||||
// prebuilt_ prefix (if it is a prebuilt), without any "-hiddenapi" suffix if it just provides
|
// prebuilt_ prefix (if it is a prebuilt) and without any ".impl" suffix if it is a
|
||||||
// annotations and without any ".impl" suffix if it is a java_sdk_library implementation library.
|
// java_sdk_library implementation library.
|
||||||
configurationName string
|
configurationName string
|
||||||
|
|
||||||
// True if the module containing this structure contributes to the hiddenapi information or has
|
// True if the module containing this structure contributes to the hiddenapi information or has
|
||||||
@@ -49,11 +47,6 @@ type hiddenAPI struct {
|
|||||||
// annotation information.
|
// annotation information.
|
||||||
primary bool
|
primary bool
|
||||||
|
|
||||||
// True if the module only contains additional annotations and so does not require hiddenapi
|
|
||||||
// information to be encoded in its dex file and should not be used to generate the
|
|
||||||
// hiddenAPISingletonPathsStruct.stubFlags file.
|
|
||||||
annotationsOnly bool
|
|
||||||
|
|
||||||
// The path to the dex jar that is in the boot class path. If this is nil then the associated
|
// The path to the dex jar that is in the boot class path. If this is nil then the associated
|
||||||
// module is not a boot jar, but could be one of the <x>-hiddenapi modules that provide additional
|
// module is not a boot jar, but could be one of the <x>-hiddenapi modules that provide additional
|
||||||
// annotations for the <x> boot dex jar but which do not actually provide a boot dex jar
|
// annotations for the <x> boot dex jar but which do not actually provide a boot dex jar
|
||||||
@@ -119,16 +112,12 @@ type hiddenAPIIntf interface {
|
|||||||
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
|
var _ hiddenAPIIntf = (*hiddenAPI)(nil)
|
||||||
|
|
||||||
// Initialize the hiddenapi structure
|
// Initialize the hiddenapi structure
|
||||||
func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, name string) {
|
func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, configurationName string) {
|
||||||
// If hiddenapi processing is disabled treat this as inactive.
|
// If hiddenapi processing is disabled treat this as inactive.
|
||||||
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
|
if ctx.Config().IsEnvTrue("UNSAFE_DISABLE_HIDDENAPI_FLAGS") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modules whose names are of the format <x>-hiddenapi provide hiddenapi information for the boot
|
|
||||||
// jar module <x>. Otherwise, the module provides information for itself. Either way extract the
|
|
||||||
// configurationName of the boot jar module.
|
|
||||||
configurationName := strings.TrimSuffix(name, "-hiddenapi")
|
|
||||||
h.configurationName = configurationName
|
h.configurationName = configurationName
|
||||||
|
|
||||||
// It is important that hiddenapi information is only gathered for/from modules that are actually
|
// It is important that hiddenapi information is only gathered for/from modules that are actually
|
||||||
@@ -141,10 +130,6 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, name string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this module has a suffix of -hiddenapi then it only provides additional annotation
|
|
||||||
// information for a module on the boot jars list.
|
|
||||||
h.annotationsOnly = strings.HasSuffix(name, "-hiddenapi")
|
|
||||||
|
|
||||||
// Determine whether this module is the primary module or not.
|
// Determine whether this module is the primary module or not.
|
||||||
primary := true
|
primary := true
|
||||||
|
|
||||||
@@ -156,11 +141,11 @@ func (h *hiddenAPI) initHiddenAPI(ctx android.BaseModuleContext, name string) {
|
|||||||
primary = p.UsePrebuilt()
|
primary = p.UsePrebuilt()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The only module that will pass a different name to its module name to this method is the
|
// The only module that will pass a different configurationName to its module name to this
|
||||||
// implementation library of a java_sdk_library. It has a configuration name of <x> the same
|
// method is the implementation library of a java_sdk_library. It has a configuration name of
|
||||||
// as its parent java_sdk_library but a module name of <x>.impl. It is not the primary module,
|
// <x> the same as its parent java_sdk_library but a module name of <x>.impl. It is not the
|
||||||
// the java_sdk_library with the name of <x> is.
|
// primary module, the java_sdk_library with the name of <x> is.
|
||||||
primary = name == ctx.ModuleName()
|
primary = configurationName == ctx.ModuleName()
|
||||||
|
|
||||||
// A source module that has been replaced by a prebuilt can never be the primary module.
|
// A source module that has been replaced by a prebuilt can never be the primary module.
|
||||||
primary = primary && !module.IsReplacedByPrebuilt()
|
primary = primary && !module.IsReplacedByPrebuilt()
|
||||||
@@ -191,7 +176,6 @@ func (h *hiddenAPI) hiddenAPIExtractAndEncode(ctx android.ModuleContext, dexJar
|
|||||||
|
|
||||||
h.hiddenAPIExtractInformation(ctx, dexJar, implementationJar)
|
h.hiddenAPIExtractInformation(ctx, dexJar, implementationJar)
|
||||||
|
|
||||||
if !h.annotationsOnly {
|
|
||||||
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", h.configurationName+".jar").OutputPath
|
hiddenAPIJar := android.PathForModuleOut(ctx, "hiddenapi", h.configurationName+".jar").OutputPath
|
||||||
|
|
||||||
// Create a copy of the dex jar which has been encoded with hiddenapi flags.
|
// Create a copy of the dex jar which has been encoded with hiddenapi flags.
|
||||||
@@ -199,7 +183,6 @@ func (h *hiddenAPI) hiddenAPIExtractAndEncode(ctx android.ModuleContext, dexJar
|
|||||||
|
|
||||||
// Use the encoded dex jar from here onwards.
|
// Use the encoded dex jar from here onwards.
|
||||||
dexJar = hiddenAPIJar
|
dexJar = hiddenAPIJar
|
||||||
}
|
|
||||||
|
|
||||||
return dexJar
|
return dexJar
|
||||||
}
|
}
|
||||||
|
@@ -88,12 +88,6 @@ func TestHiddenAPIIndexSingleton(t *testing.T) {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
|
||||||
name: "foo-hiddenapi",
|
|
||||||
srcs: ["a.java"],
|
|
||||||
compile_dex: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "foo-hiddenapi-annotations",
|
name: "foo-hiddenapi-annotations",
|
||||||
srcs: ["a.java"],
|
srcs: ["a.java"],
|
||||||
@@ -118,7 +112,6 @@ func TestHiddenAPIIndexSingleton(t *testing.T) {
|
|||||||
indexRule := hiddenAPIIndex.Rule("singleton-merged-hiddenapi-index")
|
indexRule := hiddenAPIIndex.Rule("singleton-merged-hiddenapi-index")
|
||||||
CheckHiddenAPIRuleInputs(t, `
|
CheckHiddenAPIRuleInputs(t, `
|
||||||
.intermediates/bar/android_common/hiddenapi/index.csv
|
.intermediates/bar/android_common/hiddenapi/index.csv
|
||||||
.intermediates/foo-hiddenapi/android_common/hiddenapi/index.csv
|
|
||||||
.intermediates/foo/android_common/hiddenapi/index.csv
|
.intermediates/foo/android_common/hiddenapi/index.csv
|
||||||
`,
|
`,
|
||||||
indexRule)
|
indexRule)
|
||||||
|
Reference in New Issue
Block a user