Allow module types to generate resources
Robolectric will need to generate extra resources to be added to the jar. Test: TestResources Change-Id: I028f91ea8fc5d1e59e4e805876d70f57d8899f11
This commit is contained in:
parent
e0dbdd87f0
commit
988708ce75
|
@ -340,6 +340,9 @@ type Module struct {
|
|||
// list of additional targets for checkbuild
|
||||
additionalCheckedModules android.Paths
|
||||
|
||||
// Extra files generated by the module type to be added as java resources.
|
||||
extraResources android.Paths
|
||||
|
||||
hiddenAPI
|
||||
dexpreopter
|
||||
}
|
||||
|
@ -1113,6 +1116,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
|
|||
dirArgs, dirDeps := ResourceDirsToJarArgs(ctx, j.properties.Java_resource_dirs,
|
||||
j.properties.Exclude_java_resource_dirs, j.properties.Exclude_java_resources)
|
||||
fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources, j.properties.Exclude_java_resources)
|
||||
extraArgs, extraDeps := resourcePathsToJarArgs(j.extraResources), j.extraResources
|
||||
|
||||
var resArgs []string
|
||||
var resDeps android.Paths
|
||||
|
@ -1123,6 +1127,9 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
|
|||
resArgs = append(resArgs, fileArgs...)
|
||||
resDeps = append(resDeps, fileDeps...)
|
||||
|
||||
resArgs = append(resArgs, extraArgs...)
|
||||
resDeps = append(resDeps, extraDeps...)
|
||||
|
||||
if Bool(j.properties.Include_srcs) {
|
||||
srcArgs, srcDeps := SourceFilesToJarArgs(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
|
||||
resArgs = append(resArgs, srcArgs...)
|
||||
|
|
|
@ -98,6 +98,14 @@ func resourceFilesToJarArgs(ctx android.ModuleContext,
|
|||
|
||||
files := android.PathsForModuleSrcExcludes(ctx, res, exclude)
|
||||
|
||||
args = resourcePathsToJarArgs(files)
|
||||
|
||||
return args, files
|
||||
}
|
||||
|
||||
func resourcePathsToJarArgs(files android.Paths) []string {
|
||||
var args []string
|
||||
|
||||
lastDir := ""
|
||||
for i, f := range files {
|
||||
rel := f.Rel()
|
||||
|
@ -113,5 +121,5 @@ func resourceFilesToJarArgs(ctx android.ModuleContext,
|
|||
lastDir = dir
|
||||
}
|
||||
|
||||
return args, files
|
||||
return args
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue