blob: 3fdc59d24b2fcf25aefa78f76984e2d576e8dd50 [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 Condona3ad7792020-01-04 19:26:34 +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
45exports_files([
46 "tsconfig.json",
47])
48
49ts_config(
50 name = "tsconfig-test",
51 src = "tsconfig-test.json",
52 visibility = ["//visibility:public"],
53 deps = [":tsconfig.json"],
54)
55
Sean Condonf6af2a52018-08-19 10:43:24 +010056"""
Sean Condonf6af2a52018-08-19 10:43:24 +010057 Builds the java jar for the java code provided by the GUI2
58"""
59
60osgi_jar_with_tests(
61 name = "_onos-gui2-base-jar",
Sean Condon87b78502018-09-17 20:53:24 +010062 srcs =
63 glob([
64 "src/main/java/**",
65 ]) + [
66 "//web/gui:onos-gui-java-for-gui2",
67 ],
Sean Condonb2c483c2019-01-16 20:28:55 +000068 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 Condon3c8e5582018-08-28 23:22:43 +010076 suppress_checkstyle = True,
Sean Condonf6af2a52018-08-19 10:43:24 +010077 test_deps = TEST_DEPS,
Sean Condonbf7ff4f2019-03-17 16:18:42 +000078 web_context = "/onos/ui",
Sean Condonf6af2a52018-08-19 10:43:24 +010079 deps = COMPILE_DEPS,
80)
81
82"""
83 Builds the tar ball for the ONOS GUI2
84"""
85
86genrule(
Sean Condonbf7ff4f2019-03-17 16:18:42 +000087 name = "onos-web-gui2",
Sean Condonf6af2a52018-08-19 10:43:24 +010088 srcs = [
Sean Condon98b6ddb2019-12-24 08:07:40 +000089 "//web/gui2/src/main/webapp:prodapp",
Sean Condonf6af2a52018-08-19 10:43:24 +010090 ":_onos-gui2-base-jar",
Sean Condonb2c483c2019-01-16 20:28:55 +000091 "//web/gui:onos-gui-lion-for-gui2",
Sean Condon98b6ddb2019-12-24 08:07:40 +000092 "//web/gui2/src/main/webapp:WEB-INF/web.xml",
Sean Condonf6af2a52018-08-19 10:43:24 +010093 ],
94 outs = ["onos-gui2.jar"],
95 cmd = " ROOT=`pwd` &&" +
Sean Condon98b6ddb2019-12-24 08:07:40 +000096 " mkdir -p web/gui2/WEB-INF/classes/org/onosproject/ui/ &&" +
Sean Condonf6af2a52018-08-19 10:43:24 +010097 " cd web/gui2 &&" +
Sean Condonf6af2a52018-08-19 10:43:24 +010098 " jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" +
Sean Condonb2c483c2019-01-16 20:28:55 +000099 " 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 Condon98b6ddb2019-12-24 08:07:40 +0000101 " 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 Condonb2c483c2019-01-16 20:28:55 +0000104 " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/web.xml WEB-INF/classes OSGI-INF/*.xml",
Sean Condonf6af2a52018-08-19 10:43:24 +0100105 output_to_bindir = 1,
106 visibility = ["//visibility:public"],
107)
108
Sean Condonbf7ff4f2019-03-17 16:18:42 +0000109onos_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)