Merge "Load a list of plugins from vendor/google_clockwork" into main
This commit is contained in:
@@ -16,8 +16,6 @@ package android
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -72,28 +70,31 @@ var allowedPluginsByName = map[string]bool{
|
|||||||
"xsdc-soong-rules": true,
|
"xsdc-soong-rules": true,
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
var internalPluginsPaths = []string{
|
||||||
internalPluginsPath = "vendor/google/build/soong/internal_plugins.json"
|
"vendor/google/build/soong/internal_plugins.json",
|
||||||
)
|
"vendor/google_clockwork/build/internal_plugins.json",
|
||||||
|
}
|
||||||
|
|
||||||
type pluginProvider interface {
|
type pluginProvider interface {
|
||||||
IsPluginFor(string) bool
|
IsPluginFor(string) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func maybeAddInternalPluginsToAllowlist(ctx SingletonContext) {
|
func maybeAddInternalPluginsToAllowlist(ctx SingletonContext) {
|
||||||
if path := ExistentPathForSource(ctx, internalPluginsPath); path.Valid() {
|
for _, internalPluginsPath := range internalPluginsPaths {
|
||||||
ctx.AddNinjaFileDeps(path.String())
|
if path := ExistentPathForSource(ctx, internalPluginsPath); path.Valid() {
|
||||||
absPath := absolutePath(path.String())
|
ctx.AddNinjaFileDeps(path.String())
|
||||||
var moreAllowed map[string]bool
|
absPath := absolutePath(path.String())
|
||||||
data, err := ioutil.ReadFile(absPath)
|
var moreAllowed map[string]bool
|
||||||
if err != nil {
|
data, err := os.ReadFile(absPath)
|
||||||
ctx.Errorf("Failed to open internal plugins path %q %q", internalPluginsPath, err)
|
if err != nil {
|
||||||
}
|
ctx.Errorf("Failed to open internal plugins path %q %q", internalPluginsPath, err)
|
||||||
if err := json.Unmarshal(data, &moreAllowed); err != nil {
|
}
|
||||||
fmt.Fprintf(os.Stderr, "Internal plugins file %q did not parse correctly: %q", data, err)
|
if err := json.Unmarshal(data, &moreAllowed); err != nil {
|
||||||
}
|
ctx.Errorf("Internal plugins file %q did not parse correctly: %q", data, err)
|
||||||
for k, v := range moreAllowed {
|
}
|
||||||
allowedPluginsByName[k] = v
|
for k, v := range moreAllowed {
|
||||||
|
allowedPluginsByName[k] = v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user