Annotate more java dependencies for licensing

Annotate more dependencies as runtime linked or toolchain.

Bug: 207445310
Test: m checkbuild
Change-Id: Ia5dc3321a1e476b16058eee94d6dc494fe1e933e
This commit is contained in:
Colin Cross 2022-01-12 11:13:32 -08:00
parent aff21fbf3c
commit ce56425a6b
4 changed files with 23 additions and 5 deletions

View file

@ -224,6 +224,9 @@ const (
// LicenseAnnotationSharedDependency should be returned by LicenseAnnotations implementations
// of dependency tags when the usage of the dependency is dynamic, for example a shared library
// linkage for native modules or as a classpath library for java modules.
//
// Dependency tags that need to always return LicenseAnnotationSharedDependency
// can embed LicenseAnnotationSharedDependencyTag to implement LicenseAnnotations.
LicenseAnnotationSharedDependency LicenseAnnotation = "dynamic"
// LicenseAnnotationToolchain should be returned by LicenseAnnotations implementations of
@ -234,6 +237,14 @@ const (
LicenseAnnotationToolchain LicenseAnnotation = "toolchain"
)
// LicenseAnnotationSharedDependencyTag can be embedded in a dependency tag to implement
// LicenseAnnotations that always returns LicenseAnnotationSharedDependency.
type LicenseAnnotationSharedDependencyTag struct{}
func (LicenseAnnotationSharedDependencyTag) LicenseAnnotations() []LicenseAnnotation {
return []LicenseAnnotation{LicenseAnnotationSharedDependency}
}
// LicenseAnnotationToolchainDependencyTag can be embedded in a dependency tag to implement
// LicenseAnnotations that always returns LicenseAnnotationToolchain.
type LicenseAnnotationToolchainDependencyTag struct{}

View file

@ -408,6 +408,7 @@ func dex2oatModuleName(config android.Config) string {
type dex2oatDependencyTag struct {
blueprint.BaseDependencyTag
android.LicenseAnnotationToolchainDependencyTag
}
func (d dex2oatDependencyTag) ExcludeFromVisibilityEnforcement() {

View file

@ -297,6 +297,7 @@ func hiddenAPIEncodeDex(ctx android.ModuleContext, dexInput, flagsCSV android.Pa
type hiddenApiAnnotationsDependencyTag struct {
blueprint.BaseDependencyTag
android.LicenseAnnotationSharedDependencyTag
}
// Tag used to mark dependencies on java_library instances that contains Java source files whose

View file

@ -274,6 +274,9 @@ type dependencyTag struct {
// True if the dependency is relinked at runtime.
runtimeLinked bool
// True if the dependency is a toolchain, for example an annotation processor.
toolchain bool
}
// installDependencyTag is a dependency tag that is annotated to cause the installed files of the
@ -287,6 +290,8 @@ type installDependencyTag struct {
func (d dependencyTag) LicenseAnnotations() []android.LicenseAnnotation {
if d.runtimeLinked {
return []android.LicenseAnnotation{android.LicenseAnnotationSharedDependency}
} else if d.toolchain {
return []android.LicenseAnnotation{android.LicenseAnnotationToolchain}
}
return nil
}
@ -329,19 +334,19 @@ var (
staticLibTag = dependencyTag{name: "staticlib"}
libTag = dependencyTag{name: "javalib", runtimeLinked: true}
java9LibTag = dependencyTag{name: "java9lib", runtimeLinked: true}
pluginTag = dependencyTag{name: "plugin"}
errorpronePluginTag = dependencyTag{name: "errorprone-plugin"}
exportedPluginTag = dependencyTag{name: "exported-plugin"}
pluginTag = dependencyTag{name: "plugin", toolchain: true}
errorpronePluginTag = dependencyTag{name: "errorprone-plugin", toolchain: true}
exportedPluginTag = dependencyTag{name: "exported-plugin", toolchain: true}
bootClasspathTag = dependencyTag{name: "bootclasspath", runtimeLinked: true}
systemModulesTag = dependencyTag{name: "system modules", runtimeLinked: true}
frameworkResTag = dependencyTag{name: "framework-res"}
kotlinStdlibTag = dependencyTag{name: "kotlin-stdlib", runtimeLinked: true}
kotlinAnnotationsTag = dependencyTag{name: "kotlin-annotations", runtimeLinked: true}
kotlinPluginTag = dependencyTag{name: "kotlin-plugin"}
kotlinPluginTag = dependencyTag{name: "kotlin-plugin", toolchain: true}
proguardRaiseTag = dependencyTag{name: "proguard-raise"}
certificateTag = dependencyTag{name: "certificate"}
instrumentationForTag = dependencyTag{name: "instrumentation_for"}
extraLintCheckTag = dependencyTag{name: "extra-lint-check"}
extraLintCheckTag = dependencyTag{name: "extra-lint-check", toolchain: true}
jniLibTag = dependencyTag{name: "jnilib", runtimeLinked: true}
syspropPublicStubDepTag = dependencyTag{name: "sysprop public stub"}
jniInstallTag = installDependencyTag{name: "jni install"}