diff options
author | Dan Willemsen <dwillemsen@google.com> | 2015-06-30 18:15:24 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@google.com> | 2015-07-01 20:59:39 +0000 |
commit | 2ef08f4458aaeb1cf69a167107d52a2ca22ba3f3 (patch) | |
tree | e315609987dd9b06d1d85f379149e2b64e7bac5d /java | |
parent | c41f63071ebdb34fea48c11bc94b6e4a7e159c06 (diff) | |
download | build_soong-2ef08f4458aaeb1cf69a167107d52a2ca22ba3f3.tar.gz build_soong-2ef08f4458aaeb1cf69a167107d52a2ca22ba3f3.tar.bz2 build_soong-2ef08f4458aaeb1cf69a167107d52a2ca22ba3f3.zip |
Add exclude_* and remove arch_subtract / "-file"
To align with the current make build system, add exclude_srcs and
exclude_java_resource_dirs. These replace the functionality of
arch_subtract and glob exclusions that use "-file" to exclude a file.
Change-Id: I91c23d5e3c9409f2d9f7921f950153a03a68ad61
Diffstat (limited to 'java')
-rw-r--r-- | java/java.go | 13 | ||||
-rw-r--r-- | java/resources.go | 19 |
2 files changed, 23 insertions, 9 deletions
diff --git a/java/java.go b/java/java.go index a16d1d67..94f6914e 100644 --- a/java/java.go +++ b/java/java.go @@ -47,11 +47,18 @@ import ( type javaBaseProperties struct { // list of source files used to compile the Java module. May be .java, .logtags, .proto, // or .aidl files. - Srcs []string `android:"arch_variant,arch_subtract"` + Srcs []string `android:"arch_variant"` + + // list of source files that should not be used to build the Java module. + // This is most useful in the arch/multilib variants to remove non-common files + Exclude_srcs []string `android:"arch_variant"` // list of directories containing Java resources Java_resource_dirs []string `android:"arch_variant"` + // list of directories that should be excluded from java_resource_dirs + Exclude_java_resource_dirs []string `android:"arch_variant"` + // don't build against the default libraries (core-libart, core-junit, // ext, and framework for device targets) No_standard_libraries bool @@ -294,7 +301,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) { javacDeps = append(javacDeps, classpath...) } - srcFiles := ctx.ExpandSources(j.properties.Srcs) + srcFiles := ctx.ExpandSources(j.properties.Srcs, j.properties.Exclude_srcs) srcFiles = j.genSources(ctx, srcFiles, flags) @@ -316,7 +323,7 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) { classJarSpecs = append([]jarSpec{classes}, classJarSpecs...) } - resourceJarSpecs = append(ResourceDirsToJarSpecs(ctx, j.properties.Java_resource_dirs), + resourceJarSpecs = append(ResourceDirsToJarSpecs(ctx, j.properties.Java_resource_dirs, j.properties.Exclude_java_resource_dirs), resourceJarSpecs...) manifest := j.properties.Manifest diff --git a/java/resources.go b/java/resources.go index f9d7a05b..dfdbeb5d 100644 --- a/java/resources.go +++ b/java/resources.go @@ -29,13 +29,20 @@ var resourceExcludes = []string{ "**/*~", } -func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs []string) []jarSpec { +func isStringInSlice(str string, slice []string) bool { + for _, s := range slice { + if s == str { + return true + } + } + return false +} + +func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs, excludeDirs []string) []jarSpec { var excludes []string - for _, resourceDir := range resourceDirs { - if resourceDir[0] == '-' { - excludes = append(excludes, filepath.Join(common.ModuleSrcDir(ctx), resourceDir[1:], "**/*")) - } + for _, exclude := range excludeDirs { + excludes = append(excludes, filepath.Join(common.ModuleSrcDir(ctx), exclude, "**/*")) } excludes = append(excludes, resourceExcludes...) @@ -43,7 +50,7 @@ func ResourceDirsToJarSpecs(ctx common.AndroidModuleContext, resourceDirs []stri var jarSpecs []jarSpec for _, resourceDir := range resourceDirs { - if resourceDir[0] == '-' { + if isStringInSlice(resourceDir, excludeDirs) { continue } resourceDir := filepath.Join(common.ModuleSrcDir(ctx), resourceDir) |