Ask primary builder for module names
Remove the assumed Name and Deps properties. Instead, ask the Module
for the Name, and require them to use the existing replacements for
Deps.
Change-Id: I729045d86277686078b3aa0bba71c67d612ead2c
diff --git a/context_test.go b/context_test.go
index 70a6daa..5d9f4bc 100644
--- a/context_test.go
+++ b/context_test.go
@@ -24,19 +24,25 @@
}
type fooModule struct {
+ SimpleName
properties struct {
- Foo string
+ Deps []string
+ Foo string
}
}
func newFooModule() (Module, []interface{}) {
m := &fooModule{}
- return m, []interface{}{&m.properties}
+ return m, []interface{}{&m.properties, &m.SimpleName.Properties}
}
func (f *fooModule) GenerateBuildActions(ModuleContext) {
}
+func (f *fooModule) DynamicDependencies(ctx DynamicDependerModuleContext) []string {
+ return f.properties.Deps
+}
+
func (f *fooModule) Foo() string {
return f.properties.Foo
}
@@ -46,14 +52,20 @@
}
type barModule struct {
+ SimpleName
properties struct {
- Bar bool
+ Deps []string
+ Bar bool
}
}
func newBarModule() (Module, []interface{}) {
m := &barModule{}
- return m, []interface{}{&m.properties}
+ return m, []interface{}{&m.properties, &m.SimpleName.Properties}
+}
+
+func (b *barModule) DynamicDependencies(ctx DynamicDependerModuleContext) []string {
+ return b.properties.Deps
}
func (b *barModule) GenerateBuildActions(ModuleContext) {
@@ -74,12 +86,12 @@
r := bytes.NewBufferString(`
foo_module {
- name: "MyFooModule",
+ name: "MyFooModule",
deps: ["MyBarModule"],
}
bar_module {
- name: "MyBarModule",
+ name: "MyBarModule",
}
`)
@@ -168,7 +180,7 @@
var outputDown string
var outputUp string
- topModule := ctx.moduleGroups["A"].modules[0]
+ topModule := ctx.modulesFromName("A")[0]
ctx.walkDeps(topModule,
func(dep depInfo, parent *moduleInfo) bool {
if dep.module.logicModule.(Walker).Walk() {