blob: f4c2c93a48906106f8d0b3fcfef12bfdd83e31d4 [file] [log] [blame]
Ray Milkey6b3775a2018-06-28 11:18:44 -07001NODE_VERSION = "8.0.1"
2
3COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
4 "@javax_ws_rs_api//jar",
5 "@servlet_api//jar",
6 "@jetty_websocket//jar",
7 "@jetty_util//jar",
8 "@jersey_media_multipart//jar",
9 "@org_apache_karaf_shell_console//jar",
10 "@jersey_server//jar",
11 "//cli:onos-cli",
12 "//incubator/api:onos-incubator-api",
13 "//incubator/net:onos-incubator-net",
14 "//utils/rest:onlab-rest",
15 "//core/store/serializers:onos-core-serializers",
16]
17
18TEST_DEPS = TEST + [
19 "//core/api:onos-api-tests",
20 "//drivers/default:onos-drivers-default",
21]
22
23genrule(
24 name = "_onos-gui-npm-install",
25 srcs = [
26 "//tools/gui:package.json",
27 "@nodejs//:bin/npm",
28 ] + glob(
29 [
30 "src/main/webapp/*.js",
31 "src/main/webapp/app/**/*.js",
32 ],
33 exclude = ["src/main/webapp/dist/*.js"],
34 ),
35 outs = ["onos-gui-npm-install.tar"],
36 cmd = "(ROOT=`pwd` &&" +
37 " NPM=$$ROOT/$(location @nodejs//:bin/npm) &&" +
38 " cd tools/gui &&" +
39 " $$NPM install --loglevel=error --no-cache --cache=$(@D)/.npm --no-update-notifier &&" +
40 " tar cf $$ROOT/$@ package.json node_modules)",
41 local = True,
42 visibility = ["//visibility:public"],
43)
44
45genrule(
46 name = "_onos-gui-npm-build",
47 srcs = [
48 "//tools/gui:gulpfile.babel.js",
49 ":_onos-gui-npm-install",
50 "@nodejs//:bin/npm",
51 "//tools/gui:package.json",
52 ] + glob(["src/main/webapp/*"]),
53 outs = ["onos-gui-npm-build.tar"],
54 cmd = "(ROOT=`pwd` &&" +
55 " NPM=$$ROOT/$(location @nodejs//:bin/npm) &&" +
56 " cd tools/gui &&" +
57 " tar xf ../../$(location :_onos-gui-npm-install) &&" +
58 " $$NPM run build --no-update-notifier &&" +
59 " cd ../../web/gui/src/main/webapp &&" +
60 " jar cf $$ROOT/$@ dist vendor data tests README.md _doc _dev app/fw app/*.css app/*.js app/*.txt)",
61 local = True,
62 visibility = ["//visibility:public"],
63)
64
65genrule(
66 name = "_onos-gui-npm",
67 srcs = [
68 ":_onos-gui-npm-build",
69 ],
70 outs = ["onos-gui-npm.log"],
71 cmd = "ROOT=`pwd` && cd web/gui/src/main/webapp && tar xf $$ROOT/$(location :_onos-gui-npm-build) >$$ROOT/$@",
72 local = True,
73 visibility = ["//visibility:public"],
74)
75
76osgi_jar_with_tests(
77 name = "_onos-gui-base-jar",
78 exclude_tests = [
79 "org.onosproject.ui.impl.AbstractUiImplTest",
80 "org.onosproject.ui.impl.topo.model.AbstractTopoModelTest",
81 ],
82 test_deps = TEST_DEPS,
83 web_context = "/onos/ui",
84 deps = COMPILE_DEPS,
85)
86
87filegroup(
88 name = "_root_level_files",
89 srcs =
90 [
91 ":src/main/webapp/bower.json",
92 ":src/main/webapp/bs-config.js",
93 ":src/main/webapp/dev_server.js",
94 ":src/main/webapp/package.json",
95 ],
96)
97
98filegroup(
99 name = "_web_inf_classes_files",
100 srcs =
101 [
102 ":src/main/webapp/error.html",
103 ":src/main/webapp/index.html",
104 ":src/main/webapp/login.html",
105 ":src/main/webapp/nav.html",
106 ":src/main/webapp/not-ready.html",
107 ":src/main/webapp/onos.js",
108 ],
109)
110
111filegroup(
112 name = "_raw_classes_files",
113 srcs = glob(["src/main/webapp/raw/**"]),
114)
115
116# app/view is packaged as a tar file because it has subdirectories that need to be preserved
117genrule(
118 name = "_app_view_tar",
119 srcs = glob(["src/main/webapp/app/view/**"]),
120 outs = ["app_view_tar.tar"],
121 cmd = " ROOT=`pwd` &&" +
122 " cd web/gui/src/main/webapp/app/view &&" +
123 " tar cf $$ROOT/$@ .",
124)
125
126genrule(
127 name = "onos-gui",
128 srcs = [
129 ":_onos-gui-npm-build",
130 ":_onos-gui-base-jar",
131 ":_root_level_files",
132 ":_web_inf_classes_files",
133 ":_raw_classes_files",
134 ":_app_view_tar",
135 ],
136 outs = ["onos-gui.jar"],
137 cmd = " ROOT=`pwd` &&" +
138 " mkdir -p gui/WEB-INF/classes &&" +
139 " cd gui &&" +
140 " tar xf $$ROOT/$(location :_onos-gui-npm-build) &&" +
141 " (cd WEB-INF/classes && mkdir -p app/view && cd app/view && tar xf $$ROOT/$(location :_app_view_tar)) &&" +
142 " for i in $(locations :_root_level_files); do cp $$ROOT/$$i .; done &&" +
143 " for i in $(locations :_web_inf_classes_files); do cp $$ROOT/$$i ./WEB-INF/classes/; done &&" +
144 " mkdir ./WEB-INF/classes/raw && for i in $(locations :_raw_classes_files); do cp $$ROOT/$$i ./WEB-INF/classes/raw/; done &&" +
145 " jar xf $$ROOT/$(location :_onos-gui-base-jar) &&" +
146 " jar cmf META-INF/MANIFEST.MF $$ROOT/$@ .",
147 local = True,
148 output_to_bindir = 1,
149 visibility = ["//visibility:public"],
150)