diff options
| -rw-r--r-- | android/Android.bp | 1 | ||||
| -rw-r--r-- | android/allowlists/allowlists.go | 1 | ||||
| -rw-r--r-- | android/makefile_goal.go | 98 | ||||
| -rw-r--r-- | android/neverallow.go | 15 | ||||
| -rw-r--r-- | android/neverallow_test.go | 59 | ||||
| -rw-r--r-- | apex/apex_singleton.go | 6 | ||||
| -rw-r--r-- | apex/apex_test.go | 87 | ||||
| -rw-r--r-- | apex/builder.go | 5 | ||||
| -rw-r--r-- | apex/testing.go | 1 | ||||
| -rw-r--r-- | fuzz/fuzz_common.go | 2 | ||||
| -rw-r--r-- | licenses/Android.bp | 5 | ||||
| -rw-r--r-- | ui/build/config.go | 3 |
12 files changed, 102 insertions, 181 deletions
diff --git a/android/Android.bp b/android/Android.bp index 29af75850..118087db7 100644 --- a/android/Android.bp +++ b/android/Android.bp @@ -61,7 +61,6 @@ bootstrap_go_package { "license_metadata.go", "license_sdk_member.go", "licenses.go", - "makefile_goal.go", "makevars.go", "metrics.go", "module.go", diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go index 67ca8ecf0..a4df34c3f 100644 --- a/android/allowlists/allowlists.go +++ b/android/allowlists/allowlists.go @@ -291,6 +291,7 @@ var ( "packages/modules/Gki/libkver": Bp2BuildDefaultTrue, "packages/modules/NetworkStack/common/captiveportal": Bp2BuildDefaultTrue, "packages/modules/NeuralNetworks/apex": Bp2BuildDefaultTrue, + "packages/modules/NeuralNetworks/apex/testing": Bp2BuildDefaultTrue, "packages/providers/MediaProvider/tools/dialogs": Bp2BuildDefaultFalse, // TODO(b/242834374) "packages/screensavers/Basic": Bp2BuildDefaultTrue, "packages/services/Car/tests/SampleRearViewCamera": Bp2BuildDefaultFalse, // TODO(b/242834321) diff --git a/android/makefile_goal.go b/android/makefile_goal.go deleted file mode 100644 index 07354a648..000000000 --- a/android/makefile_goal.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2020 Google Inc. All rights reserved. -// -// 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. - -package android - -import ( - "fmt" - "io" - "path/filepath" - - "github.com/google/blueprint/proptools" -) - -func init() { - RegisterModuleType("makefile_goal", MakefileGoalFactory) -} - -type makefileGoalProperties struct { - // Sources. - - // Makefile goal output file path, relative to PRODUCT_OUT. - Product_out_path *string -} - -type makefileGoal struct { - ModuleBase - - properties makefileGoalProperties - - // Destination. Output file path of this module. - outputFilePath OutputPath -} - -var _ AndroidMkEntriesProvider = (*makefileGoal)(nil) -var _ OutputFileProducer = (*makefileGoal)(nil) - -// Input file of this makefile_goal module. Nil if none specified. May use variable names in makefiles. -func (p *makefileGoal) inputPath() *string { - if p.properties.Product_out_path != nil { - return proptools.StringPtr(filepath.Join("$(PRODUCT_OUT)", proptools.String(p.properties.Product_out_path))) - } - return nil -} - -// OutputFileProducer -func (p *makefileGoal) OutputFiles(tag string) (Paths, error) { - if tag != "" { - return nil, fmt.Errorf("unsupported tag %q", tag) - } - return Paths{p.outputFilePath}, nil -} - -// AndroidMkEntriesProvider -func (p *makefileGoal) DepsMutator(ctx BottomUpMutatorContext) { - if p.inputPath() == nil { - ctx.PropertyErrorf("product_out_path", "Path relative to PRODUCT_OUT required") - } -} - -func (p *makefileGoal) GenerateAndroidBuildActions(ctx ModuleContext) { - filename := filepath.Base(proptools.String(p.inputPath())) - p.outputFilePath = PathForModuleOut(ctx, filename).OutputPath - - ctx.InstallFile(PathForModuleInstall(ctx, "etc"), ctx.ModuleName(), p.outputFilePath) -} - -func (p *makefileGoal) AndroidMkEntries() []AndroidMkEntries { - return []AndroidMkEntries{AndroidMkEntries{ - Class: "ETC", - OutputFile: OptionalPathForPath(p.outputFilePath), - ExtraFooters: []AndroidMkExtraFootersFunc{ - func(w io.Writer, name, prefix, moduleDir string) { - // Can't use Cp because inputPath() is not a valid Path. - fmt.Fprintf(w, "$(eval $(call copy-one-file,%s,%s))\n", proptools.String(p.inputPath()), p.outputFilePath) - }, - }, - }} -} - -// Import a Makefile goal to Soong by copying the file built by -// the goal to a path visible to Soong. This rule only works on boot images. -func MakefileGoalFactory() Module { - module := &makefileGoal{} - module.AddProperties(&module.properties) - InitAndroidModule(module) - return module -} diff --git a/android/neverallow.go b/android/neverallow.go index 2139c3c3e..5b5e61328 100644 --- a/android/neverallow.go +++ b/android/neverallow.go @@ -55,7 +55,6 @@ func init() { AddNeverAllowRules(createJavaDeviceForHostRules()...) AddNeverAllowRules(createCcSdkVariantRules()...) AddNeverAllowRules(createUncompressDexRules()...) - AddNeverAllowRules(createMakefileGoalRules()...) AddNeverAllowRules(createInitFirstStageRules()...) AddNeverAllowRules(createProhibitFrameworkAccessRules()...) AddNeverAllowRules(createBp2BuildRule()) @@ -236,20 +235,6 @@ func createUncompressDexRules() []Rule { } } -func createMakefileGoalRules() []Rule { - allowlist := []string{ - // libwifi_hal uses makefile_goal for its dependencies - "frameworks/opt/net/wifi/libwifi_hal", - } - return []Rule{ - NeverAllow(). - ModuleType("makefile_goal"). - WithoutMatcher("product_out_path", Regexp("^boot[0-9a-zA-Z.-]*[.]img$")). - NotIn(allowlist...). - Because("Only boot images may be imported as a makefile goal if not in allowed projects"), - } -} - func createInitFirstStageRules() []Rule { return []Rule{ NeverAllow(). diff --git a/android/neverallow_test.go b/android/neverallow_test.go index 5f5f9a193..ddd982d15 100644 --- a/android/neverallow_test.go +++ b/android/neverallow_test.go @@ -313,45 +313,6 @@ var neverallowTests = []struct { "module \"outside_art_libraries\": violates neverallow", }, }, - { - name: "disallowed makefile_goal", - fs: map[string][]byte{ - "Android.bp": []byte(` - makefile_goal { - name: "foo", - product_out_path: "boot/trap.img" - } - `), - }, - expectedErrors: []string{ - "Only boot images.* may be imported as a makefile goal", - }, - }, - { - name: "disallowed makefile_goal outside external", - fs: map[string][]byte{ - "project/Android.bp": []byte(` - makefile_goal { - name: "foo", - product_out_path: "obj/EXE/foo", - } - `), - }, - expectedErrors: []string{ - "not in allowed projects", - }, - }, - { - name: "allow makefile_goal within external", - fs: map[string][]byte{ - "frameworks/opt/net/wifi/libwifi_hal/Android.bp": []byte(` - makefile_goal { - name: "foo", - product_out_path: "obj/EXE/foo", - } - `), - }, - }, // Tests for the rule prohibiting the use of framework { name: "prohibit framework", @@ -391,7 +352,6 @@ var prepareForNeverAllowTest = GroupFixturePreparers( ctx.RegisterModuleType("java_library", newMockJavaLibraryModule) ctx.RegisterModuleType("java_library_host", newMockJavaLibraryModule) ctx.RegisterModuleType("java_device_for_host", newMockJavaLibraryModule) - ctx.RegisterModuleType("makefile_goal", newMockMakefileGoalModule) }), ) @@ -489,22 +449,3 @@ func newMockJavaLibraryModule() Module { func (p *mockJavaLibraryModule) GenerateAndroidBuildActions(ModuleContext) { } - -type mockMakefileGoalProperties struct { - Product_out_path *string -} - -type mockMakefileGoalModule struct { - ModuleBase - properties mockMakefileGoalProperties -} - -func newMockMakefileGoalModule() Module { - m := &mockMakefileGoalModule{} - m.AddProperties(&m.properties) - InitAndroidModule(m) - return m -} - -func (p *mockMakefileGoalModule) GenerateAndroidBuildActions(ModuleContext) { -} diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go index 158194937..ebc35cf5c 100644 --- a/apex/apex_singleton.go +++ b/apex/apex_singleton.go @@ -23,7 +23,11 @@ import ( ) func init() { - android.RegisterSingletonType("apex_depsinfo_singleton", apexDepsInfoSingletonFactory) + registerApexDepsInfoComponents(android.InitRegistrationContext) +} + +func registerApexDepsInfoComponents(ctx android.RegistrationContext) { + ctx.RegisterSingletonType("apex_depsinfo_singleton", apexDepsInfoSingletonFactory) } type apexDepsInfoSingleton struct { diff --git a/apex/apex_test.go b/apex/apex_test.go index d08d2466e..31b7ef7ff 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -1980,6 +1980,93 @@ func TestApexMinSdkVersion_InVendorApex(t *testing.T) { android.AssertStringDoesContain(t, "cflags", cflags, "-target aarch64-linux-android29") } +func TestTrackAllowedDeps(t *testing.T) { + ctx := testApex(t, ` + apex { + name: "myapex", + key: "myapex.key", + updatable: true, + native_shared_libs: [ + "mylib", + "yourlib", + ], + min_sdk_version: "29", + } + + apex { + name: "myapex2", + key: "myapex.key", + updatable: false, + native_shared_libs: ["yourlib"], + } + + apex_key { + name: "myapex.key", + public_key: "testkey.avbpubkey", + private_key: "testkey.pem", + } + + cc_library { + name: "mylib", + srcs: ["mylib.cpp"], + shared_libs: ["libbar"], + min_sdk_version: "29", + apex_available: ["myapex"], + } + + cc_library { + name: "libbar", + stubs: { versions: ["29", "30"] }, + } + + cc_library { + name: "yourlib", + srcs: ["mylib.cpp"], + min_sdk_version: "29", + apex_available: ["myapex", "myapex2", "//apex_available:platform"], + } + `, withFiles(android.MockFS{ + "packages/modules/common/build/allowed_deps.txt": nil, + })) + + depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton") + inputs := depsinfo.Rule("generateApexDepsInfoFilesRule").BuildParams.Inputs.Strings() + android.AssertStringListContains(t, "updatable myapex should generate depsinfo file", inputs, + "out/soong/.intermediates/myapex/android_common_myapex_image/depsinfo/flatlist.txt") + android.AssertStringListDoesNotContain(t, "non-updatable myapex2 should not generate depsinfo file", inputs, + "out/soong/.intermediates/myapex2/android_common_myapex2_image/depsinfo/flatlist.txt") + + myapex := ctx.ModuleForTests("myapex", "android_common_myapex_image") + flatlist := strings.Split(myapex.Output("depsinfo/flatlist.txt").BuildParams.Args["content"], "\\n") + android.AssertStringListContains(t, "deps with stubs should be tracked in depsinfo as external dep", + flatlist, "libbar(minSdkVersion:(no version)) (external)") + android.AssertStringListDoesNotContain(t, "do not track if not available for platform", + flatlist, "mylib:(minSdkVersion:29)") + android.AssertStringListContains(t, "track platform-available lib", + flatlist, "yourlib(minSdkVersion:29)") +} + +func TestTrackAllowedDeps_SkipWithoutAllowedDepsTxt(t *testing.T) { + ctx := testApex(t, ` + apex { + name: "myapex", + key: "myapex.key", + updatable: true, + min_sdk_version: "29", + } + + apex_key { + name: "myapex.key", + public_key: "testkey.avbpubkey", + private_key: "testkey.pem", + } + `) + depsinfo := ctx.SingletonForTests("apex_depsinfo_singleton") + if nil != depsinfo.MaybeRule("generateApexDepsInfoFilesRule").Output { + t.Error("apex_depsinfo_singleton shouldn't run when allowed_deps.txt doesn't exist") + } +} + func TestPlatformUsesLatestStubsFromApexes(t *testing.T) { ctx := testApex(t, ` apex { diff --git a/apex/builder.go b/apex/builder.go index 2efdf1e7b..7c6522d1d 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -231,7 +231,7 @@ var ( apexSepolicyTestsRule = pctx.StaticRule("apexSepolicyTestsRule", blueprint.RuleParams{ Command: `${deapexer} --debugfs_path ${debugfs_static} list -Z ${in} > ${out}.fc` + - `&& ${apex_sepolicy_tests} -f ${out}.fc && touch ${out}`, + ` && ${apex_sepolicy_tests} -f ${out}.fc && touch ${out}`, CommandDeps: []string{"${apex_sepolicy_tests}", "${deapexer}", "${debugfs_static}"}, Description: "run apex_sepolicy_tests", }) @@ -872,7 +872,8 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) { args["outCommaList"] = signedOutputFile.String() } var validations android.Paths - if suffix == imageApexSuffix { + // TODO(b/279688635) deapexer supports [ext4] + if suffix == imageApexSuffix && ext4 == a.payloadFsType { validations = append(validations, runApexSepolicyTests(ctx, unsignedOutputFile.OutputPath)) } ctx.Build(pctx, android.BuildParams{ diff --git a/apex/testing.go b/apex/testing.go index 69bd73e5d..3b200f05b 100644 --- a/apex/testing.go +++ b/apex/testing.go @@ -19,6 +19,7 @@ import "android/soong/android" var PrepareForTestWithApexBuildComponents = android.GroupFixturePreparers( android.FixtureRegisterWithContext(registerApexBuildComponents), android.FixtureRegisterWithContext(registerApexKeyBuildComponents), + android.FixtureRegisterWithContext(registerApexDepsInfoComponents), // Additional files needed in tests that disallow non-existent source files. // This includes files that are needed by all, or at least most, instances of an apex module type. android.MockFS{ diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go index 79d241279..f76529d31 100644 --- a/fuzz/fuzz_common.go +++ b/fuzz/fuzz_common.go @@ -339,7 +339,7 @@ type FuzzConfig struct { // List of modules for monitoring coverage drops in directories (e.g. "libicu") Target_modules []string `json:"target_modules,omitempty"` // Specifies a bug assignee to replace default ISE assignment - Assignee string `json:"assignee,omitempty"` + Triage_assignee string `json:"triage_assignee,omitempty"` } type FuzzFrameworks struct { diff --git a/licenses/Android.bp b/licenses/Android.bp index 7267cf374..dee72ed42 100644 --- a/licenses/Android.bp +++ b/licenses/Android.bp @@ -923,7 +923,10 @@ license_kind { license_kind { name: "SPDX-license-identifier-Linux-syscall-note", // expanding visibility requires approval from an OSPO lawyer or pcounsel - visibility: ["//external/libbpf:__subpackages__"], + visibility: [ + "//external/libbpf:__subpackages__", + "//prebuilts/vsdk:__subpackages__", + ], conditions: ["permissive"], url: "https://spdx.org/licenses/Linux-syscall-note.html", } diff --git a/ui/build/config.go b/ui/build/config.go index 81ea69e86..2dda52a01 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -814,9 +814,6 @@ func (c *configImpl) parseArgs(ctx Context, args []string) { // by a previous build. c.skipConfig = true c.skipKati = true - } else if arg == "--skip-kati" { - // TODO: remove --skip-kati once module builds have been migrated to --song-only - c.skipKati = true } else if arg == "--soong-only" { c.skipKati = true c.skipKatiNinja = true |