Move compliance commands into subdirectories

Move each compliance command into its own directory to avoid Go tooling
considering all the files to be a single package and complaining about
conflicting global names.

Test: go test ./...
Change-Id: I3db6310e7368bcc7fe6a3704b40a84078ed44209
This commit is contained in:
Colin Cross
2022-01-27 15:40:29 -08:00
parent 38a6193180
commit d0f05c9eda
17 changed files with 103 additions and 16 deletions

View File

@@ -19,58 +19,58 @@ package {
blueprint_go_binary {
name: "bom",
srcs: ["cmd/bom.go"],
srcs: ["cmd/bom/bom.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/bom_test.go"],
testSrcs: ["cmd/bom/bom_test.go"],
}
blueprint_go_binary {
name: "checkshare",
srcs: ["cmd/checkshare.go"],
srcs: ["cmd/checkshare/checkshare.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/checkshare_test.go"],
testSrcs: ["cmd/checkshare/checkshare_test.go"],
}
blueprint_go_binary {
name: "listshare",
srcs: ["cmd/listshare.go"],
srcs: ["cmd/listshare/listshare.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/listshare_test.go"],
testSrcs: ["cmd/listshare/listshare_test.go"],
}
blueprint_go_binary {
name: "dumpgraph",
srcs: ["cmd/dumpgraph.go"],
srcs: ["cmd/dumpgraph/dumpgraph.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/dumpgraph_test.go"],
testSrcs: ["cmd/dumpgraph/dumpgraph_test.go"],
}
blueprint_go_binary {
name: "dumpresolutions",
srcs: ["cmd/dumpresolutions.go"],
srcs: ["cmd/dumpresolutions/dumpresolutions.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/dumpresolutions_test.go"],
testSrcs: ["cmd/dumpresolutions/dumpresolutions_test.go"],
}
blueprint_go_binary {
name: "htmlnotice",
srcs: ["cmd/htmlnotice.go"],
srcs: ["cmd/htmlnotice/htmlnotice.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/htmlnotice_test.go"],
testSrcs: ["cmd/htmlnotice/htmlnotice_test.go"],
}
blueprint_go_binary {
name: "shippedlibs",
srcs: ["cmd/shippedlibs.go"],
srcs: ["cmd/shippedlibs/shippedlibs.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/shippedlibs_test.go"],
testSrcs: ["cmd/shippedlibs/shippedlibs_test.go"],
}
blueprint_go_binary {
name: "textnotice",
srcs: ["cmd/textnotice.go"],
srcs: ["cmd/textnotice/textnotice.go"],
deps: ["compliance-module"],
testSrcs: ["cmd/textnotice_test.go"],
testSrcs: ["cmd/textnotice/textnotice_test.go"],
}
bootstrap_go_package {

View File

@@ -17,11 +17,22 @@ package main
import (
"bufio"
"bytes"
"fmt"
"os"
"strings"
"testing"
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test(t *testing.T) {
tests := []struct {
condition string

View File

@@ -17,10 +17,21 @@ package main
import (
"bytes"
"fmt"
"os"
"strings"
"testing"
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
type outcome struct {
target string
privacyCondition string

View File

@@ -17,10 +17,21 @@ package main
import (
"bytes"
"fmt"
"os"
"strings"
"testing"
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test_plaintext(t *testing.T) {
tests := []struct {
condition string

View File

@@ -17,12 +17,23 @@ package main
import (
"bytes"
"fmt"
"os"
"strings"
"testing"
"android/soong/tools/compliance"
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test_plaintext(t *testing.T) {
tests := []struct {
condition string

View File

@@ -39,6 +39,16 @@ var (
libReference = regexp.MustCompile(`^\s*<li><a href="#[^"]{32}">(.*)</a>\s*$`)
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test(t *testing.T) {
tests := []struct {
condition string

View File

@@ -16,10 +16,22 @@ package main
import (
"bytes"
"fmt"
"os"
"strings"
"testing"
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test(t *testing.T) {
type projectShare struct {
project string

View File

@@ -17,11 +17,22 @@ package main
import (
"bufio"
"bytes"
"fmt"
"os"
"strings"
"testing"
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test(t *testing.T) {
tests := []struct {
condition string

View File

@@ -28,6 +28,16 @@ var (
horizontalRule = regexp.MustCompile("^===[=]*===$")
)
func TestMain(m *testing.M) {
// Change into the parent directory before running the tests
// so they can find the testdata directory.
if err := os.Chdir(".."); err != nil {
fmt.Printf("failed to change to testdata directory: %s\n", err)
os.Exit(1)
}
os.Exit(m.Run())
}
func Test(t *testing.T) {
tests := []struct {
condition string