Commit graph

18 commits

Author SHA1 Message Date
Colin Cross
a97c5d3f08 Add support for android_library modules
Add support for compiling android_library modules into AARs,
and refactor app support on top of it.

Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
2018-04-16 15:24:47 -07:00
Colin Cross
0ead1d75ce Allow wildcards in java_resource_dirs
Expand java_resource_dirs using ctx.Glob before globbing inside it
in case it has wildcards in it.  Fixes:
internal error: panic in GenerateBuildActions for module "icu4j" variant "linux_glibc_common"
path "external/icu/icu4j/main/classes/charset/src/META-INF" does not start with "external/icu/icu4j/main/classes/*/src"

Test: java_test.go
Change-Id: Icd28b7a3dd14752642fb0ec8d41bbd6e30f81a68
2018-04-10 20:12:47 +00:00
Colin Cross
af9c55b780 Correctly add dependencies to java_resource_dirs files
java_resource_dirs was using a file list file that was generated
at ninja time to get the list of files to include, which meant
there were no dependencies on the files to cause res.jar to get
rebuilt.  Switch to using a glob at soong time instead.  This
is substantially similar to a glob in java_resources, except that
java_resource_dirs strips the listed directories off the paths
that end up in the jar.

Test: TestResources in java_test.go
Change-Id: I4b9b38f7b6b38a013cbb4e211187e7282a6795c0
2017-10-04 17:19:43 -07:00
Colin Cross
2372923fe0 Honor resource exclusions in java_resources properties
Honor the default resource exclusions in java_resources properties
including *.java.

Test: m -j checkbuild
Change-Id: Ia117a000680161b54c189758926ddb2068a2a2c3
2017-10-04 17:19:43 -07:00
Colin Cross
0532fb0d4c Fix excluding resource directories
Using a glob as a path failed the existence check.  Append the
glob after converting the path to a string.

Test: TestExcludeResources in java_test.go
Change-Id: Ic1fd40aa283f3b0d59c1c589dbeec411583eddf1
2017-10-03 02:13:16 +00:00
Colin Cross
0f37af0c15 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
2017-09-29 14:02:22 -07:00
Colin Cross
40a3671416 Remove jarSpec structure
It's not doing anything anymore, and the next patch will need more
complex jar arguments.  Just remove it.

Test: m -j checkbuild
Change-Id: I96d15995e86263ec04fd5c13ab0fd54d8b85c788
2017-09-29 14:02:22 -07:00
Colin Cross
0a6e007e06 Make javac rules output a jar with soong_zip
Make javac rules output a jar file instead of a classes.list.
Combine the output jar, static jar dependencies, and resources
into the final jar using a separate rule.  For now, use a shell
command with unzip and soong_zip to create the final jar,
eventually it will be done with a zip2zip-style jar combiner.

Bug: 64691570
Test: java_test.go
Change-Id: Id8e6313e0097b78947d88e86e47b56ad08caca1a
2017-09-05 22:08:13 -07:00
Colin Cross
b852a58aa6 Convert soong java from soong_zip to jar
soong_zip produces jar files that are not compatible with java's
ZipInputStream.  Switch to jar using ugly sed scripts to munge
file lists into the alternating -C and file arguments required
by jar.

Bug: 64536066
Test: m -j checkbuild
Test: build/soong/scripts/jar_args.sh --test
Change-Id: Ifcc4bdab25e7d02342720eb246c673ff9a58bddb
2017-08-14 10:07:53 -07:00
Colin Cross
7f19f37443 Move globbing to Blueprint
Move Soong's globbing-with-dependencies support into Blueprint so it can
be used for subdirs= lines in Android.bp files.

Blueprint has a slight change in behavior around subname= lines, it now
always uses the subname and doesn't fall back to Blueprints.  To support
the Blueprints files in build/blueprint, use them directly with build=.

Test: build, add source file that matches glob, rebuild
Change-Id: Ifd0b0d3bc061aae0a16d6c7ca9a1cd8672656b4d
2016-11-04 04:54:16 +00:00
Colin Cross
635c3b0157 Rename common to android
Rename the "common" package to "android", because common is too
generic.  Also removes all android.Android naming stutter.

Ran:
gomvpkg -from 'android/soong/common' -to 'android/soong/android'
gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext'
gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext'
gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase'
gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext'
gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext'
gorename -from '"android/soong/android".AndroidModule' -to 'Module'

Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
2016-05-18 15:37:25 -07:00
Dan Willemsen
34cc69e4bf Use Path instead of string for file paths
This centralizes verification and common operations, like converting the
path to a source file to the path for a built object.

It also embeds the configuration knowledge into the path, so that we can
remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that
leads to paths like './path' instead of just 'path' like make is doing,
causing differences in compiled binaries.

Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
2015-12-09 14:29:12 -08:00
Colin Cross
6e18ca49f8 Fix java resource glob file list location
The source path was being appended to the module out directory
to create the file list file, which was resulting in .. in the
source path moving the file list file up the directory tree.
Use SrcDirRelPath to convert the globbed resource directories
to be relatiave to $srcDir before appending them.

Also do the same fix to generated aidl, logtags, yacc, and lex
files.

Change-Id: I2e636bd30abf03bc1d80a897951a9812cc3e09ef
2015-08-24 16:19:43 -07:00
Colin Cross
a819f08275 Fix glob filename overlap
If resources and java files were compiled from the same directory,
ctx.Glob could try to create a glob file that had the same name
as the directory containing another glob file.  Namespace each
call to ctx.Glob so they never conflict.

Change-Id: I4db73af568a2ff2e708e9db64798073b1ed2ff61
2015-07-23 17:52:17 -07:00
Dan Willemsen
2ef08f4458 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
2015-07-01 20:59:39 +00:00
Colin Cross
8f101b45fc Allow common.Glob to be called by singletons
Make common.Glob take an interface that is the intersection of
blueprint.ModuleContext and blueprint.SingletonContext used by
Glob and GlobRule, allowing it to be called on either.  Also
move ExpandSources and Glob into AndroidModuleContext.

Change-Id: I8d1a3160c5dd201033afdb37210e82d8065b137d
2015-06-17 15:36:48 -07:00
Colin Cross
3d7678f9d6 Fix java resource globbing
Handle java resource globbing in two passes, the first on the
list of resource dirs to produce a list of directories, and the
second to glob for files inside those directories using **/*.
Fixes incorrect jarSpec dir errors when the resource directories
list contains globs.

Change-Id: Icea5d8178336eb7de4ad91a9acba4822423d9f60
2015-04-29 14:59:23 -07:00
Colin Cross
2fe6687847 Support java libraries, binaries, and prebuilts
Add support for compiling java libraries (.jar files with
or without .dex), java binaries (.jar files with a wrapper
script to run them), and java prebuilts (for the SDK .jars)

Change-Id: Id624da64c92cf20c6d9577c6bb06e5b212af0d1b
2015-04-03 16:24:44 -07:00