aboutsummaryrefslogtreecommitdiff
path: root/build/hidl_interface.go
diff options
context:
space:
mode:
authorDan Shi <dshi@google.com>2021-11-15 19:52:32 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-11-15 19:52:32 +0000
commit07d6b81e3b45bef27c2108aa9f5589de45661695 (patch)
tree407245401bae4ec458f20977c184cf1aa7d301b5 /build/hidl_interface.go
parentd51a947b4f9f0b30eaee75967d177a9c9d0c4871 (diff)
parent52a8bb9cfe6574992aaf773b7feac0e2524514a4 (diff)
downloadhidl-07d6b81e3b45bef27c2108aa9f5589de45661695.tar.gz
Revert VTS related changes am: fc29f8c51b am: dd3c2272b9 am: c2d7dbe897 am: 52a8bb9cfe
Original change: https://android-review.googlesource.com/c/platform/system/tools/hidl/+/1795970 Change-Id: I116a5dfa09aa46128658ad7ad52a0b565e2f5359
Diffstat (limited to 'build/hidl_interface.go')
-rw-r--r--build/hidl_interface.go228
1 files changed, 0 insertions, 228 deletions
diff --git a/build/hidl_interface.go b/build/hidl_interface.go
index ce093d13..d9be39b9 100644
--- a/build/hidl_interface.go
+++ b/build/hidl_interface.go
@@ -16,9 +16,7 @@ package hidl
import (
"fmt"
- "sort"
"strings"
- "sync"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -36,7 +34,6 @@ var (
pctx = android.NewPackageContext("android/hidl")
hidl = pctx.HostBinToolVariable("hidl", "hidl-gen")
- vtsc = pctx.HostBinToolVariable("vtsc", "vtsc")
hidlLint = pctx.HostBinToolVariable("lint", "hidl-lint")
soong_zip = pctx.HostBinToolVariable("soong_zip", "soong_zip")
intermediatesDir = pctx.IntermediatesPathVariable("intermediatesDir", "")
@@ -59,12 +56,6 @@ var (
Description: "HIDL ${language}: ${in} => srcs.srcjar",
}, "depfile", "fqName", "genDir", "language", "options")
- vtsRule = pctx.StaticRule("vtsRule", blueprint.RuleParams{
- Command: "rm -rf ${genDir} && ${vtsc} -m${mode} -t${type} ${inputDir}/${packagePath} ${genDir}/${packagePath}",
- CommandDeps: []string{"${vtsc}"},
- Description: "VTS ${mode} ${type}: ${in} => ${out}",
- }, "mode", "type", "inputDir", "genDir", "packagePath")
-
lintRule = pctx.StaticRule("lintRule", blueprint.RuleParams{
Command: "rm -f ${output} && touch ${output} && ${lint} -j -e -R -p . ${options} ${fqName} > ${output}",
CommandDeps: []string{"${lint}"},
@@ -105,7 +96,6 @@ func init() {
android.RegisterModuleType("prebuilt_hidl_interfaces", prebuiltHidlInterfaceFactory)
android.RegisterModuleType("hidl_interface", hidlInterfaceFactory)
android.RegisterSingletonType("all_hidl_lints", allHidlLintsFactory)
- android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
android.RegisterModuleType("hidl_interfaces_metadata", hidlInterfacesMetadataSingletonFactory)
pctx.Import("android/soong/android")
}
@@ -256,13 +246,6 @@ func (g *hidlGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
}
- if g.properties.Language == "vts" && isVtsSpecPackage(ctx.ModuleName()) {
- vtsList := vtsList(ctx.AConfig())
- vtsListMutex.Lock()
- *vtsList = append(*vtsList, g.genOutputs.Paths()...)
- vtsListMutex.Unlock()
- }
-
var extraOptions []string // including roots
var currentPath android.OptionalPath
ctx.VisitDirectDeps(func(dep android.Module) {
@@ -371,83 +354,6 @@ func hidlGenFactory() android.Module {
return g
}
-type vtscProperties struct {
- Mode string
- Type string
- SpecName string // e.g. foo-vts.spec
- Outputs []string
- PackagePath string // e.g. android/hardware/foo/1.0/
-}
-
-type vtscRule struct {
- android.ModuleBase
-
- properties vtscProperties
-
- genOutputDir android.Path
- genInputDir android.Path
- genInputs android.Paths
- genOutputs android.WritablePaths
-}
-
-var _ android.SourceFileProducer = (*vtscRule)(nil)
-var _ genrule.SourceFileGenerator = (*vtscRule)(nil)
-
-func (g *vtscRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- g.genOutputDir = android.PathForModuleGen(ctx)
-
- ctx.VisitDirectDeps(func(dep android.Module) {
- if specs, ok := dep.(*hidlGenRule); ok {
- g.genInputDir = specs.genOutputDir
- g.genInputs = specs.genOutputs.Paths()
- }
- })
-
- for _, output := range g.properties.Outputs {
- g.genOutputs = append(g.genOutputs, android.PathForModuleGen(ctx, output))
- }
-
- ctx.ModuleBuild(pctx, android.ModuleBuildParams{
- Rule: vtsRule,
- Inputs: g.genInputs,
- Outputs: g.genOutputs,
- Args: map[string]string{
- "mode": g.properties.Mode,
- "type": g.properties.Type,
- "inputDir": g.genInputDir.String(),
- "genDir": g.genOutputDir.String(),
- "packagePath": g.properties.PackagePath,
- },
- })
-}
-
-func (g *vtscRule) GeneratedSourceFiles() android.Paths {
- return g.genOutputs.Paths()
-}
-
-func (g *vtscRule) Srcs() android.Paths {
- return g.genOutputs.Paths()
-}
-
-func (g *vtscRule) GeneratedDeps() android.Paths {
- return g.genOutputs.Paths()
-}
-
-func (g *vtscRule) GeneratedHeaderDirs() android.Paths {
- return android.Paths{g.genOutputDir}
-}
-
-func (g *vtscRule) DepsMutator(ctx android.BottomUpMutatorContext) {
- ctx.AddDependency(ctx.Module(), nil, g.properties.SpecName)
-}
-
-func vtscFactory() android.Module {
- g := &vtscRule{}
- g.AddProperties(&g.properties)
- android.InitAndroidModule(g)
- return g
-}
-
type prebuiltHidlInterfaceProperties struct {
// List of interfaces to consider valid, e.g. "vendor.foo.bar@1.0::IFoo" for typo checking
// between init.rc, VINTF, and elsewhere. Note that inheritance properties will not be
@@ -634,11 +540,6 @@ This corresponds to the "-r%s:<some path>" option that would be passed into hidl
// explicitly true if not specified to give early warning to devs
shouldGenerateJava := proptools.BoolDefault(i.properties.Gen_java, true)
shouldGenerateJavaConstants := i.properties.Gen_java_constants
- shouldGenerateVts := shouldGenerateLibrary && proptools.BoolDefault(i.properties.Gen_vts, true)
-
- // To generate VTS, hidl_interface must have a core variant.
- // A module with 'product_specific: true' does not create a core variant.
- shouldGenerateVts = shouldGenerateVts && !mctx.ProductSpecific()
var productAvailable *bool
if !mctx.ProductSpecific() {
@@ -774,101 +675,6 @@ This corresponds to the "-r%s:<some path>" option that would be passed into hidl
})
}
- if shouldGenerateVts {
- vtsSpecs := concat(wrap(name.dir(), interfaces, ".vts"), wrap(name.dir(), types, ".vts"))
-
- mctx.CreateModule(hidlGenFactory, &nameProperties{
- Name: proptools.StringPtr(name.vtsSpecName()),
- }, &hidlGenProperties{
- Language: "vts",
- FqName: name.string(),
- Root: i.properties.Root,
- Interfaces: i.properties.Interfaces,
- Inputs: i.properties.Srcs,
- Outputs: vtsSpecs,
- })
-
- mctx.CreateModule(vtscFactory, &nameProperties{
- Name: proptools.StringPtr(name.vtsDriverSourcesName()),
- }, &vtscProperties{
- Mode: "DRIVER",
- Type: "SOURCE",
- SpecName: name.vtsSpecName(),
- Outputs: wrap("", vtsSpecs, ".cpp"),
- PackagePath: name.dir(),
- })
- mctx.CreateModule(vtscFactory, &nameProperties{
- Name: proptools.StringPtr(name.vtsDriverHeadersName()),
- }, &vtscProperties{
- Mode: "DRIVER",
- Type: "HEADER",
- SpecName: name.vtsSpecName(),
- Outputs: wrap("", vtsSpecs, ".h"),
- PackagePath: name.dir(),
- })
- mctx.CreateModule(cc.LibraryFactory, &ccProperties{
- Name: proptools.StringPtr(name.vtsDriverName()),
- Defaults: []string{"VtsHalDriverDefaults"},
- Generated_sources: []string{name.vtsDriverSourcesName()},
- Generated_headers: []string{name.vtsDriverHeadersName()},
- Export_generated_headers: []string{name.vtsDriverHeadersName()},
- Shared_libs: wrap("", cppDependencies, "-vts.driver"),
- Export_shared_lib_headers: wrap("", cppDependencies, "-vts.driver"),
- Static_libs: concat(cppDependencies, libraryIfExists),
-
- // TODO(b/126244142)
- Cflags: []string{"-Wno-unused-variable"},
- })
-
- mctx.CreateModule(vtscFactory, &nameProperties{
- Name: proptools.StringPtr(name.vtsProfilerSourcesName()),
- }, &vtscProperties{
- Mode: "PROFILER",
- Type: "SOURCE",
- SpecName: name.vtsSpecName(),
- Outputs: wrap("", vtsSpecs, ".cpp"),
- PackagePath: name.dir(),
- })
- mctx.CreateModule(vtscFactory, &nameProperties{
- Name: proptools.StringPtr(name.vtsProfilerHeadersName()),
- }, &vtscProperties{
- Mode: "PROFILER",
- Type: "HEADER",
- SpecName: name.vtsSpecName(),
- Outputs: wrap("", vtsSpecs, ".h"),
- PackagePath: name.dir(),
- })
- mctx.CreateModule(cc.LibraryFactory, &ccProperties{
- Name: proptools.StringPtr(name.vtsProfilerName()),
- Defaults: []string{"VtsHalProfilerDefaults"},
- Generated_sources: []string{name.vtsProfilerSourcesName()},
- Generated_headers: []string{name.vtsProfilerHeadersName()},
- Export_generated_headers: []string{name.vtsProfilerHeadersName()},
- Shared_libs: wrap("", cppDependencies, "-vts.profiler"),
- Export_shared_lib_headers: wrap("", cppDependencies, "-vts.profiler"),
- Static_libs: concat(cppDependencies, libraryIfExists),
-
- // TODO(b/126244142)
- Cflags: []string{"-Wno-unused-variable"},
- })
-
- specDependencies := append(cppDependencies, name.string())
- mctx.CreateModule(cc.FuzzFactory, &ccProperties{
- Name: proptools.StringPtr(name.vtsFuzzerName()),
- Defaults: []string{"vts_proto_fuzzer_default"},
- Shared_libs: []string{name.vtsDriverName()},
- Cflags: []string{
- "-DSTATIC_TARGET_FQ_NAME=" + name.string(),
- "-DSTATIC_SPEC_DATA=" + strings.Join(specDependencies, ":"),
- },
- }, &fuzzProperties{
- Data: wrap(":", specDependencies, "-vts.spec"),
- Fuzz_config: &fuzzConfig{
- Fuzz_on_haiku_device: proptools.BoolPtr(isFuzzerEnabled(name.vtsFuzzerName())),
- },
- })
- }
-
mctx.CreateModule(hidlGenFactory, &nameProperties{
Name: proptools.StringPtr(name.lintName()),
}, &hidlGenProperties{
@@ -1050,40 +856,6 @@ func isFuzzerEnabled(name string) bool {
return false
}
-// TODO(b/126383715): centralize this logic/support filtering in core VTS build
-var coreVtsSpecs = []string{
- "android.frameworks.",
- "android.hardware.",
- "android.hidl.",
- "android.system.",
-}
-
-func isVtsSpecPackage(name string) bool {
- for _, pkgname := range coreVtsSpecs {
- if strings.HasPrefix(name, pkgname) {
- return true
- }
- }
- return false
-}
-
-var vtsListKey = android.NewOnceKey("vtsList")
-
-func vtsList(config android.Config) *android.Paths {
- return config.Once(vtsListKey, func() interface{} {
- return &android.Paths{}
- }).(*android.Paths)
-}
-
-var vtsListMutex sync.Mutex
-
-func makeVarsProvider(ctx android.MakeVarsContext) {
- vtsList := vtsList(ctx.Config()).Strings()
- sort.Strings(vtsList)
-
- ctx.Strict("VTS_SPEC_FILE_LIST", strings.Join(vtsList, " "))
-}
-
func canInterfaceExist(name string) bool {
if strings.HasPrefix(name, "android.") {
return allAospHidlInterfaces[name]