Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4442b7d authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge changes I3db6310e,I061be2b9,I7e81936d,If0684cf1,I404b138f

* changes:
  Move compliance commands into subdirectories
  Give compliance a pkgPath
  Move policy subdirectory into package directory
  Fix errors caught by go vet in compliance package
  Run gofmt on compliance
parents d8724181 d0f05c9e
Loading
Loading
Loading
Loading
+33 −33
Original line number Diff line number Diff line
@@ -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 {
@@ -81,14 +81,14 @@ bootstrap_go_package {
        "doc.go",
        "graph.go",
        "noticeindex.go",
        "policy/policy.go",
        "policy/resolve.go",
        "policy/resolvenotices.go",
        "policy/resolveshare.go",
        "policy/resolveprivacy.go",
        "policy/shareprivacyconflicts.go",
        "policy/shipped.go",
        "policy/walk.go",
        "policy_policy.go",
        "policy_resolve.go",
        "policy_resolvenotices.go",
        "policy_resolveshare.go",
        "policy_resolveprivacy.go",
        "policy_shareprivacyconflicts.go",
        "policy_shipped.go",
        "policy_walk.go",
        "readgraph.go",
        "resolution.go",
        "resolutionset.go",
@@ -97,14 +97,14 @@ bootstrap_go_package {
        "condition_test.go",
        "conditionset_test.go",
        "readgraph_test.go",
        "policy/policy_test.go",
        "policy/resolve_test.go",
        "policy/resolvenotices_test.go",
        "policy/resolveshare_test.go",
        "policy/resolveprivacy_test.go",
        "policy/shareprivacyconflicts_test.go",
        "policy/shipped_test.go",
        "policy/walk_test.go",
        "policy_policy_test.go",
        "policy_resolve_test.go",
        "policy_resolvenotices_test.go",
        "policy_resolveshare_test.go",
        "policy_resolveprivacy_test.go",
        "policy_shareprivacyconflicts_test.go",
        "policy_shipped_test.go",
        "policy_walk_test.go",
        "resolutionset_test.go",
        "test_util.go",
    ],
@@ -113,5 +113,5 @@ bootstrap_go_package {
        "golang-protobuf-encoding-prototext",
        "license_metadata_proto",
    ],
    pkgPath: "compliance",
    pkgPath: "android/soong/tools/compliance",
}
+5 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ package main

import (
	"bytes"
	"compliance"
	"flag"
	"fmt"
	"io"
@@ -24,6 +23,8 @@ import (
	"os"
	"path/filepath"
	"strings"

	"android/soong/tools/compliance"
)

var (
@@ -69,12 +70,12 @@ func main() {
	} else {
		dir, err := filepath.Abs(filepath.Dir(*outputFile))
		if err != nil {
			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %w\n", *outputFile, err)
			fmt.Fprintf(os.Stderr, "cannot determine path to %q: %s\n", *outputFile, err)
			os.Exit(1)
		}
		fi, err := os.Stat(dir)
		if err != nil {
			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %w\n", dir, *outputFile, err)
			fmt.Fprintf(os.Stderr, "cannot read directory %q of %q: %s\n", dir, *outputFile, err)
			os.Exit(1)
		}
		if !fi.IsDir() {
@@ -102,7 +103,7 @@ func main() {
	if *outputFile != "-" {
		err := os.WriteFile(*outputFile, ofile.(*bytes.Buffer).Bytes(), 0666)
		if err != nil {
			fmt.Fprintf(os.Stderr, "could not write output to %q: %w\n", *outputFile, err)
			fmt.Fprintf(os.Stderr, "could not write output to %q: %s\n", *outputFile, err)
			os.Exit(1)
		}
	}
+81 −70
Original line number Diff line number Diff line
@@ -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
@@ -275,7 +286,7 @@ func Test(t *testing.T) {

			err := billOfMaterials(&ctx, rootFiles...)
			if err != nil {
				t.Fatalf("bom: error = %w, stderr = %v", err, stderr)
				t.Fatalf("bom: error = %v, stderr = %v", err, stderr)
				return
			}
			if stderr.Len() > 0 {
+4 −4
Original line number Diff line number Diff line
@@ -15,13 +15,14 @@
package main

import (
	"compliance"
	"flag"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"sort"

	"android/soong/tools/compliance"
)

func init() {
@@ -51,7 +52,6 @@ var (
	failNoLicenses    = fmt.Errorf("No licenses")
)


// byError orders conflicts by error string
type byError []compliance.SourceSharePrivacyConflict

+11 −0
Original line number Diff line number Diff line
@@ -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
Loading