blob: c3b700b6c34b3f63f985ab42f193208ed93ae1f8 [file] [log] [blame]
Sean Condonf6af2a52018-08-19 10:43:24 +01001"""
2 Copyright 2018-present Open Networking Foundation
Sean Condonf6af2a52018-08-19 10:43:24 +01003 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 Condonf6af2a52018-08-19 10:43:24 +01006 http://www.apache.org/licenses/LICENSE-2.0
Sean Condonf6af2a52018-08-19 10:43:24 +01007 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 Condon0c577f62018-11-18 22:40:05 +000016 The GUI2 Angular 7 elements are built here with Angular CLI 'ng'
Sean Condon4fff3732020-01-07 17:53:54 +000017 This uses Angular Buildtools Convergence - https://bazel.angular.io/
18 in place of previous bash scripts that wrapped Angular CLI
Sean Condonf6af2a52018-08-19 10:43:24 +010019"""
20
Carmelo Casconed33d3b42019-06-18 12:12:36 -070021load("//tools/build/bazel:jdk_genrule.bzl", genrule = "jdk_genrule")
22
Sean Condonb2c483c2019-01-16 20:28:55 +000023COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + [
Sean Condonf6af2a52018-08-19 10:43:24 +010024 "@javax_ws_rs_api//jar",
25 "@servlet_api//jar",
26 "@jetty_websocket//jar",
Sean Condonb2c483c2019-01-16 20:28:55 +000027 "@jetty_websocket_api//jar",
Sean Condonf6af2a52018-08-19 10:43:24 +010028 "@jetty_util//jar",
29 "@jersey_media_multipart//jar",
30 "@jersey_server//jar",
Ray Milkey427e9752018-11-15 16:34:48 -080031 "@jersey_hk2//jar",
Sean Condonf6af2a52018-08-19 10:43:24 +010032 "//utils/rest:onlab-rest",
33 "//core/store/serializers:onos-core-serializers",
34]
35
36TEST_DEPS = TEST + [
37 "//core/api:onos-api-tests",
38 "//drivers/default:onos-drivers-default",
39]
40
41"""
Sean Condonf6af2a52018-08-19 10:43:24 +010042 Builds the java jar for the java code provided by the GUI2
43"""
44
45osgi_jar_with_tests(
46 name = "_onos-gui2-base-jar",
Sean Condon87b78502018-09-17 20:53:24 +010047 srcs =
48 glob([
49 "src/main/java/**",
50 ]) + [
51 "//web/gui:onos-gui-java-for-gui2",
52 ],
Sean Condonb2c483c2019-01-16 20:28:55 +000053 exclude_tests = [
54 "org.onosproject.ui.impl.AbstractUiImplTest",
55 "org.onosproject.ui.impl.topo.model.AbstractTopoModelTest",
56 ],
57 karaf_command_packages = [
58 "org.onosproject.ui.impl.cli",
59 "org.onosproject.ui.impl.topo",
60 ],
Sean Condon3c8e5582018-08-28 23:22:43 +010061 suppress_checkstyle = True,
Sean Condonf6af2a52018-08-19 10:43:24 +010062 test_deps = TEST_DEPS,
Sean Condonbf7ff4f2019-03-17 16:18:42 +000063 web_context = "/onos/ui",
Sean Condonf6af2a52018-08-19 10:43:24 +010064 deps = COMPILE_DEPS,
65)
66
67"""
68 Builds the tar ball for the ONOS GUI2
69"""
70
71genrule(
Sean Condonbf7ff4f2019-03-17 16:18:42 +000072 name = "onos-web-gui2",
Sean Condonf6af2a52018-08-19 10:43:24 +010073 srcs = [
Sean Condon98b6ddb2019-12-24 08:07:40 +000074 "//web/gui2/src/main/webapp:prodapp",
Sean Condonf6af2a52018-08-19 10:43:24 +010075 ":_onos-gui2-base-jar",
Sean Condonb2c483c2019-01-16 20:28:55 +000076 "//web/gui:onos-gui-lion-for-gui2",
Sean Condon98b6ddb2019-12-24 08:07:40 +000077 "//web/gui2/src/main/webapp:WEB-INF/web.xml",
Sean Condonf6af2a52018-08-19 10:43:24 +010078 ],
79 outs = ["onos-gui2.jar"],
80 cmd = " ROOT=`pwd` &&" +
Sean Condon98b6ddb2019-12-24 08:07:40 +000081 " mkdir -p web/gui2/WEB-INF/classes/org/onosproject/ui/ &&" +
Sean Condonf6af2a52018-08-19 10:43:24 +010082 " cd web/gui2 &&" +
Sean Condonf6af2a52018-08-19 10:43:24 +010083 " jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" +
Sean Condonb2c483c2019-01-16 20:28:55 +000084 " unzip -q $$ROOT/$(location //web/gui:onos-gui-lion-for-gui2) web/gui/src/main/resources/**/* &&" +
85 " mv web/gui/src/main/resources/org/onosproject/ui/lion* WEB-INF/classes/org/onosproject/ui/ &&" +
Sean Condon98b6ddb2019-12-24 08:07:40 +000086 " cp -R $$ROOT/$(location //web/gui2/src/main/webapp:prodapp)/* WEB-INF/classes/ &&" +
87 " mv $$ROOT/$(location //web/gui2/src/main/webapp:WEB-INF/web.xml) WEB-INF &&" +
88 " find . -type f -exec touch -t 202001010001 {} \; &&" +
Sean Condonb2c483c2019-01-16 20:28:55 +000089 " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/web.xml WEB-INF/classes OSGI-INF/*.xml",
Sean Condonf6af2a52018-08-19 10:43:24 +010090 output_to_bindir = 1,
91 visibility = ["//visibility:public"],
92)
93
Sean Condonbf7ff4f2019-03-17 16:18:42 +000094onos_app(
95 category = "Graphical User Interface",
96 description = "ONOS GUI2 - a reengineered version of the original ONOS GUI " +
97 "based on the latest Angular framework components",
98 title = "ONOS GUI2",
99 url = "http://onosproject.org",
100)