Add new file name to output inputs/outputs of actions of modules into a new file when `m json-module-graph` is executed.
And also delete the logic in droidstubs to output JSONDataActions.
Test: local.
Change-Id: Ib5d6f1f69c16c41f128e481131775c7699f96464
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 5a84e05..7ad316f 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -19,7 +19,6 @@
"path/filepath"
"strings"
- "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
@@ -807,8 +806,7 @@
properties PrebuiltStubsSourcesProperties
- stubsSrcJar android.Path
- jsonDataActions []blueprint.JSONDataAction
+ stubsSrcJar android.Path
}
func (p *PrebuiltStubsSources) OutputFiles(tag string) (android.Paths, error) {
@@ -824,13 +822,6 @@
return d.stubsSrcJar
}
-// AddJSONData is a temporary solution for droidstubs module to put action
-// related data into the module json graph.
-func (p *PrebuiltStubsSources) AddJSONData(d *map[string]interface{}) {
- p.ModuleBase.AddJSONData(d)
- (*d)["Actions"] = blueprint.FormatJSONDataActions(p.jsonDataActions)
-}
-
func (p *PrebuiltStubsSources) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(p.properties.Srcs) != 1 {
ctx.PropertyErrorf("srcs", "must only specify one directory path or srcjar, contains %d paths", len(p.properties.Srcs))
@@ -838,12 +829,9 @@
}
src := p.properties.Srcs[0]
- var jsonDataAction blueprint.JSONDataAction
if filepath.Ext(src) == ".srcjar" {
// This is a srcjar. We can use it directly.
p.stubsSrcJar = android.PathForModuleSrc(ctx, src)
- jsonDataAction.Inputs = []string{src}
- jsonDataAction.Outputs = []string{src}
} else {
outPath := android.PathForModuleOut(ctx, ctx.ModuleName()+"-"+"stubs.srcjar")
@@ -867,10 +855,7 @@
rule.Restat()
rule.Build("zip src", "Create srcjar from prebuilt source")
p.stubsSrcJar = outPath
- jsonDataAction.Inputs = srcPaths.Strings()
- jsonDataAction.Outputs = []string{outPath.String()}
}
- p.jsonDataActions = []blueprint.JSONDataAction{jsonDataAction}
}
func (p *PrebuiltStubsSources) Prebuilt() *android.Prebuilt {
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index 82ebba7..10d99f3 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -21,8 +21,6 @@
"strings"
"testing"
- "github.com/google/blueprint"
-
"android/soong/android"
)
@@ -234,27 +232,6 @@
checkSystemModulesUseByDroidstubs(t, ctx, "stubs-prebuilt-system-modules", "prebuilt-jar.jar")
}
-func TestAddJSONData(t *testing.T) {
- prebuiltStubsSources := PrebuiltStubsSources{}
- prebuiltStubsSources.jsonDataActions = []blueprint.JSONDataAction{
- blueprint.JSONDataAction{
- Inputs: []string{},
- Outputs: []string{},
- },
- }
- jsonData := map[string]interface{}{}
- prebuiltStubsSources.AddJSONData(&jsonData)
- expectedOut := []map[string]interface{}{
- map[string]interface{}{
- "Inputs": []string{},
- "Outputs": []string{},
- },
- }
- if !reflect.DeepEqual(jsonData["Actions"], expectedOut) {
- t.Errorf("The JSON action data %#v isn't as expected %#v.", jsonData["Actions"], expectedOut)
- }
-}
-
func checkSystemModulesUseByDroidstubs(t *testing.T, ctx *android.TestContext, moduleName string, systemJar string) {
metalavaRule := ctx.ModuleForTests(moduleName, "android_common").Rule("metalava")
var systemJars []string