Matthew Dempsky | 7da3948 | 2013-05-10 13:54:49 -0700 | [diff] [blame^] | 1 | # 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 |
| 19 | licenses(["unencumbered"]) |
| 20 | |
| 21 | package( |
| 22 | default_visibility = [ |
| 23 | "//third_party/java_src/gwt:__pkg__", |
| 24 | "//third_party/java_src/gwt/legacy:__pkg__", |
| 25 | ], |
| 26 | ) |
| 27 | |
| 28 | subinclude("//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. |
| 32 | java_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 |
| 41 | filegroup( |
| 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 |
| 58 | java_library( |
| 59 | name = "requestfactory-apt-deps", |
| 60 | srcs = [ |
| 61 | "core/src/com/google/gwt/core/ext/typeinfo/JniConstants.java", |
| 62 | "core/src/com/google/gwt/dev/asm/Opcodes.java", |
| 63 | "core/src/com/google/gwt/dev/asm/Type.java", |
| 64 | "core/src/com/google/gwt/dev/asm/commons/Method.java", |
| 65 | "core/src/com/google/gwt/dev/util/Name.java", |
| 66 | "core/src/com/google/gwt/dev/util/StringKey.java", |
| 67 | ], |
| 68 | ) |
| 69 | |
| 70 | # Dependencies of gwt-servlet.jar. (Included in server run-time classpaths.) |
| 71 | java_library( |
| 72 | name = "servlet-deps", |
| 73 | srcs = glob( |
| 74 | [ |
| 75 | "core/src/com/google/gwt/**/shared/**/*.java", |
| 76 | "core/src/com/google/gwt/dev/asm/**/*.java", |
| 77 | "core/src/com/google/gwt/dev/util/Name.java", |
| 78 | "core/src/com/google/gwt/dev/util/StringKey.java", |
| 79 | "core/src/com/google/gwt/util/tools/Utility.java", |
| 80 | "core/src/com/google/gwt/util/tools/shared/**/*.java", |
| 81 | ], |
| 82 | exclude = [ |
| 83 | "**/junit/**", |
| 84 | "**/super/**", |
| 85 | "**/package-info.java", |
| 86 | ], |
| 87 | ), |
| 88 | deps = [ |
| 89 | # GWTBridge & UnsafeNativeLong |
| 90 | ":compiler.standalone.super", |
| 91 | ], |
| 92 | ) |
| 93 | |
| 94 | # Builds gwt-dev-deps.jar, which contains third-party deps for gwt-dev.jar. |
| 95 | # (This is a separate jar for better build caching.) |
| 96 | AugmentedJar( |
| 97 | name = "gwt-dev-deps", |
| 98 | srcs = [], |
| 99 | added_jars = [ |
| 100 | "//third_party/java_src/gwt/legacy:libdev.jar", |
| 101 | "//third_party/java_src/gwt/legacy:dev-resources.jar", |
| 102 | "//third_party/java_src/gwt/svn/tools:dev_jars", |
| 103 | "//third_party/java_src/gwt/svn/tools:legacy_dev_jars", |
| 104 | ], |
| 105 | constraints = [], |
| 106 | dojarjar = 1, |
| 107 | wrap_javalibrary = 0, |
| 108 | ) |
| 109 | |
| 110 | # Builds gwt-dev-only.jar, which contains the GWT compiler and tools. |
| 111 | # Relies on gwt-dev-deps.jar being in the classpath. |
| 112 | AugmentedJar( |
| 113 | name = "gwt-dev-only", |
| 114 | srcs = [], |
| 115 | added_jars = [ |
| 116 | ":libgwt-dev-classes.jar", |
| 117 | ":gwt-dev-resources.jar", |
| 118 | ":libcompiler.standalone.jar", |
| 119 | ":libcompiler.standalone.super.jar", |
| 120 | ":super-resources.jar", |
| 121 | ], |
| 122 | constraints = [], |
| 123 | dojarjar = 1, |
| 124 | resources = ["//tools/gwt:gwt_google_defaults"], |
| 125 | wrap_javalibrary = 0, |
| 126 | ) |
| 127 | |
| 128 | # All the dev classes before jarjaring. |
| 129 | # This should only be used in code that will itself be jarjar-ed |
| 130 | # or in internal tests. |
| 131 | # (Exposed because it helps other targets build faster than |
| 132 | # if they waited for gwt-dev to be jarjar-ed.) |
| 133 | # TODO: split up. |
| 134 | java_library( |
| 135 | name = "gwt-dev-classes", |
| 136 | srcs = glob( |
| 137 | ["core/src/**/*.java"], |
| 138 | exclude = ["**/package-info.java"], |
| 139 | ), |
| 140 | deps = [ |
| 141 | ":compiler.standalone.super", |
| 142 | "//third_party/java_src/gwt/svn/tools:dev_deps", |
| 143 | ], |
| 144 | ) |
| 145 | |
| 146 | # Resource files in core/src. |
| 147 | # (Includes .java files.) |
| 148 | Zip( |
| 149 | name = "gwt-dev-resources.jar", |
| 150 | srcs = glob( |
| 151 | [ |
| 152 | "core/src/**/*.java", |
| 153 | "core/src/**/*.html", |
| 154 | "core/src/**/*.css", |
| 155 | "core/src/**/*.js", |
| 156 | "core/src/**/*.png", |
| 157 | "core/src/**/*.gif", |
| 158 | "core/src/**/*.keystore", |
| 159 | "core/src/**/*.proto", |
| 160 | "core/src/**/*.properties", |
| 161 | "core/src/**/*.xsd", |
| 162 | ], |
| 163 | exclude = ["**/package-info.java"], |
| 164 | ), |
| 165 | root = "core/src", |
| 166 | ) |
| 167 | |
| 168 | java_library( |
| 169 | name = "compiler.standalone", |
| 170 | srcs = glob( |
| 171 | [ |
| 172 | "core/src/com/google/gwt/core/ext/**/*.java", |
| 173 | "core/src/com/google/gwt/core/linker/**/*.java", |
| 174 | "core/src/com/google/gwt/dev/About.java", |
| 175 | "core/src/com/google/gwt/dev/GwtVersion.java", |
| 176 | "core/src/com/google/gwt/dev/Permutation.java", |
| 177 | "core/src/com/google/gwt/dev/asm/**/*.java", |
| 178 | "core/src/com/google/gwt/dev/cfg/**/*.java", |
| 179 | "core/src/com/google/gwt/dev/javac/**/*.java", |
| 180 | "core/src/com/google/gwt/dev/jdt/**/*.java", |
| 181 | "core/src/com/google/gwt/dev/jjs/**/*.java", |
| 182 | "core/src/com/google/gwt/dev/js/**/*.java", |
| 183 | "core/src/com/google/gwt/dev/json/*.java", |
| 184 | "core/src/com/google/gwt/dev/resource/**/*.java", |
| 185 | "core/src/com/google/gwt/dev/util/**/*.java", |
| 186 | "core/src/com/google/gwt/dev/shell/DevModeSession.java", |
| 187 | "core/src/com/google/gwt/soyc/**/*.java", |
| 188 | "core/src/com/google/gwt/util/**/*.java", |
| 189 | "core/src/org/eclipse/jdt/**/*.java", |
| 190 | ], |
| 191 | exclude = [ |
| 192 | "**/testing/**", |
| 193 | ], |
| 194 | ), |
| 195 | javacopts = [ |
| 196 | "-encoding utf8", |
| 197 | "-source 5", |
| 198 | "-target 5", |
| 199 | ], |
| 200 | deps = [ |
| 201 | ":compiler.standalone.super", |
| 202 | "//third_party/java_src/gwt/svn/tools:compiler_deps", |
| 203 | ], |
| 204 | ) |
| 205 | |
| 206 | # This is a bootstrap library; it will later be stripped out of the classpath |
| 207 | # chain, since the "real" versions are super-source not class files. |
| 208 | # TODO(scottb): this thing may be completely obsolete. |
| 209 | java_library( |
| 210 | name = "compiler.standalone.super", |
| 211 | srcs = glob( |
| 212 | ["core/super/**/*.java"], |
| 213 | exclude = [ |
| 214 | "core/super/com/google/gwt/dev/jjs/intrinsic/**", |
| 215 | "**/package-info.java", |
| 216 | ], |
| 217 | ), |
| 218 | javacopts = [ |
| 219 | "-encoding utf8", |
| 220 | "-source 5", |
| 221 | "-target 5", |
| 222 | ], |
| 223 | ) |
| 224 | |
| 225 | # Resource files in core/super (including Java source) |
| 226 | Zip( |
| 227 | name = "super-resources.jar", |
| 228 | srcs = glob( |
| 229 | [ |
| 230 | "core/super/**/*.java", |
| 231 | "core/super/**/*.xml", |
| 232 | ], |
| 233 | exclude = ["**/package-info.java"], |
| 234 | ), |
| 235 | root = "core/super", |
| 236 | ) |
| 237 | |
| 238 | # A minimal library for annotations not likely to otherwise need gwt-user.jar |
| 239 | # (so i18n annotations are out, they'd need i18n classes and interfaces, but |
| 240 | # @GwtScriptOnly is in). The test is that this target is for POJO Java work |
| 241 | # that happens to want a bit of annotations to hint GWT what to do. |
| 242 | # |
| 243 | # CAUTION: Most internal Google code ends up depending on this, via |
| 244 | # //j/c/g/common/collect:collect-gwt. You really don't want it to be big! |
| 245 | java_library( |
| 246 | name = "interop-annotations", |
| 247 | srcs = [ |
| 248 | "core/super/com/google/gwt/core/client/GwtScriptOnly.java", |
| 249 | "core/super/com/google/gwt/core/client/UnsafeNativeLong.java", |
| 250 | ], |
| 251 | constraints = [ |
| 252 | "android", |
| 253 | "gwt", |
| 254 | "public", |
| 255 | ], |
| 256 | gwtxml = ":interop-annotations-gwtxml", |
| 257 | javacopts = [ |
| 258 | "-encoding utf8", |
| 259 | "-source 5", |
| 260 | "-target 5", |
| 261 | ], |
| 262 | ) |
| 263 | |
| 264 | # (This is a genrule so that it won't be mirrored to svn and git.) |
| 265 | genrule( |
| 266 | name = "interop-annotations-gwtxml", |
| 267 | outs = ["Gwt-dev-interop-annotations.gwt.xml"], |
| 268 | cmd = "$(ECHO) '<module></module>' > $(@)", |
| 269 | ) |
| 270 | |
| 271 | # All test code in dev. |
| 272 | # TODO: split up. |
| 273 | AugmentedJar( |
| 274 | name = "dev-test-code", |
| 275 | srcs = glob([ |
| 276 | "core/test/**/*.java", |
| 277 | ]), |
| 278 | added_jars = [ |
| 279 | # for soycTest |
| 280 | "//third_party/java_src/gwt/svn/trunk/samples:hello-src.jar", |
| 281 | ], |
| 282 | added_roots = [ |
| 283 | "core/test", |
| 284 | ], |
| 285 | build_deps = [ |
| 286 | ":gwt-dev-classes", |
| 287 | ":compiler.standalone.super", |
| 288 | "//third_party/java_src/gwt/svn/tools:dev_deps", # for pre-jarjar imports |
| 289 | ], |
| 290 | constraints = [], |
| 291 | dojarjar = 1, |
| 292 | export_deps = [ |
| 293 | ":dev", # for the post-jarjar names |
| 294 | ], |
| 295 | deps = [ |
| 296 | "//third_party/java/junit", |
| 297 | ], |
| 298 | ) |
| 299 | |
| 300 | # The "dev" directory is tested by loose tests. Some of them fail because of |
| 301 | # classpath expectations that are invalid in Google's distributed build |
| 302 | # environment. |
| 303 | GWT_DEV_TESTS = glob( |
| 304 | [ |
| 305 | "core/test/**/*Test.java", |
| 306 | ], |
| 307 | # TODO(fabbott): These fail due to classpath differences, |
| 308 | # because the distributed build's classpath is jar'ed not loose |
| 309 | exclude = [ |
| 310 | "core/test/**/ClassPathEntryTest.java", |
| 311 | "core/test/**/ResourceOracleImplTest.java", |
| 312 | ], |
| 313 | ) |
| 314 | |
| 315 | GwtTestSuites( |
| 316 | name = "tests", |
| 317 | jvm_flags = ["-ea"], |
| 318 | srcjars = [":dev-test-code"], |
| 319 | tests = GWT_DEV_TESTS, |
| 320 | ) |