Skip to content

Commit 0a884ad

Browse files
author
Sean Condon
committed
Upgrading NodeJS to 10.16 and GUI2 to Angular 8
Change-Id: I722ffd8438728e6658a0589aa12b087ad5da8864
1 parent 41ec148 commit 0a884ad

File tree

23 files changed

+48210
-28147
lines changed

23 files changed

+48210
-28147
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bucklets/plugins/
2626
lib/yang
2727
/tools/gui/bin
2828
/tools/gui/node_modules
29-
/tools/gui/package-lock.json
29+
/tools/gui/false
3030

3131
web/gui/src/main/webapp/tests/node_modules
3232
web/gui/src/test/_karma/node_modules

WORKSPACE

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
workspace(name = "org_onosproject_onos")
1+
workspace(
2+
name = "org_onosproject_onos",
3+
managed_directories = {
4+
"@gui1_npm": ["tools/gui/node_modules"],
5+
"@gui2_npm": ["web/gui2-fw-lib/node_modules"],
6+
},
7+
)
28

39
load("//tools/build/bazel:bazel_version.bzl", "check_bazel_version")
410

@@ -95,23 +101,48 @@ load("//tools/build/bazel:gnoi_workspace.bzl", "generate_gnoi")
95101

96102
generate_gnoi()
97103

98-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
104+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
99105

100-
git_repository(
106+
http_archive(
101107
name = "build_bazel_rules_nodejs",
102-
commit = "70406e05de721520ca568a17186de73e972d7651",
103-
remote = "https://github.com/bazelbuild/rules_nodejs.git",
104-
shallow_since = "1551145517 -0800",
108+
sha256 = "26c39450ce2d825abee5583a43733863098ed29d3cbaebf084ebaca59a21a1c8",
109+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.39.0/rules_nodejs-0.39.0.tar.gz"],
105110
)
106111

107-
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")
112+
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install")
108113

109114
node_repositories(
110-
node_version = "8.11.1",
111-
package_json = ["//tools/gui:package.json"],
115+
node_repositories = {
116+
"10.16.0-darwin_amd64": ("node-v10.16.0-darwin-x64.tar.gz", "node-v10.16.0-darwin-x64", "6c009df1b724026d84ae9a838c5b382662e30f6c5563a0995532f2bece39fa9c"),
117+
"10.16.0-linux_amd64": ("node-v10.16.0-linux-x64.tar.xz", "node-v10.16.0-linux-x64", "1827f5b99084740234de0c506f4dd2202a696ed60f76059696747c34339b9d48"),
118+
"10.16.0-windows_amd64": ("node-v10.16.0-win-x64.zip", "node-v10.16.0-win-x64", "aa22cb357f0fb54ccbc06b19b60e37eefea5d7dd9940912675d3ed988bf9a059"),
119+
},
120+
node_version = "10.16.0",
121+
package_json = ["//web/gui2-fw-lib:package.json"],
112122
)
113123

114-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
124+
# The npm_install rule runs yarn anytime the package.json or package-lock.json file changes.
125+
# It also extracts any Bazel rules distributed in an npm package.
126+
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")
127+
128+
npm_install(
129+
# Name this npm so that Bazel Label references look like @npm//package
130+
name = "gui1_npm",
131+
package_json = "//tools/gui:package.json",
132+
package_lock_json = "//tools/gui:package-lock.json",
133+
)
134+
135+
npm_install(
136+
# Name this npm so that Bazel Label references look like @npm//package
137+
name = "gui2_npm",
138+
package_json = "//web/gui2-fw-lib:package.json",
139+
package_lock_json = "//web/gui2-fw-lib:package-lock.json",
140+
)
141+
142+
# Install any Bazel rules which were extracted earlier by the npm_install rule.
143+
load("@gui2_npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")
144+
145+
install_bazel_dependencies()
115146

116147
# buildifier is written in Go and hence needs rules_go to be built.
117148
# See https://github.com/bazelbuild/rules_go for the up to date setup instructions.

apps/faultmanagement/fm-gui2-lib/BUILD

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ genrule(
7474
name = "fm-gui2-lib-build",
7575
srcs = [
7676
"@nodejs//:bin/npm",
77-
"@nodejs//:bin/node",
7877
"@nodejs//:bin/nodejs/bin/node",
79-
"@nodejs//:bin/nodejs/bin/npm",
8078
"//web/gui2-fw-lib:onos-gui2-fw-npm-install",
8179
"//web/gui2-fw-lib:onos-gui2-fw-ng-build",
8280
"//web/gui2-fw-lib:gui2_fw_lib_ext_css",
@@ -91,7 +89,7 @@ genrule(
9189
cmd = "ROOT=`pwd` &&" +
9290
" export HOME=. &&" +
9391
" export XDG_CONFIG_HOME=$(@D)/config &&" +
94-
" NODE=$(location @nodejs//:bin/node) &&" +
92+
" NODE=$(location @nodejs//:bin/nodejs/bin/node) &&" +
9593
" INSTALL_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-npm-install)) &&" + # An array of filenames - sorted by time created
9694
" FWLIB_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-ng-build)) &&" + # An array of filenames - sorted by time created
9795
" mkdir -p apps/faultmanagement/fm-gui2-lib &&" +
@@ -113,7 +111,7 @@ genrule(
113111
" exit 1;" +
114112
" fi;" +
115113
" cd dist/fm-gui2-lib && " +
116-
" npm pack >> $$ROOT/$(location fm-gui2-lib.log) 2>&1 &&" +
114+
" $$ROOT/$(location @nodejs//:bin/npm) pack >> $$ROOT/$(location fm-gui2-lib.log) 2>&1 &&" +
117115
" mv fm-gui2-lib-*.tgz $$ROOT/$(location fm-gui2-lib-ver.tgz) &&" +
118116
" touch $$ROOT/$(location fm-gui2-lib.log)", # to get the log always as the 2nd file,
119117
message = "Angular FM GUI2 build",
@@ -130,9 +128,7 @@ genrule(
130128
name = "_fm-gui2-lib-test-genrule",
131129
srcs = [
132130
"@nodejs//:bin/npm",
133-
"@nodejs//:bin/node",
134131
"@nodejs//:bin/nodejs/bin/node",
135-
"@nodejs//:bin/nodejs/bin/npm",
136132
"//web/gui2-fw-lib:onos-gui2-fw-npm-install",
137133
"//web/gui2-fw-lib:onos-gui2-fw-ng-build",
138134
"//web/gui2-fw-lib:gui2_fw_lib_ext_css",
@@ -148,7 +144,7 @@ genrule(
148144
cmd = " ROOT=`pwd` &&" +
149145
" export HOME=. &&" +
150146
" export XDG_CONFIG_HOME=$(@D)/config &&" +
151-
" NODE=$(location @nodejs//:bin/node) &&" +
147+
" NODE=$(location @nodejs//:bin/nodejs/bin/node) &&" +
152148
" INSTALL_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-npm-install)) &&" + # An array of filenames - sorted by time created
153149
" FWLIB_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-ng-build)) &&" + # An array of filenames - sorted by time created
154150
" mkdir -p apps/faultmanagement/fm-gui2-lib &&" +
@@ -163,7 +159,7 @@ genrule(
163159
" chmod +x $$ROOT/apps/faultmanagement/fm-gui2-lib/node_modules/@angular/cli/bin/ng &&" +
164160
" export PATH=$$ROOT/$$(dirname $${NODE}):node_modules/@angular/cli/bin:$$PATH &&" +
165161
" node -v > ../../../$(location fm-gui2-lib-ver.log) &&" +
166-
" npm -v >> ../../../$(location fm-gui2-lib-ver.log) &&" +
162+
" $$ROOT/$(location @nodejs//:bin/npm) -v >> ../../../$(location fm-gui2-lib-ver.log) &&" +
167163
" ng -v >> ../../../$(location fm-gui2-lib-ver.log) &&" +
168164
" ng lint fm-gui2-lib > ../../../$(location fm-gui2-lib-lint.log);" +
169165
" if [ -f /usr/bin/chromium-browser ]; then " + # Add to this for Mac and Chrome

apps/faultmanagement/fm-gui2-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fm-gui2-lib-app",
3-
"version": "2.1.0",
3+
"version": "2.3.0",
44
"private": true,
55
"dependencies": {
66
"@angular/animations": "^7.0.2",

apps/roadm/web/roadm-gui/BUILD

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ genrule(
7474
name = "roadm-gui-lib-build",
7575
srcs = [
7676
"@nodejs//:bin/npm",
77-
"@nodejs//:bin/node",
7877
"@nodejs//:bin/nodejs/bin/node",
79-
"@nodejs//:bin/nodejs/bin/npm",
8078
"//web/gui2-fw-lib:onos-gui2-fw-npm-install",
8179
"//web/gui2-fw-lib:onos-gui2-fw-ng-build",
8280
"//web/gui2-fw-lib:gui2_fw_lib_ext_css",
@@ -91,7 +89,7 @@ genrule(
9189
cmd = "ROOT=`pwd` &&" +
9290
" export HOME=. &&" +
9391
" export XDG_CONFIG_HOME=$(@D)/config &&" +
94-
" NODE=$(location @nodejs//:bin/node) &&" +
92+
" NODE=$(location @nodejs//:bin/nodejs/bin/node) &&" +
9593
" INSTALL_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-npm-install)) &&" + # An array of filenames - sorted by time created
9694
" FWLIB_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-ng-build)) &&" + # An array of filenames - sorted by time created
9795
" mkdir -p apps/roadm/web/roadm-gui &&" +
@@ -113,7 +111,7 @@ genrule(
113111
" exit 1;" +
114112
" fi;" +
115113
" cp README.md LICENSE dist/roadm-gui-lib && " +
116-
" npm pack ./dist/roadm-gui-lib >> $$ROOT/$(location roadm-gui-lib.log) 2>&1 &&" +
114+
" $$ROOT/$(location @nodejs//:bin/npm) pack ./dist/roadm-gui-lib >> $$ROOT/$(location roadm-gui-lib.log) 2>&1 &&" +
117115
" mv roadm-gui-lib-*.tgz $$ROOT/$(location roadm-gui-lib-ver.tgz) &&" +
118116
" touch $$ROOT/$(location roadm-gui-lib.log)", # to get the log always as the 2nd file,
119117
message = "Angular roadm Lib build",
@@ -130,9 +128,7 @@ genrule(
130128
name = "_roadm-gui-lib-test-genrule",
131129
srcs = [
132130
"@nodejs//:bin/npm",
133-
"@nodejs//:bin/node",
134131
"@nodejs//:bin/nodejs/bin/node",
135-
"@nodejs//:bin/nodejs/bin/npm",
136132
"//web/gui2-fw-lib:onos-gui2-fw-npm-install",
137133
"//web/gui2-fw-lib:onos-gui2-fw-ng-build",
138134
"//web/gui2-fw-lib:gui2_fw_lib_ext_css",
@@ -148,7 +144,7 @@ genrule(
148144
cmd = " ROOT=`pwd` &&" +
149145
" export HOME=. &&" +
150146
" export XDG_CONFIG_HOME=$(@D)/config &&" +
151-
" NODE=$(location @nodejs//:bin/node) &&" +
147+
" NODE=$(location @nodejs//:bin/nodejs/bin/node) &&" +
152148
" INSTALL_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-npm-install)) &&" + # An array of filenames - sorted by time created
153149
" FWLIB_FILES=($(locations //web/gui2-fw-lib:onos-gui2-fw-ng-build)) &&" + # An array of filenames - sorted by time created
154150
" mkdir -p apps/roadm/web/roadm-gui &&" +
@@ -163,7 +159,7 @@ genrule(
163159
" chmod +x $$ROOT/apps/roadm/web/roadm-gui/node_modules/@angular/cli/bin/ng &&" +
164160
" export PATH=$$ROOT/$$(dirname $${NODE}):node_modules/@angular/cli/bin:$$PATH &&" +
165161
" node -v > ../../../../$(location roadm-gui-lib-ver.log) &&" +
166-
" npm -v >> ../../../../$(location roadm-gui-lib-ver.log) &&" +
162+
" $$ROOT/$(location @nodejs//:bin/npm) -v >> ../../../../$(location roadm-gui-lib-ver.log) &&" +
167163
" ng version >> ../../../../$(location roadm-gui-lib-ver.log) &&" +
168164
" ng lint roadm-gui-lib > ../../../../$(location roadm-gui-lib-lint.log) 2>&1 ||" +
169165
" if [ $$? -eq 0 ]; then echo 'Successfully ran lint';" +

0 commit comments

Comments
 (0)