blob: 40113425590f4f4c29fa06dbc79774b3147326a4 [file] [log] [blame]
Thomas Vachuskaf5d17202018-06-12 17:28:13 -07001load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION")
Ray Milkey15053f02018-06-13 10:00:45 -07002load(":modules.bzl", "APPS", "CORE")
Thomas Vachuskaaab45d12018-06-05 16:39:46 -07003
Ray Milkey7dac7da2017-08-01 16:56:05 -07004filegroup(
5 name = "onos",
Thomas Vachuskaf5d17202018-06-12 17:28:13 -07006 srcs = CORE + APPS + [
Ray Milkey15053f02018-06-13 10:00:45 -07007 ":onos-package-admin",
8 ":onos-package-test",
9 ":onos-package",
10 ],
Thomas Vachuska0f956032018-06-12 10:41:12 -070011 visibility = ["//visibility:public"],
12)
13
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070014KARAF = "@apache_karaf//file"
Ray Milkey15053f02018-06-13 10:00:45 -070015
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070016PATCHES = "@apache_karaf_patches//file"
Ray Milkey15053f02018-06-13 10:00:45 -070017
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070018BRANDING = "//tools/package/branding:onos-tools-package-branding"
19
20# Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools
21genrule(
22 name = "onos-karaf",
Ray Milkey15053f02018-06-13 10:00:45 -070023 srcs = [
24 KARAF,
25 PATCHES,
26 BRANDING,
27 ] + glob([
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070028 "tools/package/bin/*",
29 "tools/package/etc/*",
30 "tools/package/init/*",
Ray Milkey15053f02018-06-13 10:00:45 -070031 "tools/package/runtime/bin/*",
32 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070033 outs = ["karaf.zip"],
Ray Milkey15053f02018-06-13 10:00:45 -070034 cmd = "$(location tools/package/onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) $(location %s) tools/package" %
35 (KARAF, ONOS_VERSION, BRANDING, PATCHES),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070036 tools = ["tools/package/onos-prep-karaf"],
37)
38
39# Generates the principal onos.tar.gz bundle
40# FIXME: Need to include OAR files as dependencies and feature bundles as well
41genrule(
42 name = "onos-package",
Ray Milkey15053f02018-06-13 10:00:45 -070043 srcs = [
44 "//tools/package/features:onos-features",
45 ":onos-karaf",
46 ],
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070047 outs = ["onos.tar.gz"],
48 cmd = "$(location tools/package/onos_stage.py) $(location onos.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION,
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070049 output_to_bindir = True,
Ray Milkey15053f02018-06-13 10:00:45 -070050 tools = ["tools/package/onos_stage.py"],
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070051)
52
53# Generates the onos-admin.tar.gz file with remote admin tools
54genrule(
55 name = "onos-package-admin",
56 srcs = glob([
57 "tools/package/runtime/bin/*",
58 "tools/dev/bin/onos-create-app",
Ray Milkey15053f02018-06-13 10:00:45 -070059 "tools/test/bin/onos",
60 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070061 outs = ["onos-admin.tar.gz"],
Ray Milkey15053f02018-06-13 10:00:45 -070062 cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar zcf $(location onos-admin.tar.gz) onos-admin-%s" %
63 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070064 output_to_bindir = True,
65)
66
67# Generates the onos-test.tar.gz file with test tools
68genrule(
69 name = "onos-package-test",
70 srcs = glob([
71 "tools/build/envDefaults",
72 "tools/dev/bash_profile",
73 "tools/dev/bin/onos-create-app",
74 "tools/test/**/*",
Ray Milkey15053f02018-06-13 10:00:45 -070075 "tools/package/runtime/bin/*",
76 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070077 outs = ["onos-test.tar.gz"],
Ray Milkey15053f02018-06-13 10:00:45 -070078 cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar zcf $(location onos-test.tar.gz) onos-test-%s" %
79 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070080 output_to_bindir = True,
81)
82
83# Runs ONOS as a single instance from the /tmp directory
84# FIXME: Still work in progress
Ray Milkey0fe0cdb2018-06-12 18:13:35 -070085#genrule(
86# name = "onos-run",
87# outs = ["onos-runner"],
88# srcs = ["onos-run-karaf", "onos-package"],
89# cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)",
90# executable = True,
91# output_to_bindir = True,
92# visibility = ["//visibility:public"],
93#)