diff options
58 files changed, 227 insertions, 2531 deletions
diff --git a/aidl_library/Android.bp b/aidl_library/Android.bp index 07472a492..3c386fb0f 100644 --- a/aidl_library/Android.bp +++ b/aidl_library/Android.bp @@ -20,6 +20,7 @@ bootstrap_go_package { name: "soong-aidl-library", pkgPath: "android/soong/aidl_library", deps: [ + "blueprint-depset", "soong-android", ], srcs: [ diff --git a/aidl_library/aidl_library.go b/aidl_library/aidl_library.go index 01415456d..1e0ab3056 100644 --- a/aidl_library/aidl_library.go +++ b/aidl_library/aidl_library.go @@ -17,6 +17,7 @@ package aidl_library import ( "android/soong/android" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" ) @@ -58,17 +59,17 @@ type AidlLibraryInfo struct { // The direct aidl files of the module Srcs android.Paths // The include dirs to the direct aidl files and those provided from transitive aidl_library deps - IncludeDirs android.DepSet[android.Path] + IncludeDirs depset.DepSet[android.Path] // The direct hdrs and hdrs from transitive deps - Hdrs android.DepSet[android.Path] + Hdrs depset.DepSet[android.Path] } // AidlLibraryProvider provides the srcs and the transitive include dirs var AidlLibraryProvider = blueprint.NewProvider[AidlLibraryInfo]() func (lib *AidlLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { - includeDirsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.PREORDER) - hdrsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.PREORDER) + includeDirsDepSetBuilder := depset.NewBuilder[android.Path](depset.PREORDER) + hdrsDepSetBuilder := depset.NewBuilder[android.Path](depset.PREORDER) if len(lib.properties.Srcs) == 0 && len(lib.properties.Hdrs) == 0 { ctx.ModuleErrorf("at least srcs or hdrs prop must be non-empty") @@ -100,15 +101,15 @@ func (lib *AidlLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { for _, dep := range ctx.GetDirectDepsWithTag(aidlLibraryTag) { if info, ok := android.OtherModuleProvider(ctx, dep, AidlLibraryProvider); ok { - includeDirsDepSetBuilder.Transitive(&info.IncludeDirs) - hdrsDepSetBuilder.Transitive(&info.Hdrs) + includeDirsDepSetBuilder.Transitive(info.IncludeDirs) + hdrsDepSetBuilder.Transitive(info.Hdrs) } } android.SetProvider(ctx, AidlLibraryProvider, AidlLibraryInfo{ Srcs: srcs, - IncludeDirs: *includeDirsDepSetBuilder.Build(), - Hdrs: *hdrsDepSetBuilder.Build(), + IncludeDirs: includeDirsDepSetBuilder.Build(), + Hdrs: hdrsDepSetBuilder.Build(), }) } diff --git a/android/Android.bp b/android/Android.bp index 3b5432687..87ac65789 100644 --- a/android/Android.bp +++ b/android/Android.bp @@ -8,6 +8,7 @@ bootstrap_go_package { deps: [ "blueprint", "blueprint-bootstrap", + "blueprint-depset", "blueprint-metrics", "sbox_proto", "soong", @@ -50,7 +51,6 @@ bootstrap_go_package { "deapexer.go", "defaults.go", "defs.go", - "depset_generic.go", "deptag.go", "dirgroup.go", "early_module_context.go", @@ -123,7 +123,6 @@ bootstrap_go_package { "configured_jars_test.go", "csuite_config_test.go", "defaults_test.go", - "depset_test.go", "deptag_test.go", "expand_test.go", "filegroup_test.go", diff --git a/android/depset_generic.go b/android/depset_generic.go deleted file mode 100644 index d04f88b5b..000000000 --- a/android/depset_generic.go +++ /dev/null @@ -1,226 +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" - - "github.com/google/blueprint" -) - -// DepSet is designed to be conceptually compatible with Bazel's depsets: -// https://docs.bazel.build/versions/master/skylark/depsets.html - -type DepSetOrder int - -const ( - PREORDER DepSetOrder = iota - POSTORDER - TOPOLOGICAL -) - -func (o DepSetOrder) String() string { - switch o { - case PREORDER: - return "PREORDER" - case POSTORDER: - return "POSTORDER" - case TOPOLOGICAL: - return "TOPOLOGICAL" - default: - panic(fmt.Errorf("Invalid DepSetOrder %d", o)) - } -} - -type depSettableType comparable - -// A DepSet efficiently stores a slice of an arbitrary type from transitive dependencies without -// copying. It is stored as a DAG of DepSet nodes, each of which has some direct contents and a list -// of dependency DepSet nodes. -// -// A DepSet has an order that will be used to walk the DAG when ToList() is called. The order -// can be POSTORDER, PREORDER, or TOPOLOGICAL. POSTORDER and PREORDER orders return a postordered -// or preordered left to right flattened list. TOPOLOGICAL returns a list that guarantees that -// elements of children are listed after all of their parents (unless there are duplicate direct -// elements in the DepSet or any of its transitive dependencies, in which case the ordering of the -// duplicated element is not guaranteed). -// -// A DepSet is created by NewDepSet or NewDepSetBuilder.Build from the slice for direct contents -// and the *DepSets of dependencies. A DepSet is immutable once created. -type DepSet[T depSettableType] struct { - preorder bool - reverse bool - order DepSetOrder - direct []T - transitive []*DepSet[T] -} - -type depSetGob[T depSettableType] struct { - Preorder bool - Reverse bool - Order DepSetOrder - Direct []T - Transitive []*DepSet[T] -} - -func (d *DepSet[T]) ToGob() *depSetGob[T] { - return &depSetGob[T]{ - Preorder: d.preorder, - Reverse: d.reverse, - Order: d.order, - Direct: d.direct, - Transitive: d.transitive, - } -} - -func (d *DepSet[T]) FromGob(data *depSetGob[T]) { - d.preorder = data.Preorder - d.reverse = data.Reverse - d.order = data.Order - d.direct = data.Direct - d.transitive = data.Transitive -} - -func (d *DepSet[T]) GobEncode() ([]byte, error) { - return blueprint.CustomGobEncode[depSetGob[T]](d) -} - -func (d *DepSet[T]) GobDecode(data []byte) error { - return blueprint.CustomGobDecode[depSetGob[T]](data, d) -} - -// NewDepSet returns an immutable DepSet with the given order, direct and transitive contents. -func NewDepSet[T depSettableType](order DepSetOrder, direct []T, transitive []*DepSet[T]) *DepSet[T] { - var directCopy []T - var transitiveCopy []*DepSet[T] - for _, t := range transitive { - if t.order != order { - panic(fmt.Errorf("incompatible order, new DepSet is %s but transitive DepSet is %s", - order, t.order)) - } - } - - if order == TOPOLOGICAL { - // TOPOLOGICAL is implemented as a postorder traversal followed by reversing the output. - // Pre-reverse the inputs here so their order is maintained in the output. - directCopy = ReverseSlice(direct) - transitiveCopy = ReverseSlice(transitive) - } else { - directCopy = append([]T(nil), direct...) - transitiveCopy = append([]*DepSet[T](nil), transitive...) - } - - return &DepSet[T]{ - preorder: order == PREORDER, - reverse: order == TOPOLOGICAL, - order: order, - direct: directCopy, - transitive: transitiveCopy, - } -} - -// DepSetBuilder is used to create an immutable DepSet. -type DepSetBuilder[T depSettableType] struct { - order DepSetOrder - direct []T - transitive []*DepSet[T] -} - -// NewDepSetBuilder returns a DepSetBuilder to create an immutable DepSet with the given order and -// type, represented by a slice of type that will be in the DepSet. -func NewDepSetBuilder[T depSettableType](order DepSetOrder) *DepSetBuilder[T] { - return &DepSetBuilder[T]{ - order: order, - } -} - -// DirectSlice adds direct contents to the DepSet being built by a DepSetBuilder. Newly added direct -// contents are to the right of any existing direct contents. -func (b *DepSetBuilder[T]) DirectSlice(direct []T) *DepSetBuilder[T] { - b.direct = append(b.direct, direct...) - return b -} - -// Direct adds direct contents to the DepSet being built by a DepSetBuilder. Newly added direct -// contents are to the right of any existing direct contents. -func (b *DepSetBuilder[T]) Direct(direct ...T) *DepSetBuilder[T] { - b.direct = append(b.direct, direct...) - return b -} - -// Transitive adds transitive contents to the DepSet being built by a DepSetBuilder. Newly added -// transitive contents are to the right of any existing transitive contents. -func (b *DepSetBuilder[T]) Transitive(transitive ...*DepSet[T]) *DepSetBuilder[T] { - for _, t := range transitive { - if t.order != b.order { - panic(fmt.Errorf("incompatible order, new DepSet is %s but transitive DepSet is %s", - b.order, t.order)) - } - } - b.transitive = append(b.transitive, transitive...) - return b -} - -// Returns the DepSet being built by this DepSetBuilder. The DepSetBuilder retains its contents -// for creating more depSets. -func (b *DepSetBuilder[T]) Build() *DepSet[T] { - return NewDepSet(b.order, b.direct, b.transitive) -} - -// walk calls the visit method in depth-first order on a DepSet, preordered if d.preorder is set, -// otherwise postordered. -func (d *DepSet[T]) walk(visit func([]T)) { - visited := make(map[*DepSet[T]]bool) - - var dfs func(d *DepSet[T]) - dfs = func(d *DepSet[T]) { - visited[d] = true - if d.preorder { - visit(d.direct) - } - for _, dep := range d.transitive { - if !visited[dep] { - dfs(dep) - } - } - - if !d.preorder { - visit(d.direct) - } - } - - dfs(d) -} - -// ToList returns the DepSet flattened to a list. The order in the list is based on the order -// of the DepSet. POSTORDER and PREORDER orders return a postordered or preordered left to right -// flattened list. TOPOLOGICAL returns a list that guarantees that elements of children are listed -// after all of their parents (unless there are duplicate direct elements in the DepSet or any of -// its transitive dependencies, in which case the ordering of the duplicated element is not -// guaranteed). -func (d *DepSet[T]) ToList() []T { - if d == nil { - return nil - } - var list []T - d.walk(func(paths []T) { - list = append(list, paths...) - }) - list = firstUniqueInPlace(list) - if d.reverse { - ReverseSliceInPlace(list) - } - return list -} diff --git a/android/depset_test.go b/android/depset_test.go deleted file mode 100644 index 376dffad1..000000000 --- a/android/depset_test.go +++ /dev/null @@ -1,295 +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" - "reflect" - "strings" - "testing" -) - -func ExampleDepSet_ToList_postordered() { - a := NewDepSetBuilder[Path](POSTORDER).Direct(PathForTesting("a")).Build() - b := NewDepSetBuilder[Path](POSTORDER).Direct(PathForTesting("b")).Transitive(a).Build() - c := NewDepSetBuilder[Path](POSTORDER).Direct(PathForTesting("c")).Transitive(a).Build() - d := NewDepSetBuilder[Path](POSTORDER).Direct(PathForTesting("d")).Transitive(b, c).Build() - - fmt.Println(Paths(d.ToList()).Strings()) - // Output: [a b c d] -} - -func ExampleDepSet_ToList_preordered() { - a := NewDepSetBuilder[Path](PREORDER).Direct(PathForTesting("a")).Build() - b := NewDepSetBuilder[Path](PREORDER).Direct(PathForTesting("b")).Transitive(a).Build() - c := NewDepSetBuilder[Path](PREORDER).Direct(PathForTesting("c")).Transitive(a).Build() - d := NewDepSetBuilder[Path](PREORDER).Direct(PathForTesting("d")).Transitive(b, c).Build() - - fmt.Println(Paths(d.ToList()).Strings()) - // Output: [d b a c] -} - -func ExampleDepSet_ToList_topological() { - a := NewDepSetBuilder[Path](TOPOLOGICAL).Direct(PathForTesting("a")).Build() - b := NewDepSetBuilder[Path](TOPOLOGICAL).Direct(PathForTesting("b")).Transitive(a).Build() - c := NewDepSetBuilder[Path](TOPOLOGICAL).Direct(PathForTesting("c")).Transitive(a).Build() - d := NewDepSetBuilder[Path](TOPOLOGICAL).Direct(PathForTesting("d")).Transitive(b, c).Build() - - fmt.Println(Paths(d.ToList()).Strings()) - // Output: [d b c a] -} - -// Tests based on Bazel's ExpanderTestBase.java to ensure compatibility -// https://github.com/bazelbuild/bazel/blob/master/src/test/java/com/google/devtools/build/lib/collect/nestedset/ExpanderTestBase.java -func TestDepSet(t *testing.T) { - a := PathForTesting("a") - b := PathForTesting("b") - c := PathForTesting("c") - c2 := PathForTesting("c2") - d := PathForTesting("d") - e := PathForTesting("e") - - tests := []struct { - name string - depSet func(t *testing.T, order DepSetOrder) *DepSet[Path] - postorder, preorder, topological []string - }{ - { - name: "simple", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - return NewDepSet[Path](order, Paths{c, a, b}, nil) - }, - postorder: []string{"c", "a", "b"}, - preorder: []string{"c", "a", "b"}, - topological: []string{"c", "a", "b"}, - }, - { - name: "simpleNoDuplicates", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - return NewDepSet[Path](order, Paths{c, a, a, a, b}, nil) - }, - postorder: []string{"c", "a", "b"}, - preorder: []string{"c", "a", "b"}, - topological: []string{"c", "a", "b"}, - }, - { - name: "nesting", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - subset := NewDepSet[Path](order, Paths{c, a, e}, nil) - return NewDepSet[Path](order, Paths{b, d}, []*DepSet[Path]{subset}) - }, - postorder: []string{"c", "a", "e", "b", "d"}, - preorder: []string{"b", "d", "c", "a", "e"}, - topological: []string{"b", "d", "c", "a", "e"}, - }, - { - name: "builderReuse", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - assertEquals := func(t *testing.T, w, g Paths) { - t.Helper() - if !reflect.DeepEqual(w, g) { - t.Errorf("want %q, got %q", w, g) - } - } - builder := NewDepSetBuilder[Path](order) - assertEquals(t, nil, builder.Build().ToList()) - - builder.Direct(b) - assertEquals(t, Paths{b}, builder.Build().ToList()) - - builder.Direct(d) - assertEquals(t, Paths{b, d}, builder.Build().ToList()) - - child := NewDepSetBuilder[Path](order).Direct(c, a, e).Build() - builder.Transitive(child) - return builder.Build() - }, - postorder: []string{"c", "a", "e", "b", "d"}, - preorder: []string{"b", "d", "c", "a", "e"}, - topological: []string{"b", "d", "c", "a", "e"}, - }, - { - name: "builderChaining", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - return NewDepSetBuilder[Path](order).Direct(b).Direct(d). - Transitive(NewDepSetBuilder[Path](order).Direct(c, a, e).Build()).Build() - }, - postorder: []string{"c", "a", "e", "b", "d"}, - preorder: []string{"b", "d", "c", "a", "e"}, - topological: []string{"b", "d", "c", "a", "e"}, - }, - { - name: "transitiveDepsHandledSeparately", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - subset := NewDepSetBuilder[Path](order).Direct(c, a, e).Build() - builder := NewDepSetBuilder[Path](order) - // The fact that we add the transitive subset between the Direct(b) and Direct(d) - // calls should not change the result. - builder.Direct(b) - builder.Transitive(subset) - builder.Direct(d) - return builder.Build() - }, - postorder: []string{"c", "a", "e", "b", "d"}, - preorder: []string{"b", "d", "c", "a", "e"}, - topological: []string{"b", "d", "c", "a", "e"}, - }, - { - name: "nestingNoDuplicates", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - subset := NewDepSetBuilder[Path](order).Direct(c, a, e).Build() - return NewDepSetBuilder[Path](order).Direct(b, d, e).Transitive(subset).Build() - }, - postorder: []string{"c", "a", "e", "b", "d"}, - preorder: []string{"b", "d", "e", "c", "a"}, - topological: []string{"b", "d", "c", "a", "e"}, - }, - { - name: "chain", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - c := NewDepSetBuilder[Path](order).Direct(c).Build() - b := NewDepSetBuilder[Path](order).Direct(b).Transitive(c).Build() - a := NewDepSetBuilder[Path](order).Direct(a).Transitive(b).Build() - - return a - }, - postorder: []string{"c", "b", "a"}, - preorder: []string{"a", "b", "c"}, - topological: []string{"a", "b", "c"}, - }, - { - name: "diamond", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - d := NewDepSetBuilder[Path](order).Direct(d).Build() - c := NewDepSetBuilder[Path](order).Direct(c).Transitive(d).Build() - b := NewDepSetBuilder[Path](order).Direct(b).Transitive(d).Build() - a := NewDepSetBuilder[Path](order).Direct(a).Transitive(b).Transitive(c).Build() - - return a - }, - postorder: []string{"d", "b", "c", "a"}, - preorder: []string{"a", "b", "d", "c"}, - topological: []string{"a", "b", "c", "d"}, - }, - { - name: "extendedDiamond", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - d := NewDepSetBuilder[Path](order).Direct(d).Build() - e := NewDepSetBuilder[Path](order).Direct(e).Build() - b := NewDepSetBuilder[Path](order).Direct(b).Transitive(d).Transitive(e).Build() - c := NewDepSetBuilder[Path](order).Direct(c).Transitive(e).Transitive(d).Build() - a := NewDepSetBuilder[Path](order).Direct(a).Transitive(b).Transitive(c).Build() - return a - }, - postorder: []string{"d", "e", "b", "c", "a"}, - preorder: []string{"a", "b", "d", "e", "c"}, - topological: []string{"a", "b", "c", "e", "d"}, - }, - { - name: "extendedDiamondRightArm", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - d := NewDepSetBuilder[Path](order).Direct(d).Build() - e := NewDepSetBuilder[Path](order).Direct(e).Build() - b := NewDepSetBuilder[Path](order).Direct(b).Transitive(d).Transitive(e).Build() - c2 := NewDepSetBuilder[Path](order).Direct(c2).Transitive(e).Transitive(d).Build() - c := NewDepSetBuilder[Path](order).Direct(c).Transitive(c2).Build() - a := NewDepSetBuilder[Path](order).Direct(a).Transitive(b).Transitive(c).Build() - return a - }, - postorder: []string{"d", "e", "b", "c2", "c", "a"}, - preorder: []string{"a", "b", "d", "e", "c", "c2"}, - topological: []string{"a", "b", "c", "c2", "e", "d"}, - }, - { - name: "orderConflict", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - child1 := NewDepSetBuilder[Path](order).Direct(a, b).Build() - child2 := NewDepSetBuilder[Path](order).Direct(b, a).Build() - parent := NewDepSetBuilder[Path](order).Transitive(child1).Transitive(child2).Build() - return parent - }, - postorder: []string{"a", "b"}, - preorder: []string{"a", "b"}, - topological: []string{"b", "a"}, - }, - { - name: "orderConflictNested", - depSet: func(t *testing.T, order DepSetOrder) *DepSet[Path] { - a := NewDepSetBuilder[Path](order).Direct(a).Build() - b := NewDepSetBuilder[Path](order).Direct(b).Build() - child1 := NewDepSetBuilder[Path](order).Transitive(a).Transitive(b).Build() - child2 := NewDepSetBuilder[Path](order).Transitive(b).Transitive(a).Build() - parent := NewDepSetBuilder[Path](order).Transitive(child1).Transitive(child2).Build() - return parent - }, - postorder: []string{"a", "b"}, - preorder: []string{"a", "b"}, - topological: []string{"b", "a"}, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - t.Run("postorder", func(t *testing.T) { - depSet := tt.depSet(t, POSTORDER) - if g, w := Paths(depSet.ToList()).Strings(), tt.postorder; !reflect.DeepEqual(g, w) { - t.Errorf("expected ToList() = %q, got %q", w, g) - } - }) - t.Run("preorder", func(t *testing.T) { - depSet := tt.depSet(t, PREORDER) - if g, w := Paths(depSet.ToList()).Strings(), tt.preorder; !reflect.DeepEqual(g, w) { - t.Errorf("expected ToList() = %q, got %q", w, g) - } - }) - t.Run("topological", func(t *testing.T) { - depSet := tt.depSet(t, TOPOLOGICAL) - if g, w := Paths(depSet.ToList()).Strings(), tt.topological; !reflect.DeepEqual(g, w) { - t.Errorf("expected ToList() = %q, got %q", w, g) - } - }) - }) - } -} - -func TestDepSetInvalidOrder(t *testing.T) { - orders := []DepSetOrder{POSTORDER, PREORDER, TOPOLOGICAL} - - run := func(t *testing.T, order1, order2 DepSetOrder) { - defer func() { - if r := recover(); r != nil { - if err, ok := r.(error); !ok { - t.Fatalf("expected panic error, got %v", err) - } else if !strings.Contains(err.Error(), "incompatible order") { - t.Fatalf("expected incompatible order error, got %v", err) - } - } - }() - NewDepSet(order1, nil, []*DepSet[Path]{NewDepSet[Path](order2, nil, nil)}) - t.Fatal("expected panic") - } - - for _, order1 := range orders { - t.Run(order1.String(), func(t *testing.T) { - for _, order2 := range orders { - t.Run(order2.String(), func(t *testing.T) { - if order1 != order2 { - run(t, order1, order2) - } - }) - } - }) - } -} diff --git a/android/license_metadata.go b/android/license_metadata.go index f92563862..3df36e674 100644 --- a/android/license_metadata.go +++ b/android/license_metadata.go @@ -15,6 +15,7 @@ package android import ( + "github.com/google/blueprint/depset" "sort" "strings" @@ -61,7 +62,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath) var allDepMetadataFiles Paths var allDepMetadataArgs []string var allDepOutputFiles Paths - var allDepMetadataDepSets []*DepSet[Path] + var allDepMetadataDepSets []depset.DepSet[Path] ctx.VisitDirectDeps(func(dep Module) { if !dep.Enabled(ctx) { @@ -133,7 +134,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath) JoinWithPrefix(proptools.NinjaAndShellEscapeListIncludingSpaces(base.commonProperties.Effective_license_text.Strings()), "-n ")) if isContainer { - transitiveDeps := Paths(NewDepSet[Path](TOPOLOGICAL, nil, allDepMetadataDepSets).ToList()) + transitiveDeps := Paths(depset.New[Path](depset.TOPOLOGICAL, nil, allDepMetadataDepSets).ToList()) args = append(args, JoinWithPrefix(proptools.NinjaAndShellEscapeListIncludingSpaces(transitiveDeps.Strings()), "-d ")) orderOnlyDeps = append(orderOnlyDeps, transitiveDeps...) @@ -176,7 +177,7 @@ func buildLicenseMetadata(ctx *moduleContext, licenseMetadataFile WritablePath) SetProvider(ctx, LicenseMetadataProvider, &LicenseMetadataInfo{ LicenseMetadataPath: licenseMetadataFile, - LicenseMetadataDepSet: NewDepSet(TOPOLOGICAL, Paths{licenseMetadataFile}, allDepMetadataDepSets), + LicenseMetadataDepSet: depset.New(depset.TOPOLOGICAL, Paths{licenseMetadataFile}, allDepMetadataDepSets), }) } @@ -204,7 +205,7 @@ var LicenseMetadataProvider = blueprint.NewProvider[*LicenseMetadataInfo]() // LicenseMetadataInfo stores the license metadata path for a module. type LicenseMetadataInfo struct { LicenseMetadataPath Path - LicenseMetadataDepSet *DepSet[Path] + LicenseMetadataDepSet depset.DepSet[Path] } // licenseAnnotationsFromTag returns the LicenseAnnotations for a tag (if any) converted into diff --git a/android/module.go b/android/module.go index e3dabcccc..ec0f44688 100644 --- a/android/module.go +++ b/android/module.go @@ -16,6 +16,7 @@ package android import ( "fmt" + "github.com/google/blueprint/depset" "net/url" "path/filepath" "reflect" @@ -1437,9 +1438,9 @@ func (m *ModuleBase) EffectiveLicenseFiles() Paths { // computeInstallDeps finds the installed paths of all dependencies that have a dependency // tag that is annotated as needing installation via the isInstallDepNeeded method. -func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]*DepSet[InstallPath], []*DepSet[PackagingSpec]) { - var installDeps []*DepSet[InstallPath] - var packagingSpecs []*DepSet[PackagingSpec] +func (m *ModuleBase) computeInstallDeps(ctx ModuleContext) ([]depset.DepSet[InstallPath], []depset.DepSet[PackagingSpec]) { + var installDeps []depset.DepSet[InstallPath] + var packagingSpecs []depset.DepSet[PackagingSpec] ctx.VisitDirectDeps(func(dep Module) { if isInstallDepNeeded(dep, ctx.OtherModuleDependencyTag(dep)) { // Installation is still handled by Make, so anything hidden from Make is not @@ -1772,12 +1773,12 @@ type InstallFilesInfo struct { KatiInstalls katiInstalls KatiSymlinks katiInstalls TestData []DataPath - TransitivePackagingSpecs *DepSet[PackagingSpec] + TransitivePackagingSpecs depset.DepSet[PackagingSpec] LicenseMetadataFile WritablePath // The following fields are private before, make it private again once we have // better solution. - TransitiveInstallFiles *DepSet[InstallPath] + TransitiveInstallFiles depset.DepSet[InstallPath] // katiInitRcInstalls and katiVintfInstalls track the install rules created by Soong that are // allowed to have duplicates across modules and variants. KatiInitRcInstalls katiInstalls @@ -1843,7 +1844,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) // set the TransitiveInstallFiles to only the transitive dependencies to be used as the dependencies // of installed files of this module. It will be replaced by a depset including the installed // files of this module at the end for use by modules that depend on this one. - ctx.TransitiveInstallFiles = NewDepSet[InstallPath](TOPOLOGICAL, nil, dependencyInstallFiles) + ctx.TransitiveInstallFiles = depset.New[InstallPath](depset.TOPOLOGICAL, nil, dependencyInstallFiles) // Temporarily continue to call blueprintCtx.GetMissingDependencies() to maintain the previous behavior of never // reporting missing dependency errors in Blueprint when AllowMissingDependencies == true. @@ -2002,9 +2003,9 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext) } } - ctx.TransitiveInstallFiles = NewDepSet[InstallPath](TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles) + ctx.TransitiveInstallFiles = depset.New[InstallPath](depset.TOPOLOGICAL, ctx.installFiles, dependencyInstallFiles) installFiles.TransitiveInstallFiles = ctx.TransitiveInstallFiles - installFiles.TransitivePackagingSpecs = NewDepSet[PackagingSpec](TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs) + installFiles.TransitivePackagingSpecs = depset.New[PackagingSpec](depset.TOPOLOGICAL, ctx.packagingSpecs, dependencyPackagingSpecs) SetProvider(ctx, InstallFilesProvider, installFiles) buildLicenseMetadata(ctx, ctx.licenseMetadataFile) diff --git a/android/module_context.go b/android/module_context.go index 2bf2a8f00..9fa3a6211 100644 --- a/android/module_context.go +++ b/android/module_context.go @@ -16,6 +16,7 @@ package android import ( "fmt" + "github.com/google/blueprint/depset" "path" "path/filepath" "strings" @@ -261,7 +262,7 @@ type moduleContext struct { // the OutputFilesProvider in GenerateBuildActions outputFiles OutputFilesInfo - TransitiveInstallFiles *DepSet[InstallPath] + TransitiveInstallFiles depset.DepSet[InstallPath] // set of dependency module:location mappings used to populate the license metadata for // apex containers. diff --git a/cc/Android.bp b/cc/Android.bp index a5ad9ce9c..a7b6d8161 100644 --- a/cc/Android.bp +++ b/cc/Android.bp @@ -7,6 +7,7 @@ bootstrap_go_package { pkgPath: "android/soong/cc", deps: [ "blueprint", + "blueprint-depset", "blueprint-pathtools", "soong", "soong-aconfig", @@ -16,7 +17,6 @@ bootstrap_go_package { "soong-etc", "soong-fuzz", "soong-genrule", - "soong-testing", "soong-tradefed", ], srcs: [ @@ -24,9 +24,8 @@ import ( "strconv" "strings" - "android/soong/testing" - "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/aidl_library" @@ -170,7 +169,7 @@ type PathDeps struct { RustRlibDeps []RustRlibDep // Transitive static library dependencies of static libraries for use in ordering. - TranstiveStaticLibrariesForOrdering *android.DepSet[android.Path] + TranstiveStaticLibrariesForOrdering depset.DepSet[android.Path] // Paths to .o files Objs Objects @@ -2038,9 +2037,6 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { c.maybeUnhideFromMake() } - if c.testModule { - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) - } android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: deps.GeneratedSources.Strings()}) @@ -3382,19 +3378,17 @@ func ChooseStubOrImpl(ctx android.ModuleContext, dep android.Module) (SharedLibr // orderStaticModuleDeps rearranges the order of the static library dependencies of the module // to match the topological order of the dependency tree, including any static analogues of -// direct shared libraries. It returns the ordered static dependencies, and an android.DepSet +// direct shared libraries. It returns the ordered static dependencies, and a depset.DepSet // of the transitive dependencies. -func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLibraryInfo) (ordered android.Paths, transitive *android.DepSet[android.Path]) { - transitiveStaticLibsBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL) +func orderStaticModuleDeps(staticDeps []StaticLibraryInfo, sharedDeps []SharedLibraryInfo) (ordered android.Paths, transitive depset.DepSet[android.Path]) { + transitiveStaticLibsBuilder := depset.NewBuilder[android.Path](depset.TOPOLOGICAL) var staticPaths android.Paths for _, staticDep := range staticDeps { staticPaths = append(staticPaths, staticDep.StaticLibrary) transitiveStaticLibsBuilder.Transitive(staticDep.TransitiveStaticLibrariesForOrdering) } for _, sharedDep := range sharedDeps { - if sharedDep.TransitiveStaticLibrariesForOrdering != nil { - transitiveStaticLibsBuilder.Transitive(sharedDep.TransitiveStaticLibrariesForOrdering) - } + transitiveStaticLibsBuilder.Transitive(sharedDep.TransitiveStaticLibrariesForOrdering) } transitiveStaticLibs := transitiveStaticLibsBuilder.Build() diff --git a/cc/library.go b/cc/library.go index 988a7fa0b..91a09fac7 100644 --- a/cc/library.go +++ b/cc/library.go @@ -27,6 +27,7 @@ import ( "android/soong/android" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/pathtools" "github.com/google/blueprint/proptools" ) @@ -1017,7 +1018,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext, Objects: library.objects, WholeStaticLibsFromPrebuilts: library.wholeStaticLibsFromPrebuilts, - TransitiveStaticLibrariesForOrdering: android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL). + TransitiveStaticLibrariesForOrdering: depset.NewBuilder[android.Path](depset.TOPOLOGICAL). Direct(outputFile). Transitive(deps.TranstiveStaticLibrariesForOrdering). Build(), @@ -1182,7 +1183,7 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext, library.coverageOutputFile = transformCoverageFilesToZip(ctx, objs, library.getLibName(ctx)) library.linkSAbiDumpFiles(ctx, deps, objs, fileName, unstrippedOutputFile) - var transitiveStaticLibrariesForOrdering *android.DepSet[android.Path] + var transitiveStaticLibrariesForOrdering depset.DepSet[android.Path] if static := ctx.GetDirectDepsWithTag(staticVariantTag); len(static) > 0 { s, _ := android.OtherModuleProvider(ctx, static[0], StaticLibraryInfoProvider) transitiveStaticLibrariesForOrdering = s.TransitiveStaticLibrariesForOrdering diff --git a/cc/linkable.go b/cc/linkable.go index 1672366a7..cd33e2855 100644 --- a/cc/linkable.go +++ b/cc/linkable.go @@ -5,6 +5,7 @@ import ( "android/soong/fuzz" "github.com/google/blueprint" + "github.com/google/blueprint/depset" ) // PlatformSanitizeable is an interface for sanitizing platform modules. @@ -319,7 +320,7 @@ type SharedLibraryInfo struct { TableOfContents android.OptionalPath // should be obtained from static analogue - TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path] + TransitiveStaticLibrariesForOrdering depset.DepSet[android.Path] } var SharedLibraryInfoProvider = blueprint.NewProvider[SharedLibraryInfo]() @@ -361,7 +362,7 @@ type StaticLibraryInfo struct { // This isn't the actual transitive DepSet, shared library dependencies have been // converted into static library analogues. It is only used to order the static // library dependencies that were specified for the current module. - TransitiveStaticLibrariesForOrdering *android.DepSet[android.Path] + TransitiveStaticLibrariesForOrdering depset.DepSet[android.Path] } var StaticLibraryInfoProvider = blueprint.NewProvider[StaticLibraryInfo]() diff --git a/cc/prebuilt.go b/cc/prebuilt.go index 299fb5148..7c8729709 100644 --- a/cc/prebuilt.go +++ b/cc/prebuilt.go @@ -18,6 +18,7 @@ import ( "path/filepath" "strings" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/android" @@ -156,7 +157,7 @@ func (p *prebuiltLibraryLinker) link(ctx ModuleContext, } if p.static() { - depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(in).Build() + depSet := depset.NewBuilder[android.Path](depset.TOPOLOGICAL).Direct(in).Build() android.SetProvider(ctx, StaticLibraryInfoProvider, StaticLibraryInfo{ StaticLibrary: in, diff --git a/java/Android.bp b/java/Android.bp index 1101d7a33..885e6825a 100644 --- a/java/Android.bp +++ b/java/Android.bp @@ -7,6 +7,7 @@ bootstrap_go_package { pkgPath: "android/soong/java", deps: [ "blueprint", + "blueprint-depset", "blueprint-pathtools", "soong", "soong-aconfig", @@ -15,7 +16,6 @@ bootstrap_go_package { "soong-dexpreopt", "soong-genrule", "soong-java-config", - "soong-testing", "soong-provenance", "soong-python", "soong-remoteexec", @@ -86,7 +86,6 @@ bootstrap_go_package { "app_import_test.go", "app_set_test.go", "app_test.go", - "code_metadata_test.go", "container_test.go", "bootclasspath_fragment_test.go", "device_host_converter_test.go", @@ -117,7 +116,6 @@ bootstrap_go_package { "sdk_version_test.go", "system_modules_test.go", "systemserver_classpath_fragment_test.go", - "test_spec_test.go", ], pluginFor: ["soong_build"], visibility: ["//visibility:public"], diff --git a/java/aar.go b/java/aar.go index 41cc24a0d..66ca00af8 100644 --- a/java/aar.go +++ b/java/aar.go @@ -25,14 +25,15 @@ import ( "android/soong/dexpreopt" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" ) type AndroidLibraryDependency interface { ExportPackage() android.Path - ResourcesNodeDepSet() *android.DepSet[*resourcesNode] - RRODirsDepSet() *android.DepSet[rroDir] - ManifestsDepSet() *android.DepSet[android.Path] + ResourcesNodeDepSet() depset.DepSet[*resourcesNode] + RRODirsDepSet() depset.DepSet[rroDir] + ManifestsDepSet() depset.DepSet[android.Path] SetRROEnforcedForDependent(enforce bool) IsRROEnforced(ctx android.BaseModuleContext) bool } @@ -136,9 +137,9 @@ type aapt struct { aaptProperties aaptProperties - resourcesNodesDepSet *android.DepSet[*resourcesNode] - rroDirsDepSet *android.DepSet[rroDir] - manifestsDepSet *android.DepSet[android.Path] + resourcesNodesDepSet depset.DepSet[*resourcesNode] + rroDirsDepSet depset.DepSet[rroDir] + manifestsDepSet depset.DepSet[android.Path] manifestValues struct { applicationId string @@ -232,15 +233,15 @@ func (a *aapt) filterProduct() string { func (a *aapt) ExportPackage() android.Path { return a.exportPackage } -func (a *aapt) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] { +func (a *aapt) ResourcesNodeDepSet() depset.DepSet[*resourcesNode] { return a.resourcesNodesDepSet } -func (a *aapt) RRODirsDepSet() *android.DepSet[rroDir] { +func (a *aapt) RRODirsDepSet() depset.DepSet[rroDir] { return a.rroDirsDepSet } -func (a *aapt) ManifestsDepSet() *android.DepSet[android.Path] { +func (a *aapt) ManifestsDepSet() depset.DepSet[android.Path] { return a.manifestsDepSet } @@ -639,7 +640,7 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio a.extraAaptPackagesFile = extraPackages a.rTxt = rTxt a.splits = splits - a.resourcesNodesDepSet = android.NewDepSetBuilder[*resourcesNode](android.TOPOLOGICAL). + a.resourcesNodesDepSet = depset.NewBuilder[*resourcesNode](depset.TOPOLOGICAL). Direct(&resourcesNode{ resPackage: a.exportPackage, manifest: a.manifestPath, @@ -651,10 +652,10 @@ func (a *aapt) buildActions(ctx android.ModuleContext, opts aaptBuildActionOptio usedResourceProcessor: a.useResourceProcessorBusyBox(ctx), }). Transitive(staticResourcesNodesDepSet).Build() - a.rroDirsDepSet = android.NewDepSetBuilder[rroDir](android.TOPOLOGICAL). + a.rroDirsDepSet = depset.NewBuilder[rroDir](depset.TOPOLOGICAL). Direct(rroDirs...). Transitive(staticRRODirsDepSet).Build() - a.manifestsDepSet = android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL). + a.manifestsDepSet = depset.NewBuilder[android.Path](depset.TOPOLOGICAL). Direct(a.manifestPath). DirectSlice(additionalManifests). Transitive(staticManifestsDepSet).Build() @@ -773,8 +774,8 @@ func (t transitiveAarDeps) assets() android.Paths { // aaptLibs collects libraries from dependencies and sdk_version and converts them into paths func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext, classLoaderContexts dexpreopt.ClassLoaderContextMap, usesLibrary *usesLibrary) ( - staticResourcesNodes, sharedResourcesNodes *android.DepSet[*resourcesNode], staticRRODirs *android.DepSet[rroDir], - staticManifests *android.DepSet[android.Path], sharedLibs android.Paths, flags []string) { + staticResourcesNodes, sharedResourcesNodes depset.DepSet[*resourcesNode], staticRRODirs depset.DepSet[rroDir], + staticManifests depset.DepSet[android.Path], sharedLibs android.Paths, flags []string) { if classLoaderContexts == nil { // Not all callers need to compute class loader context, those who don't just pass nil. @@ -787,10 +788,10 @@ func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext, sharedLibs = append(sharedLibs, sdkDep.jars...) } - var staticResourcesNodeDepSets []*android.DepSet[*resourcesNode] - var sharedResourcesNodeDepSets []*android.DepSet[*resourcesNode] - rroDirsDepSetBuilder := android.NewDepSetBuilder[rroDir](android.TOPOLOGICAL) - manifestsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL) + var staticResourcesNodeDepSets []depset.DepSet[*resourcesNode] + var sharedResourcesNodeDepSets []depset.DepSet[*resourcesNode] + rroDirsDepSetBuilder := depset.NewBuilder[rroDir](depset.TOPOLOGICAL) + manifestsDepSetBuilder := depset.NewBuilder[android.Path](depset.TOPOLOGICAL) ctx.VisitDirectDeps(func(module android.Module) { depTag := ctx.OtherModuleDependencyTag(module) @@ -834,9 +835,9 @@ func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext, // dependencies) the highest priority dependency is listed first, but for resources the highest priority // dependency has to be listed last. This is also inconsistent with the way manifests from the same // transitive dependencies are merged. - staticResourcesNodes = android.NewDepSet(android.TOPOLOGICAL, nil, + staticResourcesNodes = depset.New(depset.TOPOLOGICAL, nil, android.ReverseSliceInPlace(staticResourcesNodeDepSets)) - sharedResourcesNodes = android.NewDepSet(android.TOPOLOGICAL, nil, + sharedResourcesNodes = depset.New(depset.TOPOLOGICAL, nil, android.ReverseSliceInPlace(sharedResourcesNodeDepSets)) staticRRODirs = rroDirsDepSetBuilder.Build() @@ -1064,8 +1065,8 @@ type AARImport struct { rTxt android.Path rJar android.Path - resourcesNodesDepSet *android.DepSet[*resourcesNode] - manifestsDepSet *android.DepSet[android.Path] + resourcesNodesDepSet depset.DepSet[*resourcesNode] + manifestsDepSet depset.DepSet[android.Path] hideApexVariantFromMake bool @@ -1111,15 +1112,15 @@ var _ AndroidLibraryDependency = (*AARImport)(nil) func (a *AARImport) ExportPackage() android.Path { return a.exportPackage } -func (a *AARImport) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] { +func (a *AARImport) ResourcesNodeDepSet() depset.DepSet[*resourcesNode] { return a.resourcesNodesDepSet } -func (a *AARImport) RRODirsDepSet() *android.DepSet[rroDir] { - return android.NewDepSet[rroDir](android.TOPOLOGICAL, nil, nil) +func (a *AARImport) RRODirsDepSet() depset.DepSet[rroDir] { + return depset.New[rroDir](depset.TOPOLOGICAL, nil, nil) } -func (a *AARImport) ManifestsDepSet() *android.DepSet[android.Path] { +func (a *AARImport) ManifestsDepSet() depset.DepSet[android.Path] { return a.manifestsDepSet } @@ -1233,13 +1234,13 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { proguardFlags := extractedAARDir.Join(ctx, "proguard.txt") transitiveProguardFlags, transitiveUnconditionalExportedFlags := collectDepProguardSpecInfo(ctx) android.SetProvider(ctx, ProguardSpecInfoProvider, ProguardSpecInfo{ - ProguardFlagsFiles: android.NewDepSet[android.Path]( - android.POSTORDER, + ProguardFlagsFiles: depset.New[android.Path]( + depset.POSTORDER, android.Paths{proguardFlags}, transitiveProguardFlags, ), - UnconditionallyExportedProguardFlags: android.NewDepSet[android.Path]( - android.POSTORDER, + UnconditionallyExportedProguardFlags: depset.New[android.Path]( + depset.POSTORDER, nil, transitiveUnconditionalExportedFlags, ), @@ -1320,7 +1321,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { aapt2ExtractExtraPackages(ctx, extraAaptPackagesFile, a.rJar) a.extraAaptPackagesFile = extraAaptPackagesFile - resourcesNodesDepSetBuilder := android.NewDepSetBuilder[*resourcesNode](android.TOPOLOGICAL) + resourcesNodesDepSetBuilder := depset.NewBuilder[*resourcesNode](depset.TOPOLOGICAL) resourcesNodesDepSetBuilder.Direct(&resourcesNode{ resPackage: a.exportPackage, manifest: a.manifest, @@ -1333,7 +1334,7 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { resourcesNodesDepSetBuilder.Transitive(staticResourcesNodesDepSet) a.resourcesNodesDepSet = resourcesNodesDepSetBuilder.Build() - manifestDepSetBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(a.manifest) + manifestDepSetBuilder := depset.NewBuilder[android.Path](depset.TOPOLOGICAL).Direct(a.manifest) manifestDepSetBuilder.Transitive(staticManifestsDepSet) a.manifestsDepSet = manifestDepSetBuilder.Build() @@ -1352,9 +1353,9 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { var staticJars android.Paths var staticHeaderJars android.Paths var staticResourceJars android.Paths - var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path] - var transitiveStaticLibsImplementationJars []*android.DepSet[android.Path] - var transitiveStaticLibsResourceJars []*android.DepSet[android.Path] + var transitiveStaticLibsHeaderJars []depset.DepSet[android.Path] + var transitiveStaticLibsImplementationJars []depset.DepSet[android.Path] + var transitiveStaticLibsResourceJars []depset.DepSet[android.Path] ctx.VisitDirectDeps(func(module android.Module) { if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok { @@ -1364,24 +1365,18 @@ func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) { staticJars = append(staticJars, dep.ImplementationJars...) staticHeaderJars = append(staticHeaderJars, dep.HeaderJars...) staticResourceJars = append(staticResourceJars, dep.ResourceJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } - if dep.TransitiveStaticLibsImplementationJars != nil { - transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars) - } - if dep.TransitiveStaticLibsResourceJars != nil { - transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars) - } + transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) + transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars) + transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars) } } addCLCFromDep(ctx, module, a.classLoaderContexts) addMissingOptionalUsesLibsFromDep(ctx, module, &a.usesLibrary) }) - completeStaticLibsHeaderJars := android.NewDepSet(android.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsHeaderJars) - completeStaticLibsImplementationJars := android.NewDepSet(android.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsImplementationJars) - completeStaticLibsResourceJars := android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsResourceJars) + completeStaticLibsHeaderJars := depset.New(depset.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsHeaderJars) + completeStaticLibsImplementationJars := depset.New(depset.PREORDER, android.Paths{classpathFile}, transitiveStaticLibsImplementationJars) + completeStaticLibsResourceJars := depset.New(depset.PREORDER, nil, transitiveStaticLibsResourceJars) var implementationJarFile android.Path var combineJars android.Paths diff --git a/java/app.go b/java/app.go index addbc28b0..e01a2ba7b 100644 --- a/java/app.go +++ b/java/app.go @@ -22,9 +22,8 @@ import ( "path/filepath" "strings" - "android/soong/testing" - "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/android" @@ -227,7 +226,7 @@ func (a *AndroidApp) IsInstallable() bool { return Bool(a.properties.Installable) } -func (a *AndroidApp) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] { +func (a *AndroidApp) ResourcesNodeDepSet() depset.DepSet[*resourcesNode] { return a.aapt.resourcesNodesDepSet } @@ -1443,7 +1442,6 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_common_data)...) a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_data)...) a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_prefer32_data)...) - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{ InstalledFiles: a.data, OutputFile: a.OutputFile(), diff --git a/java/base.go b/java/base.go index 3927c6194..07899d1f9 100644 --- a/java/base.go +++ b/java/base.go @@ -24,6 +24,7 @@ import ( "strings" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/pathtools" "github.com/google/blueprint/proptools" @@ -483,7 +484,7 @@ type Module struct { srcJarDeps android.Paths // the source files of this module and all its static dependencies - transitiveSrcFiles *android.DepSet[android.Path] + transitiveSrcFiles depset.DepSet[android.Path] // jar file containing implementation classes and resources including static library // dependencies @@ -1289,7 +1290,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{ HeaderJars: android.PathsIfNonNil(j.headerJarFile), LocalHeaderJars: localHeaderJars, - TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars), + TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars), TransitiveLibsHeaderJarsForR8: j.transitiveLibsHeaderJarsForR8, TransitiveStaticLibsHeaderJarsForR8: j.transitiveStaticLibsHeaderJarsForR8, AidlIncludeDirs: j.exportAidlIncludeDirs, @@ -1552,7 +1553,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath localResourceJars = append(localResourceJars, servicesJar) } - completeStaticLibsResourceJars := android.NewDepSet(android.PREORDER, localResourceJars, deps.transitiveStaticLibsResourceJars) + completeStaticLibsResourceJars := depset.New(depset.PREORDER, localResourceJars, deps.transitiveStaticLibsResourceJars) var combinedResourceJar android.Path var resourceJars android.Paths @@ -1579,7 +1580,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath // classes.jar. If there is only one input jar this step will be skipped. var outputFile android.Path - completeStaticLibsImplementationJars := android.NewDepSet(android.PREORDER, localImplementationJars, deps.transitiveStaticLibsImplementationJars) + completeStaticLibsImplementationJars := depset.New(depset.PREORDER, localImplementationJars, deps.transitiveStaticLibsImplementationJars) var jars android.Paths if ctx.Config().UseTransitiveJarsInClasspath() { @@ -1609,7 +1610,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath Input: jars[0], Output: copiedJar, }) - completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, android.Paths{copiedJar}, nil) + completeStaticLibsImplementationJars = depset.New(depset.PREORDER, android.Paths{copiedJar}, nil) outputFile = copiedJar } else { outputFile = jars[0] @@ -1625,7 +1626,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath jarjarFile, jarjarred := j.jarjarIfNecessary(ctx, outputFile, jarName, "") if jarjarred { localImplementationJars = android.Paths{jarjarFile} - completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil) + completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil) } outputFile = jarjarFile @@ -1635,7 +1636,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath combinedResourceJar = resourceJarJarFile if jarjarred { localResourceJars = android.Paths{resourceJarJarFile} - completeStaticLibsResourceJars = android.NewDepSet(android.PREORDER, localResourceJars, nil) + completeStaticLibsResourceJars = depset.New(depset.PREORDER, localResourceJars, nil) } } @@ -1653,14 +1654,14 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath TransformRavenizer(ctx, ravenizerOutput, ravenizerInput, ravenizerArgs) outputFile = ravenizerOutput localImplementationJars = android.Paths{ravenizerOutput} - completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil) + completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil) if combinedResourceJar != nil { ravenizerInput = combinedResourceJar ravenizerOutput = android.PathForModuleOut(ctx, "ravenizer", "resources", jarName) TransformRavenizer(ctx, ravenizerOutput, ravenizerInput, ravenizerArgs) combinedResourceJar = ravenizerOutput localResourceJars = android.Paths{ravenizerOutput} - completeStaticLibsResourceJars = android.NewDepSet(android.PREORDER, localResourceJars, nil) + completeStaticLibsResourceJars = depset.New(depset.PREORDER, localResourceJars, nil) } } @@ -1675,7 +1676,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath }) outputFile = apiMapperFile localImplementationJars = android.Paths{apiMapperFile} - completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil) + completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil) } // Check package restrictions if necessary. @@ -1698,7 +1699,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath }) outputFile = packageCheckOutputFile localImplementationJars = android.Paths{packageCheckOutputFile} - completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, localImplementationJars, nil) + completeStaticLibsImplementationJars = depset.New(depset.PREORDER, localImplementationJars, nil) // Check packages and create a timestamp file when complete. CheckJarPackages(ctx, pkgckFile, outputFile, j.properties.Permitted_packages) @@ -1736,7 +1737,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath if j.shouldInstrument(ctx) { instrumentedOutputFile := j.instrument(ctx, flags, outputFile, jarName, specs) - completeStaticLibsImplementationJarsToCombine = android.NewDepSet(android.PREORDER, android.Paths{instrumentedOutputFile}, nil) + completeStaticLibsImplementationJarsToCombine = depset.New(depset.PREORDER, android.Paths{instrumentedOutputFile}, nil) outputFile = instrumentedOutputFile } @@ -1915,7 +1916,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath RepackagedHeaderJars: android.PathsIfNonNil(repackagedHeaderJarFile), LocalHeaderJars: localHeaderJars, - TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars), + TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, localHeaderJars, transitiveStaticLibsHeaderJars), TransitiveStaticLibsImplementationJars: completeStaticLibsImplementationJars, TransitiveStaticLibsResourceJars: completeStaticLibsResourceJars, @@ -1944,17 +1945,15 @@ func (j *Module) useCompose(ctx android.BaseModuleContext) bool { return android.InList("androidx.compose.runtime_runtime", j.staticLibs(ctx)) } -func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []*android.DepSet[android.Path]) { +func collectDepProguardSpecInfo(ctx android.ModuleContext) (transitiveProguardFlags, transitiveUnconditionalExportedFlags []depset.DepSet[android.Path]) { ctx.VisitDirectDeps(func(m android.Module) { depProguardInfo, _ := android.OtherModuleProvider(ctx, m, ProguardSpecInfoProvider) depTag := ctx.OtherModuleDependencyTag(m) - if depProguardInfo.UnconditionallyExportedProguardFlags != nil { - transitiveUnconditionalExportedFlags = append(transitiveUnconditionalExportedFlags, depProguardInfo.UnconditionallyExportedProguardFlags) - transitiveProguardFlags = append(transitiveProguardFlags, depProguardInfo.UnconditionallyExportedProguardFlags) - } + transitiveUnconditionalExportedFlags = append(transitiveUnconditionalExportedFlags, depProguardInfo.UnconditionallyExportedProguardFlags) + transitiveProguardFlags = append(transitiveProguardFlags, depProguardInfo.UnconditionallyExportedProguardFlags) - if depTag == staticLibTag && depProguardInfo.ProguardFlagsFiles != nil { + if depTag == staticLibTag { transitiveProguardFlags = append(transitiveProguardFlags, depProguardInfo.ProguardFlagsFiles) } }) @@ -1976,13 +1975,13 @@ func (j *Module) collectProguardSpecInfo(ctx android.ModuleContext) ProguardSpec return ProguardSpecInfo{ Export_proguard_flags_files: exportUnconditionally, - ProguardFlagsFiles: android.NewDepSet[android.Path]( - android.POSTORDER, + ProguardFlagsFiles: depset.New[android.Path]( + depset.POSTORDER, proguardFlagsForThisModule, transitiveProguardFlags, ), - UnconditionallyExportedProguardFlags: android.NewDepSet[android.Path]( - android.POSTORDER, + UnconditionallyExportedProguardFlags: depset.New[android.Path]( + depset.POSTORDER, directUnconditionalExportedFlags, transitiveUnconditionalExportedFlags, ), @@ -2074,7 +2073,7 @@ func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars // one input jar this step will be skipped. var jars android.Paths if ctx.Config().UseTransitiveJarsInClasspath() { - depSet := android.NewDepSet(android.PREORDER, localHeaderJars, deps.transitiveStaticLibsHeaderJars) + depSet := depset.New(depset.PREORDER, localHeaderJars, deps.transitiveStaticLibsHeaderJars) jars = depSet.ToList() } else { jars = append(slices.Clone(localHeaderJars), deps.staticHeaderJars...) @@ -2104,9 +2103,9 @@ func (j *Module) instrument(ctx android.ModuleContext, flags javaBuilderFlags, type providesTransitiveHeaderJarsForR8 struct { // set of header jars for all transitive libs deps - transitiveLibsHeaderJarsForR8 *android.DepSet[android.Path] + transitiveLibsHeaderJarsForR8 depset.DepSet[android.Path] // set of header jars for all transitive static libs deps - transitiveStaticLibsHeaderJarsForR8 *android.DepSet[android.Path] + transitiveStaticLibsHeaderJarsForR8 depset.DepSet[android.Path] } // collectTransitiveHeaderJarsForR8 visits direct dependencies and collects all transitive libs and static_libs @@ -2116,8 +2115,8 @@ type providesTransitiveHeaderJarsForR8 struct { func (j *providesTransitiveHeaderJarsForR8) collectTransitiveHeaderJarsForR8(ctx android.ModuleContext) { directLibs := android.Paths{} directStaticLibs := android.Paths{} - transitiveLibs := []*android.DepSet[android.Path]{} - transitiveStaticLibs := []*android.DepSet[android.Path]{} + transitiveLibs := []depset.DepSet[android.Path]{} + transitiveStaticLibs := []depset.DepSet[android.Path]{} ctx.VisitDirectDeps(func(module android.Module) { // don't add deps of the prebuilt version of the same library if ctx.ModuleName() == android.RemoveOptionalPrebuiltPrefix(module.Name()) { @@ -2136,17 +2135,12 @@ func (j *providesTransitiveHeaderJarsForR8) collectTransitiveHeaderJarsForR8(ctx return } - if dep.TransitiveLibsHeaderJarsForR8 != nil { - transitiveLibs = append(transitiveLibs, dep.TransitiveLibsHeaderJarsForR8) - } - if dep.TransitiveStaticLibsHeaderJarsForR8 != nil { - transitiveStaticLibs = append(transitiveStaticLibs, dep.TransitiveStaticLibsHeaderJarsForR8) - } - + transitiveLibs = append(transitiveLibs, dep.TransitiveLibsHeaderJarsForR8) + transitiveStaticLibs = append(transitiveStaticLibs, dep.TransitiveStaticLibsHeaderJarsForR8) } }) - j.transitiveLibsHeaderJarsForR8 = android.NewDepSet(android.POSTORDER, directLibs, transitiveLibs) - j.transitiveStaticLibsHeaderJarsForR8 = android.NewDepSet(android.POSTORDER, directStaticLibs, transitiveStaticLibs) + j.transitiveLibsHeaderJarsForR8 = depset.New(depset.POSTORDER, directLibs, transitiveLibs) + j.transitiveStaticLibsHeaderJarsForR8 = depset.New(depset.POSTORDER, directStaticLibs, transitiveStaticLibs) } func (j *Module) HeaderJars() android.Paths { @@ -2246,19 +2240,17 @@ func (j *Module) JacocoReportClassesFile() android.Path { } func (j *Module) collectTransitiveSrcFiles(ctx android.ModuleContext, mine android.Paths) { - var fromDeps []*android.DepSet[android.Path] + var fromDeps []depset.DepSet[android.Path] ctx.VisitDirectDeps(func(module android.Module) { tag := ctx.OtherModuleDependencyTag(module) if tag == staticLibTag { if depInfo, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok { - if depInfo.TransitiveSrcFiles != nil { - fromDeps = append(fromDeps, depInfo.TransitiveSrcFiles) - } + fromDeps = append(fromDeps, depInfo.TransitiveSrcFiles) } } }) - j.transitiveSrcFiles = android.NewDepSet(android.POSTORDER, mine, fromDeps) + j.transitiveSrcFiles = depset.New(depset.POSTORDER, mine, fromDeps) } func (j *Module) IsInstallable() bool { @@ -2392,12 +2384,12 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { j.collectTransitiveHeaderJarsForR8(ctx) - var transitiveBootClasspathHeaderJars []*android.DepSet[android.Path] - var transitiveClasspathHeaderJars []*android.DepSet[android.Path] - var transitiveJava9ClasspathHeaderJars []*android.DepSet[android.Path] - var transitiveStaticJarsHeaderLibs []*android.DepSet[android.Path] - var transitiveStaticJarsImplementationLibs []*android.DepSet[android.Path] - var transitiveStaticJarsResourceLibs []*android.DepSet[android.Path] + var transitiveBootClasspathHeaderJars []depset.DepSet[android.Path] + var transitiveClasspathHeaderJars []depset.DepSet[android.Path] + var transitiveJava9ClasspathHeaderJars []depset.DepSet[android.Path] + var transitiveStaticJarsHeaderLibs []depset.DepSet[android.Path] + var transitiveStaticJarsImplementationLibs []depset.DepSet[android.Path] + var transitiveStaticJarsResourceLibs []depset.DepSet[android.Path] ctx.VisitDirectDeps(func(module android.Module) { otherName := ctx.OtherModuleName(module) @@ -2431,9 +2423,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { switch tag { case bootClasspathTag: deps.bootClasspath = append(deps.bootClasspath, dep.HeaderJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } + transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) case sdkLibTag, libTag, instrumentationForTag: if _, ok := module.(*Plugin); ok { ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a libs dependency", otherName) @@ -2448,14 +2438,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { addPlugins(&deps, dep.ExportedPlugins, dep.ExportedPluginClasses...) deps.disableTurbine = deps.disableTurbine || dep.ExportedPluginDisableTurbine - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } + transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) case java9LibTag: deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveJava9ClasspathHeaderJars = append(transitiveJava9ClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } + transitiveJava9ClasspathHeaderJars = append(transitiveJava9ClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) case staticLibTag: if _, ok := module.(*Plugin); ok { ctx.ModuleErrorf("a java_plugin (%s) cannot be used as a static_libs dependency", otherName) @@ -2472,16 +2458,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { deps.disableTurbine = deps.disableTurbine || dep.ExportedPluginDisableTurbine deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.AconfigIntermediateCacheOutputPaths...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - transitiveStaticJarsHeaderLibs = append(transitiveStaticJarsHeaderLibs, dep.TransitiveStaticLibsHeaderJars) - } - if dep.TransitiveStaticLibsImplementationJars != nil { - transitiveStaticJarsImplementationLibs = append(transitiveStaticJarsImplementationLibs, dep.TransitiveStaticLibsImplementationJars) - } - if dep.TransitiveStaticLibsResourceJars != nil { - transitiveStaticJarsResourceLibs = append(transitiveStaticJarsResourceLibs, dep.TransitiveStaticLibsResourceJars) - } + transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) + transitiveStaticJarsHeaderLibs = append(transitiveStaticJarsHeaderLibs, dep.TransitiveStaticLibsHeaderJars) + transitiveStaticJarsImplementationLibs = append(transitiveStaticJarsImplementationLibs, dep.TransitiveStaticLibsImplementationJars) + transitiveStaticJarsResourceLibs = append(transitiveStaticJarsResourceLibs, dep.TransitiveStaticLibsResourceJars) case pluginTag: if plugin, ok := module.(*Plugin); ok { if plugin.pluginProperties.Processor_class != nil { @@ -2535,14 +2515,14 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { deps.classpath = append(deps.classpath, dep.Srcs()...) deps.dexClasspath = append(deps.classpath, dep.Srcs()...) transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, - android.NewDepSet(android.PREORDER, dep.Srcs(), nil)) + depset.New(depset.PREORDER, dep.Srcs(), nil)) case staticLibTag: checkProducesJars(ctx, dep) deps.classpath = append(deps.classpath, dep.Srcs()...) deps.staticJars = append(deps.staticJars, dep.Srcs()...) deps.staticHeaderJars = append(deps.staticHeaderJars, dep.Srcs()...) - depHeaderJars := android.NewDepSet(android.PREORDER, dep.Srcs(), nil) + depHeaderJars := depset.New(depset.PREORDER, dep.Srcs(), nil) transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, depHeaderJars) transitiveStaticJarsHeaderLibs = append(transitiveStaticJarsHeaderLibs, depHeaderJars) transitiveStaticJarsImplementationLibs = append(transitiveStaticJarsImplementationLibs, depHeaderJars) @@ -2559,10 +2539,8 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { // then add its libs to the bootclasspath. if sm, ok := android.OtherModuleProvider(ctx, module, SystemModulesProvider); ok { deps.bootClasspath = append(deps.bootClasspath, sm.HeaderJars...) - if sm.TransitiveStaticLibsHeaderJars != nil { - transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, - sm.TransitiveStaticLibsHeaderJars) - } + transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, + sm.TransitiveStaticLibsHeaderJars) } else { ctx.PropertyErrorf("boot classpath dependency %q does not provide SystemModulesProvider", ctx.OtherModuleName(module)) @@ -2598,11 +2576,11 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps { deps.transitiveStaticLibsResourceJars = transitiveStaticJarsResourceLibs if ctx.Config().UseTransitiveJarsInClasspath() { - depSet := android.NewDepSet(android.PREORDER, nil, transitiveClasspathHeaderJars) + depSet := depset.New(depset.PREORDER, nil, transitiveClasspathHeaderJars) deps.classpath = depSet.ToList() - depSet = android.NewDepSet(android.PREORDER, nil, transitiveBootClasspathHeaderJars) + depSet = depset.New(depset.PREORDER, nil, transitiveBootClasspathHeaderJars) deps.bootClasspath = depSet.ToList() - depSet = android.NewDepSet(android.PREORDER, nil, transitiveJava9ClasspathHeaderJars) + depSet = depset.New(depset.PREORDER, nil, transitiveJava9ClasspathHeaderJars) deps.java9Classpath = depSet.ToList() } diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 4fcd40bd3..1a3368057 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -23,7 +23,6 @@ import ( "android/soong/android" "android/soong/dexpreopt" - "android/soong/testing" "github.com/google/blueprint/proptools" @@ -524,7 +523,6 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo if ctx.Module() != ctx.FinalModule() { b.HideFromMake() } - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) } // getProfileProviderApex returns the name of the apex that provides a boot image profile, or an diff --git a/java/code_metadata_test.go b/java/code_metadata_test.go deleted file mode 100644 index 9dc9a2262..000000000 --- a/java/code_metadata_test.go +++ /dev/null @@ -1,115 +0,0 @@ -package java - -import ( - "strings" - "testing" - - "android/soong/android" - soongTesting "android/soong/testing" - "android/soong/testing/code_metadata_internal_proto" - - "google.golang.org/protobuf/proto" -) - -func TestCodeMetadata(t *testing.T) { - bp := `code_metadata { - name: "module-name", - teamId: "12345", - code: [ - "foo", - ] - } - - java_sdk_library { - name: "foo", - srcs: ["a.java"], - }` - result := runCodeMetadataTest(t, android.FixtureExpectsNoErrors, bp) - - module := result.ModuleForTests("module-name", "") - - // Check that the provider has the right contents - data, _ := android.OtherModuleProvider(result, module.Module(), soongTesting.CodeMetadataProviderKey) - if !strings.HasSuffix( - data.IntermediatePath.String(), "/intermediateCodeMetadata.pb", - ) { - t.Errorf( - "Missing intermediates path in provider: %s", - data.IntermediatePath.String(), - ) - } - - metadata := android.ContentFromFileRuleForTests(t, result.TestContext, - module.Output(data.IntermediatePath.String())) - - metadataList := make([]*code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership, 0, 2) - teamId := "12345" - bpFilePath := "Android.bp" - targetName := "foo" - srcFile := []string{"a.java"} - expectedMetadataProto := code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership{ - TrendyTeamId: &teamId, - TargetName: &targetName, - Path: &bpFilePath, - SourceFiles: srcFile, - } - metadataList = append(metadataList, &expectedMetadataProto) - - CodeMetadataMetadata := code_metadata_internal_proto.CodeMetadataInternal{TargetOwnershipList: metadataList} - protoData, _ := proto.Marshal(&CodeMetadataMetadata) - expectedMetadata := string(protoData) - - if metadata != expectedMetadata { - t.Errorf( - "Retrieved metadata: %s is not equal to expectedMetadata: %s", metadata, - expectedMetadata, - ) - } - - // Tests for all_test_spec singleton. - singleton := result.SingletonForTests("all_code_metadata") - rule := singleton.Rule("all_code_metadata_rule") - prebuiltOs := result.Config.PrebuiltOS() - expectedCmd := "out/soong/host/" + prebuiltOs + "/bin/metadata -rule code_metadata -inputFile out/soong/all_code_metadata_paths.rsp -outputFile out/soong/ownership/all_code_metadata.pb" - expectedOutputFile := "out/soong/ownership/all_code_metadata.pb" - expectedInputFile := "out/soong/.intermediates/module-name/intermediateCodeMetadata.pb" - if !strings.Contains( - strings.TrimSpace(rule.Output.String()), - expectedOutputFile, - ) { - t.Errorf( - "Retrieved singletonOutputFile: %s is not equal to expectedSingletonOutputFile: %s", - rule.Output.String(), expectedOutputFile, - ) - } - - if !strings.Contains( - strings.TrimSpace(rule.Inputs[0].String()), - expectedInputFile, - ) { - t.Errorf( - "Retrieved singletonInputFile: %s is not equal to expectedSingletonInputFile: %s", - rule.Inputs[0].String(), expectedInputFile, - ) - } - - if !strings.Contains( - strings.TrimSpace(rule.RuleParams.Command), - expectedCmd, - ) { - t.Errorf( - "Retrieved cmd: %s doesn't contain expectedCmd: %s", - rule.RuleParams.Command, expectedCmd, - ) - } -} -func runCodeMetadataTest( - t *testing.T, errorHandler android.FixtureErrorHandler, bp string, -) *android.TestResult { - return android.GroupFixturePreparers( - soongTesting.PrepareForTestWithTestingBuildComponents, prepareForJavaTest, - PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("foo"), - ). - ExtendWithErrorHandler(errorHandler). - RunTestWithBp(t, bp) -} diff --git a/java/device_host_converter.go b/java/device_host_converter.go index 3f4e3cda0..bfacea6da 100644 --- a/java/device_host_converter.go +++ b/java/device_host_converter.go @@ -20,6 +20,8 @@ import ( "android/soong/android" "android/soong/dexpreopt" + + "github.com/google/blueprint/depset" ) type DeviceHostConverter struct { @@ -96,9 +98,9 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont ctx.PropertyErrorf("libs", "at least one dependency is required") } - var transitiveHeaderJars []*android.DepSet[android.Path] - var transitiveImplementationJars []*android.DepSet[android.Path] - var transitiveResourceJars []*android.DepSet[android.Path] + var transitiveHeaderJars []depset.DepSet[android.Path] + var transitiveImplementationJars []depset.DepSet[android.Path] + var transitiveResourceJars []depset.DepSet[android.Path] ctx.VisitDirectDepsWithTag(deviceHostConverterDepTag, func(m android.Module) { if dep, ok := android.OtherModuleProvider(ctx, m, JavaInfoProvider); ok { @@ -110,15 +112,9 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont d.srcJarArgs = append(d.srcJarArgs, dep.SrcJarArgs...) d.srcJarDeps = append(d.srcJarDeps, dep.SrcJarDeps...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveHeaderJars = append(transitiveHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } - if dep.TransitiveStaticLibsImplementationJars != nil { - transitiveImplementationJars = append(transitiveImplementationJars, dep.TransitiveStaticLibsImplementationJars) - } - if dep.TransitiveStaticLibsResourceJars != nil { - transitiveResourceJars = append(transitiveResourceJars, dep.TransitiveStaticLibsResourceJars) - } + transitiveHeaderJars = append(transitiveHeaderJars, dep.TransitiveStaticLibsHeaderJars) + transitiveImplementationJars = append(transitiveImplementationJars, dep.TransitiveStaticLibsImplementationJars) + transitiveResourceJars = append(transitiveResourceJars, dep.TransitiveStaticLibsResourceJars) } else { ctx.PropertyErrorf("libs", "module %q cannot be used as a dependency", ctx.OtherModuleName(m)) } @@ -147,9 +143,9 @@ func (d *DeviceHostConverter) GenerateAndroidBuildActions(ctx android.ModuleCont android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{ HeaderJars: d.headerJars, LocalHeaderJars: d.headerJars, - TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, nil, transitiveHeaderJars), - TransitiveStaticLibsImplementationJars: android.NewDepSet(android.PREORDER, nil, transitiveImplementationJars), - TransitiveStaticLibsResourceJars: android.NewDepSet(android.PREORDER, nil, transitiveResourceJars), + TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, nil, transitiveHeaderJars), + TransitiveStaticLibsImplementationJars: depset.New(depset.PREORDER, nil, transitiveImplementationJars), + TransitiveStaticLibsResourceJars: depset.New(depset.PREORDER, nil, transitiveResourceJars), ImplementationAndResourcesJars: d.implementationAndResourceJars, ImplementationJars: d.implementationJars, ResourceJars: d.resourceJars, diff --git a/java/dex.go b/java/dex.go index f4b53f00a..1f71aee1a 100644 --- a/java/dex.go +++ b/java/dex.go @@ -324,20 +324,16 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams) r8Deps = append(r8Deps, flags.dexClasspath...) transitiveStaticLibsLookupMap := map[android.Path]bool{} - if d.transitiveStaticLibsHeaderJarsForR8 != nil { - for _, jar := range d.transitiveStaticLibsHeaderJarsForR8.ToList() { - transitiveStaticLibsLookupMap[jar] = true - } + for _, jar := range d.transitiveStaticLibsHeaderJarsForR8.ToList() { + transitiveStaticLibsLookupMap[jar] = true } transitiveHeaderJars := android.Paths{} - if d.transitiveLibsHeaderJarsForR8 != nil { - for _, jar := range d.transitiveLibsHeaderJarsForR8.ToList() { - if _, ok := transitiveStaticLibsLookupMap[jar]; ok { - // don't include a lib if it is already packaged in the current JAR as a static lib - continue - } - transitiveHeaderJars = append(transitiveHeaderJars, jar) + for _, jar := range d.transitiveLibsHeaderJarsForR8.ToList() { + if _, ok := transitiveStaticLibsLookupMap[jar]; ok { + // don't include a lib if it is already packaged in the current JAR as a static lib + continue } + transitiveHeaderJars = append(transitiveHeaderJars, jar) } transitiveClasspath := classpath(transitiveHeaderJars) r8Flags = append(r8Flags, transitiveClasspath.FormJavaClassPath("-libraryjars")) diff --git a/java/java.go b/java/java.go index 679714858..f8b781df3 100644 --- a/java/java.go +++ b/java/java.go @@ -26,9 +26,9 @@ import ( "strings" "android/soong/remoteexec" - "android/soong/testing" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/android" @@ -242,10 +242,10 @@ type ProguardSpecInfo struct { // TransitiveDepsProguardSpecFiles is a depset of paths to proguard flags files that are exported from // all transitive deps. This list includes all proguard flags files from transitive static dependencies, // and all proguard flags files from transitive libs dependencies which set `export_proguard_spec: true`. - ProguardFlagsFiles *android.DepSet[android.Path] + ProguardFlagsFiles depset.DepSet[android.Path] // implementation detail to store transitive proguard flags files from exporting shared deps - UnconditionallyExportedProguardFlags *android.DepSet[android.Path] + UnconditionallyExportedProguardFlags depset.DepSet[android.Path] } var ProguardSpecInfoProvider = blueprint.NewProvider[ProguardSpecInfo]() @@ -260,19 +260,19 @@ type JavaInfo struct { RepackagedHeaderJars android.Paths // set of header jars for all transitive libs deps - TransitiveLibsHeaderJarsForR8 *android.DepSet[android.Path] + TransitiveLibsHeaderJarsForR8 depset.DepSet[android.Path] // set of header jars for all transitive static libs deps - TransitiveStaticLibsHeaderJarsForR8 *android.DepSet[android.Path] + TransitiveStaticLibsHeaderJarsForR8 depset.DepSet[android.Path] // depset of header jars for this module and all transitive static dependencies - TransitiveStaticLibsHeaderJars *android.DepSet[android.Path] + TransitiveStaticLibsHeaderJars depset.DepSet[android.Path] // depset of implementation jars for this module and all transitive static dependencies - TransitiveStaticLibsImplementationJars *android.DepSet[android.Path] + TransitiveStaticLibsImplementationJars depset.DepSet[android.Path] // depset of resource jars for this module and all transitive static dependencies - TransitiveStaticLibsResourceJars *android.DepSet[android.Path] + TransitiveStaticLibsResourceJars depset.DepSet[android.Path] // ImplementationAndResourceJars is a list of jars that contain the implementations of classes // in the module as well as any resources included in the module. @@ -300,7 +300,7 @@ type JavaInfo struct { SrcJarDeps android.Paths // The source files of this module and all its transitive static dependencies. - TransitiveSrcFiles *android.DepSet[android.Path] + TransitiveSrcFiles depset.DepSet[android.Path] // ExportedPlugins is a list of paths that should be used as annotation processors for any // module that depends on this module. @@ -586,9 +586,9 @@ type deps struct { disableTurbine bool - transitiveStaticLibsHeaderJars []*android.DepSet[android.Path] - transitiveStaticLibsImplementationJars []*android.DepSet[android.Path] - transitiveStaticLibsResourceJars []*android.DepSet[android.Path] + transitiveStaticLibsHeaderJars []depset.DepSet[android.Path] + transitiveStaticLibsImplementationJars []depset.DepSet[android.Path] + transitiveStaticLibsResourceJars []depset.DepSet[android.Path] } func checkProducesJars(ctx android.ModuleContext, dep android.SourceFileProducer) { @@ -1557,7 +1557,6 @@ func (j *TestHost) GenerateAndroidBuildActions(ctx android.ModuleContext) { } j.Test.generateAndroidBuildActionsWithConfig(ctx, configs) - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{ InstalledFiles: j.data, OutputFile: j.outputFile, @@ -1573,7 +1572,6 @@ func (j *TestHost) GenerateAndroidBuildActions(ctx android.ModuleContext) { func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { checkMinSdkVersionMts(ctx, j.MinSdkVersion(ctx)) j.generateAndroidBuildActionsWithConfig(ctx, nil) - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) } func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, configs []tradefed.Config) { @@ -2415,8 +2413,8 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{ HeaderJars: android.PathsIfNonNil(al.stubsJar), LocalHeaderJars: android.PathsIfNonNil(al.stubsJar), - TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, android.PathsIfNonNil(al.stubsJar), nil), - TransitiveStaticLibsImplementationJars: android.NewDepSet(android.PREORDER, android.PathsIfNonNil(al.stubsJar), nil), + TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, android.PathsIfNonNil(al.stubsJar), nil), + TransitiveStaticLibsImplementationJars: depset.New(depset.PREORDER, android.PathsIfNonNil(al.stubsJar), nil), ImplementationAndResourcesJars: android.PathsIfNonNil(al.stubsJar), ImplementationJars: android.PathsIfNonNil(al.stubsJar), AidlIncludeDirs: android.Paths{}, @@ -2680,11 +2678,11 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { var flags javaBuilderFlags - var transitiveClasspathHeaderJars []*android.DepSet[android.Path] - var transitiveBootClasspathHeaderJars []*android.DepSet[android.Path] - var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path] - var transitiveStaticLibsImplementationJars []*android.DepSet[android.Path] - var transitiveStaticLibsResourceJars []*android.DepSet[android.Path] + var transitiveClasspathHeaderJars []depset.DepSet[android.Path] + var transitiveBootClasspathHeaderJars []depset.DepSet[android.Path] + var transitiveStaticLibsHeaderJars []depset.DepSet[android.Path] + var transitiveStaticLibsImplementationJars []depset.DepSet[android.Path] + var transitiveStaticLibsResourceJars []depset.DepSet[android.Path] j.collectTransitiveHeaderJarsForR8(ctx) var staticJars android.Paths @@ -2697,29 +2695,19 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { case libTag, sdkLibTag: flags.classpath = append(flags.classpath, dep.HeaderJars...) flags.dexClasspath = append(flags.dexClasspath, dep.HeaderJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } + transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) case staticLibTag: flags.classpath = append(flags.classpath, dep.HeaderJars...) staticJars = append(staticJars, dep.ImplementationJars...) staticResourceJars = append(staticResourceJars, dep.ResourceJars...) staticHeaderJars = append(staticHeaderJars, dep.HeaderJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } - if dep.TransitiveStaticLibsImplementationJars != nil { - transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars) - } - if dep.TransitiveStaticLibsResourceJars != nil { - transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars) - } + transitiveClasspathHeaderJars = append(transitiveClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) + transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) + transitiveStaticLibsImplementationJars = append(transitiveStaticLibsImplementationJars, dep.TransitiveStaticLibsImplementationJars) + transitiveStaticLibsResourceJars = append(transitiveStaticLibsResourceJars, dep.TransitiveStaticLibsResourceJars) case bootClasspathTag: flags.bootClasspath = append(flags.bootClasspath, dep.HeaderJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } + transitiveBootClasspathHeaderJars = append(transitiveBootClasspathHeaderJars, dep.TransitiveStaticLibsHeaderJars) } } else if _, ok := android.OtherModuleProvider(ctx, module, SdkLibraryInfoProvider); ok { switch tag { @@ -2744,9 +2732,9 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { false, j.properties.Exclude_files, j.properties.Exclude_dirs) localStrippedJars := android.Paths{localCombinedHeaderJar} - completeStaticLibsHeaderJars := android.NewDepSet(android.PREORDER, localStrippedJars, transitiveStaticLibsHeaderJars) - completeStaticLibsImplementationJars := android.NewDepSet(android.PREORDER, localStrippedJars, transitiveStaticLibsImplementationJars) - completeStaticLibsResourceJars := android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsResourceJars) + completeStaticLibsHeaderJars := depset.New(depset.PREORDER, localStrippedJars, transitiveStaticLibsHeaderJars) + completeStaticLibsImplementationJars := depset.New(depset.PREORDER, localStrippedJars, transitiveStaticLibsImplementationJars) + completeStaticLibsResourceJars := depset.New(depset.PREORDER, nil, transitiveStaticLibsResourceJars) // Always pass the input jars to TransformJarsToJar, even if there is only a single jar, we need the output // file of the module to be named jarName. @@ -2807,8 +2795,8 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Enabling jetifier requires modifying classes from transitive dependencies, disable transitive // classpath and use the combined header jar instead. - completeStaticLibsHeaderJars = android.NewDepSet(android.PREORDER, android.Paths{headerJar}, nil) - completeStaticLibsImplementationJars = android.NewDepSet(android.PREORDER, android.Paths{outputFile}, nil) + completeStaticLibsHeaderJars = depset.New(depset.PREORDER, android.Paths{headerJar}, nil) + completeStaticLibsImplementationJars = depset.New(depset.PREORDER, android.Paths{outputFile}, nil) } implementationJarFile := outputFile diff --git a/java/lint.go b/java/lint.go index 2cbefc3bb..ac90e19ba 100644 --- a/java/lint.go +++ b/java/lint.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/android" @@ -101,19 +102,19 @@ type linter struct { } type LintDepSets struct { - HTML, Text, XML, Baseline *android.DepSet[android.Path] + HTML, Text, XML, Baseline depset.DepSet[android.Path] } type LintDepSetsBuilder struct { - HTML, Text, XML, Baseline *android.DepSetBuilder[android.Path] + HTML, Text, XML, Baseline *depset.Builder[android.Path] } func NewLintDepSetBuilder() LintDepSetsBuilder { return LintDepSetsBuilder{ - HTML: android.NewDepSetBuilder[android.Path](android.POSTORDER), - Text: android.NewDepSetBuilder[android.Path](android.POSTORDER), - XML: android.NewDepSetBuilder[android.Path](android.POSTORDER), - Baseline: android.NewDepSetBuilder[android.Path](android.POSTORDER), + HTML: depset.NewBuilder[android.Path](depset.POSTORDER), + Text: depset.NewBuilder[android.Path](depset.POSTORDER), + XML: depset.NewBuilder[android.Path](depset.POSTORDER), + Baseline: depset.NewBuilder[android.Path](depset.POSTORDER), } } @@ -128,18 +129,10 @@ func (l LintDepSetsBuilder) Direct(html, text, xml android.Path, baseline androi } func (l LintDepSetsBuilder) Transitive(info *LintInfo) LintDepSetsBuilder { - if info.TransitiveHTML != nil { - l.HTML.Transitive(info.TransitiveHTML) - } - if info.TransitiveText != nil { - l.Text.Transitive(info.TransitiveText) - } - if info.TransitiveXML != nil { - l.XML.Transitive(info.TransitiveXML) - } - if info.TransitiveBaseline != nil { - l.Baseline.Transitive(info.TransitiveBaseline) - } + l.HTML.Transitive(info.TransitiveHTML) + l.Text.Transitive(info.TransitiveText) + l.XML.Transitive(info.TransitiveXML) + l.Baseline.Transitive(info.TransitiveBaseline) return l } @@ -204,10 +197,10 @@ type LintInfo struct { XML android.Path ReferenceBaseline android.Path - TransitiveHTML *android.DepSet[android.Path] - TransitiveText *android.DepSet[android.Path] - TransitiveXML *android.DepSet[android.Path] - TransitiveBaseline *android.DepSet[android.Path] + TransitiveHTML depset.DepSet[android.Path] + TransitiveText depset.DepSet[android.Path] + TransitiveXML depset.DepSet[android.Path] + TransitiveBaseline depset.DepSet[android.Path] } func (l *linter) enabled() bool { diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go index 5bb77542c..acfc7745e 100644 --- a/java/platform_bootclasspath.go +++ b/java/platform_bootclasspath.go @@ -191,9 +191,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo var transitiveSrcFiles android.Paths for _, module := range append(allModules, implLibModule...) { if depInfo, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok { - if depInfo.TransitiveSrcFiles != nil { - transitiveSrcFiles = append(transitiveSrcFiles, depInfo.TransitiveSrcFiles.ToList()...) - } + transitiveSrcFiles = append(transitiveSrcFiles, depInfo.TransitiveSrcFiles.ToList()...) } } jarArgs := resourcePathsToJarArgs(transitiveSrcFiles) diff --git a/java/robolectric.go b/java/robolectric.go index e6f80ac37..5f46267f9 100644 --- a/java/robolectric.go +++ b/java/robolectric.go @@ -19,7 +19,6 @@ import ( "android/soong/android" "android/soong/java/config" - "android/soong/testing" "android/soong/tradefed" "github.com/google/blueprint/proptools" @@ -243,7 +242,6 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext) } r.installFile = ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.outputFile, installDeps...) - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) } func generateSameDirRoboTestConfigJar(ctx android.ModuleContext, outputFile android.ModuleOutPath) { diff --git a/java/system_modules.go b/java/system_modules.go index d9430b25e..e955aec15 100644 --- a/java/system_modules.go +++ b/java/system_modules.go @@ -19,6 +19,7 @@ import ( "strings" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/android" @@ -129,7 +130,7 @@ type SystemModulesProviderInfo struct { OutputDirDeps android.Paths // depset of header jars for this module and all transitive static dependencies - TransitiveStaticLibsHeaderJars *android.DepSet[android.Path] + TransitiveStaticLibsHeaderJars depset.DepSet[android.Path] } var SystemModulesProvider = blueprint.NewProvider[*SystemModulesProviderInfo]() @@ -152,13 +153,11 @@ type SystemModulesProperties struct { func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleContext) { var jars android.Paths - var transitiveStaticLibsHeaderJars []*android.DepSet[android.Path] + var transitiveStaticLibsHeaderJars []depset.DepSet[android.Path] ctx.VisitDirectDepsWithTag(systemModulesLibsTag, func(module android.Module) { if dep, ok := android.OtherModuleProvider(ctx, module, JavaInfoProvider); ok { jars = append(jars, dep.HeaderJars...) - if dep.TransitiveStaticLibsHeaderJars != nil { - transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) - } + transitiveStaticLibsHeaderJars = append(transitiveStaticLibsHeaderJars, dep.TransitiveStaticLibsHeaderJars) } }) @@ -168,7 +167,7 @@ func (system *SystemModules) GenerateAndroidBuildActions(ctx android.ModuleConte HeaderJars: jars, OutputDir: system.outputDir, OutputDirDeps: system.outputDeps, - TransitiveStaticLibsHeaderJars: android.NewDepSet(android.PREORDER, nil, transitiveStaticLibsHeaderJars), + TransitiveStaticLibsHeaderJars: depset.New(depset.PREORDER, nil, transitiveStaticLibsHeaderJars), }) } diff --git a/java/test_spec_test.go b/java/test_spec_test.go deleted file mode 100644 index f0a5fdb4b..000000000 --- a/java/test_spec_test.go +++ /dev/null @@ -1,122 +0,0 @@ -package java - -import ( - "strings" - "testing" - - "android/soong/android" - soongTesting "android/soong/testing" - "android/soong/testing/test_spec_proto" - "google.golang.org/protobuf/proto" -) - -func TestTestSpec(t *testing.T) { - bp := `test_spec { - name: "module-name", - teamId: "12345", - tests: [ - "java-test-module-name-one", - "java-test-module-name-two" - ] - } - - java_test { - name: "java-test-module-name-one", - } - - java_test { - name: "java-test-module-name-two", - }` - result := runTestSpecTest(t, android.FixtureExpectsNoErrors, bp) - - module := result.ModuleForTests("module-name", "") - - // Check that the provider has the right contents - data, _ := android.OtherModuleProvider(result, module.Module(), soongTesting.TestSpecProviderKey) - if !strings.HasSuffix( - data.IntermediatePath.String(), "/intermediateTestSpecMetadata.pb", - ) { - t.Errorf( - "Missing intermediates path in provider: %s", - data.IntermediatePath.String(), - ) - } - - metadata := android.ContentFromFileRuleForTests(t, result.TestContext, - module.Output(data.IntermediatePath.String())) - - metadataList := make([]*test_spec_proto.TestSpec_OwnershipMetadata, 0, 2) - teamId := "12345" - bpFilePath := "Android.bp" - targetNames := []string{ - "java-test-module-name-one", "java-test-module-name-two", - } - - for _, test := range targetNames { - targetName := test - metadata := test_spec_proto.TestSpec_OwnershipMetadata{ - TrendyTeamId: &teamId, - TargetName: &targetName, - Path: &bpFilePath, - } - metadataList = append(metadataList, &metadata) - } - testSpecMetadata := test_spec_proto.TestSpec{OwnershipMetadataList: metadataList} - protoData, _ := proto.Marshal(&testSpecMetadata) - expectedMetadata := string(protoData) - - if metadata != expectedMetadata { - t.Errorf( - "Retrieved metadata: %s doesn't contain expectedMetadata: %s", metadata, - expectedMetadata, - ) - } - - // Tests for all_test_spec singleton. - singleton := result.SingletonForTests("all_test_specs") - rule := singleton.Rule("all_test_specs_rule") - prebuiltOs := result.Config.PrebuiltOS() - expectedCmd := "out/soong/host/" + prebuiltOs + "/bin/metadata -rule test_spec -inputFile out/soong/all_test_spec_paths.rsp -outputFile out/soong/ownership/all_test_specs.pb" - expectedOutputFile := "out/soong/ownership/all_test_specs.pb" - expectedInputFile := "out/soong/.intermediates/module-name/intermediateTestSpecMetadata.pb" - if !strings.Contains( - strings.TrimSpace(rule.Output.String()), - expectedOutputFile, - ) { - t.Errorf( - "Retrieved singletonOutputFile: %s is not equal to expectedSingletonOutputFile: %s", - rule.Output.String(), expectedOutputFile, - ) - } - - if !strings.Contains( - strings.TrimSpace(rule.Inputs[0].String()), - expectedInputFile, - ) { - t.Errorf( - "Retrieved singletonInputFile: %s is not equal to expectedSingletonInputFile: %s", - rule.Inputs[0].String(), expectedInputFile, - ) - } - - if !strings.Contains( - strings.TrimSpace(rule.RuleParams.Command), - expectedCmd, - ) { - t.Errorf( - "Retrieved cmd: %s is not equal to expectedCmd: %s", - rule.RuleParams.Command, expectedCmd, - ) - } -} - -func runTestSpecTest( - t *testing.T, errorHandler android.FixtureErrorHandler, bp string, -) *android.TestResult { - return android.GroupFixturePreparers( - soongTesting.PrepareForTestWithTestingBuildComponents, - PrepareForIntegrationTestWithJava, - ). - ExtendWithErrorHandler(errorHandler). - RunTestWithBp(t, bp) -} diff --git a/licenses/Android.bp b/licenses/Android.bp index e4e5da74e..f420110dd 100644 --- a/licenses/Android.bp +++ b/licenses/Android.bp @@ -32,6 +32,17 @@ license { } license_kind { + name: "BSD-Binary-Only", + conditions: [ + "notice", + "by_exception_only", + "proprietary", + ], +} + +// Deprecated. All users of the following license should be changed to +// BSD-Binary-Only and it should be removed. +license_kind { name: "BSD-Like-Binary-Only", conditions: [ "notice", diff --git a/python/Android.bp b/python/Android.bp index 14e83c184..3b5445510 100644 --- a/python/Android.bp +++ b/python/Android.bp @@ -10,7 +10,6 @@ bootstrap_go_package { "soong-android", "soong-tradefed", "soong-cc", - "soong-testing", ], srcs: [ "binary.go", diff --git a/python/test.go b/python/test.go index acf5b26da..9f57bea1b 100644 --- a/python/test.go +++ b/python/test.go @@ -17,8 +17,6 @@ package python import ( "fmt" - "android/soong/testing" - "github.com/google/blueprint/proptools" "android/soong/android" @@ -208,8 +206,6 @@ func (p *PythonTestModule) GenerateAndroidBuildActions(ctx android.ModuleContext installDir := installDir(ctx, "nativetest", "nativetest64", ctx.ModuleName()) installedData := ctx.InstallTestData(installDir, p.data) p.installedDest = ctx.InstallFile(installDir, p.installSource.Base(), p.installSource, installedData...) - - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) } func (p *PythonTestModule) AndroidMkEntries() []android.AndroidMkEntries { diff --git a/rust/Android.bp b/rust/Android.bp index 781f325d1..54ba9d49c 100644 --- a/rust/Android.bp +++ b/rust/Android.bp @@ -12,7 +12,6 @@ bootstrap_go_package { "soong-bloaty", "soong-cc", "soong-rust-config", - "soong-testing", ], srcs: [ "afdo.go", diff --git a/rust/library.go b/rust/library.go index 7db8f3691..20cd2af7d 100644 --- a/rust/library.go +++ b/rust/library.go @@ -21,6 +21,7 @@ import ( "strings" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "android/soong/android" "android/soong/cc" @@ -620,7 +621,7 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa } if library.static() { - depSet := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).Direct(outputFile).Build() + depSet := depset.NewBuilder[android.Path](depset.TOPOLOGICAL).Direct(outputFile).Build() android.SetProvider(ctx, cc.StaticLibraryInfoProvider, cc.StaticLibraryInfo{ StaticLibrary: outputFile, diff --git a/rust/rust.go b/rust/rust.go index b22ebf7e7..6b91ccb25 100644 --- a/rust/rust.go +++ b/rust/rust.go @@ -20,9 +20,9 @@ import ( "strings" "android/soong/bloaty" - "android/soong/testing" "github.com/google/blueprint" + "github.com/google/blueprint/depset" "github.com/google/blueprint/proptools" "android/soong/android" @@ -179,7 +179,7 @@ type Module struct { // For apex variants, this is set as apex.min_sdk_version apexSdkVersion android.ApiLevel - transitiveAndroidMkSharedLibs *android.DepSet[string] + transitiveAndroidMkSharedLibs depset.DepSet[string] } func (mod *Module) Header() bool { @@ -992,9 +992,6 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { ctx.Phony("rust", ctx.RustModule().OutputFile().Path()) } - if mod.testModule { - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) - } mod.setOutputFiles(ctx) @@ -1217,7 +1214,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { skipModuleList := map[string]bool{} - var transitiveAndroidMkSharedLibs []*android.DepSet[string] + var transitiveAndroidMkSharedLibs []depset.DepSet[string] var directAndroidMkSharedLibs []string ctx.VisitDirectDeps(func(dep android.Module) { @@ -1453,7 +1450,7 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps { } }) - mod.transitiveAndroidMkSharedLibs = android.NewDepSet[string](android.PREORDER, directAndroidMkSharedLibs, transitiveAndroidMkSharedLibs) + mod.transitiveAndroidMkSharedLibs = depset.New[string](depset.PREORDER, directAndroidMkSharedLibs, transitiveAndroidMkSharedLibs) var rlibDepFiles RustLibraries aliases := mod.compiler.Aliases() diff --git a/sh/Android.bp b/sh/Android.bp index 930fcf54d..1deedc731 100644 --- a/sh/Android.bp +++ b/sh/Android.bp @@ -11,7 +11,6 @@ bootstrap_go_package { "soong-android", "soong-cc", "soong-java", - "soong-testing", "soong-tradefed", ], srcs: [ diff --git a/sh/sh_binary.go b/sh/sh_binary.go index 399144983..9c0db73ba 100644 --- a/sh/sh_binary.go +++ b/sh/sh_binary.go @@ -18,8 +18,6 @@ import ( "path/filepath" "strings" - "android/soong/testing" - "github.com/google/blueprint" "github.com/google/blueprint/proptools" @@ -510,8 +508,6 @@ func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { installedData := ctx.InstallTestData(s.installDir, s.data) s.installedFile = ctx.InstallExecutable(s.installDir, s.outputFilePath.Base(), s.outputFilePath, installedData...) - - android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{}) } func (s *ShTest) InstallInData() bool { diff --git a/testing/Android.bp b/testing/Android.bp deleted file mode 100644 index 43040b0f9..000000000 --- a/testing/Android.bp +++ /dev/null @@ -1,24 +0,0 @@ -package { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -bootstrap_go_package { - name: "soong-testing", - pkgPath: "android/soong/testing", - deps: [ - "blueprint", - "soong-android", - "soong-testing-code_metadata_internal_proto", - "soong-testing-test_spec_proto", - - ], - srcs: [ - "all_code_metadata.go", - "all_test_specs.go", - "code_metadata.go", - "test_spec.go", - "init.go", - "test.go", - ], - pluginFor: ["soong_build"], -} diff --git a/testing/OWNERS b/testing/OWNERS deleted file mode 100644 index 03bcdf1c4..000000000 --- a/testing/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -dariofreni@google.com -joeo@google.com -ronish@google.com -caditya@google.com diff --git a/testing/all_code_metadata.go b/testing/all_code_metadata.go deleted file mode 100644 index e89b28155..000000000 --- a/testing/all_code_metadata.go +++ /dev/null @@ -1,46 +0,0 @@ -package testing - -import ( - "android/soong/android" -) - -const fileContainingCodeMetadataFilePaths = "all_code_metadata_paths.rsp" -const allCodeMetadataFile = "all_code_metadata.pb" - -func AllCodeMetadataFactory() android.Singleton { - return &allCodeMetadataSingleton{} -} - -type allCodeMetadataSingleton struct { - // Path where the collected metadata is stored after successful validation. - outputPath android.OutputPath -} - -func (this *allCodeMetadataSingleton) GenerateBuildActions(ctx android.SingletonContext) { - var intermediateMetadataPaths android.Paths - - ctx.VisitAllModules( - func(module android.Module) { - if metadata, ok := android.OtherModuleProvider(ctx, module, CodeMetadataProviderKey); ok { - intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath) - } - }, - ) - - rspFile := android.PathForOutput(ctx, fileContainingCodeMetadataFilePaths) - this.outputPath = android.PathForOutput(ctx, ownershipDirectory, allCodeMetadataFile) - - rule := android.NewRuleBuilder(pctx, ctx) - cmd := rule.Command(). - BuiltTool("metadata"). - FlagWithArg("-rule ", "code_metadata"). - FlagWithRspFileInputList("-inputFile ", rspFile, intermediateMetadataPaths) - cmd.FlagWithOutput("-outputFile ", this.outputPath) - rule.Build("all_code_metadata_rule", "Generate all code metadata") - - ctx.Phony("all_code_metadata", this.outputPath) -} - -func (this *allCodeMetadataSingleton) MakeVars(ctx android.MakeVarsContext) { - ctx.DistForGoal("code_metadata", this.outputPath) -} diff --git a/testing/all_test_specs.go b/testing/all_test_specs.go deleted file mode 100644 index 68f24d15c..000000000 --- a/testing/all_test_specs.go +++ /dev/null @@ -1,44 +0,0 @@ -package testing - -import ( - "android/soong/android" -) - -const ownershipDirectory = "ownership" -const fileContainingFilePaths = "all_test_spec_paths.rsp" -const allTestSpecsFile = "all_test_specs.pb" - -func AllTestSpecsFactory() android.Singleton { - return &allTestSpecsSingleton{} -} - -type allTestSpecsSingleton struct { - // Path where the collected metadata is stored after successful validation. - outputPath android.OutputPath -} - -func (this *allTestSpecsSingleton) GenerateBuildActions(ctx android.SingletonContext) { - var intermediateMetadataPaths android.Paths - - ctx.VisitAllModules(func(module android.Module) { - if metadata, ok := android.OtherModuleProvider(ctx, module, TestSpecProviderKey); ok { - intermediateMetadataPaths = append(intermediateMetadataPaths, metadata.IntermediatePath) - } - }) - - rspFile := android.PathForOutput(ctx, fileContainingFilePaths) - this.outputPath = android.PathForOutput(ctx, ownershipDirectory, allTestSpecsFile) - - rule := android.NewRuleBuilder(pctx, ctx) - cmd := rule.Command(). - BuiltTool("metadata"). - FlagWithArg("-rule ", "test_spec"). - FlagWithRspFileInputList("-inputFile ", rspFile, intermediateMetadataPaths) - cmd.FlagWithOutput("-outputFile ", this.outputPath) - rule.Build("all_test_specs_rule", "Generate all test specifications") - ctx.Phony("all_test_specs", this.outputPath) -} - -func (this *allTestSpecsSingleton) MakeVars(ctx android.MakeVarsContext) { - ctx.DistForGoal("test_specs", this.outputPath) -} diff --git a/testing/code_metadata.go b/testing/code_metadata.go deleted file mode 100644 index 11ba43037..000000000 --- a/testing/code_metadata.go +++ /dev/null @@ -1,137 +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 testing - -import ( - "path/filepath" - - "android/soong/android" - "android/soong/testing/code_metadata_internal_proto" - "github.com/google/blueprint" - - "google.golang.org/protobuf/proto" -) - -func CodeMetadataFactory() android.Module { - module := &CodeMetadataModule{} - - android.InitAndroidModule(module) - android.InitDefaultableModule(module) - module.AddProperties(&module.properties) - - return module -} - -type CodeMetadataModule struct { - android.ModuleBase - android.DefaultableModuleBase - - // Properties for "code_metadata" - properties struct { - // Specifies the name of the code_config. - Name string - // Specifies the team ID. - TeamId string - // Specifies the list of modules that this code_metadata covers. - Code []string - // An optional field to specify if multiple ownerships for source files is allowed. - MultiOwnership bool - } -} - -type codeDepTagType struct { - blueprint.BaseDependencyTag -} - -var codeDepTag = codeDepTagType{} - -func (module *CodeMetadataModule) DepsMutator(ctx android.BottomUpMutatorContext) { - // Validate Properties - if len(module.properties.TeamId) == 0 { - ctx.PropertyErrorf( - "TeamId", - "Team Id not found in the code_metadata module. Hint: Maybe the teamId property hasn't been properly specified.", - ) - } - if !isInt(module.properties.TeamId) { - ctx.PropertyErrorf( - "TeamId", "Invalid value for Team ID. The Team ID must be an integer.", - ) - } - if len(module.properties.Code) == 0 { - ctx.PropertyErrorf( - "Code", - "Targets to be attributed cannot be empty. Hint: Maybe the code property hasn't been properly specified.", - ) - } - ctx.AddDependency(ctx.Module(), codeDepTag, module.properties.Code...) -} - -// Provider published by CodeMetadata -type CodeMetadataProviderData struct { - IntermediatePath android.WritablePath -} - -var CodeMetadataProviderKey = blueprint.NewProvider[CodeMetadataProviderData]() - -func (module *CodeMetadataModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { - metadataList := make( - []*code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership, 0, - len(module.properties.Code), - ) - bpFilePath := filepath.Join(ctx.ModuleDir(), ctx.BlueprintsFile()) - - for _, m := range ctx.GetDirectDepsWithTag(codeDepTag) { - targetName := m.Name() - var moduleSrcs []string - if srcsFileInfo, ok := android.OtherModuleProvider(ctx, m, blueprint.SrcsFileProviderKey); ok { - moduleSrcs = srcsFileInfo.SrcPaths - } - if module.properties.MultiOwnership { - metadata := &code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership{ - TargetName: &targetName, - TrendyTeamId: &module.properties.TeamId, - Path: &bpFilePath, - MultiOwnership: &module.properties.MultiOwnership, - SourceFiles: moduleSrcs, - } - metadataList = append(metadataList, metadata) - } else { - metadata := &code_metadata_internal_proto.CodeMetadataInternal_TargetOwnership{ - TargetName: &targetName, - TrendyTeamId: &module.properties.TeamId, - Path: &bpFilePath, - SourceFiles: moduleSrcs, - } - metadataList = append(metadataList, metadata) - } - - } - codeMetadata := &code_metadata_internal_proto.CodeMetadataInternal{TargetOwnershipList: metadataList} - protoData, err := proto.Marshal(codeMetadata) - if err != nil { - ctx.ModuleErrorf("Error marshaling code metadata: %s", err.Error()) - return - } - intermediatePath := android.PathForModuleOut( - ctx, "intermediateCodeMetadata.pb", - ) - android.WriteFileRuleVerbatim(ctx, intermediatePath, string(protoData)) - - android.SetProvider(ctx, - CodeMetadataProviderKey, - CodeMetadataProviderData{IntermediatePath: intermediatePath}, - ) -} diff --git a/testing/code_metadata_internal_proto/Android.bp b/testing/code_metadata_internal_proto/Android.bp deleted file mode 100644 index 396e44f52..000000000 --- a/testing/code_metadata_internal_proto/Android.bp +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -bootstrap_go_package { - name: "soong-testing-code_metadata_internal_proto", - pkgPath: "android/soong/testing/code_metadata_internal_proto", - deps: [ - "golang-protobuf-reflect-protoreflect", - "golang-protobuf-runtime-protoimpl", - ], - srcs: [ - "code_metadata_internal.pb.go", - ], - visibility: [ - "//build/make/tools/metadata", - "//build/soong:__subpackages__", - ], -} diff --git a/testing/code_metadata_internal_proto/OWNERS b/testing/code_metadata_internal_proto/OWNERS deleted file mode 100644 index 03bcdf1c4..000000000 --- a/testing/code_metadata_internal_proto/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -dariofreni@google.com -joeo@google.com -ronish@google.com -caditya@google.com diff --git a/testing/code_metadata_internal_proto/code_metadata_internal.pb.go b/testing/code_metadata_internal_proto/code_metadata_internal.pb.go deleted file mode 100644 index ecb8b867a..000000000 --- a/testing/code_metadata_internal_proto/code_metadata_internal.pb.go +++ /dev/null @@ -1,277 +0,0 @@ -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.30.0 -// protoc v3.21.12 -// source: code_metadata_internal.proto - -package code_metadata_internal_proto - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CodeMetadataInternal struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of all code targets and their metadata. - TargetOwnershipList []*CodeMetadataInternal_TargetOwnership `protobuf:"bytes,1,rep,name=target_ownership_list,json=targetOwnershipList" json:"target_ownership_list,omitempty"` -} - -func (x *CodeMetadataInternal) Reset() { - *x = CodeMetadataInternal{} - if protoimpl.UnsafeEnabled { - mi := &file_code_metadata_internal_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CodeMetadataInternal) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CodeMetadataInternal) ProtoMessage() {} - -func (x *CodeMetadataInternal) ProtoReflect() protoreflect.Message { - mi := &file_code_metadata_internal_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CodeMetadataInternal.ProtoReflect.Descriptor instead. -func (*CodeMetadataInternal) Descriptor() ([]byte, []int) { - return file_code_metadata_internal_proto_rawDescGZIP(), []int{0} -} - -func (x *CodeMetadataInternal) GetTargetOwnershipList() []*CodeMetadataInternal_TargetOwnership { - if x != nil { - return x.TargetOwnershipList - } - return nil -} - -type CodeMetadataInternal_TargetOwnership struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // REQUIRED: Name of the build target - TargetName *string `protobuf:"bytes,1,opt,name=target_name,json=targetName" json:"target_name,omitempty"` - // REQUIRED: Code location of the target. - // To be used to support legacy/backup systems that use OWNERS file and is - // also required for our dashboard to support per code location basis UI - Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` - // REQUIRED: Team ID of the team that owns this target. - TrendyTeamId *string `protobuf:"bytes,3,opt,name=trendy_team_id,json=trendyTeamId" json:"trendy_team_id,omitempty"` - // OPTIONAL: The src files of the target. - // To be used to determine ownership of a file for ownership - SourceFiles []string `protobuf:"bytes,4,rep,name=source_files,json=sourceFiles" json:"source_files,omitempty"` - // OPTIONAL: Specify if multiple ownerships of the source files are allowed. - MultiOwnership *bool `protobuf:"varint,5,opt,name=multi_ownership,json=multiOwnership" json:"multi_ownership,omitempty"` -} - -func (x *CodeMetadataInternal_TargetOwnership) Reset() { - *x = CodeMetadataInternal_TargetOwnership{} - if protoimpl.UnsafeEnabled { - mi := &file_code_metadata_internal_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CodeMetadataInternal_TargetOwnership) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CodeMetadataInternal_TargetOwnership) ProtoMessage() {} - -func (x *CodeMetadataInternal_TargetOwnership) ProtoReflect() protoreflect.Message { - mi := &file_code_metadata_internal_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CodeMetadataInternal_TargetOwnership.ProtoReflect.Descriptor instead. -func (*CodeMetadataInternal_TargetOwnership) Descriptor() ([]byte, []int) { - return file_code_metadata_internal_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *CodeMetadataInternal_TargetOwnership) GetTargetName() string { - if x != nil && x.TargetName != nil { - return *x.TargetName - } - return "" -} - -func (x *CodeMetadataInternal_TargetOwnership) GetPath() string { - if x != nil && x.Path != nil { - return *x.Path - } - return "" -} - -func (x *CodeMetadataInternal_TargetOwnership) GetTrendyTeamId() string { - if x != nil && x.TrendyTeamId != nil { - return *x.TrendyTeamId - } - return "" -} - -func (x *CodeMetadataInternal_TargetOwnership) GetSourceFiles() []string { - if x != nil { - return x.SourceFiles - } - return nil -} - -func (x *CodeMetadataInternal_TargetOwnership) GetMultiOwnership() bool { - if x != nil && x.MultiOwnership != nil { - return *x.MultiOwnership - } - return false -} - -var File_code_metadata_internal_proto protoreflect.FileDescriptor - -var file_code_metadata_internal_proto_rawDesc = []byte{ - 0x0a, 0x1c, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, - 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc9, 0x02, 0x0a, - 0x14, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x12, 0x76, 0x0a, 0x15, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, - 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x13, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x1a, 0xb8, 0x01, - 0x0a, 0x0f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, - 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, - 0x5f, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, 0x54, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, - 0x27, 0x0a, 0x0f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, - 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x4f, - 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x42, 0x34, 0x5a, 0x32, 0x61, 0x6e, 0x64, 0x72, - 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, - 0x67, 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, -} - -var ( - file_code_metadata_internal_proto_rawDescOnce sync.Once - file_code_metadata_internal_proto_rawDescData = file_code_metadata_internal_proto_rawDesc -) - -func file_code_metadata_internal_proto_rawDescGZIP() []byte { - file_code_metadata_internal_proto_rawDescOnce.Do(func() { - file_code_metadata_internal_proto_rawDescData = protoimpl.X.CompressGZIP(file_code_metadata_internal_proto_rawDescData) - }) - return file_code_metadata_internal_proto_rawDescData -} - -var file_code_metadata_internal_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_code_metadata_internal_proto_goTypes = []interface{}{ - (*CodeMetadataInternal)(nil), // 0: code_metadata_internal_proto.CodeMetadataInternal - (*CodeMetadataInternal_TargetOwnership)(nil), // 1: code_metadata_internal_proto.CodeMetadataInternal.TargetOwnership -} -var file_code_metadata_internal_proto_depIdxs = []int32{ - 1, // 0: code_metadata_internal_proto.CodeMetadataInternal.target_ownership_list:type_name -> code_metadata_internal_proto.CodeMetadataInternal.TargetOwnership - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_code_metadata_internal_proto_init() } -func file_code_metadata_internal_proto_init() { - if File_code_metadata_internal_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_code_metadata_internal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeMetadataInternal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_code_metadata_internal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeMetadataInternal_TargetOwnership); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_code_metadata_internal_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_code_metadata_internal_proto_goTypes, - DependencyIndexes: file_code_metadata_internal_proto_depIdxs, - MessageInfos: file_code_metadata_internal_proto_msgTypes, - }.Build() - File_code_metadata_internal_proto = out.File - file_code_metadata_internal_proto_rawDesc = nil - file_code_metadata_internal_proto_goTypes = nil - file_code_metadata_internal_proto_depIdxs = nil -} diff --git a/testing/code_metadata_internal_proto/code_metadata_internal.proto b/testing/code_metadata_internal_proto/code_metadata_internal.proto deleted file mode 100644 index 14edc0f9b..000000000 --- a/testing/code_metadata_internal_proto/code_metadata_internal.proto +++ /dev/null @@ -1,40 +0,0 @@ -// 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. - -syntax = "proto2"; -package code_metadata_internal_proto; -option go_package = "android/soong/testing/code_metadata_internal_proto"; - -message CodeMetadataInternal { - - message TargetOwnership { - // REQUIRED: Name of the build target - optional string target_name = 1; - - // REQUIRED: Code location of the target. - // To be used to support legacy/backup systems that use OWNERS file and is - // also required for our dashboard to support per code location basis UI - optional string path = 2; - - // REQUIRED: Team ID of the team that owns this target. - optional string trendy_team_id = 3; - - // OPTIONAL: The src files of the target. - // To be used to determine ownership of a file for ownership - repeated string source_files = 4; - - // OPTIONAL: Specify if multiple ownerships of the source files are allowed. - optional bool multi_ownership = 5; - } - - // List of all code targets and their metadata. - repeated TargetOwnership target_ownership_list = 1; -} diff --git a/testing/code_metadata_internal_proto/regen.sh b/testing/code_metadata_internal_proto/regen.sh deleted file mode 100644 index f101a02b2..000000000 --- a/testing/code_metadata_internal_proto/regen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -aprotoc --go_out=paths=source_relative:. code_metadata_internal.proto diff --git a/testing/code_metadata_proto/Android.bp b/testing/code_metadata_proto/Android.bp deleted file mode 100644 index ae41d4aa1..000000000 --- a/testing/code_metadata_proto/Android.bp +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2022 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -bootstrap_go_package { - name: "soong-testing-code_metadata_proto", - pkgPath: "android/soong/testing/code_metadata_proto", - deps: [ - "golang-protobuf-reflect-protoreflect", - "golang-protobuf-runtime-protoimpl", - ], - srcs: [ - "code_metadata.pb.go", - ], - visibility: ["//build/make/tools/metadata"], -} - -python_library_host { - name: "code-metadata-proto-py", - pkg_path: "code_metadata", - srcs: [ - "code_metadata.proto", - ], - libs: [ - "libprotobuf-python", - ], - proto: { - canonical_path_from_root: false, - }, - visibility: ["//tools/asuite/team_build_scripts"], -} diff --git a/testing/code_metadata_proto/OWNERS b/testing/code_metadata_proto/OWNERS deleted file mode 100644 index 03bcdf1c4..000000000 --- a/testing/code_metadata_proto/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -dariofreni@google.com -joeo@google.com -ronish@google.com -caditya@google.com diff --git a/testing/code_metadata_proto/code_metadata.pb.go b/testing/code_metadata_proto/code_metadata.pb.go deleted file mode 100644 index 711bf7a82..000000000 --- a/testing/code_metadata_proto/code_metadata.pb.go +++ /dev/null @@ -1,263 +0,0 @@ -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.30.0 -// protoc v3.21.12 -// source: code_metadata.proto - -package code_metadata_proto - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type CodeMetadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of all code targets and their metadata. - TargetOwnershipList []*CodeMetadata_TargetOwnership `protobuf:"bytes,1,rep,name=target_ownership_list,json=targetOwnershipList" json:"target_ownership_list,omitempty"` -} - -func (x *CodeMetadata) Reset() { - *x = CodeMetadata{} - if protoimpl.UnsafeEnabled { - mi := &file_code_metadata_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CodeMetadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CodeMetadata) ProtoMessage() {} - -func (x *CodeMetadata) ProtoReflect() protoreflect.Message { - mi := &file_code_metadata_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CodeMetadata.ProtoReflect.Descriptor instead. -func (*CodeMetadata) Descriptor() ([]byte, []int) { - return file_code_metadata_proto_rawDescGZIP(), []int{0} -} - -func (x *CodeMetadata) GetTargetOwnershipList() []*CodeMetadata_TargetOwnership { - if x != nil { - return x.TargetOwnershipList - } - return nil -} - -type CodeMetadata_TargetOwnership struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // REQUIRED: Name of the build target - TargetName *string `protobuf:"bytes,1,opt,name=target_name,json=targetName" json:"target_name,omitempty"` - // REQUIRED: Code location of the target. - // To be used to support legacy/backup systems that use OWNERS file and is - // also required for our dashboard to support per code location basis UI - Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` - // REQUIRED: Team ID of the team that owns this target. - TrendyTeamId *string `protobuf:"bytes,3,opt,name=trendy_team_id,json=trendyTeamId" json:"trendy_team_id,omitempty"` - // OPTIONAL: The src files of the target. - // To be used to determine ownership of a file for ownership - SourceFiles []string `protobuf:"bytes,4,rep,name=source_files,json=sourceFiles" json:"source_files,omitempty"` -} - -func (x *CodeMetadata_TargetOwnership) Reset() { - *x = CodeMetadata_TargetOwnership{} - if protoimpl.UnsafeEnabled { - mi := &file_code_metadata_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CodeMetadata_TargetOwnership) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CodeMetadata_TargetOwnership) ProtoMessage() {} - -func (x *CodeMetadata_TargetOwnership) ProtoReflect() protoreflect.Message { - mi := &file_code_metadata_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CodeMetadata_TargetOwnership.ProtoReflect.Descriptor instead. -func (*CodeMetadata_TargetOwnership) Descriptor() ([]byte, []int) { - return file_code_metadata_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *CodeMetadata_TargetOwnership) GetTargetName() string { - if x != nil && x.TargetName != nil { - return *x.TargetName - } - return "" -} - -func (x *CodeMetadata_TargetOwnership) GetPath() string { - if x != nil && x.Path != nil { - return *x.Path - } - return "" -} - -func (x *CodeMetadata_TargetOwnership) GetTrendyTeamId() string { - if x != nil && x.TrendyTeamId != nil { - return *x.TrendyTeamId - } - return "" -} - -func (x *CodeMetadata_TargetOwnership) GetSourceFiles() []string { - if x != nil { - return x.SourceFiles - } - return nil -} - -var File_code_metadata_proto protoreflect.FileDescriptor - -var file_code_metadata_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x02, 0x0a, 0x0c, 0x43, - 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x65, 0x0a, 0x15, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x5f, - 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x6f, 0x64, - 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x13, 0x74, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x4c, 0x69, - 0x73, 0x74, 0x1a, 0x8f, 0x01, 0x0a, 0x0f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4f, 0x77, 0x6e, - 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x74, - 0x72, 0x65, 0x6e, 0x64, 0x79, 0x5f, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, 0x54, 0x65, 0x61, 0x6d, 0x49, - 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x46, - 0x69, 0x6c, 0x65, 0x73, 0x42, 0x2b, 0x5a, 0x29, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, - 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x63, 0x6f, - 0x64, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, -} - -var ( - file_code_metadata_proto_rawDescOnce sync.Once - file_code_metadata_proto_rawDescData = file_code_metadata_proto_rawDesc -) - -func file_code_metadata_proto_rawDescGZIP() []byte { - file_code_metadata_proto_rawDescOnce.Do(func() { - file_code_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_code_metadata_proto_rawDescData) - }) - return file_code_metadata_proto_rawDescData -} - -var file_code_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_code_metadata_proto_goTypes = []interface{}{ - (*CodeMetadata)(nil), // 0: code_metadata_proto.CodeMetadata - (*CodeMetadata_TargetOwnership)(nil), // 1: code_metadata_proto.CodeMetadata.TargetOwnership -} -var file_code_metadata_proto_depIdxs = []int32{ - 1, // 0: code_metadata_proto.CodeMetadata.target_ownership_list:type_name -> code_metadata_proto.CodeMetadata.TargetOwnership - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_code_metadata_proto_init() } -func file_code_metadata_proto_init() { - if File_code_metadata_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_code_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_code_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CodeMetadata_TargetOwnership); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_code_metadata_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_code_metadata_proto_goTypes, - DependencyIndexes: file_code_metadata_proto_depIdxs, - MessageInfos: file_code_metadata_proto_msgTypes, - }.Build() - File_code_metadata_proto = out.File - file_code_metadata_proto_rawDesc = nil - file_code_metadata_proto_goTypes = nil - file_code_metadata_proto_depIdxs = nil -} diff --git a/testing/code_metadata_proto/code_metadata.proto b/testing/code_metadata_proto/code_metadata.proto deleted file mode 100644 index 254836300..000000000 --- a/testing/code_metadata_proto/code_metadata.proto +++ /dev/null @@ -1,37 +0,0 @@ -// 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. - -syntax = "proto2"; -package code_metadata_proto; -option go_package = "android/soong/testing/code_metadata_proto"; - -message CodeMetadata { - - message TargetOwnership { - // REQUIRED: Name of the build target - optional string target_name = 1; - - // REQUIRED: Code location of the target. - // To be used to support legacy/backup systems that use OWNERS file and is - // also required for our dashboard to support per code location basis UI - optional string path = 2; - - // REQUIRED: Team ID of the team that owns this target. - optional string trendy_team_id = 3; - - // OPTIONAL: The src files of the target. - // To be used to determine ownership of a file for ownership - repeated string source_files = 4; - } - - // List of all code targets and their metadata. - repeated TargetOwnership target_ownership_list = 1; -} diff --git a/testing/code_metadata_proto/regen.sh b/testing/code_metadata_proto/regen.sh deleted file mode 100644 index ffe06f7e2..000000000 --- a/testing/code_metadata_proto/regen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -aprotoc --go_out=paths=source_relative:. code_metadata.proto diff --git a/testing/init.go b/testing/init.go deleted file mode 100644 index edcbf59b4..000000000 --- a/testing/init.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2022 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 testing - -import ( - "android/soong/android" -) - -var ( - pctx = android.NewPackageContext("android/soong/testing") -) - -func init() { - RegisterBuildComponents(android.InitRegistrationContext) - pctx.HostBinToolVariable("metadata", "metadata") -} - -func RegisterBuildComponents(ctx android.RegistrationContext) { - ctx.RegisterModuleType("code_metadata", CodeMetadataFactory) - ctx.RegisterModuleType("test_spec", TestSpecFactory) - ctx.RegisterParallelSingletonType("all_code_metadata", AllCodeMetadataFactory) - ctx.RegisterParallelSingletonType("all_test_specs", AllTestSpecsFactory) -} diff --git a/testing/test.go b/testing/test.go deleted file mode 100644 index cd97a8fac..000000000 --- a/testing/test.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2023 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 testing - -import ( - "android/soong/android" -) - -var PrepareForTestWithTestingBuildComponents = android.FixtureRegisterWithContext(RegisterBuildComponents) diff --git a/testing/test_spec.go b/testing/test_spec.go deleted file mode 100644 index 4d885c6de..000000000 --- a/testing/test_spec.go +++ /dev/null @@ -1,127 +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 testing - -import ( - "path/filepath" - "strconv" - - "android/soong/android" - "android/soong/testing/test_spec_proto" - "google.golang.org/protobuf/proto" - - "github.com/google/blueprint" -) - -// ErrTestModuleDataNotFound is the error message for missing test module provider data. -const ErrTestModuleDataNotFound = "The module '%s' does not provide test specification data. Hint: This issue could arise if either the module is not a valid testing module or if it lacks the required 'TestModuleProviderKey' provider.\n" - -func TestSpecFactory() android.Module { - module := &TestSpecModule{} - - android.InitAndroidModule(module) - android.InitDefaultableModule(module) - module.AddProperties(&module.properties) - - return module -} - -type TestSpecModule struct { - android.ModuleBase - android.DefaultableModuleBase - - // Properties for "test_spec" - properties struct { - // Specifies the name of the test config. - Name string - // Specifies the team ID. - TeamId string - // Specifies the list of tests covered under this module. - Tests []string - } -} - -type testsDepTagType struct { - blueprint.BaseDependencyTag -} - -var testsDepTag = testsDepTagType{} - -func (module *TestSpecModule) DepsMutator(ctx android.BottomUpMutatorContext) { - // Validate Properties - if len(module.properties.TeamId) == 0 { - ctx.PropertyErrorf("TeamId", "Team Id not found in the test_spec module. Hint: Maybe the TeamId property hasn't been properly specified.") - } - if !isInt(module.properties.TeamId) { - ctx.PropertyErrorf("TeamId", "Invalid value for Team ID. The Team ID must be an integer.") - } - if len(module.properties.Tests) == 0 { - ctx.PropertyErrorf("Tests", "Expected to attribute some test but none found. Hint: Maybe the test property hasn't been properly specified.") - } - ctx.AddDependency(ctx.Module(), testsDepTag, module.properties.Tests...) -} -func isInt(s string) bool { - _, err := strconv.Atoi(s) - return err == nil -} - -// Provider published by TestSpec -type TestSpecProviderData struct { - IntermediatePath android.WritablePath -} - -var TestSpecProviderKey = blueprint.NewProvider[TestSpecProviderData]() - -type TestModuleProviderData struct { -} - -var TestModuleProviderKey = blueprint.NewProvider[TestModuleProviderData]() - -func (module *TestSpecModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { - for _, m := range ctx.GetDirectDepsWithTag(testsDepTag) { - if _, ok := android.OtherModuleProvider(ctx, m, TestModuleProviderKey); !ok { - ctx.ModuleErrorf(ErrTestModuleDataNotFound, m.Name()) - } - } - bpFilePath := filepath.Join(ctx.ModuleDir(), ctx.BlueprintsFile()) - metadataList := make( - []*test_spec_proto.TestSpec_OwnershipMetadata, 0, - len(module.properties.Tests), - ) - for _, test := range module.properties.Tests { - targetName := test - metadata := test_spec_proto.TestSpec_OwnershipMetadata{ - TrendyTeamId: &module.properties.TeamId, - TargetName: &targetName, - Path: &bpFilePath, - } - metadataList = append(metadataList, &metadata) - } - intermediatePath := android.PathForModuleOut( - ctx, "intermediateTestSpecMetadata.pb", - ) - testSpecMetadata := test_spec_proto.TestSpec{OwnershipMetadataList: metadataList} - protoData, err := proto.Marshal(&testSpecMetadata) - if err != nil { - ctx.ModuleErrorf("Error: %s", err.Error()) - } - android.WriteFileRuleVerbatim(ctx, intermediatePath, string(protoData)) - - android.SetProvider(ctx, - TestSpecProviderKey, TestSpecProviderData{ - IntermediatePath: intermediatePath, - }, - ) -} diff --git a/testing/test_spec_proto/Android.bp b/testing/test_spec_proto/Android.bp deleted file mode 100644 index 1070d1a9c..000000000 --- a/testing/test_spec_proto/Android.bp +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -bootstrap_go_package { - name: "soong-testing-test_spec_proto", - pkgPath: "android/soong/testing/test_spec_proto", - deps: [ - "golang-protobuf-reflect-protoreflect", - "golang-protobuf-runtime-protoimpl", - ], - srcs: [ - "test_spec.pb.go", - ], - visibility: [ - "//build/make/tools/metadata", - "//build/soong:__subpackages__", - "//vendor:__subpackages__", - ], -} - -python_library_host { - name: "test-spec-proto-py", - pkg_path: "test_spec", - srcs: [ - "test_spec.proto", - ], - libs: [ - "libprotobuf-python", - ], - proto: { - canonical_path_from_root: false, - }, - visibility: ["//tools/asuite/team_build_scripts"], -} diff --git a/testing/test_spec_proto/OWNERS b/testing/test_spec_proto/OWNERS deleted file mode 100644 index 03bcdf1c4..000000000 --- a/testing/test_spec_proto/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -dariofreni@google.com -joeo@google.com -ronish@google.com -caditya@google.com diff --git a/testing/test_spec_proto/regen.sh b/testing/test_spec_proto/regen.sh deleted file mode 100644 index 2cf820375..000000000 --- a/testing/test_spec_proto/regen.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -aprotoc --go_out=paths=source_relative:. test_spec.proto diff --git a/testing/test_spec_proto/test_spec.pb.go b/testing/test_spec_proto/test_spec.pb.go deleted file mode 100644 index 5cce60029..000000000 --- a/testing/test_spec_proto/test_spec.pb.go +++ /dev/null @@ -1,244 +0,0 @@ -// 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. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.30.0 -// protoc v3.21.12 -// source: test_spec.proto - -package test_spec_proto - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type TestSpec struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // List of all test targets and their metadata. - OwnershipMetadataList []*TestSpec_OwnershipMetadata `protobuf:"bytes,1,rep,name=ownership_metadata_list,json=ownershipMetadataList" json:"ownership_metadata_list,omitempty"` -} - -func (x *TestSpec) Reset() { - *x = TestSpec{} - if protoimpl.UnsafeEnabled { - mi := &file_test_spec_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestSpec) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestSpec) ProtoMessage() {} - -func (x *TestSpec) ProtoReflect() protoreflect.Message { - mi := &file_test_spec_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestSpec.ProtoReflect.Descriptor instead. -func (*TestSpec) Descriptor() ([]byte, []int) { - return file_test_spec_proto_rawDescGZIP(), []int{0} -} - -func (x *TestSpec) GetOwnershipMetadataList() []*TestSpec_OwnershipMetadata { - if x != nil { - return x.OwnershipMetadataList - } - return nil -} - -type TestSpec_OwnershipMetadata struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TargetName *string `protobuf:"bytes,1,opt,name=target_name,json=targetName" json:"target_name,omitempty"` - Path *string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` - TrendyTeamId *string `protobuf:"bytes,3,opt,name=trendy_team_id,json=trendyTeamId" json:"trendy_team_id,omitempty"` -} - -func (x *TestSpec_OwnershipMetadata) Reset() { - *x = TestSpec_OwnershipMetadata{} - if protoimpl.UnsafeEnabled { - mi := &file_test_spec_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TestSpec_OwnershipMetadata) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TestSpec_OwnershipMetadata) ProtoMessage() {} - -func (x *TestSpec_OwnershipMetadata) ProtoReflect() protoreflect.Message { - mi := &file_test_spec_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TestSpec_OwnershipMetadata.ProtoReflect.Descriptor instead. -func (*TestSpec_OwnershipMetadata) Descriptor() ([]byte, []int) { - return file_test_spec_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *TestSpec_OwnershipMetadata) GetTargetName() string { - if x != nil && x.TargetName != nil { - return *x.TargetName - } - return "" -} - -func (x *TestSpec_OwnershipMetadata) GetPath() string { - if x != nil && x.Path != nil { - return *x.Path - } - return "" -} - -func (x *TestSpec_OwnershipMetadata) GetTrendyTeamId() string { - if x != nil && x.TrendyTeamId != nil { - return *x.TrendyTeamId - } - return "" -} - -var File_test_spec_proto protoreflect.FileDescriptor - -var file_test_spec_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xdf, 0x01, 0x0a, 0x08, 0x54, 0x65, 0x73, 0x74, 0x53, 0x70, 0x65, 0x63, 0x12, - 0x63, 0x0a, 0x17, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x5f, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x2b, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x73, 0x74, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x4f, 0x77, 0x6e, 0x65, - 0x72, 0x73, 0x68, 0x69, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x15, 0x6f, - 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x4c, 0x69, 0x73, 0x74, 0x1a, 0x6e, 0x0a, 0x11, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x73, 0x68, 0x69, - 0x70, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, - 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x24, - 0x0a, 0x0e, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, 0x5f, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x72, 0x65, 0x6e, 0x64, 0x79, 0x54, 0x65, - 0x61, 0x6d, 0x49, 0x64, 0x42, 0x27, 0x5a, 0x25, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, - 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x2f, 0x74, 0x65, - 0x73, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, -} - -var ( - file_test_spec_proto_rawDescOnce sync.Once - file_test_spec_proto_rawDescData = file_test_spec_proto_rawDesc -) - -func file_test_spec_proto_rawDescGZIP() []byte { - file_test_spec_proto_rawDescOnce.Do(func() { - file_test_spec_proto_rawDescData = protoimpl.X.CompressGZIP(file_test_spec_proto_rawDescData) - }) - return file_test_spec_proto_rawDescData -} - -var file_test_spec_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_test_spec_proto_goTypes = []interface{}{ - (*TestSpec)(nil), // 0: test_spec_proto.TestSpec - (*TestSpec_OwnershipMetadata)(nil), // 1: test_spec_proto.TestSpec.OwnershipMetadata -} -var file_test_spec_proto_depIdxs = []int32{ - 1, // 0: test_spec_proto.TestSpec.ownership_metadata_list:type_name -> test_spec_proto.TestSpec.OwnershipMetadata - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_test_spec_proto_init() } -func file_test_spec_proto_init() { - if File_test_spec_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_test_spec_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestSpec); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_test_spec_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TestSpec_OwnershipMetadata); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_test_spec_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_test_spec_proto_goTypes, - DependencyIndexes: file_test_spec_proto_depIdxs, - MessageInfos: file_test_spec_proto_msgTypes, - }.Build() - File_test_spec_proto = out.File - file_test_spec_proto_rawDesc = nil - file_test_spec_proto_goTypes = nil - file_test_spec_proto_depIdxs = nil -} diff --git a/testing/test_spec_proto/test_spec.proto b/testing/test_spec_proto/test_spec.proto deleted file mode 100644 index 86bc78954..000000000 --- a/testing/test_spec_proto/test_spec.proto +++ /dev/null @@ -1,33 +0,0 @@ -// 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. - -syntax = "proto2"; -package test_spec_proto; -option go_package = "android/soong/testing/test_spec_proto"; - -message TestSpec { - - message OwnershipMetadata { - // REQUIRED: Name of the build target - optional string target_name = 1; - - // REQUIRED: Code location of the target. - // To be used to support legacy/backup systems that use OWNERS file and is - // also required for our dashboard to support per code location basis UI - optional string path = 2; - - // REQUIRED: Team ID of the team that owns this target. - optional string trendy_team_id = 3; - } - - // List of all test targets and their metadata. - repeated OwnershipMetadata ownership_metadata_list = 1; -} |