diff options
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/java/java.go b/java/java.go index 4c3363a9c..0739eab04 100644 --- a/java/java.go +++ b/java/java.go @@ -417,7 +417,7 @@ type Module struct { overrideManifest android.OptionalPath // map of SDK version to class loader context - exportedSdkLibs dexpreopt.ClassLoaderContextMap + classLoaderContexts dexpreopt.ClassLoaderContextMap // list of plugins that this java module is exporting exportedPluginJars android.Paths @@ -509,7 +509,7 @@ type Dependency interface { ImplementationJars() android.Paths ResourceJars() android.Paths AidlIncludeDirs() android.Paths - ExportedSdkLibs() dexpreopt.ClassLoaderContextMap + ClassLoaderContexts() dexpreopt.ClassLoaderContextMap ExportedPlugins() (android.Paths, []string) SrcJarArgs() ([]string, android.Paths) BaseModuleName() string @@ -547,14 +547,6 @@ type dependencyTag struct { name string } -// installDependencyTag is a dependency tag that is annotated to cause the installed files of the -// dependency to be installed when the parent module is installed. -type installDependencyTag struct { - blueprint.BaseDependencyTag - android.InstallAlwaysNeededDependencyTag - name string -} - type usesLibraryDependencyTag struct { dependencyTag sdkVersion int // SDK version in which the library appared as a standalone library. @@ -588,8 +580,6 @@ var ( instrumentationForTag = dependencyTag{name: "instrumentation_for"} extraLintCheckTag = dependencyTag{name: "extra-lint-check"} jniLibTag = dependencyTag{name: "jnilib"} - jniInstallTag = installDependencyTag{name: "jni install"} - binaryInstallTag = installDependencyTag{name: "binary install"} usesLibTag = makeUsesLibraryDependencyTag(dexpreopt.AnySdkVersion) usesLibCompat28Tag = makeUsesLibraryDependencyTag(28) usesLibCompat29Tag = makeUsesLibraryDependencyTag(29) @@ -1039,7 +1029,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { case libTag: deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.sdkVersion())...) // names of sdk libs that are directly depended are exported - j.exportedSdkLibs.MaybeAddContext(ctx, dep.OptionalImplicitSdkLibrary(), + j.classLoaderContexts.MaybeAddContext(ctx, dep.OptionalImplicitSdkLibrary(), true, dep.DexJarBuildPath(), dep.DexJarInstallPath()) case staticLibTag: ctx.ModuleErrorf("dependency on java_sdk_library %q can only be in libs", otherName) @@ -1051,7 +1041,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { case libTag, instrumentationForTag: deps.classpath = append(deps.classpath, dep.HeaderJars()...) // sdk lib names from dependencies are re-exported - j.exportedSdkLibs.AddContextMap(dep.ExportedSdkLibs(), otherName) + j.classLoaderContexts.AddContextMap(dep.ClassLoaderContexts(), otherName) deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs()...) pluginJars, pluginClasses := dep.ExportedPlugins() addPlugins(&deps, pluginJars, pluginClasses...) @@ -1063,7 +1053,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { deps.staticHeaderJars = append(deps.staticHeaderJars, dep.HeaderJars()...) deps.staticResourceJars = append(deps.staticResourceJars, dep.ResourceJars()...) // sdk lib names from dependencies are re-exported - j.exportedSdkLibs.AddContextMap(dep.ExportedSdkLibs(), otherName) + j.classLoaderContexts.AddContextMap(dep.ClassLoaderContexts(), otherName) deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs()...) pluginJars, pluginClasses := dep.ExportedPlugins() addPlugins(&deps, pluginJars, pluginClasses...) @@ -1915,8 +1905,8 @@ func (j *Module) AidlIncludeDirs() android.Paths { return j.exportAidlIncludeDirs } -func (j *Module) ExportedSdkLibs() dexpreopt.ClassLoaderContextMap { - return j.exportedSdkLibs +func (j *Module) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap { + return j.classLoaderContexts } func (j *Module) ExportedPlugins() (android.Paths, []string) { @@ -2054,7 +2044,7 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.dexProperties.Uncompress_dex = proptools.BoolPtr(shouldUncompressDex(ctx, &j.dexpreopter)) } j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex - j.exportedSdkLibs = make(dexpreopt.ClassLoaderContextMap) + j.classLoaderContexts = make(dexpreopt.ClassLoaderContextMap) j.compile(ctx, nil) // Collect the module directory for IDE info in java/jdeps.go. @@ -2074,12 +2064,12 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) { // add the name of that java_sdk_library to the exported sdk libs to make sure // that, if necessary, a <uses-library> element for that java_sdk_library is // added to the Android manifest. - j.exportedSdkLibs.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(), + j.classLoaderContexts.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(), true, j.DexJarBuildPath(), j.DexJarInstallPath()) // A non-SDK library may provide a <uses-library> (the name may be different from the module name). if lib := proptools.String(j.usesLibraryProperties.Provides_uses_lib); lib != "" { - j.exportedSdkLibs.AddContext(ctx, lib, j.DexJarBuildPath(), j.DexJarInstallPath()) + j.classLoaderContexts.AddContext(ctx, lib, true, j.DexJarBuildPath(), j.DexJarInstallPath()) } j.distFiles = j.GenerateTaggedDistFiles(ctx) @@ -2238,6 +2228,9 @@ func LibraryHostFactory() android.Module { type TestOptions struct { // a list of extra test configuration files that should be installed with the module. Extra_test_configs []string `android:"path,arch_variant"` + + // If the test is a hostside(no device required) unittest that shall be run during presubmit check. + Unit_test *bool } type testProperties struct { @@ -2562,12 +2555,9 @@ func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) { if ctx.Arch().ArchType == android.Common { j.deps(ctx) } else { - // These dependencies ensure the host installation rules will install the jar file and - // the jni libraries when the wrapper is installed. - ctx.AddVariationDependencies(nil, jniInstallTag, j.binaryProperties.Jni_libs...) - ctx.AddVariationDependencies( - []blueprint.Variation{{Mutator: "arch", Variation: android.CommonArch.String()}}, - binaryInstallTag, ctx.ModuleName()) + // This dependency ensures the host installation rules will install the jni libraries + // when the wrapper is installed. + ctx.AddVariationDependencies(nil, jniLibTag, j.binaryProperties.Jni_libs...) } } @@ -2661,7 +2651,7 @@ type Import struct { dexJarFile android.Path combinedClasspathFile android.Path - exportedSdkLibs dexpreopt.ClassLoaderContextMap + classLoaderContexts dexpreopt.ClassLoaderContextMap exportAidlIncludeDirs android.Paths hideApexVariantFromMake bool @@ -2736,7 +2726,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { TransformJetifier(ctx, outputFile, inputFile) } j.combinedClasspathFile = outputFile - j.exportedSdkLibs = make(dexpreopt.ClassLoaderContextMap) + j.classLoaderContexts = make(dexpreopt.ClassLoaderContextMap) var flags javaBuilderFlags @@ -2750,7 +2740,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { case libTag, staticLibTag: flags.classpath = append(flags.classpath, dep.HeaderJars()...) // sdk lib names from dependencies are re-exported - j.exportedSdkLibs.AddContextMap(dep.ExportedSdkLibs(), otherName) + j.classLoaderContexts.AddContextMap(dep.ClassLoaderContexts(), otherName) case bootClasspathTag: flags.bootClasspath = append(flags.bootClasspath, dep.HeaderJars()...) } @@ -2759,7 +2749,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { case libTag: flags.classpath = append(flags.classpath, dep.SdkHeaderJars(ctx, j.sdkVersion())...) // names of sdk libs that are directly depended are exported - j.exportedSdkLibs.AddContext(ctx, otherName, + j.classLoaderContexts.AddContext(ctx, otherName, dep.IsSharedLibrary(), dep.DexJarBuildPath(), dep.DexJarInstallPath()) } } @@ -2775,7 +2765,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { // add the name of that java_sdk_library to the exported sdk libs to make sure // that, if necessary, a <uses-library> element for that java_sdk_library is // added to the Android manifest. - j.exportedSdkLibs.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(), + j.classLoaderContexts.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(), true, outputFile, installFile) j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs) @@ -2858,8 +2848,8 @@ func (j *Import) AidlIncludeDirs() android.Paths { return j.exportAidlIncludeDirs } -func (j *Import) ExportedSdkLibs() dexpreopt.ClassLoaderContextMap { - return j.exportedSdkLibs +func (j *Import) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap { + return j.classLoaderContexts } func (j *Import) ExportedPlugins() (android.Paths, []string) { |