Merge "Add exemption for framework-sdkextensions-classpaths boot jar." into sc-dev
diff --git a/cc/cc.go b/cc/cc.go
index 4bfb132..be2c0a3 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1971,9 +1971,13 @@
if minSdkVersion == "" || minSdkVersion == "apex_inherit" {
minSdkVersion = m.SdkVersion()
}
+ apiLevel, err := android.ApiLevelFromUser(ctx, minSdkVersion)
+ if err != nil {
+ ctx.PropertyErrorf("min_sdk_version", err.Error())
+ }
return []blueprint.Variation{
{Mutator: "sdk", Variation: "sdk"},
- {Mutator: "version", Variation: minSdkVersion},
+ {Mutator: "version", Variation: apiLevel.String()},
}
}
return []blueprint.Variation{
diff --git a/cc/sabi.go b/cc/sabi.go
index 384dcc1..1f331cb 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -192,7 +192,7 @@
// Mark all of its static library dependencies.
mctx.VisitDirectDeps(func(child android.Module) {
depTag := mctx.OtherModuleDependencyTag(child)
- if libDepTag, ok := depTag.(libraryDependencyTag); ok && libDepTag.static() {
+ if IsStaticDepTag(depTag) || depTag == reuseObjTag {
if c, ok := child.(*Module); ok && c.sabi != nil {
// Mark this module so that .sdump for this static library can be generated.
c.sabi.Properties.ShouldCreateSourceAbiDump = true
diff --git a/jar/jar.go b/jar/jar.go
index a8f06a4..f164ee1 100644
--- a/jar/jar.go
+++ b/jar/jar.go
@@ -77,7 +77,7 @@
Name: MetaDir,
Extra: []byte{MetaDirExtra[1], MetaDirExtra[0], 0, 0},
}
- dirHeader.SetMode(0700 | os.ModeDir)
+ dirHeader.SetMode(0755 | os.ModeDir)
dirHeader.SetModTime(DefaultTime)
return dirHeader
@@ -95,7 +95,7 @@
Method: zip.Store,
UncompressedSize64: uint64(len(b)),
}
- fh.SetMode(0700)
+ fh.SetMode(0644)
fh.SetModTime(DefaultTime)
return fh, b, nil
diff --git a/java/sdk_library.go b/java/sdk_library.go
index aec113c..133deda 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -435,9 +435,6 @@
// a list of top-level directories containing Java stub files to merge show/hide annotations from.
Merge_inclusion_annotations_dirs []string
- // If set to true, the path of dist files is apistubs/core. Defaults to false.
- Core_lib *bool
-
// If set to true then don't create dist rules.
No_dist *bool
@@ -458,7 +455,7 @@
Dist_stem *string
// The subdirectory for the artifacts that are copied to the dist directory. If not specified
- // then defaults to "android". Should be set to "android" for anything that should be published
+ // then defaults to "unknown". Should be set to "android" for anything that should be published
// in the public Android SDK.
Dist_group *string
@@ -1203,11 +1200,7 @@
// The dist path of the stub artifacts
func (module *SdkLibrary) apiDistPath(apiScope *apiScope) string {
- if Bool(module.sdkLibraryProperties.Core_lib) {
- return path.Join("apistubs", "core", apiScope.name)
- } else {
- return path.Join("apistubs", module.distGroup(), apiScope.name)
- }
+ return path.Join("apistubs", module.distGroup(), apiScope.name)
}
// Get the sdk version for use when compiling the stubs library.
@@ -1233,15 +1226,7 @@
// distGroup returns the subdirectory of the dist path of the stub artifacts.
func (module *SdkLibrary) distGroup() string {
- if group := proptools.String(module.sdkLibraryProperties.Dist_group); group != "" {
- return group
- }
- // TODO(b/186723288): Remove this once everything uses dist_group.
- if owner := module.ModuleBase.Owner(); owner != "" {
- return owner
- }
- // TODO(b/186723288): Make this "unknown".
- return "android"
+ return proptools.StringDefault(module.sdkLibraryProperties.Dist_group, "unknown")
}
func (module *SdkLibrary) latestApiFilegroupName(apiScope *apiScope) string {
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 0fe6e72..2520dde 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -844,40 +844,34 @@
PrepareForTestWithJavaBuildComponents,
PrepareForTestWithJavaDefaultModules,
PrepareForTestWithJavaSdkLibraryFiles,
+ FixtureWithLastReleaseApis(
+ "sdklib_no_group",
+ "sdklib_group_foo",
+ "sdklib_owner_foo",
+ "foo"),
).RunTestWithBp(t, `
java_sdk_library {
- name: "sdklib_no_owner",
- unsafe_ignore_missing_latest_api: true,
+ name: "sdklib_no_group",
srcs: ["foo.java"],
}
java_sdk_library {
name: "sdklib_group_foo",
- unsafe_ignore_missing_latest_api: true,
srcs: ["foo.java"],
dist_group: "foo",
}
java_sdk_library {
name: "sdklib_owner_foo",
- unsafe_ignore_missing_latest_api: true,
srcs: ["foo.java"],
owner: "foo",
}
java_sdk_library {
name: "sdklib_stem_foo",
- unsafe_ignore_missing_latest_api: true,
srcs: ["foo.java"],
dist_stem: "foo",
}
-
- java_sdk_library {
- name: "sdklib_core_lib",
- unsafe_ignore_missing_latest_api: true,
- srcs: ["foo.java"],
- core_lib: true,
- }
`)
type testCase struct {
@@ -887,9 +881,9 @@
}
testCases := []testCase{
{
- module: "sdklib_no_owner",
- distDir: "apistubs/android/public",
- distStem: "sdklib_no_owner.jar",
+ module: "sdklib_no_group",
+ distDir: "apistubs/unknown/public",
+ distStem: "sdklib_no_group.jar",
},
{
module: "sdklib_group_foo",
@@ -897,20 +891,16 @@
distStem: "sdklib_group_foo.jar",
},
{
+ // Owner doesn't affect distDir after b/186723288.
module: "sdklib_owner_foo",
- distDir: "apistubs/foo/public",
+ distDir: "apistubs/unknown/public",
distStem: "sdklib_owner_foo.jar",
},
{
module: "sdklib_stem_foo",
- distDir: "apistubs/android/public",
+ distDir: "apistubs/unknown/public",
distStem: "foo.jar",
},
- {
- module: "sdklib_core_lib",
- distDir: "apistubs/core/public",
- distStem: "sdklib_core_lib.jar",
- },
}
for _, tt := range testCases {
diff --git a/scripts/build-aml-prebuilts.sh b/scripts/build-aml-prebuilts.sh
index 4b08ac3..8a5513e 100755
--- a/scripts/build-aml-prebuilts.sh
+++ b/scripts/build-aml-prebuilts.sh
@@ -1,14 +1,24 @@
#!/bin/bash -e
-# This is a wrapper around "m" that builds the given modules in multi-arch mode
-# for all architectures supported by Mainline modules. The make (kati) stage is
-# skipped, so the build targets in the arguments can only be Soong modules or
-# intermediate output files - make targets and normal installed paths are not
-# supported.
+# This script is similar to "m" but builds in --soong-only mode, and handles
+# special cases to make that mode work. All arguments are passed on to
+# build/soong/soong_ui.bash.
#
-# This script is typically used with "sdk" or "module_export" modules, which
-# Soong will install in $OUT_DIR/soong/mainline-sdks (cf
-# PathForMainlineSdksInstall in android/paths.go).
+# --soong-only bypasses the kati step and hence the make logic that e.g. doesn't
+# handle more than two device architectures. It is particularly intended for use
+# with TARGET_PRODUCT=mainline_sdk to build 'sdk' and 'module_export' Soong
+# modules in TARGET_ARCH_SUITE=mainline_sdk mode so that they get all four
+# device architectures (artifacts get installed in $OUT_DIR/soong/mainline-sdks
+# - cf PathForMainlineSdksInstall in android/paths.go).
+#
+# TODO(b/174315599): Replace this script completely with a 'soong_ui.bash
+# --soong-only' invocation. For now it is still necessary to set up
+# build_number.txt.
+
+if [ ! -e build/soong/soong_ui.bash ]; then
+ echo "$0 must be run from the top of the tree"
+ exit 1
+fi
export OUT_DIR=${OUT_DIR:-out}
@@ -23,109 +33,19 @@
OUT_DIR=${AML_OUT_DIR}
fi
-if [ ! -e "build/envsetup.sh" ]; then
- echo "$0 must be run from the top of the tree"
- exit 1
-fi
+mkdir -p ${OUT_DIR}/soong
-source build/envsetup.sh
-
-my_get_build_var() {
- # get_build_var will run Soong in normal in-make mode where it creates
- # .soong.kati_enabled. That would clobber our real out directory, so we need
- # to run it in a different one.
- OUT_DIR=${OUT_DIR}/get_build_var get_build_var "$@"
-}
-
-readonly SOONG_OUT=${OUT_DIR}/soong
-mkdir -p ${SOONG_OUT}
+# The --dumpvars-mode invocation will run Soong in normal make mode where it
+# creates .soong.kati_enabled. That would clobber our real out directory, so we
+# need to use a different OUT_DIR.
+vars="$(OUT_DIR=${OUT_DIR}/dumpvars_mode build/soong/soong_ui.bash \
+ --dumpvars-mode --vars=BUILD_NUMBER)"
+# Assign to a variable and eval that, since bash ignores any error status
+# from the command substitution if it's directly on the eval line.
+eval $vars
# Some Soong build rules may require this, and the failure mode if it's missing
# is confusing (b/172548608).
-readonly BUILD_NUMBER="$(my_get_build_var BUILD_NUMBER)"
-echo -n ${BUILD_NUMBER} > ${SOONG_OUT}/build_number.txt
+echo -n ${BUILD_NUMBER} > ${OUT_DIR}/soong/build_number.txt
-readonly PLATFORM_SDK_VERSION="$(my_get_build_var PLATFORM_SDK_VERSION)"
-readonly PLATFORM_VERSION="$(my_get_build_var PLATFORM_VERSION)"
-PLATFORM_VERSION_ALL_CODENAMES="$(my_get_build_var PLATFORM_VERSION_ALL_CODENAMES)"
-
-# PLATFORM_VERSION_ALL_CODENAMES is a comma separated list like O,P. We need to
-# turn this into ["O","P"].
-PLATFORM_VERSION_ALL_CODENAMES="${PLATFORM_VERSION_ALL_CODENAMES/,/'","'}"
-PLATFORM_VERSION_ALL_CODENAMES="[\"${PLATFORM_VERSION_ALL_CODENAMES}\"]"
-
-# Get the list of missing <uses-library> modules and convert it to a JSON array
-# (quote module names, add comma separator and wrap in brackets).
-MISSING_USES_LIBRARIES="$(my_get_build_var INTERNAL_PLATFORM_MISSING_USES_LIBRARIES)"
-MISSING_USES_LIBRARIES="[$(echo $MISSING_USES_LIBRARIES | sed -e 's/\([^ ]\+\)/\"\1\"/g' -e 's/[ ]\+/, /g')]"
-
-# Logic from build/make/core/goma.mk
-if [ "${USE_GOMA}" = true ]; then
- if [ -n "${GOMA_DIR}" ]; then
- goma_dir="${GOMA_DIR}"
- else
- goma_dir="${HOME}/goma"
- fi
- GOMA_CC="${goma_dir}/gomacc"
- export CC_WRAPPER="${CC_WRAPPER}${CC_WRAPPER:+ }${GOMA_CC}"
- export CXX_WRAPPER="${CXX_WRAPPER}${CXX_WRAPPER:+ }${GOMA_CC}"
- export JAVAC_WRAPPER="${JAVAC_WRAPPER}${JAVAC_WRAPPER:+ }${GOMA_CC}"
-else
- USE_GOMA=false
-fi
-
-readonly SOONG_VARS=${SOONG_OUT}/soong.variables
-
-# Aml_abis: true
-# - This flag configures Soong to compile for all architectures required for
-# Mainline modules.
-# CrossHost: linux_bionic
-# CrossHostArch: x86_64
-# - Enable Bionic on host as ART needs prebuilts for it.
-# VendorVars.art_mdoule.source_build
-# - TODO(b/172480615): Change default to false when platform uses ART Module
-# prebuilts by default.
-cat > ${SOONG_VARS}.new << EOF
-{
- "BuildNumberFile": "build_number.txt",
-
- "Platform_version_name": "${PLATFORM_VERSION}",
- "Platform_sdk_version": ${PLATFORM_SDK_VERSION},
- "Platform_sdk_codename": "${PLATFORM_VERSION}",
- "Platform_version_active_codenames": ${PLATFORM_VERSION_ALL_CODENAMES},
-
- "DeviceName": "generic_arm64",
- "HostArch": "x86_64",
- "HostSecondaryArch": "x86",
- "CrossHost": "linux_bionic",
- "CrossHostArch": "x86_64",
- "Aml_abis": true,
-
- "Allow_missing_dependencies": ${SOONG_ALLOW_MISSING_DEPENDENCIES:-false},
- "Unbundled_build": ${TARGET_BUILD_UNBUNDLED:-false},
- "UseGoma": ${USE_GOMA},
-
- "VendorVars": {
- "art_module": {
- "source_build": "${ENABLE_ART_SOURCE_BUILD:-true}"
- }
- },
-
- "MissingUsesLibraries": ${MISSING_USES_LIBRARIES}
-}
-EOF
-
-if [ -f ${SOONG_VARS} ] && cmp -s ${SOONG_VARS} ${SOONG_VARS}.new; then
- # Don't touch soong.variables if we don't have to, to avoid Soong rebuilding
- # the ninja file when it isn't necessary.
- rm ${SOONG_VARS}.new
-else
- mv ${SOONG_VARS}.new ${SOONG_VARS}
-fi
-
-# We use force building LLVM components flag (even though we actually don't
-# compile them) because we don't have bionic host prebuilts
-# for them.
-export FORCE_BUILD_LLVM_COMPONENTS=true
-
-m --skip-make "$@"
+build/soong/soong_ui.bash --make-mode --soong-only "$@"
diff --git a/scripts/build-mainline-modules.sh b/scripts/build-mainline-modules.sh
index 39c8fba..7d49492 100755
--- a/scripts/build-mainline-modules.sh
+++ b/scripts/build-mainline-modules.sh
@@ -93,11 +93,17 @@
done
done
+# We use force building LLVM components flag (even though we actually don't
+# compile them) because we don't have bionic host prebuilts
+# for them.
+export FORCE_BUILD_LLVM_COMPONENTS=true
+
# Create multi-archs SDKs in a different out directory. The multi-arch script
# uses Soong in --skip-make mode which cannot use the same directory as normal
# mode with make.
export OUT_DIR=${OUT_DIR}/aml
-echo_and_run build/soong/scripts/build-aml-prebuilts.sh ${MODULES_SDK_AND_EXPORTS[@]}
+echo_and_run build/soong/scripts/build-aml-prebuilts.sh \
+ TARGET_PRODUCT=mainline_sdk ${MODULES_SDK_AND_EXPORTS[@]}
rm -rf ${DIST_DIR}/mainline-sdks
echo_and_run cp -R ${OUT_DIR}/soong/mainline-sdks ${DIST_DIR}
diff --git a/zip/zip.go b/zip/zip.go
index 6e412c9..ae379f5 100644
--- a/zip/zip.go
+++ b/zip/zip.go
@@ -656,9 +656,9 @@
UncompressedSize64: uint64(fileSize),
}
- mode := os.FileMode(0600)
+ mode := os.FileMode(0644)
if executable {
- mode = 0700
+ mode = 0755
}
header.SetMode(mode)
@@ -955,7 +955,7 @@
dirHeader = &zip.FileHeader{
Name: cleanDir + "/",
}
- dirHeader.SetMode(0700 | os.ModeDir)
+ dirHeader.SetMode(0755 | os.ModeDir)
}
dirHeader.SetModTime(z.time)
diff --git a/zip/zip_test.go b/zip/zip_test.go
index 441dea3..79cc0b4 100644
--- a/zip/zip_test.go
+++ b/zip/zip_test.go
@@ -62,7 +62,7 @@
Method: method,
CRC32: crc32.ChecksumIEEE(contents),
UncompressedSize64: uint64(len(contents)),
- ExternalAttrs: (syscall.S_IFREG | 0600) << 16,
+ ExternalAttrs: (syscall.S_IFREG | 0644) << 16,
}
}
@@ -72,7 +72,7 @@
Method: zip.Store,
CRC32: crc32.ChecksumIEEE(contents),
UncompressedSize64: uint64(len(contents)),
- ExternalAttrs: (syscall.S_IFREG | 0700) << 16,
+ ExternalAttrs: (syscall.S_IFREG | 0644) << 16,
}
}
@@ -92,7 +92,7 @@
Method: zip.Store,
CRC32: crc32.ChecksumIEEE(nil),
UncompressedSize64: 0,
- ExternalAttrs: (syscall.S_IFDIR|0700)<<16 | 0x10,
+ ExternalAttrs: (syscall.S_IFDIR|0755)<<16 | 0x10,
}
}