Newer
Older
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// We need this "trampoline" rule to force soong to give a host-side jar to
// framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get
// a dex jar.
java_library {
name: "framework-minus-apex-for-hoststubgen",
installable: false, // host only jar.
static_libs: [
"framework-minus-apex",
],
sdk_version: "core_platform",
visibility: ["//visibility:private"],
}
// Generate the stub/impl from framework-all, with hidden APIs.
name: "framework-minus-apex.ravenwood-base",
tools: ["hoststubgen"],
cmd: "$(location hoststubgen) " +
"@$(location ravenwood/ravenwood-standard-options.txt) " +
"--debug-log $(location hoststubgen_framework-minus-apex.log) " +
"--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
"--out-impl-jar $(location ravenwood.jar) " +
"--gen-keep-all-file $(location hoststubgen_keep_all.txt) " +
"--gen-input-dump-file $(location hoststubgen_dump.txt) " +
"--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
"--policy-override-file $(location ravenwood/framework-minus-apex-ravenwood-policies.txt) " +
"--annotation-allowed-classes-file $(location ravenwood/ravenwood-annotation-allowed-classes.txt) ",
srcs: [
":framework-minus-apex-for-hoststubgen",
"ravenwood/framework-minus-apex-ravenwood-policies.txt",
"ravenwood/ravenwood-standard-options.txt",
"ravenwood/ravenwood-annotation-allowed-classes.txt",
],
out: [
"ravenwood.jar",
// Following files are created just as FYI.
"hoststubgen_keep_all.txt",
"hoststubgen_dump.txt",
"hoststubgen_framework-minus-apex.log",
"hoststubgen_framework-minus-apex_stats.csv",
],
visibility: ["//visibility:private"],
}
// Extract the impl jar from "framework-minus-apex.ravenwood-base" for subsequent build rules.
// Note this emits a "device side" output, so that ravenwood tests can (implicitly)
// depend on it.
java_genrule {
name: "framework-minus-apex.ravenwood",
defaults: ["ravenwood-internal-only-visibility-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":framework-minus-apex.ravenwood-base{ravenwood.jar}",
],
out: [
"framework-minus-apex.ravenwood.jar",
],
}
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
java_library {
name: "services.core-for-hoststubgen",
installable: false, // host only jar.
static_libs: [
"services.core",
],
sdk_version: "core_platform",
visibility: ["//visibility:private"],
}
java_genrule {
name: "services.core.ravenwood-base",
tools: ["hoststubgen"],
cmd: "$(location hoststubgen) " +
"@$(location ravenwood/ravenwood-standard-options.txt) " +
"--debug-log $(location hoststubgen_services.core.log) " +
"--stats-file $(location hoststubgen_services.core_stats.csv) " +
"--out-impl-jar $(location ravenwood.jar) " +
"--gen-keep-all-file $(location hoststubgen_keep_all.txt) " +
"--gen-input-dump-file $(location hoststubgen_dump.txt) " +
"--in-jar $(location :services.core-for-hoststubgen) " +
"--policy-override-file $(location ravenwood/services.core-ravenwood-policies.txt) " +
"--annotation-allowed-classes-file $(location ravenwood/ravenwood-annotation-allowed-classes.txt) ",
srcs: [
":services.core-for-hoststubgen",
"ravenwood/services.core-ravenwood-policies.txt",
"ravenwood/ravenwood-standard-options.txt",
"ravenwood/ravenwood-annotation-allowed-classes.txt",
],
out: [
"ravenwood.jar",
// Following files are created just as FYI.
"hoststubgen_keep_all.txt",
"hoststubgen_dump.txt",
"hoststubgen_services.core.log",
"hoststubgen_services.core_stats.csv",
],
visibility: ["//visibility:private"],
}
java_genrule {
name: "services.core.ravenwood",
defaults: ["ravenwood-internal-only-visibility-genrule"],
cmd: "cp $(in) $(out)",
srcs: [
":services.core.ravenwood-base{ravenwood.jar}",
],
out: [
"services.core.ravenwood.jar",
],
}
java_library {
name: "services.core.ravenwood-jarjar",
installable: false,
static_libs: [
"services.core.ravenwood",
],
jarjar_rules: ":ravenwood-services-jarjar-rules",
}
java_library {
name: "services.fakes.ravenwood-jarjar",
installable: false,
srcs: [":services.fakes-sources"],
libs: [
"services.core.ravenwood",
],
jarjar_rules: ":ravenwood-services-jarjar-rules",
}
java_library {
name: "mockito-ravenwood-prebuilt",
installable: false,
static_libs: [
"mockito-robolectric-prebuilt",
],
}
java_library {
name: "inline-mockito-ravenwood-prebuilt",
installable: false,
static_libs: [
"inline-mockito-robolectric-prebuilt",
],
}
// Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
// Rename some of the dependencies to make sure they're included in the intended order.
java_genrule {
name: "100-framework-minus-apex.ravenwood",
cmd: "cp $(in) $(out)",
srcs: [":framework-minus-apex.ravenwood"],
out: ["100-framework-minus-apex.ravenwood.jar"],
visibility: ["//visibility:private"],
}
java_genrule {
// Use 200 to make sure it comes before the mainline stub ("all-updatable...").
name: "200-kxml2-android",
cmd: "cp $(in) $(out)",
srcs: [":kxml2-android"],
out: ["200-kxml2-android.jar"],
visibility: ["//visibility:private"],
}
android_ravenwood_libgroup {
name: "ravenwood-runtime",
libs: [
"100-framework-minus-apex.ravenwood",
"200-kxml2-android",
"all-updatable-modules-system-stubs",
"android.test.mock.ravenwood",
"services.core.ravenwood-jarjar",
"services.fakes.ravenwood-jarjar",
// Provide runtime versions of utils linked in below
"ravenwood-junit-impl-flag",
"mockito-ravenwood-prebuilt",
"inline-mockito-ravenwood-prebuilt",
jni_libs: [
"libandroid_runtime",
],
}
android_ravenwood_libgroup {
name: "ravenwood-utils",
libs: [
"junit",
"truth",
"mockito-ravenwood-prebuilt",
"inline-mockito-ravenwood-prebuilt",