Add java file resources and flag to include sources
Add a properties to allow including files as resources, including support for filegroups. Also add a flag that causes module sources to be included in the final jar. Test: java_test.go TestResources Change-Id: Ida8ee59b28df9fe66952170f46470d3a09fd5d65
This commit is contained in:
@@ -15,7 +15,9 @@
|
||||
package java
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint/bootstrap"
|
||||
|
||||
@@ -71,3 +73,20 @@ func ResourceDirsToJarArgs(ctx android.ModuleContext,
|
||||
|
||||
return args, deps
|
||||
}
|
||||
|
||||
func ResourceFilesToJarArgs(ctx android.ModuleContext,
|
||||
res, exclude []string) (args []string, deps android.Paths) {
|
||||
files := ctx.ExpandSources(res, exclude)
|
||||
|
||||
for _, f := range files {
|
||||
rel := f.Rel()
|
||||
path := f.String()
|
||||
if !strings.HasSuffix(path, rel) {
|
||||
panic(fmt.Errorf("path %q does not end with %q", path, rel))
|
||||
}
|
||||
path = filepath.Clean(strings.TrimSuffix(path, rel))
|
||||
args = append(args, "-C", filepath.Clean(path), "-f", f.String())
|
||||
}
|
||||
|
||||
return args, files
|
||||
}
|
||||
|
Reference in New Issue
Block a user