Commit graph

266 commits

Author SHA1 Message Date
Paul Duffin
03fbd786b5 java_sdk_library: Remove unused stubsLibraryDependencyTag
Bug: 145998881
Test: m checkbuild
Change-Id: I3ce0fa498c261a9a1f0382f6d548bb070a656358
2020-01-02 14:55:27 +00:00
Paul Duffin
235ffffbdc java_sdk_library: construct droidstubs args as []string
Bug: 145998881
Test: m checkbuild
Change-Id: Id3eb99577200a807050dbf86f47816a2476c3d9c
2019-12-31 15:08:33 +00:00
Jooyung Han
624058e6a5 Dedup generating xml file for java_sdk_library
Permission XML file for java_sdk_library is generated by
java_sdk_library itself now.

And, build rule is switched to android.WriteFile since "echo -e" is
not supported from build server. (-e is printed to output)

Bug: 145474221
Test: m com.android.cronet and check its permissions xml file
     also, m org.chromium.net.cronet.xml (created dynamically)
Change-Id: Iffb119151c49bc4fe6c4386fa267cca193f37dbc
2019-12-26 12:20:24 +00:00
Jooyung Han
58f26aba4e Support java_sdk_library as java_libs of apex
When a java_sdk_library module is added, both impl jar and permission
xml files are packaged together.

For example, when a java_sdk_library "foo" is listed, following two
entries will be in an APEX package.

/javalibs/foo.jar
/etc/permissions/foo.xml

Bug: 145474221
Test: m com.android.cronet
      deapexer list com.android.cronet.apex

Change-Id: If5883c02255e9309f20810b1532d3fbe73bf4e95
2019-12-20 08:50:34 +09:00
Paul Duffin
43dc1cc2bc Dedup system modules and sdk library module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I982fcb8d723e8e2f7679434051ddc427d4fbd7be
2019-12-19 19:19:40 +00:00
Jiyong Park
0b0e1b9804 AndroidMkEntries() returns multiple AndroidMkEntries structs
AndroidMkEntries now returns multiple AndroidMkEntires so that a module
can emit multiple Make modules if needed.

Bug: 128708192
Test: m

Change-Id: I56b6f76d22943b80329951c5acb80a1b932441ad
2019-12-11 17:25:27 +09:00
Sundong Ahn
0d7dff48f5 Add system_ext_specific
The system_ext partition was created. So if java_sdk_library module is
installed to system_ext partition, .xml and .jar install path must be
changed to system_ext.

Bug: 143440787
Test: add system_ext_specific to java_sdk_module && make -j && check
system_ext parition

Change-Id: Ie0d0df426d4aa96ac89eb4215e7376eea3f03f54
2019-12-04 04:00:21 +00:00
Jiyong Park
9495b76fbd Remove api_srcs property from java_sdk_library
The property is no longer used.

Bug: 141149570
Test: m
Change-Id: I3136c7b03138296dc59127f596f7e96502edf608
2019-10-31 20:38:14 +09:00
Jaewoong Jung
2784fda152 Merge "Migrate java/androidmk.go to new system #1" 2019-09-27 14:40:24 +00:00
Colin Cross
84dfc3d331 Make CreateModule take an android.ModuleFactory
Reduce the boilerplate required to call CreateModule by taking an
android.ModuleFactory instead of a blueprint.ModuleFactory.

Test: m checkbuild
Change-Id: I1259d2dd3f7893b5319c333bc180727ac40f9e91
2019-09-26 17:19:26 +00:00
Jaewoong Jung
b0c127cfd7 Migrate java/androidmk.go to new system #1
This change migrates some of AndroidMk()s in java/androidmk.go to
AndroidMkEntries(), mainly focusing on deduping test-related helper
funcs.

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: I7810085521600d9ea2df078837688ade41c04825
2019-09-10 07:38:31 -07:00
Jiyong Park
b5ddfa9219 Remove srcs_lib and srcs_lib_whitelist_pkgs
They are no longer used. Sources are provided via filegroup.

Also removing the SrcDependency interface as it is no longer used.

Bug: 135922046
Test: m
Merged-In: I81f9614d20fbdd2f7d18340d6dbdb592e7acde06
(cherry picked from commit fa21cba64a)
Change-Id: I81f9614d20fbdd2f7d18340d6dbdb592e7acde06
2019-08-29 13:58:40 +09:00
Jiyong Park
1112c4c0d7 Remove srcs_lib_whitelist_dirs
This change removes srcs_lib_whitelist_dirs which was used to let
droiddoc to know the base directories for the AIDL/Java source files.
Instead, the base directories are given via the path property of the
filegroup modules.

This change also includes a fix that the base directories from all
filegroup modules listed in srcs are used as the import paths for the
AIDL compiler. This removes the need to have aidl.[local_]include_dirs.

Bug: 70046217
Test: m
Exempt-From-Owner-Approval: Approved internally
Merged-In: I62ff2a7dd3943d9a3d95d91c36a30fd44ea467d2
(cherry picked from commit f79334d95c)
Change-Id: I62ff2a7dd3943d9a3d95d91c36a30fd44ea467d2
2019-08-26 08:09:33 +00:00
Jiyong Park
e3ef3c8f0c Fix the unbundled mainline module build
This change fixes two problems:

1) the prebuilt apexes are force disabled for the unbundled builds
because we need to build the modules from the source then

2) the dependencies from an sdk_library module to
*.stubs.{public|system|tests} are not added for the unbundled build
because the stubs modules are disabled.

Bug: 137282010
Test: unbundled mainline builds are successful
Test: build com.android.media and inspect the jar file to see if
hiddenapi flags are there
$ cd out/dist/mainline_modules_arm
$ unzip com.android.media.apex apex_payload.img
$ mkdir -p mnt
$ sudo mount -o ro,loop apex_payload.img mnt
$ dexdump2 mnt/javalib/updatable-media.jar | grep hiddenapi
shows results

Change-Id: I2c00af07aac4a15770d3acab011a36e2e4803bfc
2019-07-15 17:20:05 +09:00
Jaewoong Jung
4f158eed0d Add java_sdk_library summary to soong docs.
Test: m soong_docs
Change-Id: Ibaf09cd263966fad90d22d2b17161432c247cbbb
2019-07-11 10:45:40 -07:00
Paul Duffin
a3d0986cfc Remove the no_standard_libs property
Corrects an error message that refers to no_standard_libs.

Removes any tests that use no_standard_libs:true where possible as
there are duplicate tests for sdk_version:"none". Otherwise, switches
them over to use sdk_version:"none".

The androidmk mapping from LOCAL_NO_STANDARD_LIBRARIES to
no_standard_libs has also been removed. There was little point in
updating the tool to map it through to sdk_version:"none" as there are
only a couple of places where it is used, in art's test running mk
targets and in some unbundled packages to work around some limitation
in .mk based build.

Bug: 134566750
Test: m droid
Change-Id: I6413c9b1fe3e63b93753a6a017d2981e32b7e013
2019-06-17 11:21:39 +01:00
Paul Duffin
52d398a841 Add sdk_version:"none" to replace no_standard_libs:true
Where possible this duplicates any tests that use no_standard_libs:true
with ones that use sdk_version:"none". If not possible (e.g. in the
default targets included in java/testing.go) it switches some to use
sdk_version:"none" to ensure that there is no regression in the
behavior of no_standard_libs:true.

Follow up changes will switch all usages of no_standard_libs:true over
to use sdk_version:"none" at which point no_standard_libs will be
removed.

Bug: 134566750
Test: m droid
Change-Id: I5f0fd3daa980f6b223abe454cba7f25a97a39d7a
2019-06-13 19:15:10 +01:00
Paul Duffin
250e6198d4 Make sdkDep/decodeSdkDep the source of truth about the sdk
Previously, different parts of the build used different sources of
information about the SDK (i.e. the default libraries) against which
a Java module aimed at the device was built. Some used the sdk_version
property, others used the no_standard_libs or no_framework_libs, some
used a combination of all three.

That lead to inconsistent handling in the code, e.g. some parts treated
no_standard_libs: true as implying no_framework_libs: true and others
did not, and also in the build files, e.g. some modules specified
no_framework_libs: true and sdk_version: "system_current" which makes
no sense, or no_standard_libs: true and sdk_version: "core_current"
which are inconsistent.

This is the first step in a refactoring to simplify the sdk selection
process by replacing the no_standard_libs/no_framework_libs properties
with some extra options for the sdk_version property. This change
consists of:
1) Extra functions sdkContext to access the no_standard_libs and
   no_framework_libs properties.
2) Extra field/functions in sdkDep to store and access the value of
   no_standard_libs/no_framework_libs.
3) Changes to decodeSdkDep(...) to pass the values of the no_...
   properties through to the returned sdkDep.
4) Change all code that accesses the no_... properties directly to
   call decodeSdkDep(...) to get an sdkDep object and then accessing
   the values of the no_... properties from there.

The accessor functions on sdkDep are called has...() rather than
no...() as most callers of the methods invert the value anyway and
!no...() is harder to reason about than has...().

The hasFrameworkLibs() function returns true if and only if
no_standard_libs and no_framework_libs are false. That is consistent
with all but one usage of the no_framework_libs property and that is
not affected by it.

Bug: 134566750
Test: m droid
Change-Id: I196e3304e8bd802fb154e897397b0dd337f868e2
Exempt-From-Owner-Approval: Colin has already given +2 modulo some
    minor nits and this blocking other changes.
2019-06-13 15:16:32 +01:00
Colin Cross
0ea8ba82fc Consolidate baseContext, BaseContext, and BaseModuleContext
blueprint.BaseModuleContext is the set of methods available to all
module-specific calls (GenerateBuildActions or mutators).  The
android package split the same functionality across baseContext (nee
androidBaseContext), BaseModuleContext, and BaseContext.
Consolidate all of them into android.BaseModuleContext.

Test: m checkbuild
Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
2019-06-06 20:01:31 -07:00
Sundong Ahn
80a87b3309 Add No_dist property
For the sysprop apis, we don't need dist. So the No_dist property is
added for it.

Bug: 132448761
Test: m -j dist
Change-Id: I51c6a6b87ab9dc90b6825c0d4d414e958dd7b265
2019-05-15 12:20:03 +09:00
Colin Cross
109328714f Allow codename.fingerprint format for targetSdkVersion
Use codename.fingerprint format for targetSdkVersion if it is unset
in the manifest and UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true.

Test: manual
Bug: 130541924
Change-Id: I4e3b1274cc32038b00b292dc6d67559eb320e9e4
2019-04-18 16:05:37 -07:00
Colin Cross
79c7c26d8a Add support for prebuilt java_sdk_library modules
Add java_sdk_library_import for use when a java_sdk_library may
be used by unbundled branches that do not have the project that
contains the original java_sdk_library module.

Bug: 130287656
Test: m checkbuild
Change-Id: I62df4bccc0da95ed6c8b31dab8f2c32cc3215e9e
2019-04-17 11:28:34 -07:00
Colin Cross
f8b860a0fb Use LoadHook to create modules in java_sdk_library
Creating new modules in a mutator is dangerous, as other mutators
that need to see the new modules may already have run, in this case
the prebuilts mutator.  Move SdkLibraryMutator to a LoadHook instead.
Also moves registering the LoadHook mutator to testing.go so it is
registered for all tests.

Test: m checkbuild
Change-Id: I08bd76a0e6205d2ca27861058067a1562c339eed
2019-04-16 21:46:28 +00:00
Inseob Kim
6e93ac9a32 Fix checking of empty slice properties
Properties can be empty (not nil), and in that case some weird error
messages will happen to be emitted.

Bug: N/A
Test: try to build with api_pacakges: [] and srcs: []
Change-Id: I492077616e742072696265796520737465616b21
2019-03-21 22:04:01 +09:00
Inseob Kim
8098faad9f Refine error messages in case of missing api files
Some non-interpretable error messages has been shown in case of missing
current api files. Instead of that messy errors, This clearly tells
users what is the problem and how to fix it.

Bug: 126259114
Test: 1) try to build a sysprop_library and a java_sdk_library without
creating txt files under api/, and see it fails.
Test: 2) Copy and paste the emitted command, and try to build again.

Change-Id: I986781cc710475647c2b996b0f1c51a6f50c0ba2
2019-03-20 15:33:06 +09:00
Inseob Kim
38449af64f Ignore missing prebuilt_apis of java_sdk_library
Building java_sdk_library without defining prebuilt_apis has been
failing with weird error messages. So one have to touch empty txt files
and create prebuilt_apis module, even when the java_sdk_library is
brand-new and has no previous versions. This commit fixes it so that API
check against previous version is skipped, in the case of missing
prebuilt_apis.

Note that Current api txt files (placed under api/ directory) are still
needed (make update-api)

Bug: 126259114
Test: tries to build without touching empty api txt files.
Change-Id: I93630f4139cbf502621693ec315dc06c0d07d1c3
2019-03-04 10:56:53 +09:00
Sundong Ahn
ae418acbab Add path valid check
The path valid check is added for avoiding panic message

Bug: 126612123
Test: tapas tradefed-all && make -j40

Change-Id: I76b79d5040db7168d8a8879f64349846005333b5
2019-02-28 16:51:53 +09:00
Inseob Kim
c0907f191a Create sysprop_library soong module
A newly introduced sysprop_library soong module will generate a
java_sdk_library and a cc_library from .sysprop description files.
Both Java modules and C++ modules can link against sysprop_library
module, thus giving consistency for using generated sysprop API.

As Java controls accessibility of Internal / System properties with
@hide and @SystemApi, 2 different header files will be created. And
build system will selectively expose depending on the property owner
and the place where the client libraries go into.

Bug: 80125326
Bug: 122170616
Test: 1) Create sysprop_library module.
Test: 2) Create empty txt files under prebuilts/sdk.
Test: 3) Create api directory, make update-api, and see changes.
Test: 4) Try to link against sysprop_library with various clients.
Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags
work as intended.
Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
2019-02-13 23:32:51 +00:00
Paul Duffin
1151247c29 Support $(location...) in droiddoc_options
Adds droiddoc_option_files property which are passed through to
droiddoc's arg_files property.

Bug: 124220029
Test: make checkbuild
Change-Id: I6e98752cebeaac5a8779e04e6c804763c177e354
2019-02-13 10:11:54 +00:00
Colin Cross
897d2ed92f Make java_sdk_library implement Dependency
dexpreopting boot jars is going to need to visit both java_library
and java_sdk_library modules.  Since java_sdk_library is already
a java_library module, move the SdkLibraryDependency methods out
of the way so that it will implement Dependency.  Also requries
re-ording some of the type switches to check for the more-specific
SdkLibraryDependency first.

Test: TestJavaSdkLibrary
Change-Id: I155c9ffaf31689dd150a4d99e07e432ff770b4a7
2019-02-11 15:29:51 -08:00
Colin Cross
571cccfcbc Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong.  A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.

Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
2019-02-06 01:52:41 +00:00
Colin Cross
2c77ceba34 Build java_sdk_library modules when UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true
java_sdk_library modules are usually disabled in favor of prebuilts
when TARGET_BUILD_APPS is set.  Keep them enabled when
UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true, which is used by some unbundled
builds built from a full source tree like mainline modules.

Bug: 123183568
Test: m TARGET_PRODUCT=mainline_modules_arm UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true TARGET_BUILD_APPS=com.android.media
Change-Id: Ifa940769e467ca4b7ad3b95106e184c00680d2ae
2019-01-21 12:18:39 -08:00
Sundong Ahn
054b19a131 Support core library
To support core library, "Openjdk9", "No_standard_libs" and metalava
properties are added to java_sdk_library.
If core_lib is true, dist paths are changed to
apistubs/core/....
impl library name is changed to {module_name}.jar instead of
{module_name}.impl.jar

Bug: 110404779
Test: m -j
Change-Id: Ieb6248ea714b4260333d8bf61573d4f3413f7f24
Merged-In: Ieb6248ea714b4260333d8bf61573d4f3413f7f24
(cherry picked from commit af4907fed7)
2019-01-16 22:00:17 -08:00
Sundong Ahn
04ef8a3edd Remove Metalava_enabled property
Metalava_enabled property is no longer used and APIs format will be
changed. So sdk_library will not support docalva.

Test: m -j
Bug: 117127012
Change-Id: Id146d96413b2979ca903e854e00d4c7a0aa8d6e7
2019-01-14 13:47:44 +09:00
Sundong Ahn
b952ba018f Add Srcs_lib and Srcs_lib_whitelist_dirs properties
After fixing --stub-packages handling, some modules needs Srcs_lib and
Srcs_lib_whitelist_dirs properties. So Add these two properties

Bug: 117127012
Test: m -j

Change-Id: I1345f22e7e1dd9d0ee7779720004e6eba77eeff5
2019-01-08 16:35:47 +09:00
Colin Cross
43f08db29e Dexpreopt soong modules inside soong
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
2018-12-15 19:07:54 -08:00
Colin Cross
4ff85ebeb7 Revert "Dexpreopt soong modules inside soong"
This reverts commit 29ff88741e.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
29ff88741e Dexpreopt soong modules inside soong
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
2018-12-13 15:53:54 +00:00
Sundong Ahn
ba49360c51 Remove dependency on framework.jar
Remove dependency on framework.jar to reduce the build time. So sdk
libraries are not checked API whenever frameowkr.jar changes.

Test: m -j
Bug: 119625999
Change-Id: I7435c429b7857de8c3c1834757c54888091753e5
2018-12-07 02:32:40 +00:00
Colin Cross
ac5027264c Dist the javac-compiled stubs jars
The header jars are compiled with turbine, which produces a jar that
is less compliant to the class file spec than when compiled with
javac.  Since the dist'ed jars may be shipped with the SDK, use
the javac version for maximum compatibility.

Bug: 119841341
Test: forrest SDK build
Change-Id: I745c8dd0305d95ae9ce025a9c23e51a99ebb0a3b
2018-11-21 20:36:17 -08:00
Sundong Ahn
fb2721f2a6 Support Metalava in java_sdk_library
The metalava is supported instead of doclava. However, not all sdk
libraries are available now. So metalava_enabled property is added for
it.
when using metalava, DroidstubsFactory module will be created instead of
DroiddocFactory.

Test: make -j
Test: make apicheck
Bug: 117127012

Merged-In: I7fd10230bfe30a4ef4dceb1a4459145b674668cd
Change-Id: I7fd10230bfe30a4ef4dceb1a4459145b674668cd
(cherry picked from commit 0817d01ab1)
2018-10-11 08:41:57 +00:00
Neil Fuller
1fee9f3dd0 Include all core libs in default boot classpath
To migrate the default compilation over to using
"core platform api" stubs we need to make the "before"
state as close to the "after" state as possible.

The stubs will include all "core libraries" so it
makes sense to include those that contribute to the
"core platform api": okhttp, bouncycastle and conscrypt.

(apache-xml is not included because it doesn't contribute
to the core platform API).

After this change all explicit dependencies to okhttp,
bouncycastle and conscrypt in situations where the
default boot classpath is used can be removed.

A knock-on of this change is that the conscrypt, bouncycastle
and okhttp targets need to be adjusted to explicitly
depend on core-oj / core-libart with no_standard_libs: true
to avoid a cycle.

Bug: 113148576
Test: treehugger
Change-Id: I1677af8d9d48fd026874ebce4c864f39ec1a5a3d
2018-10-10 08:42:12 +00:00
Colin Cross
48de9a4ef5 Make more java modules defaultable
Make java_import, android_library and android_library_import modules
defaultable, and add some missing property structs to java_defaults.
Also use InitJavaModule everywhere.

Test: m checkbuild
Change-Id: I981875bbec5d1f87bae73f36a385e0b77c56c368
2018-10-03 14:31:10 -07:00
Sundong Ahn
4fd04bb506 Change the dist file path for sdk library
The dist file path is changed from apistubs/{api_scope}/*.jar to
apistubs/{owner}/{api_scope}/*.jar. it makes easy to get stub files
when updating prebuilts/sdk by making it possible to distinguish
between Android libraries and Google libraries.
And Onwer() function is added to ModuleBase for getting onwer info.

Test: make -j40 PRODUCT-sdk_phone_armv7-sdk dist sdk_repo
Change-Id: I50069aff6664901e6c9129d69643a414ee5e41d0
2018-09-17 09:43:30 +00:00
Colin Cross
42d48b7b8b Enforce dependencies have right architecture
ctx.AddDependency will succeed if the named dependency only has a
single variant, even if that variant is the wrong architecture.
Use ctx.AddVariationDependency(nil, ...) instead, which requires
that all variations of the calling module match the dependency.

Bug: 112707915
Test: no change to out/soong/build.ninja
Test: using a device dependency in a host java module is an error
Change-Id: I70b661a57d4412eb63b8c9841febfb756e9e025d
2018-08-30 16:31:02 +00:00
Sundong Ahn
dd567f9c14 Add new properties
Droiddoc_options is added, since all sdk libraries don't builds with the
same argument. We provide basic droiddoc argument and options can be
added like "stubsourceonly" by this property.

When building stubs, soong don't make dex files, but some module uses
dex files from stubs. So Complie_dex is added for compiling dex
regardless of installable.

Srcs_lib_whitelist_pkgs property is added for using other whitelist
pkgs instead of "android.annotation".

Bug: 77577799
Test: m -j
Change-Id: Ic2fb7bc9c49a825550dbebe3e9132ad9a735322f
2018-08-01 02:18:32 +00:00
Sundong Ahn
20e998b32c API txt files are dist artifacts
API txt files from a java_sdk_library are automatically registered as
dist artifacts for sdk and win_sdk targets.

They are installed under $(DIST_DIR)/apistubs/<apiscope>/api/<name>.txt
where <apiscope> can be public, system and test.

Bug: 77577799
Test: m -j
Change-Id: I38cd8ee000445ce843ac01ead38001e509228738
2018-07-26 01:40:08 +00:00
Sundong Ahn
241cd3747c Change classpath for droiddoc
When the module type is SdkLibraryDependency, the classpath has been
gotten from headerJar
Becuase droiddoc uses src files when it builds, we should change to use
ImplementationJars instead of headerJar.

Bug: 77577799
Test: make -j

Change-Id: I1a072be69d7edff5636ea80af700be7796c3b0fc
2018-07-17 23:52:49 +00:00
Sundong Ahn
57368eb515 Change link type rule
If linkType of a module is javaPlatform, the module will link to
<lib>.impl instead of <lib>.stubs.system.

Bug: 77577799
Test: make -j
Change-Id: I2a9a0ec7c76c0fc304935f16c4c371aea39bffd6
2018-07-11 23:56:17 +00:00
Colin Cross
9ae1b927d4 Don't install java libraries by default
Very few java libraries need to be installed, most are statically
included in other modules.  Device modules that are not installed
also don't need to be dexed, saving checkbuild time.  Change the
default for java_library to not be installed, and allow libraries
that should be installed to specify installed: true.  This makes
java_libary and java_library_static identical.  It also simplifies
some corner cases when converting from Make to Soong if a module
is built for the host (which doesn't differentiate between static
and non-static/installable) and statically for the device, which
couldn't be represented in a single java_library in soong.

Bug: 110885583
Test: m checkbuild, compare presubmit target files
Change-Id: Idc0841c39a17cebd7bac3559c9408596d167a393
2018-07-11 05:35:59 +00:00
Sundong Ahn
f043cf6b32 Add stub_only_libs property
Java libraries are not included when a stub is built with
java_sdk_library. However, we may need a java library when building
stubs. For it, stub_only_libs property is added.

Bug: 77577799
Test: make -j
Change-Id: I2223288e3a85ec7f0ccccdc1da31f8d46cbcbcc0
2018-06-25 17:30:57 +09:00
Jiyong Park
1be9691910 Export SDK library names
java_library, java_import, and android_library export SDK library names
that they are using directly or indirectly via its dependencies. When
building an apk, the manifest fixer uses the SDK lib names to
automatically add <uses-library> tags.

The SDK lib names are exported to the make world via
LOCAL_EXPORT_SDK_LIBRARIES flag.

Bug: 77575606
Test: m -j
Change-Id: I4fe606eb7ed23843c58eebe6a324405fe1da34e5
2018-06-20 12:13:33 +09:00
Jiyong Park
b5b709f72c Add errorprone.javacflags to java_sdk_library
Bug: 110208852
Test: cherry-pick https://android-review.googlesource.com/c/platform/external/apache-http/+/620154
Test: m javac-check RUN_ERROR_PRONE=true

Change-Id: If97871e6e1fd597efed2b796620538ca4c57eed4
2018-06-15 10:40:26 +09:00
Sundong Ahn
e6f0b056af Add Static libs to droiddoc libs
Add Static libs to droiddoc libs because The droiddoc doesn't
distinguish between shared libs and static libs and static libs are
needed when creating droiddoc modules.

Bug:77577799
Test: make -j
Change-Id: Iace79800d2338518e5f881f01d0002908544234f
2018-06-07 11:35:26 +09:00
Sundong Ahn
1b92c824f3 Add aidl properties
The aidl files are allowed when creating the droiddoc module in
java_sdk_library. But The properties of AIDL, local_include_dir
and include_dir, are not passed to the droiddoc module.
These properties are add because they are needed to generate the
java files.

Bug: 77575606
Test: build && java_test.go
Change-Id: I1006c9ce7a5c7e424416d39fb921c27a3fa86afa
2018-05-29 04:25:02 +00:00
Jiyong Park
58c518b594 java_sdk_library does the apicheck by default
droiddoc now supports apicheck. java_sdk_library uses it to
automatically perform apichecks against the not-yet-release API and
the latest-released API.

A module type prebuilt_apis is added. It finds api txt files and creates
filegroup modules so that it can be referenced from java_sdk_library
across the module boundary.

Bug: 77575606
Test: m -j
Test: m -j checkapi
Test: m -j update-api
Change-Id: I0ba859972eac060296e1df2e71c4e047392d4877
2018-05-15 10:57:01 +09:00
Jiyong Park
b674a5226a Prevent index out of range
I3487634f1ec5bb3b5b60d636b64461d391add35a is causing build breakages in
unbundled builds.

The stubs libs are disabled for unbundled builds, and thus we shouldn't
declare them as dist artifacts.

Bug: 605033
Test: make -j dist ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk
Change-Id: I3cd92e2cc6aeb48baf47d37780d8df2aa4756438
2018-05-06 07:56:17 +09:00
Jiyong Park
9007838c93 Stubs libs are dist artifacts
stubs libs from a java_sdk_library are automatically registered as dist
artifacts for sdk and win_sdk targets.

They are installed under $(DIST_DIR)/apistubs/<apiscope>/<name>.jar
where <apiscope> can be public, system and test.

Bug: 605033
Test: m -j
Test: choosecombo 1 sdk_phone_armv7 userdebug; m -j sdk dist
the stubs libs are found under out/dist/apistubs

Change-Id: I3487634f1ec5bb3b5b60d636b64461d391add35a
2018-05-02 19:33:45 +09:00
Jiyong Park
baaf9dd5ab Property api_srcs added for api-only source files
New property api_srcs is added to java_sdk_library. The property is used
to specify set of source files that will be part of the API but not part
of the runtime library. Currently, this is only for the legacy http
library (org.apache.http.legacy) where some framework classes (such as
android.net.SslError which are compiled into framework.jar) are
registered as its API for historical reason.

Bug: 77575606
Test: m -j
Change-Id: I36d153f4815f8e4c939d5eeec632a38e7943b4b0
2018-05-02 02:13:44 +09:00
Jiyong Park
441a47d1c9 CompilerDeviceProperties are added to the sdk impl library
java_sdk_library now accepts properties in CompilerDeviceProperties,
such as dex_preopt.profile. The properties are passed to the impl
library which is the device-specific sub-component of a
java_sdk_library.

Bug: 77575606
Test: m -j
Change-Id: I7303068bb62ca860352db306a5462fa4453ee80f
2018-05-02 01:25:10 +09:00
Jiyong Park
5a2c9d7a46 Add hidden_api_packages to java_sdk_library
hidden_api_packages is used to set packages that must be hidden from the
API. org.apache.http.legacy will be using this to exclude
references to com.android.okhttp from its API signatures.

Bug: 77575606
Test: m -j
Change-Id: Ic93c67cab96585638921dc922f175e545a68ead2
2018-05-01 22:25:41 +09:00
Anton Hansson
8959e149b7 Add some friendly error messages for java_sdk_library.
The stubs will always fail to build without at least these
three arguments. Give a clear error message when this happens
instead of failing further into the build.

Bug: 77575606
Test: make <x>.stubs for sdk_library "x" without these args
Change-Id: If3142ecc73d6428f7e3120788f8de64d56a777ad
2018-05-01 07:49:03 +01:00
Jiyong Park
df13054c2a java_sdk_library supports test as another API scope
For each java_sdk_library module, three (possibly different) stubs libs
are created.

*.stubs: public APIs only
*.system.stubs: public APIs + @SystemApi
*.test.stubs: public APIs + @TestApi

Depending on the sdk_version (or LOCAL_SDK_VERSION) of the calling
module, stubs lib of the corresponding api scope is linked.

Bug: 77575606
Test: m -j
Change-Id: I1437c64460914dbfc349dbc31d6f3ef090f541e3
2018-04-28 02:16:54 +09:00
Jiyong Park
5a8d1bee89 Add prebuilt_etc_xml
prebuilt_etc_xml installs an xml file to <partition>/etc[/<subdir>] and
validates the xml file against the given DTD file before installing it.

This change also includes some fixes for prebuilt_etc which is the super
module of prebuilt_etc_xml:

1) The module is changed to arch-specific module as the prebuilts are only
for devices (installed under the etc dir), but not for hosts.

2) Dependency to android.Prebuilt is removed because android.Prebuilt is
intended to be used for the case when a module can exist as prebuilts,
source or both. These prebuilt_etc_* modules are prebuilt only.

3) srcs property which accepts a list of source files is changed to src
that only accepts single source file, which makes more sense for
prebuilts.

Bug: 65686190
Test: m -j (xml_test.go)
Change-Id: I40484f3f6615b99f6b8d43176db0c40c5bfd838e
2018-04-28 00:13:00 +09:00
Jiyong Park
82484c0771 Additional fixes for java_sdk_library
This change fixes several problems found while re-defining some libs
using java_sdk_library module type.

1) A phony module whose name is the same as the java_sdk_library name is
defined. It is used to support installing the runtime library via
PRODUCT_PACKAGES (even when there is no dependency from other modules).

2) A bug that package names whose depth is >= 2 is ignored in
droiddoc.srcs_lib_whitelist_pkgs is fixed. A package name foo.bar.baz is
now converted to a path foo/bar/baz following the Java convention.

3) A make variable JAVA_SDK_LIBRARIES that is the list of java_sdk_library
module names is exported to make. This can be used to distinguish SDK
libraries from ordinary libs.

4) When running doclava, some framework sources in the 'android' package
and the same packages as the SDK library are automatically added to the
sources list. This is required for the case when API class is extending
from the framework class. In that case, doclava needs to know whether
the base class is hidde nor not. Since that visibility info is encoded
as @hide string in the comment, we need source files for the classes,
not the compiled ones. Also there are rare cases where part of SDK
library is implemented in the framework (e.g. org.apache.http.legacy).
In that case, we need framework source to make API stubs, though the
sources are not required to build the runtime library.

5) The stubs libs are disabled for PDK builds as well.

Bug: 77575606
Test: m -j

Change-Id: I360cf15fe5339e46644fb16d0dabe2548aa315f9
2018-04-24 09:47:50 +09:00
Jiyong Park
c678ad3f71 Adding java_sdk_library
java_sdk_library is to make a Java library that implements optional
SDK APIs to apps. It is actually a wrapper for several modules: 1) stubs
library that clients are linked against to, 2) droiddoc module that
internally generates API stubs source files, 3) the real runtime shared
library that implements the API, and 4) XML file for adding the runtime
lib to the classpath at runtime if requested via <uses-library>.

Note: this is only the initial CL for the feature. Followings are features
currently missing and under development.

1) check for API consistency
2) install stubs libs as the dist artifacts
3) ensuring that apps have appropriate <uses-library> tag
4) disallowing linking to the runtime shared lib
5) HTML generation

Bug: 77575606
Test: m -j

Change-Id: I4a4ccf6e730e041703c63bb275d8860d0de96887
2018-04-19 08:57:30 +09:00