Merge "Add spdx-tools and licenseclassifier to soong mocks"
diff --git a/android/filegroup.go b/android/filegroup.go
index 38de855..c259f21 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -126,7 +126,7 @@
props := bazel.BazelTargetModuleProperties{
Rule_class: "aidl_library",
- Bzl_load_location: "//build/bazel/rules/aidl:library.bzl",
+ Bzl_load_location: "//build/bazel/rules/aidl:aidl_library.bzl",
}
ctx.CreateBazelTargetModule(
diff --git a/android/packaging.go b/android/packaging.go
index 4a9b591..c764a6d 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -238,11 +238,11 @@
// CopySpecsToDir is a helper that will add commands to the rule builder to copy the PackagingSpec
// entries into the specified directory.
-func (p *PackagingBase) CopySpecsToDir(ctx ModuleContext, builder *RuleBuilder, specs map[string]PackagingSpec, dir ModuleOutPath) (entries []string) {
+func (p *PackagingBase) CopySpecsToDir(ctx ModuleContext, builder *RuleBuilder, specs map[string]PackagingSpec, dir WritablePath) (entries []string) {
seenDir := make(map[string]bool)
for _, k := range SortedKeys(specs) {
ps := specs[k]
- destPath := dir.Join(ctx, ps.relPathInPackage).String()
+ destPath := filepath.Join(dir.String(), ps.relPathInPackage)
destDir := filepath.Dir(destPath)
entries = append(entries, ps.relPathInPackage)
if _, ok := seenDir[destDir]; !ok {
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 7c817a2..c8f516c 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -915,7 +915,7 @@
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: "aidl_library",
- Bzl_load_location: "//build/bazel/rules/aidl:library.bzl",
+ Bzl_load_location: "//build/bazel/rules/aidl:aidl_library.bzl",
},
android.CommonAttributes{Name: aidlLibName},
&aidlLibraryAttributes{
diff --git a/cc/library.go b/cc/library.go
index a9ada97..7504302 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -26,7 +26,6 @@
"android/soong/android"
"android/soong/bazel"
"android/soong/bazel/cquery"
- "android/soong/cc/config"
"github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
@@ -2261,8 +2260,7 @@
!ctx.useVndk() && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() && ctx.Device() &&
library.baseLinker.sanitize.isUnsanitizedVariant() &&
ctx.isForPlatform() && !ctx.isPreventInstall() {
- installPath := getNdkSysrootBase(ctx).Join(
- ctx, "usr/lib", config.NDKTriple(ctx.toolchain()), file.Base())
+ installPath := getUnversionedLibraryInstallPath(ctx).Join(ctx, file.Base())
ctx.ModuleBuild(pctx, android.ModuleBuildParams{
Rule: android.Cp,
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 2473ba2..a824361 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -528,17 +528,20 @@
return false
}
-func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) {
- arch := ctx.Target().Arch.ArchType.Name
- // arm64 isn't actually a multilib toolchain, so unlike the other LP64
- // architectures it's just installed to lib.
- libDir := "lib"
- if ctx.toolchain().Is64Bit() && arch != "arm64" {
- libDir = "lib64"
- }
+// Returns the install path for unversioned NDK libraries (currently only static
+// libraries).
+func getUnversionedLibraryInstallPath(ctx ModuleContext) android.InstallPath {
+ return getNdkSysrootBase(ctx).Join(ctx, "usr/lib", config.NDKTriple(ctx.toolchain()))
+}
- installDir := getNdkInstallBase(ctx).Join(ctx, fmt.Sprintf(
- "platforms/android-%s/arch-%s/usr/%s", stub.apiLevel, arch, libDir))
+// Returns the install path for versioned NDK libraries. These are most often
+// stubs, but the same paths are used for CRT objects.
+func getVersionedLibraryInstallPath(ctx ModuleContext, apiLevel android.ApiLevel) android.InstallPath {
+ return getUnversionedLibraryInstallPath(ctx).Join(ctx, apiLevel.String())
+}
+
+func (stub *stubDecorator) install(ctx ModuleContext, path android.Path) {
+ installDir := getVersionedLibraryInstallPath(ctx, stub.apiLevel)
stub.installPath = ctx.InstallFile(installDir, path.Base(), path)
}
diff --git a/java/core-libraries/Android.bp b/java/core-libraries/Android.bp
index b9332dd..128829e 100644
--- a/java/core-libraries/Android.bp
+++ b/java/core-libraries/Android.bp
@@ -79,16 +79,25 @@
],
}
+// Defaults module to strip out android annotations
+java_defaults {
+ name: "system-modules-no-annotations",
+ sdk_version: "none",
+ system_modules: "none",
+ jarjar_rules: "jarjar-strip-annotations-rules.txt",
+}
+
// Same as core-current-stubs-for-system-modules, but android annotations are
// stripped.
java_library {
name: "core-current-stubs-for-system-modules-no-annotations",
visibility: ["//development/sdk"],
+ defaults: [
+ "system-modules-no-annotations",
+ ],
static_libs: [
"core-current-stubs-for-system-modules",
],
- sdk_version: "none",
- system_modules: "none",
dists: [
{
// Legacy dist location for the public file.
@@ -100,7 +109,6 @@
targets: dist_targets,
},
],
- jarjar_rules: "jarjar-strip-annotations-rules.txt",
}
// Used when compiling higher-level code against core.current.stubs.
@@ -158,16 +166,16 @@
java_library {
name: "core-module-lib-stubs-for-system-modules-no-annotations",
visibility: ["//visibility:private"],
+ defaults: [
+ "system-modules-no-annotations",
+ ],
static_libs: [
"core-module-lib-stubs-for-system-modules",
],
- sdk_version: "none",
- system_modules: "none",
dist: {
dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
targets: dist_targets,
},
- jarjar_rules: "jarjar-strip-annotations-rules.txt",
}
// Used when compiling higher-level code with sdk_version "module_current"
@@ -212,16 +220,16 @@
java_library {
name: "legacy.core.platform.api.no.annotations.stubs",
visibility: core_platform_visibility,
+ defaults: [
+ "system-modules-no-annotations",
+ ],
hostdex: true,
compile_dex: true,
- sdk_version: "none",
- system_modules: "none",
static_libs: [
"legacy.core.platform.api.stubs",
],
patch_module: "java.base",
- jarjar_rules: "jarjar-strip-annotations-rules.txt",
}
java_library {
@@ -247,16 +255,16 @@
java_library {
name: "stable.core.platform.api.no.annotations.stubs",
visibility: core_platform_visibility,
+ defaults: [
+ "system-modules-no-annotations",
+ ],
hostdex: true,
compile_dex: true,
- sdk_version: "none",
- system_modules: "none",
static_libs: [
"stable.core.platform.api.stubs",
],
patch_module: "java.base",
- jarjar_rules: "jarjar-strip-annotations-rules.txt",
}
// Used when compiling higher-level code against *.core.platform.api.stubs.
@@ -349,3 +357,7 @@
"art-module-intra-core-api-stubs-system-modules-lib",
],
}
+
+build = [
+ "TxtStubLibraries.bp",
+]
diff --git a/java/core-libraries/TxtStubLibraries.bp b/java/core-libraries/TxtStubLibraries.bp
new file mode 100644
index 0000000..b63ce42
--- /dev/null
+++ b/java/core-libraries/TxtStubLibraries.bp
@@ -0,0 +1,142 @@
+// Copyright (C) 2023 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// This file contains java_system_modules provided by the SDK.
+// These system modules transitively depend on core stub libraries generated from .txt files.
+
+// Same as core-public-stubs-system-modules, but the stubs are generated from .txt files
+java_system_modules {
+ name: "core-public-stubs-system-modules.from-text",
+ visibility: ["//visibility:public"],
+ libs: [
+ "core-current-stubs-for-system-modules-no-annotations.from-text",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+java_library {
+ name: "core-current-stubs-for-system-modules-no-annotations.from-text",
+ visibility: ["//visibility:private"],
+ defaults: [
+ "system-modules-no-annotations",
+ ],
+ static_libs: [
+ "core.current.stubs.from-txt",
+ "core-lambda-stubs-for-system-modules",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+// Same as core-module-lib-stubs-system-modules, but the stubs are generated from .txt files
+java_system_modules {
+ name: "core-module-lib-stubs-system-modules.from-text",
+ visibility: ["//visibility:public"],
+ libs: [
+ "core-module-lib-stubs-for-system-modules-no-annotations.from-text",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+java_library {
+ name: "core-module-lib-stubs-for-system-modules-no-annotations.from-text",
+ visibility: ["//visibility:private"],
+ defaults: [
+ "system-modules-no-annotations",
+ ],
+ static_libs: [
+ "core.module_lib.stubs.txt",
+ "core-lambda-stubs-for-system-modules",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+java_library {
+ name: "core.module_lib.stubs.from-text",
+ static_libs: [
+ "art.module.public.api.stubs.module_lib.from-text",
+
+ // Replace the following with the module-lib correspondence when Conscrypt or i18N module
+ // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
+ // @SystemApi(MODULE_LIBRARIES).
+ "conscrypt.module.public.api.stubs.from-text",
+ "i18n.module.public.api.stubs.from-text",
+ ],
+ sdk_version: "none",
+ system_modules: "none",
+ visibility: ["//visibility:private"],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+// Same as legacy-core-platform-api-stubs-system-modules, but the stubs are generated from .txt files
+java_system_modules {
+ name: "legacy-core-platform-api-stubs-system-modules.from-text",
+ visibility: core_platform_visibility,
+ libs: [
+ "legacy.core.platform.api.no.annotations.stubs.from-text",
+ "core-lambda-stubs-for-system-modules",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+java_library {
+ name: "legacy.core.platform.api.no.annotations.stubs.from-text",
+ visibility: core_platform_visibility,
+ defaults: [
+ "system-modules-no-annotations",
+ ],
+ hostdex: true,
+ compile_dex: true,
+
+ static_libs: [
+ "legacy.core.platform.api.stubs.from-text",
+ ],
+ patch_module: "java.base",
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+// Same as stable-core-platform-api-stubs-system-modules, but the stubs are generated from .txt files
+java_system_modules {
+ name: "stable-core-platform-api-stubs-system-modules.from-text",
+ visibility: core_platform_visibility,
+ libs: [
+ "stable.core.platform.api.no.annotations.stubs.from-text",
+ "core-lambda-stubs-for-system-modules",
+ ],
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
+
+java_library {
+ name: "stable.core.platform.api.no.annotations.stubs.from-text",
+ visibility: core_platform_visibility,
+ defaults: [
+ "system-modules-no-annotations",
+ ],
+ hostdex: true,
+ compile_dex: true,
+
+ static_libs: [
+ "stable.core.platform.api.stubs.from-text",
+ ],
+ patch_module: "java.base",
+ // TODO: Enable after stub generation from .txt file is available
+ enabled: false,
+}
diff --git a/java/java.go b/java/java.go
index 499a6b6..82c5535 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2772,7 +2772,7 @@
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: "aidl_library",
- Bzl_load_location: "//build/bazel/rules/aidl:library.bzl",
+ Bzl_load_location: "//build/bazel/rules/aidl:aidl_library.bzl",
},
android.CommonAttributes{Name: aidlLibName},
&aidlLibraryAttributes{
@@ -2787,7 +2787,7 @@
ctx.CreateBazelTargetModule(
bazel.BazelTargetModuleProperties{
Rule_class: "java_aidl_library",
- Bzl_load_location: "//build/bazel/rules/java:aidl_library.bzl",
+ Bzl_load_location: "//build/bazel/rules/java:java_aidl_library.bzl",
},
android.CommonAttributes{Name: javaAidlLibName},
&javaAidlLibraryAttributes{