blob: 483c4be7633b0b104c56c7dd4caafa46ce72b100 [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"],
}
// A library that simulates framework-all.jar
java_library {
name: "hoststubgen-test-tiny-framework",
installable: true,
host_supported: true,
srcs: ["tiny-framework/src/**/*.java"],
static_libs: [
"hoststubgen-annotations",
],
visibility: ["//frameworks/base/ravenwood/tools/hoststubgen:__subpackages__"],
}
// Create stub/impl jars from "hoststubgen-test-tiny-framework", using the following 3 rules.
java_genrule_host {
name: "hoststubgen-test-tiny-framework-host-base",
defaults: ["hoststubgen-command-defaults"],
cmd: hoststubgen_common_options +
"--in-jar $(location :hoststubgen-test-tiny-framework) " +
"--policy-override-file $(location policy-override-tiny-framework.txt) " +
"--package-redirect com.unsupported:com.supported ",
srcs: [
":hoststubgen-test-tiny-framework",
"policy-override-tiny-framework.txt",
],
visibility: ["//visibility:private"],
}
java_genrule_host {
name: "hoststubgen-test-tiny-framework-host",
cmd: "cp $(in) $(out)",
srcs: [
":hoststubgen-test-tiny-framework-host-base{host.jar}",
],
out: [
"host.jar",
],
visibility: ["//visibility:private"],
}
// Same as "hoststubgen-test-tiny-framework-host", but with more options, to test more hoststubgen
// features.
java_genrule_host {
name: "hoststubgen-test-tiny-framework-host-ext-base",
defaults: ["hoststubgen-command-defaults"],
cmd: hoststubgen_common_options +
"--in-jar $(location :hoststubgen-test-tiny-framework) " +
"--policy-override-file $(location policy-override-tiny-framework.txt) " +
"--package-redirect com.unsupported:com.supported " +
// More options.
"--default-method-call-hook com.android.hoststubgen.hosthelper.HostTestUtils.logMethodCall " +
"--default-class-load-hook com.android.hoststubgen.hosthelper.HostTestUtils.logClassLoaded ",
srcs: [
":hoststubgen-test-tiny-framework",
"policy-override-tiny-framework.txt",
],
visibility: ["//visibility:private"],
}
java_genrule_host {
name: "hoststubgen-test-tiny-framework-host-ext",
cmd: "cp $(in) $(out)",
srcs: [
":hoststubgen-test-tiny-framework-host-ext-base{host.jar}",
],
out: [
"host.jar",
],
visibility: ["//visibility:private"],
}
// Compile the test jar, using 2 rules.
// 1. Build the test against the original framework.
java_library_host {
name: "hoststubgen-test-tiny-test-lib",
srcs: ["tiny-test/src/**/*.java"],
libs: [
"hoststubgen-test-tiny-framework",
],
static_libs: [
"junit",
"truth",
// http://cs/h/googleplex-android/platform/superproject/main/+/main:platform_testing/libraries/annotations/src/android/platform/test/annotations/
"platform-test-annotations",
],
visibility: ["//visibility:private"],
}
// 2. Link "hoststubgen-test-tiny-test-lib" with necessary runtime dependencies, so it can be
// executed stand-alone.
java_test_host {
name: "hoststubgen-test-tiny-test",
test_config: "AndroidTest-host.xml",
static_libs: [
"hoststubgen-test-tiny-test-lib",
"hoststubgen-helper-runtime",
"hoststubgen-test-tiny-framework-host",
],
test_suites: ["general-tests"],
}
// Dump the original, stub and impl jars as text files.
// We use them in test-and-update-golden.sh.
java_genrule_host {
name: "hoststubgen-test-tiny-framework-orig-dump",
defaults: ["hoststubgen-jar-dump-defaults"],
srcs: [
":hoststubgen-test-tiny-framework",
],
out: [
"01-hoststubgen-test-tiny-framework-orig-dump.txt",
],
visibility: ["//visibility:private"],
}
java_genrule_host {
name: "hoststubgen-test-tiny-framework-host-dump",
defaults: ["hoststubgen-jar-dump-defaults"],
srcs: [
":hoststubgen-test-tiny-framework-host",
],
out: [
"03-hoststubgen-test-tiny-framework-host-dump.txt",
],
visibility: ["//visibility:private"],
}
java_genrule_host {
name: "hoststubgen-test-tiny-framework-host-ext-dump",
defaults: ["hoststubgen-jar-dump-defaults"],
srcs: [
":hoststubgen-test-tiny-framework-host-ext",
],
out: [
"13-hoststubgen-test-tiny-framework-host-ext-dump.txt",
],
visibility: ["//visibility:private"],
}
// Run it with `atest`. Compare the dump of the jar files to the golden output.
python_test_host {
name: "tiny-framework-dump-test",
srcs: [
"tiny-framework-dump-test.py",
],
data: [
"golden-output/*.txt",
"golden-output.RELEASE_TARGET_JAVA_21/*.txt",
],
java_data: [
"hoststubgen-test-tiny-framework-orig-dump",
"hoststubgen-test-tiny-framework-host-dump",
"hoststubgen-test-tiny-framework-host-ext-dump",
],
test_suites: ["general-tests"],
}