blob: 5fcc3f90e3423d47948c637098e4c315cbf1b9b0 [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")
Sean Condon0bd777c2021-01-01 14:23:29 +000022load("@npm//@bazel/typescript:index.bzl", "ts_config")
Carmelo Casconed33d3b42019-06-18 12:12:36 -070023
Sean Condonb2c483c2019-01-16 20:28:55 +000024COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + [
Sean Condonf6af2a52018-08-19 10:43:24 +010025 "@javax_ws_rs_api//jar",
26 "@servlet_api//jar",
27 "@jetty_websocket//jar",
Sean Condonb2c483c2019-01-16 20:28:55 +000028 "@jetty_websocket_api//jar",
Sean Condonf6af2a52018-08-19 10:43:24 +010029 "@jetty_util//jar",
30 "@jersey_media_multipart//jar",
31 "@jersey_server//jar",
Ray Milkey427e9752018-11-15 16:34:48 -080032 "@jersey_hk2//jar",
Sean Condonf6af2a52018-08-19 10:43:24 +010033 "//utils/rest:onlab-rest",
34 "//core/store/serializers:onos-core-serializers",
35]
36
37TEST_DEPS = TEST + [
38 "//core/api:onos-api-tests",
39 "//drivers/default:onos-drivers-default",
40]
41
Sean Condona3ad7792020-01-04 19:26:34 +000042# 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 Condon3dd062f2020-04-14 09:25:00 +010045exports_files(
46 ["tsconfig.json"],
47 visibility = ["//visibility:public"],
48)
Sean Condona3ad7792020-01-04 19:26:34 +000049
50ts_config(
51 name = "tsconfig-test",
52 src = "tsconfig-test.json",
53 visibility = ["//visibility:public"],
54 deps = [":tsconfig.json"],
55)
56
Sean Condonf6af2a52018-08-19 10:43:24 +010057"""
Sean Condonf6af2a52018-08-19 10:43:24 +010058 Builds the java jar for the java code provided by the GUI2
59"""
60
61osgi_jar_with_tests(
62 name = "_onos-gui2-base-jar",
Sean Condon87b78502018-09-17 20:53:24 +010063 srcs =
64 glob([
65 "src/main/java/**",
66 ]) + [
67 "//web/gui:onos-gui-java-for-gui2",
68 ],
Sean Condonb2c483c2019-01-16 20:28:55 +000069 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 Condon3c8e5582018-08-28 23:22:43 +010077 suppress_checkstyle = True,
Sean Condonf6af2a52018-08-19 10:43:24 +010078 test_deps = TEST_DEPS,
Sean Condonbf7ff4f2019-03-17 16:18:42 +000079 web_context = "/onos/ui",
Sean Condonf6af2a52018-08-19 10:43:24 +010080 deps = COMPILE_DEPS,
81)
82
83"""
84 Builds the tar ball for the ONOS GUI2
85"""
86
87genrule(
Sean Condonbf7ff4f2019-03-17 16:18:42 +000088 name = "onos-web-gui2",
Sean Condonf6af2a52018-08-19 10:43:24 +010089 srcs = [
Sean Condon98b6ddb2019-12-24 08:07:40 +000090 "//web/gui2/src/main/webapp:prodapp",
Sean Condonf6af2a52018-08-19 10:43:24 +010091 ":_onos-gui2-base-jar",
Sean Condonb2c483c2019-01-16 20:28:55 +000092 "//web/gui:onos-gui-lion-for-gui2",
Sean Condon98b6ddb2019-12-24 08:07:40 +000093 "//web/gui2/src/main/webapp:WEB-INF/web.xml",
pierventre37691eb2021-04-13 12:46:10 +020094 "//web/gui:onos-gui-jar_cfgdef.jar",
Sean Condonf6af2a52018-08-19 10:43:24 +010095 ],
96 outs = ["onos-gui2.jar"],
97 cmd = " ROOT=`pwd` &&" +
Sean Condon98b6ddb2019-12-24 08:07:40 +000098 " mkdir -p web/gui2/WEB-INF/classes/org/onosproject/ui/ &&" +
Sean Condonf6af2a52018-08-19 10:43:24 +010099 " cd web/gui2 &&" +
Sean Condonf6af2a52018-08-19 10:43:24 +0100100 " jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" +
Sean Condonb2c483c2019-01-16 20:28:55 +0000101 " unzip -q $$ROOT/$(location //web/gui:onos-gui-lion-for-gui2) web/gui/src/main/resources/**/* &&" +
102 " mv web/gui/src/main/resources/org/onosproject/ui/lion* WEB-INF/classes/org/onosproject/ui/ &&" +
Sean Condon98b6ddb2019-12-24 08:07:40 +0000103 " cp -R $$ROOT/$(location //web/gui2/src/main/webapp:prodapp)/* WEB-INF/classes/ &&" +
104 " mv $$ROOT/$(location //web/gui2/src/main/webapp:WEB-INF/web.xml) WEB-INF &&" +
pierventre37691eb2021-04-13 12:46:10 +0200105 " (cd WEB-INF/classes && jar xf $$ROOT/$(location //web/gui:onos-gui-jar_cfgdef.jar)) &&" +
Sean Condon0bd777c2021-01-01 14:23:29 +0000106 " find . -type f -exec touch -t 202001010001 {} \\; &&" +
Sean Condonb2c483c2019-01-16 20:28:55 +0000107 " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/web.xml WEB-INF/classes OSGI-INF/*.xml",
Sean Condonf6af2a52018-08-19 10:43:24 +0100108 output_to_bindir = 1,
109 visibility = ["//visibility:public"],
110)
111
Sean Condonbf7ff4f2019-03-17 16:18:42 +0000112onos_app(
113 category = "Graphical User Interface",
114 description = "ONOS GUI2 - a reengineered version of the original ONOS GUI " +
115 "based on the latest Angular framework components",
116 title = "ONOS GUI2",
117 url = "http://onosproject.org",
118)