Add a main_class property that will be used to generate a manifest
containing a Main-Class entry.
Test: m checkbuild
Change-Id: I0a59bb2b93cad915afd82fba708fa0f7eda2fe7a
Make android_app modules a MultiTargets module, which means the
common variant will have a list of Targets that it needs to handle.
Collect JNI libraries for each Target, and package them into or
alongside the APK.
Bug: 80095087
Test: app_test.go
Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
-f and -D arguments can now take globs in the Soong format.
Also update the use of soong_zip that jars resources to escape the
globs in the arguments, and then shell-escape them when writing to
the rsp file so the glob escape are not intepreted by ReadRespFile.
Also remove an unused argument to the buildAAR rule that could
have contained values that needed escaping.
Relands I7f20bb169dc01f952d2a7681ec6ee9c05737ed37 with a fix for
trailing "\n" in list files, which causes a call to pathtools.Glob("")
that returns "./", which could then get incorrectly translated to
"../../../" in the zip file. Also adds tests.
Test: m checkbuild
Test: zip_test.go
Change-Id: I54b8eef9231875e6042a32c9f8bcc5c2f779922a
This reverts commit 08e28abc4e.
Reason for revert: inserts extra ../../ entries in the zip file.
Bug: 116737386
Change-Id: I048f94889a66fe618058e37a5827d0cf6b1a6b68
-f and -D arguments can now take globs in the Soong format.
Also update the use of soong_zip that jars resources to escape the
globs in the arguments, and then shell-escape them when writing to
the rsp file so the glob escape are not intepreted by ReadRespFile.
Also remove an unused argument to the buildAAR rule that could
have contained values that needed escaping.
Test: m checkbuild
Change-Id: I7f20bb169dc01f952d2a7681ec6ee9c05737ed37
The icu resource directories contain filenames that have '$'
characters.
Allow paths returned by the Glob functions to contain '$', on the
assumption that real paths on disk are unlikely to contain strings
that are valid ninja variables. Fix the Build rules to escape any
paths that are passed as Path arguments. Fix the resource rules to
manually escape the paths that are passed as strings.
Test: m checkbuild
Change-Id: Ie631bc6d96259e592adb280491a365c0df7ed0e2
kotlinc-build.xml was ending up in the final jar because it was
being created in the directory where the classes were written.
Rename the variable containing the classes directory from outDir
to classesDir to discourage putting other files in there, and
move kotlinc-build.xml up a directory.
Bug: 114524493
Test: m checkbuild
Change-Id: Id2e2af0a6543499bd25b8fbd642bc59b14bd241f
A few tests that have classes in the java.base module need to pass
--patch-module=java.base=<classpath> to javac.
Test: m checkbuild
Change-Id: I246bad92dcde976969b064aace5e2856e2bac971
Make :module on a java_library provide the output file, which is
normally the implementation jar. For java_library modules with
installable: true or compile_dex: true this will be the dexjar
instead. For android_app modules this will be the apk.
Bug: 80144045
Test: no change to out/soong/build.ninja
Change-Id: I739674aee60a38bfccb859369e4414b46f293d82
Prebuilt jars sometime contain files that we don't want. In Make
we would delete everything in META-INF when importing jars, but
that caused problems when there were necessary files in there,
so we added LOCAL_DONT_DELETE_JAR_META_INF.
Soong does the opposite, keeping everything by default. Add
properties to allow explicitly stripping unwanted files instead.
Bug: 111389216
Test: m checkbuild
Change-Id: I6d07f519ebc7d0e1bf0af93416bb569e3c2b1500
If docs file which is result of javadoc is null, there is a build error
when building stubs file. To avoid build error, we don't build if srcJar
files is exist but they don't have java file list.
Bug:77577799
Test: make -j
Test: Marking @hide to all APIs in javax.obex library
-> make -j -> check build result.
result is success
Change-Id: I85439417a36425e89a8fa2ecbc66d1b2022bc63a
Use the OpenJDK9 javac to run ErrorProne by adding it to
-processorpath and using -Xplugin:ErrorProne.
Bug: 69485063
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I0496006b71b70766ef16d57753cbcf037897799c
ErrorProne needs to be added to -processorpath, but once anything is
passed via -processorpath javac stops looking in the classpath for
annotation processors. Move annotation processors to -processorpath
in preparation.
This reapplies Ife06b3c7432ab971f5605dcc18a558bcbd99a675 with fixes
to processorpath in errorprone rules.
Test: m java
Change-Id: I188136771386a2183fb31f4b70b50c95ac419ff8
ErrorProne needs to be added to -processorpath, but once anything is
passed via -processorpath javac stops looking in the classpath for
annotation processors. Move annotation processors to -processorpath
in preparation.
Test: m java
Change-Id: Ife06b3c7432ab971f5605dcc18a558bcbd99a675
Added new CompilerProperty flag, rename_kotlin_stdlib, which
allow to build kotlin libraries/binaries that use platform internal
version of kotlin stdlib (com.android.kotlin.*). This way, app-provided
kotlin standard library won't collide with version used internaly.
+ remove kotlinc-build.xml after compilation so it won't end up in the
result jar file
+ remove *.kotlin_module and *.kotlin_bultin filesfrom result jar file.
These files are needed only by kotlin-reflect library and
need more work to support kotlin-stdlib renaming.
Bug: 73281388
Test: java_test.go
Change-Id: Iae7ccb919e2ae9853b3f30f3dd447ebd01a1bed0
extract_srcjars.sh uses zipinfo and unzip, which fail with an
error on an empty zip file. Instead of trying to hack around
this (which is hard to make guarantees for since they are
non-hermetic host tools), replace them with a go tool to unzip
a set of zip files into a directory.
Bug: 73885582
Test: m checkbuild
Change-Id: I151fed347ed5196726e36866ffc27bc831799afb
The latest version of turbine requires a -- after the javac
options, and uses multiple --bootclasspath arguments instead
of a javac-style colon separated list.
Test: m javac-check
Bug: 74339924
Change-Id: Ib7096294a43e9bd30abc36751299bfac7879f765
Turbine doesn't need extract_srcjars.sh, just pass the source jars
with --source_jars.
Bug: 74339924
Test: m checkbuild
Change-Id: Ie7fe06f5a9f5e29287cf79c2d46b23a676a03d41
Historically, we've always passed '-I .' as the first argument to
protoc, essentially treating all proto file package names as their full
path in the android source tree. This would make sense in a monorepo
world, but it makes less sense when we're pulling in external projects
with established package names.
So keep the same default (for now), but allow individual builds to opt
into using local paths as the default names with
'canonical_path_from_root: false'. A cleanup effort and/or large scale
change in the future could change the default to false.
As part of this, run protoc once per input proto file, since the flags
may need to change per-file. We'll also need this in order to specify
--dependency_out in the future.
Bug: 70704330
Test: aosp/master build-aosp_arm.ninja is identical
Test: aosp/master soong/build.ninja has expected changes
Test: m
Test: Build protobuf test
Change-Id: I9d6de9fd630326bbcced1c62a4a7e9546429b0ce
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet
based droiddoc compilation output is a "real" stubs.jar instead of a
directory of java files and a timestamp file.
The std doclet based javadoc compilation output is a "empty" stubs.jar
instead of a timestamp file.
The stubs.jar will be exported to
out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar
and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar
A $(LOCAL_MODULE).zip file will be generated also, and is exported to
out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set
to false.
Bug: b/70351683
Test: unittest + convert libcore docs Android.mk to Soong manually.
Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f
(cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
Rsp files are supported through helper script (gen-kotlin-build-file.sh)
that generates the kotlinc module/build xml file.
Since rsp files are supported, I've added ExtractSrcJarsCmd step
to handle srcjars extraction.
Minor reorderings to make sure that TransformKotlinToClasses
recives only .java and .kt files when called from Module.compile.
Bug: 73281388
Test: make -j hidl-doc
Change-Id: I5a40b914569018dc529903a7f2864a5aeae838e5
Sometime the size of our command line passed to soong_zip go program
exceeds the cmdline size limit. So add an RespFile support with "@" special
character prefix.
The args in the cmdline will be considered together with the
args in RespFile during soong_zip running.
Test: real tests in my local machine, and compare the
res/libphonenumber.jar before and after changes.
./cmd -o test.zip '""'-C -> [./cmd,-o,test.zip,""-C]
./cmd -o test.zip '-C -f -> [./cmd,-o,test.zip,-C -f]
./cmd -o test.zip '\"'-C -f -> [./cmd,-o,test.zip,\"-C -f]
./cmd -o test.zip '\\'-C -f -> [./cmd,-o,test.zip,\\-C -f]
./cmd -o test.zip '\a'-C -f -> [./cmd,-o,test.zip,\a-C -f]
./cmd -o test.zip \'-C -> [./cmd,-o,test.zip,'-C]
./cmd -o test.zip \\-C -> [./cmd,-o,test.zip,\-C]
./cmd -o test.zip \"-C -> [./cmd,-o,test.zip,"-C]
./cmd -o test.zip "'"-C -> [./cmd,-o,test.zip,'-C]
./cmd -o test.zip "\\"-C -f -> [./cmd,-o,test.zip,\a-C -f]
./cmd -o test.zip "\""-C -f -> [./cmd,-o,test.zip,"a-C -f]
Bug: b/72484223
Change-Id: I83c3630b70c8396c8e8a3f266244d868d754c4e8
There are too many duplicates warnings, disable them until someone
is actually looking at them.
Bug: 69316739
Test: m checkbuild
Change-Id: I7b3315f999dff1c01b6df37ab5ca83f7b8a60bd9
Add support for an errorprone block in Java modules that accepts
additional javacflags for the errorprone build.
Sample:
errorprone: {
javacflags: ["-Xep:EqualsNaN:WARN"],
},
Bug: 72004718
Test: m RUN_ERROR_PRONE=true
Test: manual - add block with ERROR to a project
Test: androidmk_test
Change-Id: I502248fe76c26aa19102f413af72a7324c35b7f4
Move dexing support into java/dex.go, including the rules and logic
from builder.go and the function from java.go.
Test: no change to build.ninja
Change-Id: I098d2a9774e28079ba44791679a0db6f876fe3e6
Combining static jars from dependencies may bring in module-info.class
files, which don't make sense once multiple modules have been combined,
and sometimes confuse downstream tools like desugar. Strip them out
like make does when combining jars.
Test: m checkbuild
Change-Id: I560c5acfcc6e1be9adf604c22cf200581f92f702
The kotlinc build rules were missing dependencies on the jars in
the classpath.
Test: TestKotlin in java_test.go
Change-Id: I56681785289f942b1070751b7dc5944e7a995b7f
Add an option to use D8's desugar instead of the standalone version.
USE_D8_DESUGAR=true m would trigger DCHECK in dex2oat unless
https://android-review.googlesource.com/c/platform/art/+/562595 is
patched in as well.
Bug: 69329508
Test: m && USE_D8_DESUGAR=false m
Change-Id: I864d88e257a2ba0b7f19aa5cced537301950e963
AConfig() now duplicates Config(). Replace the uses of AConfig()
with Config(). Leave AConfig() for now until code in other
projects is cleaned up.
Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
AOSP's current version of kotlinc only supports -jvm-target
1.8 or 1.6. Previously, we were passing the javaVersion
(the value passed to javac -target) but that would fail if
javaVersion was eg. 1.9.
This CL changes the kotlinc invocation to always pass
-jvm-target 1.8, regardless of javaVersion.
Bug: 69160377
Test: Treehugger
Change-Id: Ib12a8c2afbe908319513861a5380e70bf09d0be0
Compute the common proto flags and pass them to the protoc invocation
when generating java files.
Test: m checkbuild
Change-Id: I0d4c23ad001d01eab03b404545383f009214106d
kotlinc expects -classpath, not --classpath.
Also add a test that uses only .kt files to exercise the code when
there are no java sources.
Test: java_test.go
Change-Id: Ifa5a007b460b40ea2188d0907570fbdca6c48da7
Source jars were not working as designed because javac will only
compile files from the -sourcepath if there are references to them
starting from files on the command line. Switch to extracting
the source jars into a directory and passing a list of the files
to javac.
Test: m checkbuild
Change-Id: I9f7d824f8538d081b2f5ad64ae3cbfd0e96213af
Now that android.ModuleContext does not include blueprint.ModuleContext
we can rename android.ModuleContext.ModuleBuild to
android.ModuleContext.Build without colliding with
blueprint.ModuleContext.Build. Leave ModuleBuild as a wrapper around
Build for now to avoid having to update all the users outside
build/soong simultaneously.
Test: m checkbuild
Change-Id: I18eb8cc04faf002049a11d9aac97e9732ff5d638
If sdk jars(android_stubs_current, etc) are compiled using soong java
modules, we have to filter them when running Java build with Turbine.
TODO: provide more unit-tests.
Test: m clean && m -j32; go test java_test
Change-Id: Iad7c241b0e8b0ca760950733f513124b56c84564
Make all the jar intermediates called modulename.jar, and put each
in a subdir for the tool that generated it. This will simplify
using the jars as inputs to genrules and resources.
Test: java_test.go
Change-Id: If00e16bd7df5a4ba24ebc4b68c9ccf2cfda49544
Allow java libraries to specify .kt sources, precompile them with
kotlin, and then pass them in the classpath to javac.
Bug: 65219535
Test: java_test.go
Change-Id: Ife22b6ef82ced9ec26a9e5392b2dadacbb16546f
srcFileLists was an ill-fated attempt to deal with generators that
produce a set of java sources that is not known ahead of time.
For example, the list of files produced by protoc depends on the
package statement in the .proto file. srcFileLists put the list
of generated files into a file, which was then passed to javac
using the @file syntax. This worked, but it was too easy to cause
missing dependencies, and will not work well in a future distributed
build environment.
Switch to putting generated sources into a jar, and then pass them
jar to javac using -sourcepath.
Test: m checkbuild
Change-Id: Iaab7a588a6c1239f7bf46e4f1b102b3ef517619b