Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2018-present Open Networking Foundation |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | you may not use this file except in compliance with the License. |
| 5 | You may obtain a copy of the License at |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 6 | http://www.apache.org/licenses/LICENSE-2.0 |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 7 | Unless required by applicable law or agreed to in writing, software |
| 8 | distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | See the License for the specific language governing permissions and |
| 11 | limitations under the License. |
| 12 | """ |
| 13 | |
| 14 | """ |
| 15 | Rules to build the ONOS GUI 2 |
Sean Condon | 0c577f6 | 2018-11-18 22:40:05 +0000 | [diff] [blame] | 16 | The GUI2 Angular 7 elements are built here with Angular CLI 'ng' |
Sean Condon | 4fff373 | 2020-01-07 17:53:54 +0000 | [diff] [blame] | 17 | This uses Angular Buildtools Convergence - https://bazel.angular.io/ |
| 18 | in place of previous bash scripts that wrapped Angular CLI |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 19 | """ |
| 20 | |
Carmelo Cascone | d33d3b4 | 2019-06-18 12:12:36 -0700 | [diff] [blame] | 21 | load("//tools/build/bazel:jdk_genrule.bzl", genrule = "jdk_genrule") |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame^] | 22 | load("@npm_bazel_typescript//:index.bzl", "ts_config") |
Carmelo Cascone | d33d3b4 | 2019-06-18 12:12:36 -0700 | [diff] [blame] | 23 | |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 24 | COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + [ |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 25 | "@javax_ws_rs_api//jar", |
| 26 | "@servlet_api//jar", |
| 27 | "@jetty_websocket//jar", |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 28 | "@jetty_websocket_api//jar", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 29 | "@jetty_util//jar", |
| 30 | "@jersey_media_multipart//jar", |
| 31 | "@jersey_server//jar", |
Ray Milkey | 427e975 | 2018-11-15 16:34:48 -0800 | [diff] [blame] | 32 | "@jersey_hk2//jar", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 33 | "//utils/rest:onlab-rest", |
| 34 | "//core/store/serializers:onos-core-serializers", |
| 35 | ] |
| 36 | |
| 37 | TEST_DEPS = TEST + [ |
| 38 | "//core/api:onos-api-tests", |
| 39 | "//drivers/default:onos-drivers-default", |
| 40 | ] |
| 41 | |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame^] | 42 | # This export allows targets in other packages to reference files that live |
| 43 | # in this package. |
| 44 | # TODO Try to move this in to /web/gui2-fw-lib when possible |
| 45 | exports_files([ |
| 46 | "tsconfig.json", |
| 47 | ]) |
| 48 | |
| 49 | ts_config( |
| 50 | name = "tsconfig-test", |
| 51 | src = "tsconfig-test.json", |
| 52 | visibility = ["//visibility:public"], |
| 53 | deps = [":tsconfig.json"], |
| 54 | ) |
| 55 | |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 56 | """ |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 57 | Builds the java jar for the java code provided by the GUI2 |
| 58 | """ |
| 59 | |
| 60 | osgi_jar_with_tests( |
| 61 | name = "_onos-gui2-base-jar", |
Sean Condon | 87b7850 | 2018-09-17 20:53:24 +0100 | [diff] [blame] | 62 | srcs = |
| 63 | glob([ |
| 64 | "src/main/java/**", |
| 65 | ]) + [ |
| 66 | "//web/gui:onos-gui-java-for-gui2", |
| 67 | ], |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 68 | exclude_tests = [ |
| 69 | "org.onosproject.ui.impl.AbstractUiImplTest", |
| 70 | "org.onosproject.ui.impl.topo.model.AbstractTopoModelTest", |
| 71 | ], |
| 72 | karaf_command_packages = [ |
| 73 | "org.onosproject.ui.impl.cli", |
| 74 | "org.onosproject.ui.impl.topo", |
| 75 | ], |
Sean Condon | 3c8e558 | 2018-08-28 23:22:43 +0100 | [diff] [blame] | 76 | suppress_checkstyle = True, |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 77 | test_deps = TEST_DEPS, |
Sean Condon | bf7ff4f | 2019-03-17 16:18:42 +0000 | [diff] [blame] | 78 | web_context = "/onos/ui", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 79 | deps = COMPILE_DEPS, |
| 80 | ) |
| 81 | |
| 82 | """ |
| 83 | Builds the tar ball for the ONOS GUI2 |
| 84 | """ |
| 85 | |
| 86 | genrule( |
Sean Condon | bf7ff4f | 2019-03-17 16:18:42 +0000 | [diff] [blame] | 87 | name = "onos-web-gui2", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 88 | srcs = [ |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 89 | "//web/gui2/src/main/webapp:prodapp", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 90 | ":_onos-gui2-base-jar", |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 91 | "//web/gui:onos-gui-lion-for-gui2", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 92 | "//web/gui2/src/main/webapp:WEB-INF/web.xml", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 93 | ], |
| 94 | outs = ["onos-gui2.jar"], |
| 95 | cmd = " ROOT=`pwd` &&" + |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 96 | " mkdir -p web/gui2/WEB-INF/classes/org/onosproject/ui/ &&" + |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 97 | " cd web/gui2 &&" + |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 98 | " jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" + |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 99 | " unzip -q $$ROOT/$(location //web/gui:onos-gui-lion-for-gui2) web/gui/src/main/resources/**/* &&" + |
| 100 | " mv web/gui/src/main/resources/org/onosproject/ui/lion* WEB-INF/classes/org/onosproject/ui/ &&" + |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 101 | " cp -R $$ROOT/$(location //web/gui2/src/main/webapp:prodapp)/* WEB-INF/classes/ &&" + |
| 102 | " mv $$ROOT/$(location //web/gui2/src/main/webapp:WEB-INF/web.xml) WEB-INF &&" + |
| 103 | " find . -type f -exec touch -t 202001010001 {} \; &&" + |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 104 | " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/web.xml WEB-INF/classes OSGI-INF/*.xml", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 105 | output_to_bindir = 1, |
| 106 | visibility = ["//visibility:public"], |
| 107 | ) |
| 108 | |
Sean Condon | bf7ff4f | 2019-03-17 16:18:42 +0000 | [diff] [blame] | 109 | onos_app( |
| 110 | category = "Graphical User Interface", |
| 111 | description = "ONOS GUI2 - a reengineered version of the original ONOS GUI " + |
| 112 | "based on the latest Angular framework components", |
| 113 | title = "ONOS GUI2", |
| 114 | url = "http://onosproject.org", |
| 115 | ) |