blob: 0a1d0cbdbaf5a244092f55f90ea9fb6c4e95398d [file] [log] [blame]
Thomas Vachuskaf5d17202018-06-12 17:28:13 -07001load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION")
Thomas Vachuska1ae26c62018-07-09 13:40:16 -07002load(":modules.bzl", "APPS", "CORE", "FEATURES")
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
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070040genrule(
41 name = "onos-package",
Ray Milkey15053f02018-06-13 10:00:45 -070042 srcs = [
43 "//tools/package/features:onos-features",
44 ":onos-karaf",
Thomas Vachuska1ae26c62018-07-09 13:40:16 -070045 ] + APPS + FEATURES,
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070046 outs = ["onos.tar.gz"],
47 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 -070048 output_to_bindir = True,
Ray Milkey15053f02018-06-13 10:00:45 -070049 tools = ["tools/package/onos_stage.py"],
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070050)
51
52# Generates the onos-admin.tar.gz file with remote admin tools
53genrule(
54 name = "onos-package-admin",
55 srcs = glob([
56 "tools/package/runtime/bin/*",
57 "tools/dev/bin/onos-create-app",
Ray Milkey15053f02018-06-13 10:00:45 -070058 "tools/test/bin/onos",
59 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070060 outs = ["onos-admin.tar.gz"],
Ray Milkey15053f02018-06-13 10:00:45 -070061 cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar zcf $(location onos-admin.tar.gz) onos-admin-%s" %
62 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070063 output_to_bindir = True,
64)
65
66# Generates the onos-test.tar.gz file with test tools
67genrule(
68 name = "onos-package-test",
69 srcs = glob([
70 "tools/build/envDefaults",
71 "tools/dev/bash_profile",
72 "tools/dev/bin/onos-create-app",
73 "tools/test/**/*",
Ray Milkey15053f02018-06-13 10:00:45 -070074 "tools/package/runtime/bin/*",
75 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070076 outs = ["onos-test.tar.gz"],
Ray Milkey15053f02018-06-13 10:00:45 -070077 cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar zcf $(location onos-test.tar.gz) onos-test-%s" %
78 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070079 output_to_bindir = True,
80)
81
82# Runs ONOS as a single instance from the /tmp directory
83# FIXME: Still work in progress
Thomas Vachuska510419f2018-06-28 17:05:09 -070084genrule(
85 name = "onos-run",
86 outs = ["onos-runner"],
87 srcs = [":onos-package", "tools/package/onos-run-karaf"],
88 cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location tools/package/onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)",
89 executable = True,
90 output_to_bindir = True,
91 visibility = ["//visibility:public"],
92)