blob: 945cb1aa3ce2f01d4904780322b1eaaceee74c31 [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,
Thomas Vachuskae7433b82018-07-24 13:57:37 -070049 tags = ["local"],
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"],
Thomas Vachuska1506abb2018-07-31 16:28:37 -070062 cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar hzcf $(location onos-admin.tar.gz) onos-admin-%s" %
Ray Milkey15053f02018-06-13 10:00:45 -070063 (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"],
Thomas Vachuska1506abb2018-07-31 16:28:37 -070078 cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar hzcf $(location onos-test.tar.gz) onos-test-%s" %
Ray Milkey15053f02018-06-13 10:00:45 -070079 (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
Thomas Vachuska510419f2018-06-28 17:05:09 -070084genrule(
Thomas Vachuska8e022a92018-07-10 14:47:38 -070085 name = "onos-local",
Ray Milkey2f380c72018-07-10 09:28:32 -070086 srcs = [
87 ":onos-package",
88 "tools/package/onos-run-karaf",
89 ],
Thomas Vachuska510419f2018-06-28 17:05:09 -070090 outs = ["onos-runner"],
Thomas Vachuska510419f2018-06-28 17:05:09 -070091 cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location tools/package/onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)",
92 executable = True,
93 output_to_bindir = True,
94 visibility = ["//visibility:public"],
95)