Add soong cc and java deps to general-tests dist

Test: m SOONG_COLLECT_CC_DEPS=true SOONG_COLLECT_JAVA_DEPS=true dist
  general-tests and verify module_bp_java_deps.json and
  module_bp_cc_deps.json is in out/dist
Test: m SOONG_COLLECT_CC_DEPS=true SOONG_COLLECT_JAVA_DEPS=true
  checkbuild dist general-tests
Bug: 154845369

Change-Id: I683fe1d7e17f7abaab40206770d09db705493ffb
diff --git a/cc/ccdeps.go b/cc/ccdeps.go
index 225405c..b96d8b0 100644
--- a/cc/ccdeps.go
+++ b/cc/ccdeps.go
@@ -38,8 +38,11 @@
 }
 
 type ccdepsGeneratorSingleton struct {
+	outputPath android.Path
 }
 
+var _ android.SingletonMakeVarsProvider = (*ccdepsGeneratorSingleton)(nil)
+
 const (
 	// Environment variables used to control the behavior of this singleton.
 	envVariableCollectCCDeps = "SOONG_COLLECT_CC_DEPS"
@@ -110,6 +113,21 @@
 	if err != nil {
 		ctx.Errorf(err.Error())
 	}
+	c.outputPath = ccfpath
+
+	// This is necessary to satisfy the dangling rules check as this file is written by Soong rather than a rule.
+	ctx.Build(pctx, android.BuildParams{
+		Rule:   android.Touch,
+		Output: ccfpath,
+	})
+}
+
+func (c *ccdepsGeneratorSingleton) MakeVars(ctx android.MakeVarsContext) {
+	if c.outputPath == nil {
+		return
+	}
+
+	ctx.DistForGoal("general-tests", c.outputPath)
 }
 
 func parseCompilerCCParameters(ctx android.SingletonContext, params []string) ccParameters {
diff --git a/java/jdeps.go b/java/jdeps.go
index 9f43887..2b5ee74 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -34,8 +34,11 @@
 }
 
 type jdepsGeneratorSingleton struct {
+	outputPath android.Path
 }
 
+var _ android.SingletonMakeVarsProvider = (*jdepsGeneratorSingleton)(nil)
+
 const (
 	// Environment variables used to modify behavior of this singleton.
 	envVariableCollectJavaDeps = "SOONG_COLLECT_JAVA_DEPS"
@@ -97,6 +100,21 @@
 	if err != nil {
 		ctx.Errorf(err.Error())
 	}
+	j.outputPath = jfpath
+
+	// This is necessary to satisfy the dangling rules check as this file is written by Soong rather than a rule.
+	ctx.Build(pctx, android.BuildParams{
+		Rule:   android.Touch,
+		Output: jfpath,
+	})
+}
+
+func (j *jdepsGeneratorSingleton) MakeVars(ctx android.MakeVarsContext) {
+	if j.outputPath == nil {
+		return
+	}
+
+	ctx.DistForGoal("general-tests", j.outputPath)
 }
 
 func createJsonFile(moduleInfos map[string]android.IdeInfo, jfpath android.WritablePath) error {