diff options
| -rw-r--r-- | Android.bp | 1 | ||||
| -rw-r--r-- | android/neverallow.go | 9 | ||||
| -rw-r--r-- | android/neverallow_test.go | 11 | ||||
| -rw-r--r-- | cc/config/clang.go | 18 | ||||
| -rw-r--r-- | cmd/soong_ui/main.go | 19 | ||||
| -rw-r--r-- | java/config/config.go | 3 | ||||
| -rw-r--r-- | java/java_test.go | 2 | ||||
| -rw-r--r-- | java/sdk_test.go | 4 | ||||
| -rw-r--r-- | java/testing.go | 1 |
9 files changed, 55 insertions, 13 deletions
diff --git a/Android.bp b/Android.bp index c0a1aeb32..9ad12473a 100644 --- a/Android.bp +++ b/Android.bp @@ -517,6 +517,7 @@ toolchain_library { kernel_headers { name: "device_kernel_headers", vendor: true, + recovery_available: true, } cc_genrule { diff --git a/android/neverallow.go b/android/neverallow.go index f63f46181..1983f0ea6 100644 --- a/android/neverallow.go +++ b/android/neverallow.go @@ -51,6 +51,7 @@ func createNeverAllows() []*rule { rules := []*rule{} rules = append(rules, createTrebleRules()...) rules = append(rules, createLibcoreRules()...) + rules = append(rules, createMediaRules()...) rules = append(rules, createJavaDeviceForHostRules()...) return rules } @@ -126,6 +127,14 @@ func createLibcoreRules() []*rule { return rules } +func createMediaRules() []*rule { + return []*rule{ + neverallow(). + with("libs", "updatable-media"). + because("updatable-media includes private APIs. Use updatable_media_stubs instead."), + } +} + func createJavaDeviceForHostRules() []*rule { javaDeviceForHostProjectsWhitelist := []string{ "external/robolectric-shadows", diff --git a/android/neverallow_test.go b/android/neverallow_test.go index d55ca575c..5451620ff 100644 --- a/android/neverallow_test.go +++ b/android/neverallow_test.go @@ -149,6 +149,17 @@ var neverallowTests = []struct { expectedError: "Only core libraries projects can depend on core-libart", }, { + name: "dependency on updatable-media", + fs: map[string][]byte{ + "Blueprints": []byte(` + java_library { + name: "needs_updatable_media", + libs: ["updatable-media"], + }`), + }, + expectedError: "updatable-media includes private APIs. Use updatable_media_stubs instead.", + }, + { name: "java_device_for_host", fs: map[string][]byte{ "Blueprints": []byte(` diff --git a/cc/config/clang.go b/cc/config/clang.go index 08c638d00..70a077478 100644 --- a/cc/config/clang.go +++ b/cc/config/clang.go @@ -97,9 +97,12 @@ func init() { pctx.StaticVariable("ClangExtraCflags", strings.Join([]string{ "-D__compiler_offsetof=__builtin_offsetof", - // Make implicit fallthrough an error in the future. + // Emit address-significance table which allows linker to perform safe ICF. Clang does + // not emit the table by default on Android since NDK still uses GNU binutils. + "-faddrsig", + + // -Wimplicit-fallthrough is not enabled by -Wall. "-Wimplicit-fallthrough", - "-Wno-error=implicit-fallthrough", // Help catch common 32/64-bit errors. "-Werror=int-conversion", @@ -164,11 +167,6 @@ func init() { "-Wno-tautological-unsigned-enum-zero-compare", "-Wno-tautological-unsigned-zero-compare", - // http://b/72330874 Disable -Wenum-compare until the instances detected by this new - // warning are fixed. - "-Wno-enum-compare", - "-Wno-enum-compare-switch", - // Disable c++98-specific warning since Android is not concerned with C++98 // compatibility. "-Wno-c++98-compat-extra-semi", @@ -181,9 +179,11 @@ func init() { "-Wno-string-plus-int", }, " ")) - // Extra cflags for projects under external/ directory + // Extra cflags for projects under external/ directory to disable warnings that are infeasible + // to fix in all the external projects and their upstream repos. pctx.StaticVariable("ClangExtraExternalCflags", strings.Join([]string{ - // TODO(yikong): Move -Wno flags here + "-Wno-enum-compare", + "-Wno-enum-compare-switch", // http://b/72331524 Allow null pointer arithmetic until the instances detected by // this new warning are fixed. diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go index d6999c570..9f40e33ef 100644 --- a/cmd/soong_ui/main.go +++ b/cmd/soong_ui/main.go @@ -132,6 +132,11 @@ func main() { } } + // Fix up the source tree due to a repo bug where it doesn't remove + // linkfiles that have been removed + fixBadDanglingLink(buildCtx, "hardware/qcom/sdm710/Android.bp") + fixBadDanglingLink(buildCtx, "hardware/qcom/sdm710/Android.mk") + f := build.NewSourceFinder(buildCtx, config) defer f.Shutdown() build.FindSources(buildCtx, config, f) @@ -160,6 +165,20 @@ func main() { } } +func fixBadDanglingLink(ctx build.Context, name string) { + _, err := os.Lstat(name) + if err != nil { + return + } + _, err = os.Stat(name) + if os.IsNotExist(err) { + err = os.Remove(name) + if err != nil { + ctx.Fatalf("Failed to remove dangling link %q: %v", name, err) + } + } +} + func dumpVar(ctx build.Context, config build.Config, args []string) { flags := flag.NewFlagSet("dumpvar", flag.ExitOnError) flags.Usage = func() { diff --git a/java/config/config.go b/java/config/config.go index 2762a4d84..6495222ce 100644 --- a/java/config/config.go +++ b/java/config/config.go @@ -29,7 +29,7 @@ var ( DefaultBootclasspathLibraries = []string{"core.platform.api.stubs", "core-lambda-stubs"} DefaultSystemModules = "core-platform-api-stubs-system-modules" - DefaultLibraries = []string{"ext", "framework"} + DefaultLibraries = []string{"ext", "framework", "updatable_media_stubs"} DefaultLambdaStubsLibrary = "core-lambda-stubs" SdkLambdaStubsPath = "prebuilts/sdk/tools/core-lambda-stubs.jar" @@ -43,6 +43,7 @@ var ( "android.car7", "core-oj", "core-libart", + "updatable-media", } ) diff --git a/java/java_test.go b/java/java_test.go index 952da1154..3857ba848 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -906,7 +906,7 @@ func TestPatchModule(t *testing.T) { checkPatchModuleFlag(t, ctx, "foo", "") expected := "java.base=.:" + buildDir checkPatchModuleFlag(t, ctx, "bar", expected) - expected = "java.base=" + strings.Join([]string{".", buildDir, moduleToPath("ext"), moduleToPath("framework")}, ":") + expected = "java.base=" + strings.Join([]string{".", buildDir, moduleToPath("ext"), moduleToPath("framework"), moduleToPath("updatable_media_stubs")}, ":") checkPatchModuleFlag(t, ctx, "baz", expected) }) } diff --git a/java/sdk_test.go b/java/sdk_test.go index 6924e2654..a11ea2f7f 100644 --- a/java/sdk_test.go +++ b/java/sdk_test.go @@ -39,14 +39,14 @@ var classpathTestcases = []struct { name: "default", bootclasspath: []string{"core.platform.api.stubs", "core-lambda-stubs"}, system: "core-platform-api-stubs-system-modules", - classpath: []string{"ext", "framework"}, + classpath: []string{"ext", "framework", "updatable_media_stubs"}, }, { name: "blank sdk version", properties: `sdk_version: "",`, bootclasspath: []string{"core.platform.api.stubs", "core-lambda-stubs"}, system: "core-platform-api-stubs-system-modules", - classpath: []string{"ext", "framework"}, + classpath: []string{"ext", "framework", "updatable_media_stubs"}, }, { diff --git a/java/testing.go b/java/testing.go index 6febfa1d3..713eca1a3 100644 --- a/java/testing.go +++ b/java/testing.go @@ -40,6 +40,7 @@ func GatherRequiredDepsForTest() string { "core-lambda-stubs", "framework", "ext", + "updatable_media_stubs", "android_stubs_current", "android_system_stubs_current", "android_test_stubs_current", |