|
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 | +) |
2 | 8 |
|
3 | 9 | load("//tools/build/bazel:bazel_version.bzl", "check_bazel_version") |
4 | 10 |
|
@@ -95,23 +101,48 @@ load("//tools/build/bazel:gnoi_workspace.bzl", "generate_gnoi") |
95 | 101 |
|
96 | 102 | generate_gnoi() |
97 | 103 |
|
98 | | -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") |
| 104 | +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
99 | 105 |
|
100 | | -git_repository( |
| 106 | +http_archive( |
101 | 107 | 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"], |
105 | 110 | ) |
106 | 111 |
|
107 | | -load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories") |
| 112 | +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install") |
108 | 113 |
|
109 | 114 | 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"], |
112 | 122 | ) |
113 | 123 |
|
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() |
115 | 146 |
|
116 | 147 | # buildifier is written in Go and hence needs rules_go to be built. |
117 | 148 | # See https://github.com/bazelbuild/rules_go for the up to date setup instructions. |
|
0 commit comments