BUILD update

Change-Id: I5ca49abb649511b0e0642978344640a2c710d7f6
diff --git a/dev/BUILD b/dev/BUILD
index 489ed74..7b29279 100644
--- a/dev/BUILD
+++ b/dev/BUILD
@@ -25,7 +25,7 @@
     ],
 )
 
-subinclude("//third_party/java_src/gwt:build-macros")
+load("//third_party/java_src/gwt:build-macros.bzl", "AugmentedJar", "GwtTestSuites", "Zip")
 
 # This target logically corresponds to gwt-dev.jar but doesn't
 # actually create it, for faster builds after a compiler change.
@@ -62,6 +62,7 @@
         "core/src/com/google/gwt/dev/util/Name.java",
         "core/src/com/google/gwt/dev/util/StringKey.java",
     ],
+    compatible_with = ["//buildenv/target:appengine"],
 )
 
 # Dependencies of gwt-servlet.jar. (Included in server run-time classpaths.)
@@ -93,8 +94,6 @@
     name = "gwt-dev-deps",
     srcs = [],
     added_jars = [
-        "//third_party/java_src/gwt/legacy:libdev-bare.jar",
-        "//third_party/java_src/gwt/legacy:dev-resources.jar",
         "//third_party/java_src/gwt/svn/tools:dev_jars",
         "//third_party/java_src/gwt/svn/tools:legacy_dev_jars",
     ],
@@ -250,21 +249,10 @@
         "core/super/com/google/gwt/core/client/GwtScriptOnly.java",
         "core/super/com/google/gwt/core/client/UnsafeNativeLong.java",
     ],
-    compatible_with = ["//buildenv/target:android"],
-    constraints = [
-        "android",
+    compatible_with = [
+        "//buildenv/target:android",
+        "//buildenv/target:appengine",
     ],
-)
-
-# A minimal library for a subset of the internal annotations for the
-# GWT compiler.
-java_library(
-    name = "gwt-dev-internal-annotations",
-    srcs = [
-        "core/super/javaemul/internal/annotations/CompilerHint.java",
-        "core/super/javaemul/internal/annotations/DoNotInline.java",
-    ],
-    compatible_with = ["//buildenv/target:android"],
     constraints = [
         "android",
     ],
@@ -304,6 +292,7 @@
     ]),
     javacopts = [
         "-Xep:SelfComparison:OFF",
+        "-Xep:SelfEquals:OFF",
     ],
     deps = [
         ":compiler.standalone.super",
diff --git a/dev/codeserver/BUILD b/dev/codeserver/BUILD
index 37e7097..531337b 100644
--- a/dev/codeserver/BUILD
+++ b/dev/codeserver/BUILD
@@ -20,7 +20,7 @@
 # released under various licenses, but Google owns the copyright
 licenses(["unencumbered"])
 
-subinclude("//third_party/java_src/gwt:build-macros")
+load("//third_party/java_src/gwt:build-macros.bzl", "AugmentedJar")
 
 # The codeserver jar, built the open source way.
 # For GWT internal use only.
diff --git a/samples/BUILD b/samples/BUILD
index cb8e518..1e346d4 100644
--- a/samples/BUILD
+++ b/samples/BUILD
@@ -22,7 +22,7 @@
     default_visibility = ["//third_party/java_src/gwt:__pkg__"],
 )
 
-subinclude("//third_party/java_src/gwt:build-macros")
+load("//third_party/java_src/gwt:build-macros.bzl", "AugmentedJar", "Zip")
 
 package_group(
     name = "showcase_friends",
@@ -65,7 +65,15 @@
 
 java_library(
     name = "showcase_lib",
-    srcs = [":showcase.jar"],
+    srcs = [":showcase.srcjar"],
+    constraints = [
+        "gwt",
+        "public",
+    ],
+    deps = [
+        "//third_party/java_src/gwt",
+        "//third_party/java_src/gwt:gwt-dev",
+    ],
 )
 
 AugmentedJar(
@@ -81,6 +89,15 @@
     ],
 )
 
+# we need to rename the jar file to end with .srcjar
+# for it to be valid input into a java_library rule
+genrule(
+    name = "rename_jar",
+    srcs = [":showcase.jar"],
+    outs = ["showcase.srcjar"],
+    cmd = "cp $(location :showcase.jar) $@",
+)
+
 # Provides the contents of the showcase war directory as a handy zip file
 # (Doesn't include appengine-web.xml so you can replace it.)
 Zip(
diff --git a/user/BUILD b/user/BUILD
index 41e2e6e..0237d12 100644
--- a/user/BUILD
+++ b/user/BUILD
@@ -25,7 +25,7 @@
     ],
 )
 
-subinclude("//third_party/java_src/gwt:build-macros")
+load("//third_party/java_src/gwt:build-macros.bzl", "AugmentedJar")
 
 # The classes in gwt-user.jar that GWT applications can depend on.
 # We want the final output of this NOT to depend on gwt-dev,
@@ -66,8 +66,8 @@
         ],
         exclude = [
             "src/com/google/gwt/junit/**/*.java",  # see gwt-testing
-            "**/ConsoleLogger.java", # relies on internal APIs
-            "**/SuperDevModeLogger.java", # relies on ConsoleLogger
+            "**/ConsoleLogger.java",  # relies on internal APIs
+            "**/SuperDevModeLogger.java",  # relies on ConsoleLogger
             "**/EmulatedCharset.java",
             "**/HashCodes.java",  # relies on java8 only APIs
             "**/RunStyleSelenium.java",
@@ -110,6 +110,7 @@
         "src/com/google/gwt/core/shared/GwtIncompatible.java",
         "src/com/google/gwt/user/server/Base64Utils.java",
     ],
+    compatible_with = ["//buildenv/target:appengine"],
     deps = [
         "//third_party/java_src/gwt/svn/trunk/dev:requestfactory-apt-deps",
     ],
@@ -440,6 +441,7 @@
         "src": ["src/com/google/gwt/junit/**"],
         "super": ["super/com/google/gwt/junit/**"],
     },
+    compatible_with = ["//buildenv/target:appengine"],
     dojarjar = 1,
     exclude_glob = [
         "**/package.html",
@@ -459,6 +461,7 @@
             "**/RunStyleSelenium.java",
         ],
     ),
+    compatible_with = ["//buildenv/target:appengine"],
     deps = [
         ":gwt-user-bare",
         "//third_party/java/junit",
@@ -514,6 +517,11 @@
         "//third_party/java_src/gwt:gwt-testing",
         "//third_party/java_src/gwt/svn/trunk/dev:dev-test-code",
     ],
+    javacopts = [
+        "-Xep:SelfComparison:OFF",  # go/self-comparison-lsc
+        "-Xep:SelfEquals:OFF",  # go/self-equals-lsc
+        "-Xep:IdentityBinaryExpression:OFF",
+    ],
     deps = [
         "//third_party/java/jsr305_annotations",
         "//third_party/java/junit",