ONOS-628 - Download and extract node binaries for the GUI build step
- Added gulp build task the:
- Bundles Vendor JS files
- Bundles ONOS JS Files
- Bundles ONOS CSS Files
- Added SourceMaps to JS bundles - Helps with debugging during development
- Added Bundles to index.js and removed old references
- Git Ignored any generated files
- Ensured the build step is able to build without a local copy of node installed
- Added BUCK genrules (provided by Viswa)
- Added BUCK Dependency to GUI
- Buck Rule to run when src changes
- Node/NPM downloaded using BUCK remote_file
Change-Id: Ia6ca3b952ff801850ade7469c23aac76c8520400
diff --git a/bucklets/node.bucklet b/bucklets/node.bucklet
new file mode 100644
index 0000000..3239e46
--- /dev/null
+++ b/bucklets/node.bucklet
@@ -0,0 +1,34 @@
+NODE_VERSION = "v8.1.2"
+NODE_RELEASE_BASE_URL = "https://nodejs.org/dist/"
+
+NODE_SHA1S = {
+ "node-v8.1.2-linux-x64.tar.gz":"61a609c83e2d3458cc2301a63b212a97e6b9f809",
+ "node-v8.1.2-darwin-x64.tar.gz":"a8b31fd645480661a8a777d9b4466dca0e6deb33"
+}
+
+def get_system_arch():
+ import platform
+ os = platform.system().lower()
+ return os
+
+def fetch_node(version):
+ file_name = "node-%s-%s-x64" % (version, get_system_arch())
+ file_fullname = "node-%s-%s-x64.tar.gz" % (version, get_system_arch())
+ if file_fullname not in NODE_SHA1S:
+ raise Exception("Cannot download %s, architecture or version not supported" % file_name)
+
+ remote_file(
+ name = 'node-release-' + version,
+ url = NODE_RELEASE_BASE_URL + version + '/' + file_fullname,
+ sha1 = NODE_SHA1S[file_fullname],
+ )
+
+ genrule(
+ name = 'node-bin-' + version,
+ bash = 'tar -xf $(location :node-release-' + version + ') && ' +
+ 'mv ' + file_name + ' $OUT && ' +
+ 'chmod +x $OUT',
+ out = 'node-binaries',
+ executable = False,
+ visibility = [ "PUBLIC" ],
+ )