Merge changes from topic "apex_available"

* changes:
  shared_lib dependency from a static lib crosses the APEX boundary
  apex_available tracks static dependencies
diff --git a/android/soong_config_modules.go b/android/soong_config_modules.go
index f54e774..198108d 100644
--- a/android/soong_config_modules.go
+++ b/android/soong_config_modules.go
@@ -303,6 +303,7 @@
 	}
 
 	return ctx.Config().Once(key, func() interface{} {
+		ctx.AddNinjaFileDeps(from)
 		r, err := ctx.Config().fs.Open(from)
 		if err != nil {
 			ctx.PropertyErrorf("from", "failed to open %q: %s", from, err)
diff --git a/android/soong_config_modules_test.go b/android/soong_config_modules_test.go
index 66feba8..6ad88a2 100644
--- a/android/soong_config_modules_test.go
+++ b/android/soong_config_modules_test.go
@@ -43,7 +43,7 @@
 			name: "acme_test_defaults",
 			module_type: "test_defaults",
 			config_namespace: "acme",
-			variables: ["board", "feature1", "feature2", "feature3"],
+			variables: ["board", "feature1", "feature2", "FEATURE3"],
 			properties: ["cflags", "srcs"],
 		}
 
@@ -61,7 +61,7 @@
 		}
 
 		soong_config_bool_variable {
-			name: "feature3",
+			name: "FEATURE3",
 		}
 	`
 
@@ -91,7 +91,7 @@
 				feature2: {
 					cflags: ["-DFEATURE2"],
 				},
-				feature3: {
+				FEATURE3: {
 					cflags: ["-DFEATURE3"],
 				},
 			},
diff --git a/cc/cc.go b/cc/cc.go
index f467c73..2e55841 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1266,8 +1266,11 @@
 	allTransitiveDeps := make(map[android.Path][]android.Path, len(staticDeps))
 	staticDepFiles := []android.Path{}
 	for _, dep := range staticDeps {
-		allTransitiveDeps[dep.OutputFile().Path()] = dep.GetDepsInLinkOrder()
-		staticDepFiles = append(staticDepFiles, dep.OutputFile().Path())
+		// The OutputFile may not be valid for a variant not present, and the AllowMissingDependencies flag is set.
+		if dep.OutputFile().Valid() {
+			allTransitiveDeps[dep.OutputFile().Path()] = dep.GetDepsInLinkOrder()
+			staticDepFiles = append(staticDepFiles, dep.OutputFile().Path())
+		}
 	}
 	sharedDepFiles := []android.Path{}
 	for _, sharedDep := range sharedDeps {