diff options
author | 2019-01-30 17:32:39 -0800 | |
---|---|---|
committer | 2019-02-05 13:28:43 -0800 | |
commit | feec25b08460d1eb1c31296463a9ec61eca9754c (patch) | |
tree | 04b767a6cb2954e7014328b4176375db7bcd04d9 /java/hiddenapi.go | |
parent | a55b12bec27b6e69ee4973d1645d8f61c2c89530 (diff) |
Move dexpreopt.Script to android.RuleBuilder
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places. Also add tests for it.
Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
Diffstat (limited to 'java/hiddenapi.go')
-rw-r--r-- | java/hiddenapi.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/java/hiddenapi.go b/java/hiddenapi.go index 67df57552..983daa79c 100644 --- a/java/hiddenapi.go +++ b/java/hiddenapi.go @@ -15,6 +15,7 @@ package java import ( + "path/filepath" "sort" "strings" "sync" @@ -32,7 +33,7 @@ var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", bl func hiddenAPIGenerateCSV(ctx android.ModuleContext, classesJar android.Path) { flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv") metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv") - stubFlagsCSV := &bootImagePath{ctx.Config().HiddenAPIStubFlags()} + stubFlagsCSV := &hiddenAPIPath{ctx.Config().HiddenAPIStubFlags()} ctx.Build(pctx, android.BuildParams{ Rule: hiddenAPIGenerateCSVRule, @@ -80,7 +81,7 @@ var hiddenAPIEncodeDexRule = pctx.AndroidStaticRule("hiddenAPIEncodeDex", bluepr func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath, dexInput android.WritablePath, uncompressDex bool) { - flagsCsv := &bootImagePath{ctx.Config().HiddenAPIFlags()} + flagsCsv := &hiddenAPIPath{ctx.Config().HiddenAPIFlags()} // The encode dex rule requires unzipping and rezipping the classes.dex files, ensure that if it was uncompressed // in the input it stays uncompressed in the output. @@ -168,3 +169,14 @@ func hiddenAPIMakeVars(ctx android.MakeVarsContext) { export("SOONG_HIDDENAPI_GREYLIST_METADATA", metadataCSVList) export("SOONG_HIDDENAPI_DEX_INPUTS", dexInputList) } + +type hiddenAPIPath struct { + path string +} + +var _ android.Path = (*hiddenAPIPath)(nil) + +func (p *hiddenAPIPath) String() string { return p.path } +func (p *hiddenAPIPath) Ext() string { return filepath.Ext(p.path) } +func (p *hiddenAPIPath) Base() string { return filepath.Base(p.path) } +func (p *hiddenAPIPath) Rel() string { return p.path } |