Add hiddenapi_flags module type am: 1b033f5c4c
am: 8d5bfad7ec
Change-Id: I5038dbffacc4cd1e52b5e5eba7c698b4c4a4d190
This commit is contained in:
commit
20cd7ec026
1 changed files with 48 additions and 0 deletions
|
@ -15,11 +15,14 @@
|
||||||
package java
|
package java
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
android.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory)
|
android.RegisterSingletonType("hiddenapi", hiddenAPISingletonFactory)
|
||||||
|
android.RegisterModuleType("hiddenapi_flags", hiddenAPIFlagsFactory)
|
||||||
}
|
}
|
||||||
|
|
||||||
type hiddenAPISingletonPathsStruct struct {
|
type hiddenAPISingletonPathsStruct struct {
|
||||||
|
@ -307,3 +310,48 @@ func commitChangeForRestat(rule *android.RuleBuilder, tempPath, outputPath andro
|
||||||
Text("fi").
|
Text("fi").
|
||||||
Text(")")
|
Text(")")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type hiddenAPIFlagsProperties struct {
|
||||||
|
// name of the file into which the flags will be copied.
|
||||||
|
Filename *string
|
||||||
|
}
|
||||||
|
|
||||||
|
type hiddenAPIFlags struct {
|
||||||
|
android.ModuleBase
|
||||||
|
|
||||||
|
properties hiddenAPIFlagsProperties
|
||||||
|
|
||||||
|
outputFilePath android.OutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *hiddenAPIFlags) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
filename := String(h.properties.Filename)
|
||||||
|
|
||||||
|
inputPath := hiddenAPISingletonPaths(ctx).flags
|
||||||
|
h.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
|
||||||
|
|
||||||
|
// This ensures that outputFilePath has the correct name for others to
|
||||||
|
// use, as the source file may have a different name.
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: android.Cp,
|
||||||
|
Output: h.outputFilePath,
|
||||||
|
Input: inputPath,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *hiddenAPIFlags) OutputFiles(tag string) (android.Paths, error) {
|
||||||
|
switch tag {
|
||||||
|
case "":
|
||||||
|
return android.Paths{h.outputFilePath}, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// hiddenapi-flags provides access to the hiddenapi-flags.csv file generated during the build.
|
||||||
|
func hiddenAPIFlagsFactory() android.Module {
|
||||||
|
module := &hiddenAPIFlags{}
|
||||||
|
module.AddProperties(&module.properties)
|
||||||
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon)
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue