Move the rules to build framework.aidl into Soong, and use it
when compiling aidl files with sdk_version: "current".
Also fixes incorrectly using the aidl includes exported by the
"framework" module when the proguardRaiseDep dependency was
added.
Bug: 130798034
Test: sdk_test.go
Change-Id: I126adf1d9e7b6acb528875ff62b974ba7ad9a337
android/soong/common was renamed to android/soong/android long
ago, but the pctx package path was still "android/soong/common".
This required all users of rules defined in android/soong/android
to import "android/soong/android" and then
pctx.Import("android/soong/common").
Test: m checkbuild
Change-Id: I20d096522760538f7cfc2bec3d4bfeba99b275d4
Using blueprint.Rule for protoc commands was causing code duplication
because there was no good way to run the same protoc for cc, java and
python but then run custom source packaging steps for java and python.
Move most of the code into a common function that returns a
RuleBuilder, and then let java and python add their own commands at
the end of the rule.
Bug: 70706119
Test: All Soong tests
Test: m checkbuild
Change-Id: Ic692136775d273bcc4f4de99620ab4878667c83a
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings. Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.
Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.
Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
The srcjar directories just confuse people looking for generated
files, clean them up after each rule.
Test: m checkbuild
Change-Id: If712ce7d4922619fd8420ae8f89830fe7824114d
Now that there are no uses left of annotation_processors remove
the property.
If there are no annotation processor classes for javac for a module,
due to an empty "plugins" property or using kapt for annotation
processors, pass -proc:none to javac to ensure it does not try
to run any annotation processors found in the classpath.
Bug: 77284273
Test: plugin_test.go, kotlin_test.go
Change-Id: I3823d9fec8d3d07d2e49b1d97839f7fcbdd35647
Follow bazel's modules for annotation processors by introducing
a java_plugin module type that can contain extra metadata about
the annotation processor, the processor class and a flag to
specify if the annotation processor is compatible with the
turbine optimization. Deprecate the annotation_processors
property, which took a list of java_library_host modules, in
favor of the plugins property, which takes a list of java_plugin
modules. The annotation_processors property will be removed
once all uses have been replaced with plugins.
Bug: 77284273
Test: plugin_test.go
Test: m caliper
Change-Id: I37c1e80eba71ae2d6a06199fb102194a51994989
Enable the kotlin-annotation-processing plugin and pass annotation
processors to it.
Bug: 122251693
Test: m checkbuild
Test: TestKapt in kotlin_test.go
Change-Id: I841df454beaaa7edd263eea714ca0d958a03c9de
kapt is going to make kotlin a little more complicated, move the
rules and tests to their own files.
Bug: 122251693
Test: m checkbuild
Change-Id: Ieed78b97995ced210b710bd50c357514cc8e3bc6
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules. The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.
Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
only expected changes to dexpreopt outputs on system_other
(.vdex files for privileged Soong modules no longer incorrectly
contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
Protobuf 3.5.2 does not natively support lite protos, instead they
are generated by the protoc-gen-javalite plugin compiled from
external/protobuf-javalite.
Bug: 117607748
Test: m checkbuild
Change-Id: I95c2d873f19d4c00e9dc312d7fdbe98cae250a8b
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