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 | # Sample apps for GWT. (Mirrored to svn.) |
| 17 | |
| 18 | # Google owns the copyright |
| 19 | licenses(["unencumbered"]) |
| 20 | |
| 21 | package( |
| 22 | default_visibility = ["//third_party/java_src/gwt:__pkg__"], |
| 23 | ) |
| 24 | |
Roberto Lublinerman | 37ff62f | 2016-09-27 13:39:25 -0700 | [diff] [blame] | 25 | load("//third_party/java_src/gwt:build-macros.bzl", "AugmentedJar", "Zip") |
Matthew Dempsky | 7da3948 | 2013-05-10 13:54:49 -0700 | [diff] [blame] | 26 | |
| 27 | package_group( |
| 28 | name = "showcase_friends", |
| 29 | packages = ["//javatests/com/google/gwt/tourguide/..."], |
| 30 | ) |
| 31 | |
| 32 | # Files in this directory for running ant |
| 33 | # Note: ant_test.sh replaces this build.xml file with its own stub. |
| 34 | filegroup( |
| 35 | name = "ant", |
Roberto Lublinerman | f01ebee | 2014-03-15 09:20:11 -0700 | [diff] [blame] | 36 | srcs = glob([ |
| 37 | "build.xml", |
| 38 | "**/*.java", |
| 39 | ]), |
Matthew Dempsky | 7da3948 | 2013-05-10 13:54:49 -0700 | [diff] [blame] | 40 | ) |
| 41 | |
| 42 | Zip( |
| 43 | name = "hello-src.jar", |
| 44 | srcs = glob([ |
| 45 | "hello/src/**/*.java", |
| 46 | "hello/src/**/*.xml", |
| 47 | ]), |
| 48 | root = "hello/src", |
| 49 | visibility = ["//third_party/java_src/gwt/svn/trunk/dev:__pkg__"], |
| 50 | ) |
| 51 | |
| 52 | # Allow friends to import the showcase app as a GWT module |
| 53 | gwt_module( |
| 54 | name = "showcase_module", |
| 55 | extra_inherits = ["com.google.gwt.sample.showcase.Showcase"], |
| 56 | rename_to = "showcase", |
| 57 | visibility = [":showcase_friends"], |
| 58 | deps = [":showcase_lib"], |
| 59 | ) |
| 60 | |
| 61 | gwt_application( |
| 62 | name = "showcase_app", |
| 63 | module_target = ":showcase_module", |
| 64 | ) |
| 65 | |
| 66 | java_library( |
| 67 | name = "showcase_lib", |
Roberto Lublinerman | 37ff62f | 2016-09-27 13:39:25 -0700 | [diff] [blame] | 68 | srcs = [":showcase.srcjar"], |
| 69 | constraints = [ |
| 70 | "gwt", |
| 71 | "public", |
| 72 | ], |
| 73 | deps = [ |
| 74 | "//third_party/java_src/gwt", |
| 75 | "//third_party/java_src/gwt:gwt-dev", |
| 76 | ], |
Matthew Dempsky | 7da3948 | 2013-05-10 13:54:49 -0700 | [diff] [blame] | 77 | ) |
| 78 | |
| 79 | AugmentedJar( |
| 80 | name = "showcase", |
| 81 | srcs = glob( |
| 82 | ["showcase/src/**/*.java"], |
| 83 | exclude_directories = 1, |
| 84 | ), |
| 85 | added_roots = ["showcase/src"], |
| 86 | deps = [ |
| 87 | "//third_party/java_src/gwt", |
| 88 | "//third_party/java_src/gwt:gwt-dev", |
| 89 | ], |
| 90 | ) |
| 91 | |
Roberto Lublinerman | 37ff62f | 2016-09-27 13:39:25 -0700 | [diff] [blame] | 92 | # we need to rename the jar file to end with .srcjar |
| 93 | # for it to be valid input into a java_library rule |
| 94 | genrule( |
| 95 | name = "rename_jar", |
| 96 | srcs = [":showcase.jar"], |
| 97 | outs = ["showcase.srcjar"], |
| 98 | cmd = "cp $(location :showcase.jar) $@", |
| 99 | ) |
| 100 | |
Matthew Dempsky | 7da3948 | 2013-05-10 13:54:49 -0700 | [diff] [blame] | 101 | # Provides the contents of the showcase war directory as a handy zip file |
| 102 | # (Doesn't include appengine-web.xml so you can replace it.) |
| 103 | Zip( |
| 104 | name = "showcase-wardir.zip", |
| 105 | srcs = glob( |
| 106 | ["showcase/war/**"], |
| 107 | exclude = glob(["showcase/war/**/*~"]) + [ |
| 108 | "showcase/war/WEB-INF/appengine-web.xml", |
| 109 | ], |
| 110 | ), |
| 111 | root = "showcase/war", |
| 112 | visibility = [":showcase_friends"], |
| 113 | ) |