blob: 5949bca2f9a3a4e3e7c129c60d20a24b15ccb681 [file] [log] [blame]
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_base_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
}
// Visibility only for ravenwood prototype uses.
genrule_defaults {
name: "hoststubgen-for-prototype-only-genrule",
visibility: [
":__subpackages__",
"//frameworks/base",
"//frameworks/base/ravenwood:__subpackages__",
],
}
// Visibility only for ravenwood prototype uses.
java_defaults {
name: "hoststubgen-for-prototype-only-java",
visibility: [
":__subpackages__",
"//frameworks/base",
"//frameworks/base/ravenwood:__subpackages__",
],
}
// Visibility only for ravenwood prototype uses.
filegroup_defaults {
name: "hoststubgen-for-prototype-only-filegroup",
visibility: [
":__subpackages__",
"//frameworks/base",
"//frameworks/base/ravenwood:__subpackages__",
],
}
// This library contains the standard hoststubgen annotations.
// This is only for the prototype. The productionized version is "ravenwood-annotations".
java_library {
name: "hoststubgen-annotations",
defaults: ["hoststubgen-for-prototype-only-java"],
srcs: [
"annotations-src/**/*.java",
],
host_supported: true,
sdk_version: "core_current",
}
// This library contains helper classes used in the host side test environment at runtime.
// This library is _not_ specific to Android APIs.
java_library_host {
name: "hoststubgen-helper-runtime",
srcs: [
"helper-runtime-src/**/*.java",
],
libs: [
"junit",
],
static_libs: [
"guava",
],
jarjar_rules: "jarjar-rules.txt",
visibility: ["//visibility:public"],
}
java_library {
name: "hoststubgen-helper-runtime.ravenwood",
srcs: [
"helper-runtime-src/**/*.java",
],
libs: [
"junit",
],
static_libs: [
"guava",
],
jarjar_rules: "jarjar-rules.txt",
visibility: ["//visibility:public"],
}
// Host-side stub generator tool.
java_binary_host {
name: "hoststubgen",
main_class: "com.android.hoststubgen.Main",
srcs: ["src/**/*.kt"],
static_libs: [
"hoststubgen-helper-runtime",
"junit",
"ow2-asm",
"ow2-asm-analysis",
"ow2-asm-commons",
"ow2-asm-tree",
"ow2-asm-util",
],
visibility: ["//visibility:public"],
}
java_test_host {
name: "hoststubgentest",
// main_class: "com.android.hoststubgen.Main",
srcs: ["test/**/*.kt"],
static_libs: [
"hoststubgen",
"truth",
],
test_suites: ["general-tests"],
visibility: ["//visibility:private"],
}
// File that contains the standard command line argumetns to hoststubgen.
// This is only for the prototype. The productionized version is "ravenwood-standard-options".
filegroup {
name: "hoststubgen-standard-options",
defaults: ["hoststubgen-for-prototype-only-filegroup"],
srcs: [
"hoststubgen-standard-options.txt",
],
}
hoststubgen_common_options = "$(location hoststubgen) " +
// "--in-jar $(location :framework-all) " +
// "--policy-override-file $(location framework-policy-override.txt) " +
"@$(location :hoststubgen-standard-options) " +
"--out-stub-jar $(location host_stub.jar) " +
"--out-impl-jar $(location host_impl.jar) " +
// "--keep-all-classes " + // Used it for an experiment. See KeepAllClassesFilter.
"--gen-keep-all-file $(location hoststubgen_keep_all.txt) " +
"--gen-input-dump-file $(location hoststubgen_dump.txt) " +
""
// Common defaults for stub generation.
// This one is not specific to Android APIs.
genrule_defaults {
name: "hoststubgen-command-defaults",
tools: ["hoststubgen"],
srcs: [
":hoststubgen-standard-options",
],
// Create two jar files.
out: [
"host_stub.jar",
"host_impl.jar",
// Following files are created just as FYI.
"hoststubgen_keep_all.txt",
"hoststubgen_dump.txt",
],
}
// Generate the stub/impl from framework-all, with hidden APIs.
java_genrule_host {
name: "framework-all-hidden-api-host",
defaults: ["hoststubgen-command-defaults"],
cmd: hoststubgen_common_options +
"--in-jar $(location :framework-all) " +
"--policy-override-file $(location framework-policy-override.txt) ",
srcs: [
":framework-all",
"framework-policy-override.txt",
],
visibility: ["//visibility:private"],
}
// Extract the stub jar from "framework-all-host" for subsequent build rules.
// This is only for the prototype. Do not use it in "productionized" build rules.
java_genrule_host {
name: "framework-all-hidden-api-host-stub",
defaults: ["hoststubgen-for-prototype-only-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":framework-all-hidden-api-host{host_stub.jar}",
],
out: [
"host_stub.jar",
],
}
// Extract the impl jar from "framework-all-host" for subsequent build rules.
// This is only for the prototype. Do not use it in "productionized" build rules.
java_genrule_host {
name: "framework-all-hidden-api-host-impl",
defaults: ["hoststubgen-for-prototype-only-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":framework-all-hidden-api-host{host_impl.jar}",
],
out: [
"host_impl.jar",
],
}
// Generate the stub/impl from framework-all, with only public/system/test APIs, without
// hidden APIs.
// This is only for the prototype. Do not use it in "productionized" build rules.
java_genrule_host {
name: "framework-all-test-api-host",
defaults: ["hoststubgen-command-defaults"],
cmd: hoststubgen_common_options +
"--intersect-stub-jar $(location :android_test_stubs_current{.jar}) " +
"--in-jar $(location :framework-all) " +
"--policy-override-file $(location framework-policy-override.txt) ",
srcs: [
":framework-all",
":android_test_stubs_current{.jar}",
"framework-policy-override.txt",
],
visibility: ["//visibility:private"],
}
// Extract the stub jar from "framework-all-test-api-host" for subsequent build rules.
// This is only for the prototype. Do not use it in "productionized" build rules.
java_genrule_host {
name: "framework-all-test-api-host-stub",
defaults: ["hoststubgen-for-prototype-only-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":framework-all-test-api-host{host_stub.jar}",
],
out: [
"host_stub.jar",
],
}
// Extract the impl jar from "framework-all-test-api-host" for subsequent build rules.
// This is only for the prototype. Do not use it in "productionized" build rules.
java_genrule_host {
name: "framework-all-test-api-host-impl",
defaults: ["hoststubgen-for-prototype-only-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":framework-all-test-api-host{host_impl.jar}",
],
out: [
"host_impl.jar",
],
}
// This library contains helper classes to build hostside tests/targets.
// This essentially contains dependencies from tests that we can't actually use the real ones.
// For example, the actual AndroidTestCase and AndroidJUnit4 don't run on the host side (yet),
// so we pup "fake" implementations here.
// Ideally this library should be empty.
java_library_host {
name: "hoststubgen-helper-framework-buildtime",
defaults: ["hoststubgen-for-prototype-only-java"],
srcs: [
"helper-framework-buildtime-src/**/*.java",
],
libs: [
// We need it to pull in some of the framework classes used in this library,
// such as Context.java.
"framework-all-hidden-api-host-impl",
"junit",
],
}
// This module contains "fake" libcore/dalvik classes, framework native substitution, etc,
// that are needed at runtime.
java_library_host {
name: "hoststubgen-helper-framework-runtime",
defaults: ["hoststubgen-for-prototype-only-java"],
srcs: [
"helper-framework-runtime-src/**/*.java",
],
libs: [
"hoststubgen-helper-runtime",
"framework-all-hidden-api-host-impl",
],
}
java_library {
name: "hoststubgen-helper-framework-runtime.ravenwood",
defaults: ["hoststubgen-for-prototype-only-java"],
srcs: [
"helper-framework-runtime-src/framework/**/*.java",
],
libs: [
"hoststubgen-helper-runtime.ravenwood",
"framework-minus-apex.ravenwood",
],
static_libs: [
"core-xml-for-device",
],
}
// Defaults for host side test modules.
// We need two rules for each test.
// 1. A "-test-lib" jar, which compiles the test against the stub jar.
// This one is only used by the second rule, so it should be "private.
// 2. A "-test" jar, which includes 1 + the runtime (impl) jars.
// This and next ones are for tests using framework-app, with hidden APIs.
java_defaults {
name: "hosttest-with-framework-all-hidden-api-test-lib-defaults",
installable: false,
libs: [
"framework-all-hidden-api-host-stub",
],
static_libs: [
"hoststubgen-helper-framework-buildtime",
"framework-annotations-lib",
],
visibility: ["//visibility:private"],
}
// Default rules to include `libandroid_runtime`. For now, it's empty, but we'll use it
// once we start using JNI.
java_defaults {
name: "hosttest-with-libandroid_runtime",
jni_libs: [
// "libandroid_runtime",
// TODO: Figure out how to build them automatically.
// Following ones are depended by libandroid_runtime.
// Without listing them here, not only we won't get them under
// $ANDROID_HOST_OUT/testcases/*/lib64, but also not under
// $ANDROID_HOST_OUT/lib64, so we'd fail to load them at runtime.
// ($ANDROID_HOST_OUT/lib/ gets all of them though.)
// "libcutils",
// "libharfbuzz_ng",
// "libminikin",
// "libz",
// "libbinder",
// "libhidlbase",
// "libvintf",
// "libicu",
// "libutils",
// "libtinyxml2",
],
}
java_defaults {
name: "hosttest-with-framework-all-hidden-api-test-defaults",
defaults: ["hosttest-with-libandroid_runtime"],
installable: false,
test_config: "AndroidTest-host.xml",
static_libs: [
"hoststubgen-helper-runtime",
"hoststubgen-helper-framework-runtime",
"framework-all-hidden-api-host-impl",
],
}
// This and next ones are for tests using framework-app, with public/system/test APIs,
// without hidden APIs.
java_defaults {
name: "hosttest-with-framework-all-test-api-test-lib-defaults",
installable: false,
libs: [
"framework-all-test-api-host-stub",
],
static_libs: [
"hoststubgen-helper-framework-buildtime",
"framework-annotations-lib",
],
visibility: ["//visibility:private"],
}
java_defaults {
name: "hosttest-with-framework-all-test-api-test-defaults",
defaults: ["hosttest-with-libandroid_runtime"],
installable: false,
test_config: "AndroidTest-host.xml",
static_libs: [
"hoststubgen-helper-runtime",
"hoststubgen-helper-framework-runtime",
"framework-all-test-api-host-impl",
],
}