blob: de10940fd33119a7522ded9f3f742dee3c217fbf [file] [log] [blame]
Matthew Dempsky7da39482013-05-10 13:54:49 -07001# Copyright 2012 Google Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15# Description:
16# The GWT compiler and dev mode.
17
18# Google owns the copyright
19licenses(["unencumbered"])
20
21package(
22 default_visibility = [
Goktug Gokdogand6314fc2015-10-09 14:59:43 -070023 "//third_party/java/gwt:__subpackages__",
24 "//third_party/java_src/gwt:__subpackages__",
Matthew Dempsky7da39482013-05-10 13:54:49 -070025 ],
26)
27
28subinclude("//third_party/java_src/gwt:build-macros")
29
30# This target logically corresponds to gwt-dev.jar but doesn't
31# actually create it, for faster builds after a compiler change.
32java_import(
33 name = "dev",
34 jars = [
35 ":gwt-dev-deps.jar",
36 ":gwt-dev-only.jar",
37 ],
38)
39
40# Files needed by the ant tests
41filegroup(
42 name = "ant",
43 srcs = glob(
44 [
45 "build.xml",
46 "core/src/**/*",
47 "core/super/**/*",
48 "core/test/**/*",
49 ],
50 exclude = [
51 "**/*~",
52 "**/#*",
53 ],
54 ),
55)
56
57# Classes needed by the requestfactory annotation processor
58java_library(
59 name = "requestfactory-apt-deps",
60 srcs = [
61 "core/src/com/google/gwt/core/ext/typeinfo/JniConstants.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -070062 "core/src/com/google/gwt/dev/util/Name.java",
63 "core/src/com/google/gwt/dev/util/StringKey.java",
64 ],
65)
66
67# Dependencies of gwt-servlet.jar. (Included in server run-time classpaths.)
68java_library(
69 name = "servlet-deps",
70 srcs = glob(
71 [
72 "core/src/com/google/gwt/**/shared/**/*.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -070073 "core/src/com/google/gwt/dev/util/Name.java",
74 "core/src/com/google/gwt/dev/util/StringKey.java",
75 "core/src/com/google/gwt/util/tools/Utility.java",
76 "core/src/com/google/gwt/util/tools/shared/**/*.java",
77 ],
78 exclude = [
79 "**/junit/**",
80 "**/super/**",
81 "**/package-info.java",
82 ],
83 ),
84 deps = [
85 # GWTBridge & UnsafeNativeLong
86 ":compiler.standalone.super",
87 ],
88)
89
90# Builds gwt-dev-deps.jar, which contains third-party deps for gwt-dev.jar.
91# (This is a separate jar for better build caching.)
92AugmentedJar(
93 name = "gwt-dev-deps",
94 srcs = [],
95 added_jars = [
Brian Slesinsky3114e452014-04-23 10:56:53 -070096 "//third_party/java_src/gwt/legacy:libdev-bare.jar",
Matthew Dempsky7da39482013-05-10 13:54:49 -070097 "//third_party/java_src/gwt/legacy:dev-resources.jar",
98 "//third_party/java_src/gwt/svn/tools:dev_jars",
99 "//third_party/java_src/gwt/svn/tools:legacy_dev_jars",
100 ],
101 constraints = [],
102 dojarjar = 1,
103 wrap_javalibrary = 0,
104)
105
106# Builds gwt-dev-only.jar, which contains the GWT compiler and tools.
107# Relies on gwt-dev-deps.jar being in the classpath.
108AugmentedJar(
109 name = "gwt-dev-only",
110 srcs = [],
111 added_jars = [
Brian Slesinsky3114e452014-04-23 10:56:53 -0700112 ":libgwt-dev-bare.jar",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700113 ":gwt-dev-resources.jar",
114 ":libcompiler.standalone.jar",
115 ":libcompiler.standalone.super.jar",
116 ":super-resources.jar",
117 ],
118 constraints = [],
119 dojarjar = 1,
120 resources = ["//tools/gwt:gwt_google_defaults"],
121 wrap_javalibrary = 0,
122)
123
Brian Slesinsky3114e452014-04-23 10:56:53 -0700124# The gwt-dev classes for GWT internal use only.
125# They must be jarjar-ed and dependencies stripped before exposing to google3.
Matthew Dempsky7da39482013-05-10 13:54:49 -0700126java_library(
Brian Slesinsky3114e452014-04-23 10:56:53 -0700127 name = "gwt-dev-bare",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700128 srcs = glob(
129 ["core/src/**/*.java"],
130 exclude = ["**/package-info.java"],
131 ),
132 deps = [
133 ":compiler.standalone.super",
134 "//third_party/java_src/gwt/svn/tools:dev_deps",
Goktug Gokdogan6e31a152014-01-28 12:40:25 -0800135 "//third_party/java_src/gwt/svn/tools:servlet_api_3",
Daniel Kurka519e16b2015-02-18 20:23:41 +0000136 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700137)
138
139# Resource files in core/src.
140# (Includes .java files.)
141Zip(
142 name = "gwt-dev-resources.jar",
143 srcs = glob(
144 [
145 "core/src/**/*.java",
146 "core/src/**/*.html",
147 "core/src/**/*.css",
148 "core/src/**/*.js",
149 "core/src/**/*.png",
150 "core/src/**/*.gif",
151 "core/src/**/*.keystore",
152 "core/src/**/*.proto",
153 "core/src/**/*.properties",
154 "core/src/**/*.xsd",
Brian Slesinsky580a2ff2013-11-01 14:10:34 -0700155 "core/src/**/*.txt",
Roberto Lublinermanf59c19e2013-12-02 10:52:28 -0800156 "core/src/com/google/gwt/dev/js/globals/globals.html", # for testing
Matthew Dempsky7da39482013-05-10 13:54:49 -0700157 ],
Brian Slesinsky580a2ff2013-11-01 14:10:34 -0700158 exclude = [
159 "**/package-info.java",
160 "README.txt",
161 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700162 ),
163 root = "core/src",
164)
165
166java_library(
167 name = "compiler.standalone",
168 srcs = glob(
169 [
170 "core/src/com/google/gwt/core/ext/**/*.java",
171 "core/src/com/google/gwt/core/linker/**/*.java",
172 "core/src/com/google/gwt/dev/About.java",
Roberto Lublinerman4c3de762013-10-02 15:32:37 -0700173 "core/src/com/google/gwt/dev/CompilerContext.java",
174 "core/src/com/google/gwt/dev/CompileTaskOptions.java",
175 "core/src/com/google/gwt/dev/CompileTaskOptionsImpl.java",
Roberto Lublinerman999d9a62014-12-10 13:19:04 -0800176 "core/src/com/google/gwt/dev/PropertyAndBindingInfo.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700177 "core/src/com/google/gwt/dev/GwtVersion.java",
John Stalcup4def7222014-07-25 11:18:08 -0700178 "core/src/com/google/gwt/dev/MinimalRebuildCache.java",
John Stalcup9da4d052014-09-02 18:41:30 -0700179 "core/src/com/google/gwt/dev/NullRebuildCache.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700180 "core/src/com/google/gwt/dev/Permutation.java",
Roberto Lublinerman4c3de762013-10-02 15:32:37 -0700181 "core/src/com/google/gwt/dev/PrecompileTaskOptions.java",
182 "core/src/com/google/gwt/dev/PrecompileTaskOptionsImpl.java",
183 "core/src/com/google/gwt/dev/PrecompilationResult.java",
John Stalcupb70e9f22015-01-05 11:25:19 -0800184 "core/src/com/google/gwt/dev/StringAnalyzableTypeEnvironment.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700185 "core/src/com/google/gwt/dev/cfg/**/*.java",
Roberto Lublinerman9fcd8482015-08-18 12:23:24 -0700186 "core/src/com/google/gwt/dev/common/**/*.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700187 "core/src/com/google/gwt/dev/javac/**/*.java",
188 "core/src/com/google/gwt/dev/jdt/**/*.java",
189 "core/src/com/google/gwt/dev/jjs/**/*.java",
190 "core/src/com/google/gwt/dev/js/**/*.java",
191 "core/src/com/google/gwt/dev/json/*.java",
192 "core/src/com/google/gwt/dev/resource/**/*.java",
193 "core/src/com/google/gwt/dev/util/**/*.java",
194 "core/src/com/google/gwt/dev/shell/DevModeSession.java",
195 "core/src/com/google/gwt/soyc/**/*.java",
196 "core/src/com/google/gwt/util/**/*.java",
197 "core/src/org/eclipse/jdt/**/*.java",
198 ],
199 exclude = [
200 "**/testing/**",
201 ],
202 ),
Matthew Dempsky7da39482013-05-10 13:54:49 -0700203 deps = [
204 ":compiler.standalone.super",
205 "//third_party/java_src/gwt/svn/tools:compiler_deps",
Daniel Kurka519e16b2015-02-18 20:23:41 +0000206 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700207)
208
209# This is a bootstrap library; it will later be stripped out of the classpath
210# chain, since the "real" versions are super-source not class files.
211# TODO(scottb): this thing may be completely obsolete.
212java_library(
213 name = "compiler.standalone.super",
214 srcs = glob(
215 ["core/super/**/*.java"],
216 exclude = [
217 "core/super/com/google/gwt/dev/jjs/intrinsic/**",
218 "**/package-info.java",
Goktug Gokdogan0d178f12016-01-22 01:21:55 -0800219 "**/EmulatedCharset.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700220 ],
221 ),
Roberto Lublinerman15a925d2016-01-11 15:46:51 -0800222 compatible_with = ["//buildenv/target:android"],
Matthew Dempsky9d527eb2013-08-20 11:52:58 -0700223 constraints = ["android"],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700224)
225
226# Resource files in core/super (including Java source)
227Zip(
228 name = "super-resources.jar",
229 srcs = glob(
230 [
231 "core/super/**/*.java",
232 "core/super/**/*.xml",
233 ],
234 exclude = ["**/package-info.java"],
235 ),
236 root = "core/super",
237)
238
239# A minimal library for annotations not likely to otherwise need gwt-user.jar
240# (so i18n annotations are out, they'd need i18n classes and interfaces, but
241# @GwtScriptOnly is in). The test is that this target is for POJO Java work
242# that happens to want a bit of annotations to hint GWT what to do.
243#
244# CAUTION: Most internal Google code ends up depending on this, via
245# //j/c/g/common/collect:collect-gwt. You really don't want it to be big!
246java_library(
Goktug Gokdogand6314fc2015-10-09 14:59:43 -0700247 name = "gwt-dev-interop-annotations",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700248 srcs = [
249 "core/super/com/google/gwt/core/client/GwtScriptOnly.java",
250 "core/super/com/google/gwt/core/client/UnsafeNativeLong.java",
251 ],
Roberto Lublinerman15a925d2016-01-11 15:46:51 -0800252 compatible_with = ["//buildenv/target:android"],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700253 constraints = [
254 "android",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700255 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700256)
257
Goktug Gokdogand6314fc2015-10-09 14:59:43 -0700258# A minimal library for a subset of the internal annotations for the
259# GWT compiler.
260java_library(
261 name = "gwt-dev-internal-annotations",
262 srcs = [
263 "core/super/javaemul/internal/annotations/CompilerHint.java",
264 "core/super/javaemul/internal/annotations/DoNotInline.java",
265 ],
Roberto Lublinerman15a925d2016-01-11 15:46:51 -0800266 compatible_with = ["//buildenv/target:android"],
Goktug Gokdogand6314fc2015-10-09 14:59:43 -0700267 constraints = [
268 "android",
269 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700270)
271
272# All test code in dev.
273# TODO: split up.
274AugmentedJar(
275 name = "dev-test-code",
Brian Slesinsky3114e452014-04-23 10:56:53 -0700276 testonly = 1,
277 srcs = [],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700278 added_jars = [
Brian Slesinsky3114e452014-04-23 10:56:53 -0700279 ":libdev-test-code-bare.jar",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700280 # for soycTest
281 "//third_party/java_src/gwt/svn/trunk/samples:hello-src.jar",
282 ],
283 added_roots = [
284 "core/test",
285 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700286 constraints = [],
287 dojarjar = 1,
288 export_deps = [
289 ":dev", # for the post-jarjar names
Brian Slesinsky3114e452014-04-23 10:56:53 -0700290 "//third_party/java/junit",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700291 ],
Brian Slesinsky3114e452014-04-23 10:56:53 -0700292)
293
294# The gwt-dev tests for GWT internal use only.
295# They must be jarjar-ed and dependencies stripped before exposing to google3.
296# TODO(skybrian): we should have a separate jar for test infrastructure and
297# and remove dependencies on this library in gwt-user and google3.
298java_library(
299 name = "dev-test-code-bare",
300 testonly = 1,
301 srcs = glob([
302 "core/test/**/*.java",
303 ]),
Matthew Dempsky7da39482013-05-10 13:54:49 -0700304 deps = [
Brian Slesinsky3114e452014-04-23 10:56:53 -0700305 ":compiler.standalone.super",
306 ":gwt-dev-bare",
307 "//third_party/java/junit",
308 "//third_party/java_src/gwt/svn/tools:dev_deps",
Daniel Kurka519e16b2015-02-18 20:23:41 +0000309 ],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700310)
311
312# The "dev" directory is tested by loose tests. Some of them fail because of
313# classpath expectations that are invalid in Google's distributed build
314# environment.
315GWT_DEV_TESTS = glob(
316 [
317 "core/test/**/*Test.java",
318 ],
319 # TODO(fabbott): These fail due to classpath differences,
320 # because the distributed build's classpath is jar'ed not loose
321 exclude = [
322 "core/test/**/ClassPathEntryTest.java",
323 "core/test/**/ResourceOracleImplTest.java",
Matthew Dempsky7da39482013-05-10 13:54:49 -0700324 ],
325)
326
Brian Slesinsky13724c62014-09-03 17:15:50 -0700327test_suite(
328 name = "alltests",
329 tests = [
330 ":tests",
Roberto Lublinerman8aa3abc2014-09-25 14:30:38 -0700331 "//third_party/java_src/gwt/svn/trunk/dev/codeserver:tests",
332 ],
Brian Slesinsky13724c62014-09-03 17:15:50 -0700333)
334
Matthew Dempsky7da39482013-05-10 13:54:49 -0700335GwtTestSuites(
336 name = "tests",
337 jvm_flags = ["-ea"],
Goktug Gokdogan4269ce12015-03-10 17:07:26 -0700338 sharding = {"dev.CompilerTest": 12},
Matthew Dempsky7da39482013-05-10 13:54:49 -0700339 tests = GWT_DEV_TESTS,
Goktug Gokdogan26deda22015-10-19 15:48:30 -0700340 deps = [":dev-test-code"],
Matthew Dempsky7da39482013-05-10 13:54:49 -0700341)
Daniel Kurka5e5d2632015-08-26 19:40:57 +0200342
343filegroup(
344 name = "emul",
345 srcs = glob([
346 "core/super/javaemul/**/*.java",
347 ]),
348 visibility = ["//third_party/java_src/j2cl:__subpackages__"],
349)