Merge "Use 1.48.0 prebuilts"
diff --git a/android/androidmk.go b/android/androidmk.go
index 4adbb22..7afc9de 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -177,13 +177,51 @@
a.EntryMap[name] = append(a.EntryMap[name], value...)
}
-// Compute the list of Make strings to declare phone goals and dist-for-goals
-// calls from the module's dist and dists properties.
-func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
+// The contributions to the dist.
+type distContributions struct {
+ // List of goals and the dist copy instructions.
+ copiesForGoals []*copiesForGoals
+}
+
+// getCopiesForGoals returns a copiesForGoals into which copy instructions that
+// must be processed when building one or more of those goals can be added.
+func (d *distContributions) getCopiesForGoals(goals string) *copiesForGoals {
+ copiesForGoals := &copiesForGoals{goals: goals}
+ d.copiesForGoals = append(d.copiesForGoals, copiesForGoals)
+ return copiesForGoals
+}
+
+// Associates a list of dist copy instructions with a set of goals for which they
+// should be run.
+type copiesForGoals struct {
+ // goals are a space separated list of build targets that will trigger the
+ // copy instructions.
+ goals string
+
+ // A list of instructions to copy a module's output files to somewhere in the
+ // dist directory.
+ copies []distCopy
+}
+
+// Adds a copy instruction.
+func (d *copiesForGoals) addCopyInstruction(from Path, dest string) {
+ d.copies = append(d.copies, distCopy{from, dest})
+}
+
+// Instruction on a path that must be copied into the dist.
+type distCopy struct {
+ // The path to copy from.
+ from Path
+
+ // The destination within the dist directory to copy to.
+ dest string
+}
+
+// Compute the contributions that the module makes to the dist.
+func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContributions {
amod := mod.(Module).base()
name := amod.BaseModuleName()
- var ret []string
var availableTaggedDists TaggedDistFiles
if a.DistFiles != nil {
@@ -195,6 +233,9 @@
return nil
}
+ // Collate the contributions this module makes to the dist.
+ distContributions := &distContributions{}
+
// Iterate over this module's dist structs, merged from the dist and dists properties.
for _, dist := range amod.Dists() {
// Get the list of goals this dist should be enabled for. e.g. sdk, droidcore
@@ -224,9 +265,9 @@
panic(fmt.Errorf(errorMessage, goals, name, tagPaths))
}
- ret = append(ret, fmt.Sprintf(".PHONY: %s\n", goals))
+ copiesForGoals := distContributions.getCopiesForGoals(goals)
- // Create dist-for-goals calls for each path in the dist'd files.
+ // Iterate over each path adding a copy instruction to copiesForGoals
for _, path := range tagPaths {
// It's possible that the Path is nil from errant modules. Be defensive here.
if path == nil {
@@ -261,15 +302,41 @@
}
}
+ copiesForGoals.addCopyInstruction(path, dest)
+ }
+ }
+
+ return distContributions
+}
+
+// generateDistContributionsForMake generates make rules that will generate the
+// dist according to the instructions in the supplied distContribution.
+func generateDistContributionsForMake(distContributions *distContributions) []string {
+ var ret []string
+ for _, d := range distContributions.copiesForGoals {
+ ret = append(ret, fmt.Sprintf(".PHONY: %s\n", d.goals))
+ // Create dist-for-goals calls for each of the copy instructions.
+ for _, c := range d.copies {
ret = append(
ret,
- fmt.Sprintf("$(call dist-for-goals,%s,%s:%s)\n", goals, path.String(), dest))
+ fmt.Sprintf("$(call dist-for-goals,%s,%s:%s)\n", d.goals, c.from.String(), c.dest))
}
}
return ret
}
+// Compute the list of Make strings to declare phony goals and dist-for-goals
+// calls from the module's dist and dists properties.
+func (a *AndroidMkEntries) GetDistForGoals(mod blueprint.Module) []string {
+ distContributions := a.getDistContributions(mod)
+ if distContributions == nil {
+ return nil
+ }
+
+ return generateDistContributionsForMake(distContributions)
+}
+
func (a *AndroidMkEntries) fillInEntries(config Config, bpPath string, mod blueprint.Module) {
a.EntryMap = make(map[string][]string)
amod := mod.(Module).base()
diff --git a/android/androidmk_test.go b/android/androidmk_test.go
index 80df6a7..5d05d91 100644
--- a/android/androidmk_test.go
+++ b/android/androidmk_test.go
@@ -18,17 +18,53 @@
"fmt"
"io"
"reflect"
+ "strings"
"testing"
+
+ "github.com/google/blueprint/proptools"
)
type customModule struct {
ModuleBase
- data AndroidMkData
- distFiles TaggedDistFiles
+
+ properties struct {
+ Default_dist_files *string
+ Dist_output_file *bool
+ }
+
+ data AndroidMkData
+ distFiles TaggedDistFiles
+ outputFile OptionalPath
}
+const (
+ defaultDistFiles_None = "none"
+ defaultDistFiles_Default = "default"
+ defaultDistFiles_Tagged = "tagged"
+)
+
func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
- m.distFiles = m.GenerateTaggedDistFiles(ctx)
+
+ // If the dist_output_file: true then create an output file that is stored in
+ // the OutputFile property of the AndroidMkEntry.
+ if proptools.BoolDefault(m.properties.Dist_output_file, true) {
+ m.outputFile = OptionalPathForPath(PathForTesting("dist-output-file.out"))
+ }
+
+ // Based on the setting of the default_dist_files property possibly create a
+ // TaggedDistFiles structure that will be stored in the DistFiles property of
+ // the AndroidMkEntry.
+ defaultDistFiles := proptools.StringDefault(m.properties.Default_dist_files, defaultDistFiles_Tagged)
+ switch defaultDistFiles {
+ case defaultDistFiles_None:
+ // Do nothing
+
+ case defaultDistFiles_Default:
+ m.distFiles = MakeDefaultDistFiles(PathForTesting("default-dist.out"))
+
+ case defaultDistFiles_Tagged:
+ m.distFiles = m.GenerateTaggedDistFiles(ctx)
+ }
}
func (m *customModule) AndroidMk() AndroidMkData {
@@ -55,28 +91,26 @@
func (m *customModule) AndroidMkEntries() []AndroidMkEntries {
return []AndroidMkEntries{
{
- Class: "CUSTOM_MODULE",
- DistFiles: m.distFiles,
+ Class: "CUSTOM_MODULE",
+ DistFiles: m.distFiles,
+ OutputFile: m.outputFile,
},
}
}
func customModuleFactory() Module {
module := &customModule{}
+
+ module.AddProperties(&module.properties)
+
InitAndroidModule(module)
return module
}
-func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
- bp := `
- custom {
- name: "foo",
- required: ["bar"],
- host_required: ["baz"],
- target_required: ["qux"],
- }
- `
-
+// buildConfigAndCustomModuleFoo creates a config object, processes the supplied
+// bp module and then returns the config and the custom module called "foo".
+func buildConfigAndCustomModuleFoo(t *testing.T, bp string) (Config, *customModule) {
+ t.Helper()
config := TestConfig(buildDir, nil, bp, nil)
config.katiEnabled = true // Enable androidmk Singleton
@@ -90,7 +124,21 @@
_, errs = ctx.PrepareBuildActions(config)
FailIfErrored(t, errs)
- m := ctx.ModuleForTests("foo", "").Module().(*customModule)
+ module := ctx.ModuleForTests("foo", "").Module().(*customModule)
+ return config, module
+}
+
+func TestAndroidMkSingleton_PassesUpdatedAndroidMkDataToCustomCallback(t *testing.T) {
+ bp := `
+ custom {
+ name: "foo",
+ required: ["bar"],
+ host_required: ["baz"],
+ target_required: ["qux"],
+ }
+ `
+
+ _, m := buildConfigAndCustomModuleFoo(t, bp)
assertEqual := func(expected interface{}, actual interface{}) {
if !reflect.DeepEqual(expected, actual) {
@@ -102,108 +150,29 @@
assertEqual([]string{"qux"}, m.data.Target_required)
}
-func TestGetDistForGoals(t *testing.T) {
- testCases := []struct {
- name string
- bp string
- expectedAndroidMkLines []string
- }{
- {
- name: "dist-without-tag",
- bp: `
- custom {
- name: "foo",
- dist: {
- targets: ["my_goal"]
- }
- }
- `,
- expectedAndroidMkLines: []string{
- ".PHONY: my_goal\n",
- "$(call dist-for-goals,my_goal,one.out:one.out)\n",
- },
- },
- {
- name: "dist-with-tag",
- bp: `
- custom {
- name: "foo",
- dist: {
- targets: ["my_goal"],
- tag: ".another-tag",
- }
- }
- `,
- expectedAndroidMkLines: []string{
- ".PHONY: my_goal\n",
- "$(call dist-for-goals,my_goal,another.out:another.out)\n",
- },
- },
- {
- name: "dists-with-tag",
- bp: `
- custom {
- name: "foo",
- dists: [
- {
- targets: ["my_goal"],
- tag: ".another-tag",
- },
- ],
- }
- `,
- expectedAndroidMkLines: []string{
- ".PHONY: my_goal\n",
- "$(call dist-for-goals,my_goal,another.out:another.out)\n",
- },
- },
- {
- name: "multiple-dists-with-and-without-tag",
- bp: `
- custom {
- name: "foo",
- dists: [
- {
- targets: ["my_goal"],
- },
- {
- targets: ["my_second_goal", "my_third_goal"],
- },
- ],
- }
- `,
- expectedAndroidMkLines: []string{
- ".PHONY: my_goal\n",
- "$(call dist-for-goals,my_goal,one.out:one.out)\n",
- ".PHONY: my_second_goal my_third_goal\n",
- "$(call dist-for-goals,my_second_goal my_third_goal,one.out:one.out)\n",
- },
- },
- {
- name: "dist-plus-dists-without-tags",
- bp: `
- custom {
- name: "foo",
- dist: {
- targets: ["my_goal"],
+func TestGenerateDistContributionsForMake(t *testing.T) {
+ dc := &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ distCopyForTest("two.out", "other.out"),
},
- dists: [
- {
- targets: ["my_second_goal", "my_third_goal"],
- },
- ],
- }
- `,
- expectedAndroidMkLines: []string{
- ".PHONY: my_second_goal my_third_goal\n",
- "$(call dist-for-goals,my_second_goal my_third_goal,one.out:one.out)\n",
- ".PHONY: my_goal\n",
- "$(call dist-for-goals,my_goal,one.out:one.out)\n",
},
},
- {
- name: "dist-plus-dists-with-tags",
- bp: `
+ }
+
+ makeOutput := generateDistContributionsForMake(dc)
+
+ assertStringEquals(t, `.PHONY: my_goal
+$(call dist-for-goals,my_goal,one.out:one.out)
+$(call dist-for-goals,my_goal,two.out:other.out)
+`, strings.Join(makeOutput, ""))
+}
+
+func TestGetDistForGoals(t *testing.T) {
+ bp := `
custom {
name: "foo",
dist: {
@@ -235,66 +204,499 @@
},
],
}
- `,
- expectedAndroidMkLines: []string{
- ".PHONY: my_second_goal\n",
- "$(call dist-for-goals,my_second_goal,two.out:two.out)\n",
- "$(call dist-for-goals,my_second_goal,three/four.out:four.out)\n",
- ".PHONY: my_third_goal\n",
- "$(call dist-for-goals,my_third_goal,one.out:test/dir/one.out)\n",
- ".PHONY: my_fourth_goal\n",
- "$(call dist-for-goals,my_fourth_goal,one.out:one.suffix.out)\n",
- ".PHONY: my_fifth_goal\n",
- "$(call dist-for-goals,my_fifth_goal,one.out:new-name)\n",
- ".PHONY: my_sixth_goal\n",
- "$(call dist-for-goals,my_sixth_goal,one.out:some/dir/new-name.suffix)\n",
- ".PHONY: my_goal my_other_goal\n",
- "$(call dist-for-goals,my_goal my_other_goal,two.out:two.out)\n",
- "$(call dist-for-goals,my_goal my_other_goal,three/four.out:four.out)\n",
- },
- },
+ `
+
+ expectedAndroidMkLines := []string{
+ ".PHONY: my_second_goal\n",
+ "$(call dist-for-goals,my_second_goal,two.out:two.out)\n",
+ "$(call dist-for-goals,my_second_goal,three/four.out:four.out)\n",
+ ".PHONY: my_third_goal\n",
+ "$(call dist-for-goals,my_third_goal,one.out:test/dir/one.out)\n",
+ ".PHONY: my_fourth_goal\n",
+ "$(call dist-for-goals,my_fourth_goal,one.out:one.suffix.out)\n",
+ ".PHONY: my_fifth_goal\n",
+ "$(call dist-for-goals,my_fifth_goal,one.out:new-name)\n",
+ ".PHONY: my_sixth_goal\n",
+ "$(call dist-for-goals,my_sixth_goal,one.out:some/dir/new-name.suffix)\n",
+ ".PHONY: my_goal my_other_goal\n",
+ "$(call dist-for-goals,my_goal my_other_goal,two.out:two.out)\n",
+ "$(call dist-for-goals,my_goal my_other_goal,three/four.out:four.out)\n",
}
- for _, testCase := range testCases {
- t.Run(testCase.name, func(t *testing.T) {
- config := TestConfig(buildDir, nil, testCase.bp, nil)
- config.katiEnabled = true // Enable androidmk Singleton
+ config, module := buildConfigAndCustomModuleFoo(t, bp)
+ entries := AndroidMkEntriesForTest(t, config, "", module)
+ if len(entries) != 1 {
+ t.Errorf("Expected a single AndroidMk entry, got %d", len(entries))
+ }
+ androidMkLines := entries[0].GetDistForGoals(module)
- ctx := NewTestContext(config)
- ctx.RegisterSingletonType("androidmk", AndroidMkSingleton)
- ctx.RegisterModuleType("custom", customModuleFactory)
- ctx.Register()
+ if len(androidMkLines) != len(expectedAndroidMkLines) {
+ t.Errorf(
+ "Expected %d AndroidMk lines, got %d:\n%v",
+ len(expectedAndroidMkLines),
+ len(androidMkLines),
+ androidMkLines,
+ )
+ }
+ for idx, line := range androidMkLines {
+ expectedLine := expectedAndroidMkLines[idx]
+ if line != expectedLine {
+ t.Errorf(
+ "Expected AndroidMk line to be '%s', got '%s'",
+ expectedLine,
+ line,
+ )
+ }
+ }
+}
- _, errs := ctx.ParseFileList(".", []string{"Android.bp"})
- FailIfErrored(t, errs)
- _, errs = ctx.PrepareBuildActions(config)
- FailIfErrored(t, errs)
+func distCopyForTest(from, to string) distCopy {
+ return distCopy{PathForTesting(from), to}
+}
- module := ctx.ModuleForTests("foo", "").Module().(*customModule)
+func TestGetDistContributions(t *testing.T) {
+ compareContributions := func(d1 *distContributions, d2 *distContributions) error {
+ if d1 == nil || d2 == nil {
+ if d1 != d2 {
+ return fmt.Errorf("pointer mismatch, expected both to be nil but they were %p and %p", d1, d2)
+ } else {
+ return nil
+ }
+ }
+ if expected, actual := len(d1.copiesForGoals), len(d2.copiesForGoals); expected != actual {
+ return fmt.Errorf("length mismatch, expected %d found %d", expected, actual)
+ }
+
+ for i, copies1 := range d1.copiesForGoals {
+ copies2 := d2.copiesForGoals[i]
+ if expected, actual := copies1.goals, copies2.goals; expected != actual {
+ return fmt.Errorf("goals mismatch at position %d: expected %q found %q", i, expected, actual)
+ }
+
+ if expected, actual := len(copies1.copies), len(copies2.copies); expected != actual {
+ return fmt.Errorf("length mismatch in copy instructions at position %d, expected %d found %d", i, expected, actual)
+ }
+
+ for j, c1 := range copies1.copies {
+ c2 := copies2.copies[j]
+ if expected, actual := NormalizePathForTesting(c1.from), NormalizePathForTesting(c2.from); expected != actual {
+ return fmt.Errorf("paths mismatch at position %d.%d: expected %q found %q", i, j, expected, actual)
+ }
+
+ if expected, actual := c1.dest, c2.dest; expected != actual {
+ return fmt.Errorf("dest mismatch at position %d.%d: expected %q found %q", i, j, expected, actual)
+ }
+ }
+ }
+
+ return nil
+ }
+
+ formatContributions := func(d *distContributions) string {
+ buf := &strings.Builder{}
+ if d == nil {
+ fmt.Fprint(buf, "nil")
+ } else {
+ for _, copiesForGoals := range d.copiesForGoals {
+ fmt.Fprintf(buf, " Goals: %q {\n", copiesForGoals.goals)
+ for _, c := range copiesForGoals.copies {
+ fmt.Fprintf(buf, " %s -> %s\n", NormalizePathForTesting(c.from), c.dest)
+ }
+ fmt.Fprint(buf, " }\n")
+ }
+ }
+ return buf.String()
+ }
+
+ testHelper := func(t *testing.T, name, bp string, expectedContributions *distContributions) {
+ t.Helper()
+ t.Run(name, func(t *testing.T) {
+ t.Helper()
+
+ config, module := buildConfigAndCustomModuleFoo(t, bp)
entries := AndroidMkEntriesForTest(t, config, "", module)
if len(entries) != 1 {
t.Errorf("Expected a single AndroidMk entry, got %d", len(entries))
}
- androidMkLines := entries[0].GetDistForGoals(module)
+ distContributions := entries[0].getDistContributions(module)
- if len(androidMkLines) != len(testCase.expectedAndroidMkLines) {
- t.Errorf(
- "Expected %d AndroidMk lines, got %d:\n%v",
- len(testCase.expectedAndroidMkLines),
- len(androidMkLines),
- androidMkLines,
- )
- }
- for idx, line := range androidMkLines {
- expectedLine := testCase.expectedAndroidMkLines[idx]
- if line != expectedLine {
- t.Errorf(
- "Expected AndroidMk line to be '%s', got '%s'",
- expectedLine,
- line,
- )
- }
+ if err := compareContributions(expectedContributions, distContributions); err != nil {
+ t.Errorf("%s\nExpected Contributions\n%sActualContributions\n%s",
+ err,
+ formatContributions(expectedContributions),
+ formatContributions(distContributions))
}
})
}
+
+ testHelper(t, "dist-without-tag", `
+ custom {
+ name: "foo",
+ dist: {
+ targets: ["my_goal"]
+ }
+ }
+`,
+ &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "dist-with-tag", `
+ custom {
+ name: "foo",
+ dist: {
+ targets: ["my_goal"],
+ tag: ".another-tag",
+ }
+ }
+`,
+ &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("another.out", "another.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "dists-with-tag", `
+ custom {
+ name: "foo",
+ dists: [
+ {
+ targets: ["my_goal"],
+ tag: ".another-tag",
+ },
+ ],
+ }
+`,
+ &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("another.out", "another.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "multiple-dists-with-and-without-tag", `
+ custom {
+ name: "foo",
+ dists: [
+ {
+ targets: ["my_goal"],
+ },
+ {
+ targets: ["my_second_goal", "my_third_goal"],
+ },
+ ],
+ }
+`,
+ &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ {
+ goals: "my_second_goal my_third_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "dist-plus-dists-without-tags", `
+ custom {
+ name: "foo",
+ dist: {
+ targets: ["my_goal"],
+ },
+ dists: [
+ {
+ targets: ["my_second_goal", "my_third_goal"],
+ },
+ ],
+ }
+`,
+ &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_second_goal my_third_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "dist-plus-dists-with-tags", `
+ custom {
+ name: "foo",
+ dist: {
+ targets: ["my_goal", "my_other_goal"],
+ tag: ".multiple",
+ },
+ dists: [
+ {
+ targets: ["my_second_goal"],
+ tag: ".multiple",
+ },
+ {
+ targets: ["my_third_goal"],
+ dir: "test/dir",
+ },
+ {
+ targets: ["my_fourth_goal"],
+ suffix: ".suffix",
+ },
+ {
+ targets: ["my_fifth_goal"],
+ dest: "new-name",
+ },
+ {
+ targets: ["my_sixth_goal"],
+ dest: "new-name",
+ dir: "some/dir",
+ suffix: ".suffix",
+ },
+ ],
+ }
+`,
+ &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_second_goal",
+ copies: []distCopy{
+ distCopyForTest("two.out", "two.out"),
+ distCopyForTest("three/four.out", "four.out"),
+ },
+ },
+ {
+ goals: "my_third_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "test/dir/one.out"),
+ },
+ },
+ {
+ goals: "my_fourth_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.suffix.out"),
+ },
+ },
+ {
+ goals: "my_fifth_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "new-name"),
+ },
+ },
+ {
+ goals: "my_sixth_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "some/dir/new-name.suffix"),
+ },
+ },
+ {
+ goals: "my_goal my_other_goal",
+ copies: []distCopy{
+ distCopyForTest("two.out", "two.out"),
+ distCopyForTest("three/four.out", "four.out"),
+ },
+ },
+ },
+ })
+
+ // The above test the default values of default_dist_files and use_output_file.
+
+ // The following tests explicitly test the different combinations of those settings.
+ testHelper(t, "tagged-dist-files-no-output", `
+ custom {
+ name: "foo",
+ default_dist_files: "tagged",
+ dist_output_file: false,
+ dists: [
+ {
+ targets: ["my_goal"],
+ },
+ {
+ targets: ["my_goal"],
+ tag: ".multiple",
+ },
+ ],
+ }
+`, &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("two.out", "two.out"),
+ distCopyForTest("three/four.out", "four.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "default-dist-files-no-output", `
+ custom {
+ name: "foo",
+ default_dist_files: "default",
+ dist_output_file: false,
+ dists: [
+ {
+ targets: ["my_goal"],
+ },
+ // The following is silently ignored because the dist files do not
+ // contain the tagged files.
+ {
+ targets: ["my_goal"],
+ tag: ".multiple",
+ },
+ ],
+ }
+`, &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("default-dist.out", "default-dist.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "no-dist-files-no-output", `
+ custom {
+ name: "foo",
+ default_dist_files: "none",
+ dist_output_file: false,
+ dists: [
+ // The following is silently ignored because there is not default file
+ // in either the dist files or the output file.
+ {
+ targets: ["my_goal"],
+ },
+ // The following is silently ignored because the dist files do not
+ // contain the tagged files.
+ {
+ targets: ["my_goal"],
+ tag: ".multiple",
+ },
+ ],
+ }
+`, nil)
+
+ testHelper(t, "tagged-dist-files-default-output", `
+ custom {
+ name: "foo",
+ default_dist_files: "tagged",
+ dist_output_file: true,
+ dists: [
+ {
+ targets: ["my_goal"],
+ },
+ {
+ targets: ["my_goal"],
+ tag: ".multiple",
+ },
+ ],
+ }
+`, &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("two.out", "two.out"),
+ distCopyForTest("three/four.out", "four.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "default-dist-files-default-output", `
+ custom {
+ name: "foo",
+ default_dist_files: "default",
+ dist_output_file: true,
+ dists: [
+ {
+ targets: ["my_goal"],
+ },
+ // The following is silently ignored because the dist files do not
+ // contain the tagged files.
+ {
+ targets: ["my_goal"],
+ tag: ".multiple",
+ },
+ ],
+ }
+`, &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("default-dist.out", "default-dist.out"),
+ },
+ },
+ },
+ })
+
+ testHelper(t, "no-dist-files-default-output", `
+ custom {
+ name: "foo",
+ default_dist_files: "none",
+ dist_output_file: true,
+ dists: [
+ {
+ targets: ["my_goal"],
+ },
+ // The following is silently ignored because the dist files do not
+ // contain the tagged files.
+ {
+ targets: ["my_goal"],
+ tag: ".multiple",
+ },
+ ],
+ }
+`, &distContributions{
+ copiesForGoals: []*copiesForGoals{
+ {
+ goals: "my_goal",
+ copies: []distCopy{
+ distCopyForTest("dist-output-file.out", "dist-output-file.out"),
+ },
+ },
+ },
+ })
}
diff --git a/android/module.go b/android/module.go
index bd60829..0716b5d 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1579,22 +1579,9 @@
ctx.Variable(pctx, "moduleDescSuffix", s)
// Some common property checks for properties that will be used later in androidmk.go
- if m.distProperties.Dist.Dest != nil {
- _, err := validateSafePath(*m.distProperties.Dist.Dest)
- if err != nil {
- ctx.PropertyErrorf("dist.dest", "%s", err.Error())
- }
- }
- if m.distProperties.Dist.Dir != nil {
- _, err := validateSafePath(*m.distProperties.Dist.Dir)
- if err != nil {
- ctx.PropertyErrorf("dist.dir", "%s", err.Error())
- }
- }
- if m.distProperties.Dist.Suffix != nil {
- if strings.Contains(*m.distProperties.Dist.Suffix, "/") {
- ctx.PropertyErrorf("dist.suffix", "Suffix may not contain a '/' character.")
- }
+ checkDistProperties(ctx, "dist", &m.distProperties.Dist)
+ for i, _ := range m.distProperties.Dists {
+ checkDistProperties(ctx, fmt.Sprintf("dists[%d]", i), &m.distProperties.Dists[i])
}
if m.Enabled() {
@@ -1659,6 +1646,32 @@
m.variables = ctx.variables
}
+// Check the supplied dist structure to make sure that it is valid.
+//
+// property - the base property, e.g. dist or dists[1], which is combined with the
+// name of the nested property to produce the full property, e.g. dist.dest or
+// dists[1].dir.
+func checkDistProperties(ctx *moduleContext, property string, dist *Dist) {
+ if dist.Dest != nil {
+ _, err := validateSafePath(*dist.Dest)
+ if err != nil {
+ ctx.PropertyErrorf(property+".dest", "%s", err.Error())
+ }
+ }
+ if dist.Dir != nil {
+ _, err := validateSafePath(*dist.Dir)
+ if err != nil {
+ ctx.PropertyErrorf(property+".dir", "%s", err.Error())
+ }
+ }
+ if dist.Suffix != nil {
+ if strings.Contains(*dist.Suffix, "/") {
+ ctx.PropertyErrorf(property+".suffix", "Suffix may not contain a '/' character.")
+ }
+ }
+
+}
+
type earlyModuleContext struct {
blueprint.EarlyModuleContext
diff --git a/android/module_test.go b/android/module_test.go
index 6cc1813..e3cc613 100644
--- a/android/module_test.go
+++ b/android/module_test.go
@@ -232,3 +232,51 @@
t.Errorf("Expected build params to fail validation: %+v", bparams)
}
}
+
+func TestDistErrorChecking(t *testing.T) {
+ bp := `
+ deps {
+ name: "foo",
+ dist: {
+ dest: "../invalid-dest",
+ dir: "../invalid-dir",
+ suffix: "invalid/suffix",
+ },
+ dists: [
+ {
+ dest: "../invalid-dest0",
+ dir: "../invalid-dir0",
+ suffix: "invalid/suffix0",
+ },
+ {
+ dest: "../invalid-dest1",
+ dir: "../invalid-dir1",
+ suffix: "invalid/suffix1",
+ },
+ ],
+ }
+ `
+
+ config := TestConfig(buildDir, nil, bp, nil)
+
+ ctx := NewTestContext(config)
+ ctx.RegisterModuleType("deps", depsModuleFactory)
+ ctx.Register()
+
+ _, errs := ctx.ParseFileList(".", []string{"Android.bp"})
+ FailIfErrored(t, errs)
+ _, errs = ctx.PrepareBuildActions(config)
+
+ expectedErrs := []string{
+ "\\QAndroid.bp:5:13: module \"foo\": dist.dest: Path is outside directory: ../invalid-dest\\E",
+ "\\QAndroid.bp:6:12: module \"foo\": dist.dir: Path is outside directory: ../invalid-dir\\E",
+ "\\QAndroid.bp:7:15: module \"foo\": dist.suffix: Suffix may not contain a '/' character.\\E",
+ "\\QAndroid.bp:11:15: module \"foo\": dists[0].dest: Path is outside directory: ../invalid-dest0\\E",
+ "\\QAndroid.bp:12:14: module \"foo\": dists[0].dir: Path is outside directory: ../invalid-dir0\\E",
+ "\\QAndroid.bp:13:17: module \"foo\": dists[0].suffix: Suffix may not contain a '/' character.\\E",
+ "\\QAndroid.bp:16:15: module \"foo\": dists[1].dest: Path is outside directory: ../invalid-dest1\\E",
+ "\\QAndroid.bp:17:14: module \"foo\": dists[1].dir: Path is outside directory: ../invalid-dir1\\E",
+ "\\QAndroid.bp:18:17: module \"foo\": dists[1].suffix: Suffix may not contain a '/' character.\\E",
+ }
+ CheckErrorsAgainstExpectations(t, errs, expectedErrs)
+}
diff --git a/dexpreopt/class_loader_context.go b/dexpreopt/class_loader_context.go
index b910a70..22f712c 100644
--- a/dexpreopt/class_loader_context.go
+++ b/dexpreopt/class_loader_context.go
@@ -71,10 +71,6 @@
// Nested class loader subcontexts for dependencies.
Subcontexts []*ClassLoaderContext
-
- // If the library is a shared library. This affects which elements of class loader context are
- // added as <uses-library> tags by the manifest_fixer (dependencies of shared libraries aren't).
- IsSharedLibrary bool
}
// ClassLoaderContextMap is a map from SDK version to a class loader context.
@@ -85,7 +81,7 @@
// Add class loader context for the given library to the map entry for the given SDK version.
func (clcMap ClassLoaderContextMap) addContext(ctx android.ModuleInstallPathContext, sdkVer int, lib string,
- shared bool, hostPath, installPath android.Path, strict bool, nestedClcMap ClassLoaderContextMap) error {
+ hostPath, installPath android.Path, strict bool, nestedClcMap ClassLoaderContextMap) error {
// If missing dependencies are allowed, the build shouldn't fail when a <uses-library> is
// not found. However, this is likely to result is disabling dexpreopt, as it won't be
@@ -132,20 +128,19 @@
}
clcMap[sdkVer] = append(clcMap[sdkVer], &ClassLoaderContext{
- Name: lib,
- Host: hostPath,
- Device: devicePath,
- Subcontexts: subcontexts,
- IsSharedLibrary: shared,
+ Name: lib,
+ Host: hostPath,
+ Device: devicePath,
+ Subcontexts: subcontexts,
})
return nil
}
// Wrapper around addContext that reports errors.
func (clcMap ClassLoaderContextMap) addContextOrReportError(ctx android.ModuleInstallPathContext, sdkVer int, lib string,
- shared bool, hostPath, installPath android.Path, strict bool, nestedClcMap ClassLoaderContextMap) {
+ hostPath, installPath android.Path, strict bool, nestedClcMap ClassLoaderContextMap) {
- err := clcMap.addContext(ctx, sdkVer, lib, shared, hostPath, installPath, strict, nestedClcMap)
+ err := clcMap.addContext(ctx, sdkVer, lib, hostPath, installPath, strict, nestedClcMap)
if err != nil {
ctx.ModuleErrorf(err.Error())
}
@@ -153,25 +148,25 @@
// Add class loader context. Fail on unknown build/install paths.
func (clcMap ClassLoaderContextMap) AddContext(ctx android.ModuleInstallPathContext, lib string,
- shared bool, hostPath, installPath android.Path) {
+ hostPath, installPath android.Path) {
- clcMap.addContextOrReportError(ctx, AnySdkVersion, lib, shared, hostPath, installPath, true, nil)
+ clcMap.addContextOrReportError(ctx, AnySdkVersion, lib, hostPath, installPath, true, nil)
}
// Add class loader context if the library exists. Don't fail on unknown build/install paths.
func (clcMap ClassLoaderContextMap) MaybeAddContext(ctx android.ModuleInstallPathContext, lib *string,
- shared bool, hostPath, installPath android.Path) {
+ hostPath, installPath android.Path) {
if lib != nil {
- clcMap.addContextOrReportError(ctx, AnySdkVersion, *lib, shared, hostPath, installPath, false, nil)
+ clcMap.addContextOrReportError(ctx, AnySdkVersion, *lib, hostPath, installPath, false, nil)
}
}
// Add class loader context for the given SDK version. Fail on unknown build/install paths.
func (clcMap ClassLoaderContextMap) AddContextForSdk(ctx android.ModuleInstallPathContext, sdkVer int,
- lib string, shared bool, hostPath, installPath android.Path, nestedClcMap ClassLoaderContextMap) {
+ lib string, hostPath, installPath android.Path, nestedClcMap ClassLoaderContextMap) {
- clcMap.addContextOrReportError(ctx, sdkVer, lib, shared, hostPath, installPath, true, nestedClcMap)
+ clcMap.addContextOrReportError(ctx, sdkVer, lib, hostPath, installPath, true, nestedClcMap)
}
// Merge the other class loader context map into this one, do not override existing entries.
@@ -208,26 +203,15 @@
}
}
-// List of libraries in the unconditional class loader context, excluding dependencies of shared
-// libraries. These libraries should be in the <uses-library> tags in the manifest. Some of them may
-// be present in the original manifest, others are added by the manifest_fixer.
+// Returns top-level libraries in the CLC (conditional CLC, i.e. compatibility libraries are not
+// included). This is the list of libraries that should be in the <uses-library> tags in the
+// manifest. Some of them may be present in the source manifest, others are added by manifest_fixer.
func (clcMap ClassLoaderContextMap) UsesLibs() (ulibs []string) {
if clcMap != nil {
- // compatibility libraries (those in conditional context) are not added to <uses-library> tags
- ulibs = usesLibsRec(clcMap[AnySdkVersion])
- ulibs = android.FirstUniqueStrings(ulibs)
- }
- return ulibs
-}
-
-func usesLibsRec(clcs []*ClassLoaderContext) (ulibs []string) {
- for _, clc := range clcs {
- ulibs = append(ulibs, clc.Name)
- // <uses-library> tags in the manifest should not include dependencies of shared libraries,
- // because PackageManager already tracks all such dependencies and automatically adds their
- // class loader contexts as subcontext of the shared library.
- if !clc.IsSharedLibrary {
- ulibs = append(ulibs, usesLibsRec(clc.Subcontexts)...)
+ clcs := clcMap[AnySdkVersion]
+ ulibs = make([]string, 0, len(clcs))
+ for _, clc := range clcs {
+ ulibs = append(ulibs, clc.Name)
}
}
return ulibs
diff --git a/dexpreopt/class_loader_context_test.go b/dexpreopt/class_loader_context_test.go
index abfca27..df68563 100644
--- a/dexpreopt/class_loader_context_test.go
+++ b/dexpreopt/class_loader_context_test.go
@@ -25,11 +25,6 @@
"android/soong/android"
)
-const (
- shared = true // dependencies are not added to uses libs
- nonshared = false // dependencies are added to uses libs
-)
-
func TestCLC(t *testing.T) {
// Construct class loader context with the following structure:
// .
@@ -55,36 +50,36 @@
m := make(ClassLoaderContextMap)
- m.AddContext(ctx, "a", nonshared, buildPath(ctx, "a"), installPath(ctx, "a"))
- m.AddContext(ctx, "b", shared, buildPath(ctx, "b"), installPath(ctx, "b"))
+ m.AddContext(ctx, "a", buildPath(ctx, "a"), installPath(ctx, "a"))
+ m.AddContext(ctx, "b", buildPath(ctx, "b"), installPath(ctx, "b"))
// "Maybe" variant in the good case: add as usual.
c := "c"
- m.MaybeAddContext(ctx, &c, nonshared, buildPath(ctx, "c"), installPath(ctx, "c"))
+ m.MaybeAddContext(ctx, &c, buildPath(ctx, "c"), installPath(ctx, "c"))
// "Maybe" variant in the bad case: don't add library with unknown name, keep going.
- m.MaybeAddContext(ctx, nil, nonshared, nil, nil)
+ m.MaybeAddContext(ctx, nil, nil, nil)
// Add some libraries with nested subcontexts.
m1 := make(ClassLoaderContextMap)
- m1.AddContext(ctx, "a1", nonshared, buildPath(ctx, "a1"), installPath(ctx, "a1"))
- m1.AddContext(ctx, "b1", shared, buildPath(ctx, "b1"), installPath(ctx, "b1"))
+ m1.AddContext(ctx, "a1", buildPath(ctx, "a1"), installPath(ctx, "a1"))
+ m1.AddContext(ctx, "b1", buildPath(ctx, "b1"), installPath(ctx, "b1"))
m2 := make(ClassLoaderContextMap)
- m2.AddContext(ctx, "a2", nonshared, buildPath(ctx, "a2"), installPath(ctx, "a2"))
- m2.AddContext(ctx, "b2", shared, buildPath(ctx, "b2"), installPath(ctx, "b2"))
- m2.AddContextForSdk(ctx, AnySdkVersion, "c2", shared, buildPath(ctx, "c2"), installPath(ctx, "c2"), m1)
+ m2.AddContext(ctx, "a2", buildPath(ctx, "a2"), installPath(ctx, "a2"))
+ m2.AddContext(ctx, "b2", buildPath(ctx, "b2"), installPath(ctx, "b2"))
+ m2.AddContextForSdk(ctx, AnySdkVersion, "c2", buildPath(ctx, "c2"), installPath(ctx, "c2"), m1)
m3 := make(ClassLoaderContextMap)
- m3.AddContext(ctx, "a3", nonshared, buildPath(ctx, "a3"), installPath(ctx, "a3"))
- m3.AddContext(ctx, "b3", shared, buildPath(ctx, "b3"), installPath(ctx, "b3"))
+ m3.AddContext(ctx, "a3", buildPath(ctx, "a3"), installPath(ctx, "a3"))
+ m3.AddContext(ctx, "b3", buildPath(ctx, "b3"), installPath(ctx, "b3"))
- m.AddContextForSdk(ctx, AnySdkVersion, "d", nonshared, buildPath(ctx, "d"), installPath(ctx, "d"), m2)
+ m.AddContextForSdk(ctx, AnySdkVersion, "d", buildPath(ctx, "d"), installPath(ctx, "d"), m2)
// When the same library is both in conditional and unconditional context, it should be removed
// from conditional context.
- m.AddContextForSdk(ctx, 42, "f", nonshared, buildPath(ctx, "f"), installPath(ctx, "f"), nil)
- m.AddContextForSdk(ctx, AnySdkVersion, "f", nonshared, buildPath(ctx, "f"), installPath(ctx, "f"), nil)
+ m.AddContextForSdk(ctx, 42, "f", buildPath(ctx, "f"), installPath(ctx, "f"), nil)
+ m.AddContextForSdk(ctx, AnySdkVersion, "f", buildPath(ctx, "f"), installPath(ctx, "f"), nil)
// Merge map with implicit root library that is among toplevel contexts => does nothing.
m.AddContextMap(m1, "c")
@@ -93,12 +88,12 @@
m.AddContextMap(m3, "m_g")
// Compatibility libraries with unknown install paths get default paths.
- m.AddContextForSdk(ctx, 29, AndroidHidlManager, nonshared, buildPath(ctx, AndroidHidlManager), nil, nil)
- m.AddContextForSdk(ctx, 29, AndroidHidlBase, nonshared, buildPath(ctx, AndroidHidlBase), nil, nil)
+ m.AddContextForSdk(ctx, 29, AndroidHidlManager, buildPath(ctx, AndroidHidlManager), nil, nil)
+ m.AddContextForSdk(ctx, 29, AndroidHidlBase, buildPath(ctx, AndroidHidlBase), nil, nil)
// Add "android.test.mock" to conditional CLC, observe that is gets removed because it is only
// needed as a compatibility library if "android.test.runner" is in CLC as well.
- m.AddContextForSdk(ctx, 30, AndroidTestMock, nonshared, buildPath(ctx, AndroidTestMock), nil, nil)
+ m.AddContextForSdk(ctx, 30, AndroidTestMock, buildPath(ctx, AndroidTestMock), nil, nil)
valid, validationError := validateClassLoaderContext(m)
@@ -158,7 +153,7 @@
// Test for libraries that are added by the manifest_fixer.
t.Run("uses libs", func(t *testing.T) {
- wantUsesLibs := []string{"a", "b", "c", "d", "a2", "b2", "c2", "f", "a3", "b3"}
+ wantUsesLibs := []string{"a", "b", "c", "d", "f", "a3", "b3"}
if !reflect.DeepEqual(wantUsesLibs, haveUsesLibs) {
t.Errorf("\nwant uses libs: %s\nhave uses libs: %s", wantUsesLibs, haveUsesLibs)
}
@@ -169,7 +164,7 @@
func TestCLCUnknownBuildPath(t *testing.T) {
ctx := testContext()
m := make(ClassLoaderContextMap)
- err := m.addContext(ctx, AnySdkVersion, "a", nonshared, nil, nil, true, nil)
+ err := m.addContext(ctx, AnySdkVersion, "a", nil, nil, true, nil)
checkError(t, err, "unknown build path to <uses-library> \"a\"")
}
@@ -177,7 +172,7 @@
func TestCLCUnknownInstallPath(t *testing.T) {
ctx := testContext()
m := make(ClassLoaderContextMap)
- err := m.addContext(ctx, AnySdkVersion, "a", nonshared, buildPath(ctx, "a"), nil, true, nil)
+ err := m.addContext(ctx, AnySdkVersion, "a", buildPath(ctx, "a"), nil, true, nil)
checkError(t, err, "unknown install path to <uses-library> \"a\"")
}
@@ -186,7 +181,7 @@
m := make(ClassLoaderContextMap)
a := "a"
- m.MaybeAddContext(ctx, &a, nonshared, nil, nil)
+ m.MaybeAddContext(ctx, &a, nil, nil)
// The library should be added to <uses-library> tags by the manifest_fixer.
t.Run("maybe add", func(t *testing.T) {
@@ -208,9 +203,9 @@
func TestCLCNestedConditional(t *testing.T) {
ctx := testContext()
m1 := make(ClassLoaderContextMap)
- m1.AddContextForSdk(ctx, 42, "a", nonshared, buildPath(ctx, "a"), installPath(ctx, "a"), nil)
+ m1.AddContextForSdk(ctx, 42, "a", buildPath(ctx, "a"), installPath(ctx, "a"), nil)
m := make(ClassLoaderContextMap)
- err := m.addContext(ctx, AnySdkVersion, "b", nonshared, buildPath(ctx, "b"), installPath(ctx, "b"), true, m1)
+ err := m.addContext(ctx, AnySdkVersion, "b", buildPath(ctx, "b"), installPath(ctx, "b"), true, m1)
checkError(t, err, "nested class loader context shouldn't have conditional part")
}
diff --git a/java/aar.go b/java/aar.go
index 799e763..1940d7f 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -426,7 +426,7 @@
// (including the java_sdk_library) itself then append any implicit sdk library
// names to the list of sdk libraries to be added to the manifest.
if component, ok := module.(SdkLibraryComponentDependency); ok {
- classLoaderContexts.MaybeAddContext(ctx, component.OptionalImplicitSdkLibrary(), true,
+ classLoaderContexts.MaybeAddContext(ctx, component.OptionalImplicitSdkLibrary(),
component.DexJarBuildPath(), component.DexJarInstallPath())
}
diff --git a/java/app.go b/java/app.go
index 3446739..3384bbd 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1981,7 +1981,7 @@
if tag, ok := ctx.OtherModuleDependencyTag(m).(usesLibraryDependencyTag); ok {
dep := ctx.OtherModuleName(m)
if lib, ok := m.(Dependency); ok {
- clcMap.AddContextForSdk(ctx, tag.sdkVersion, dep, isSharedSdkLibrary(m),
+ clcMap.AddContextForSdk(ctx, tag.sdkVersion, dep,
lib.DexJarBuildPath(), lib.DexJarInstallPath(), lib.ClassLoaderContexts())
} else if ctx.Config().AllowMissingDependencies() {
ctx.AddMissingDependencies([]string{dep})
@@ -1995,11 +1995,6 @@
return clcMap
}
-func isSharedSdkLibrary(m android.Module) bool {
- lib, ok := m.(SdkLibraryDependency)
- return ok && lib.IsSharedLibrary()
-}
-
// enforceUsesLibraries returns true of <uses-library> tags should be checked against uses_libs and optional_uses_libs
// properties. Defaults to true if either of uses_libs or optional_uses_libs is specified. Will default to true
// unconditionally in the future.
diff --git a/java/java.go b/java/java.go
index 5012279..bf139a8 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1051,7 +1051,7 @@
case libTag:
deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.sdkVersion())...)
// names of sdk libs that are directly depended are exported
- j.classLoaderContexts.MaybeAddContext(ctx, dep.OptionalImplicitSdkLibrary(), true,
+ j.classLoaderContexts.MaybeAddContext(ctx, dep.OptionalImplicitSdkLibrary(),
dep.DexJarBuildPath(), dep.DexJarInstallPath())
case staticLibTag:
ctx.ModuleErrorf("dependency on java_sdk_library %q can only be in libs", otherName)
@@ -2105,12 +2105,12 @@
// add the name of that java_sdk_library to the exported sdk libs to make sure
// that, if necessary, a <uses-library> element for that java_sdk_library is
// added to the Android manifest.
- j.classLoaderContexts.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(), true,
+ j.classLoaderContexts.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(),
j.DexJarBuildPath(), j.DexJarInstallPath())
// A non-SDK library may provide a <uses-library> (the name may be different from the module name).
if lib := proptools.String(j.usesLibraryProperties.Provides_uses_lib); lib != "" {
- j.classLoaderContexts.AddContext(ctx, lib, true, j.DexJarBuildPath(), j.DexJarInstallPath())
+ j.classLoaderContexts.AddContext(ctx, lib, j.DexJarBuildPath(), j.DexJarInstallPath())
}
j.distFiles = j.GenerateTaggedDistFiles(ctx)
@@ -2793,8 +2793,7 @@
case libTag:
flags.classpath = append(flags.classpath, dep.SdkHeaderJars(ctx, j.sdkVersion())...)
// names of sdk libs that are directly depended are exported
- j.classLoaderContexts.AddContext(ctx, otherName, dep.IsSharedLibrary(),
- dep.DexJarBuildPath(), dep.DexJarInstallPath())
+ j.classLoaderContexts.AddContext(ctx, otherName, dep.DexJarBuildPath(), dep.DexJarInstallPath())
}
}
})
@@ -2809,7 +2808,7 @@
// add the name of that java_sdk_library to the exported sdk libs to make sure
// that, if necessary, a <uses-library> element for that java_sdk_library is
// added to the Android manifest.
- j.classLoaderContexts.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(), true,
+ j.classLoaderContexts.MaybeAddContext(ctx, j.OptionalImplicitSdkLibrary(),
outputFile, installFile)
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs)
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 603c808..b832678 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -688,11 +688,6 @@
return c.namingScheme.apiModuleName(apiScope, c.moduleBase.BaseModuleName())
}
-// If the SDK library is a shared library.
-func (c *commonToSdkLibraryAndImport) IsSharedLibrary() bool {
- return c.sharedLibrary()
-}
-
// The component names for different outputs of the java_sdk_library.
//
// They are similar to the names used for the child modules it creates
@@ -938,9 +933,6 @@
// jars for the stubs. The latter should only be needed when generating JavaDoc as otherwise
// they are identical to the corresponding header jars.
SdkImplementationJars(ctx android.BaseModuleContext, sdkVersion sdkSpec) android.Paths
-
- // If the SDK library is a shared library.
- IsSharedLibrary() bool
}
type SdkLibrary struct {