deps in the packaging modules supports select

deps: ["foo"] + select(product_variable("debuggable") {
    true: ["bar"],
    default: [],
}),

returns ["foo", "bar"] on debuggable builds, and ["foo"] on user builds.

Bug: N/A
Test: go test ./...
Change-Id: I31ca22e69e3316e4007a36ae13c04c7e5c445907
diff --git a/android/packaging_test.go b/android/packaging_test.go
index f99bb91..0570ec5 100644
--- a/android/packaging_test.go
+++ b/android/packaging_test.go
@@ -95,12 +95,13 @@
 	m.entries = m.CopyDepsToZip(ctx, m.GatherPackagingSpecs(ctx), zipFile)
 }
 
-type packageTestModuleConfig struct {
+type testConfig struct {
 	multiTarget                bool
 	depsCollectFirstTargetOnly bool
+	debuggable                 bool
 }
 
-func runPackagingTest(t *testing.T, config packageTestModuleConfig, bp string, expected []string) {
+func runPackagingTest(t *testing.T, config testConfig, bp string, expected []string) {
 	t.Helper()
 
 	var archVariant string
@@ -120,6 +121,9 @@
 			ctx.RegisterModuleType("component", componentTestModuleFactory)
 			ctx.RegisterModuleType("package_module", moduleFactory)
 		}),
+		FixtureModifyProductVariables(func(variables FixtureProductVariables) {
+			variables.Debuggable = proptools.BoolPtr(config.debuggable)
+		}),
 		FixtureWithRootAndroidBp(bp),
 	).RunTest(t)
 
@@ -131,7 +135,7 @@
 }
 
 func TestPackagingBaseMultiTarget(t *testing.T) {
-	config := packageTestModuleConfig{
+	config := testConfig{
 		multiTarget:                true,
 		depsCollectFirstTargetOnly: false,
 	}
@@ -258,7 +262,7 @@
 }
 
 func TestPackagingBaseSingleTarget(t *testing.T) {
-	config := packageTestModuleConfig{
+	config := testConfig{
 		multiTarget:                false,
 		depsCollectFirstTargetOnly: false,
 	}
@@ -383,7 +387,7 @@
 func TestPackagingWithSkipInstallDeps(t *testing.T) {
 	// package -[dep]-> foo -[dep]-> bar      -[dep]-> baz
 	// Packaging should continue transitively through modules that are not installed.
-	config := packageTestModuleConfig{
+	config := testConfig{
 		multiTarget:                false,
 		depsCollectFirstTargetOnly: false,
 	}
@@ -412,7 +416,7 @@
 }
 
 func TestPackagingWithDepsCollectFirstTargetOnly(t *testing.T) {
-	config := packageTestModuleConfig{
+	config := testConfig{
 		multiTarget:                true,
 		depsCollectFirstTargetOnly: true,
 	}
@@ -537,3 +541,46 @@
 		}
 		`, []string{"lib64/foo", "lib64/bar"})
 }
+
+func TestDebuggableDeps(t *testing.T) {
+	bp := `
+		component {
+			name: "foo",
+		}
+
+		component {
+			name: "bar",
+			deps: ["baz"],
+		}
+
+		component {
+			name: "baz",
+		}
+
+		package_module {
+			name: "package",
+			deps: ["foo"] + select(product_variable("debuggable"), {
+				true: ["bar"],
+				default: [],
+			}),
+		}`
+	testcases := []struct {
+		debuggable bool
+		expected   []string
+	}{
+		{
+			debuggable: true,
+			expected:   []string{"lib64/foo", "lib64/bar", "lib64/baz"},
+		},
+		{
+			debuggable: false,
+			expected:   []string{"lib64/foo"},
+		},
+	}
+	for _, tc := range testcases {
+		config := testConfig{
+			debuggable: tc.debuggable,
+		}
+		runPackagingTest(t, config, bp, tc.expected)
+	}
+}