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 |
Sean Condon | 3dd062f | 2020-04-14 09:25:00 +0100 | [diff] [blame] | 45 | exports_files( |
| 46 | ["tsconfig.json"], |
| 47 | visibility = ["//visibility:public"], |
| 48 | ) |
Sean Condon | a3ad779 | 2020-01-04 19:26:34 +0000 | [diff] [blame] | 49 | |
| 50 | ts_config( |
| 51 | name = "tsconfig-test", |
| 52 | src = "tsconfig-test.json", |
| 53 | visibility = ["//visibility:public"], |
| 54 | deps = [":tsconfig.json"], |
| 55 | ) |
| 56 | |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 57 | """ |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 58 | Builds the java jar for the java code provided by the GUI2 |
| 59 | """ |
| 60 | |
| 61 | osgi_jar_with_tests( |
| 62 | name = "_onos-gui2-base-jar", |
Sean Condon | 87b7850 | 2018-09-17 20:53:24 +0100 | [diff] [blame] | 63 | srcs = |
| 64 | glob([ |
| 65 | "src/main/java/**", |
| 66 | ]) + [ |
| 67 | "//web/gui:onos-gui-java-for-gui2", |
| 68 | ], |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 69 | exclude_tests = [ |
| 70 | "org.onosproject.ui.impl.AbstractUiImplTest", |
| 71 | "org.onosproject.ui.impl.topo.model.AbstractTopoModelTest", |
| 72 | ], |
| 73 | karaf_command_packages = [ |
| 74 | "org.onosproject.ui.impl.cli", |
| 75 | "org.onosproject.ui.impl.topo", |
| 76 | ], |
Sean Condon | 3c8e558 | 2018-08-28 23:22:43 +0100 | [diff] [blame] | 77 | suppress_checkstyle = True, |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 78 | test_deps = TEST_DEPS, |
Sean Condon | bf7ff4f | 2019-03-17 16:18:42 +0000 | [diff] [blame] | 79 | web_context = "/onos/ui", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 80 | deps = COMPILE_DEPS, |
| 81 | ) |
| 82 | |
| 83 | """ |
| 84 | Builds the tar ball for the ONOS GUI2 |
| 85 | """ |
| 86 | |
| 87 | genrule( |
Sean Condon | bf7ff4f | 2019-03-17 16:18:42 +0000 | [diff] [blame] | 88 | name = "onos-web-gui2", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 89 | srcs = [ |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 90 | "//web/gui2/src/main/webapp:prodapp", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 91 | ":_onos-gui2-base-jar", |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 92 | "//web/gui:onos-gui-lion-for-gui2", |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 93 | "//web/gui2/src/main/webapp:WEB-INF/web.xml", |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 94 | ], |
| 95 | outs = ["onos-gui2.jar"], |
| 96 | cmd = " ROOT=`pwd` &&" + |
Sean Condon | 98b6ddb | 2019-12-24 08:07:40 +0000 | [diff] [blame] | 97 | " mkdir -p web/gui2/WEB-INF/classes/org/onosproject/ui/ &&" + |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 98 | " cd web/gui2 &&" + |
Sean Condon | f6af2a5 | 2018-08-19 10:43:24 +0100 | [diff] [blame] | 99 | " jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" + |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 100 | " unzip -q $$ROOT/$(location //web/gui:onos-gui-lion-for-gui2) web/gui/src/main/resources/**/* &&" + |
| 101 | " 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] | 102 | " cp -R $$ROOT/$(location //web/gui2/src/main/webapp:prodapp)/* WEB-INF/classes/ &&" + |
| 103 | " mv $$ROOT/$(location //web/gui2/src/main/webapp:WEB-INF/web.xml) WEB-INF &&" + |
| 104 | " find . -type f -exec touch -t 202001010001 {} \; &&" + |
Sean Condon | b2c483c | 2019-01-16 20:28:55 +0000 | [diff] [blame] | 105 | " 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] | 106 | output_to_bindir = 1, |
| 107 | visibility = ["//visibility:public"], |
| 108 | ) |
| 109 | |
Sean Condon | bf7ff4f | 2019-03-17 16:18:42 +0000 | [diff] [blame] | 110 | onos_app( |
| 111 | category = "Graphical User Interface", |
| 112 | description = "ONOS GUI2 - a reengineered version of the original ONOS GUI " + |
| 113 | "based on the latest Angular framework components", |
| 114 | title = "ONOS GUI2", |
| 115 | url = "http://onosproject.org", |
| 116 | ) |