blob: 5b7ea77e29bb6c189b059f86c064d6d60912278e [file] [log] [blame]
Thomas Vachuskaf5d17202018-06-12 17:28:13 -07001load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION")
2load(":modules.bzl", "CORE", "APPS")
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 + [
7 ":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"
15PATCHES = "@apache_karaf_patches//file"
16BRANDING = "//tools/package/branding:onos-tools-package-branding"
17
18# Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools
19genrule(
20 name = "onos-karaf",
21 srcs = [KARAF, PATCHES, BRANDING] + glob([
22 "tools/package/bin/*",
23 "tools/package/etc/*",
24 "tools/package/init/*",
25 "tools/package/runtime/bin/*"
26 ]),
27 outs = ["karaf.zip"],
28 cmd = "$(location tools/package/onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) $(location %s) tools/package" \
29 % (KARAF, ONOS_VERSION, BRANDING, PATCHES),
30 tools = ["tools/package/onos-prep-karaf"],
31)
32
33# Generates the principal onos.tar.gz bundle
34# FIXME: Need to include OAR files as dependencies and feature bundles as well
35genrule(
36 name = "onos-package",
37 srcs = ["//tools/package/features:onos-features", ":onos-karaf"],
38 outs = ["onos.tar.gz"],
39 cmd = "$(location tools/package/onos_stage.py) $(location onos.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION,
40 tools = ["tools/package/onos_stage.py"],
41 output_to_bindir = True,
42)
43
44# Generates the onos-admin.tar.gz file with remote admin tools
45genrule(
46 name = "onos-package-admin",
47 srcs = glob([
48 "tools/package/runtime/bin/*",
49 "tools/dev/bin/onos-create-app",
50 "tools/test/bin/onos"
51 ]),
52 outs = ["onos-admin.tar.gz"],
53 cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar zcf $(location onos-admin.tar.gz) onos-admin-%s"\
54 % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
55 output_to_bindir = True,
56)
57
58# Generates the onos-test.tar.gz file with test tools
59genrule(
60 name = "onos-package-test",
61 srcs = glob([
62 "tools/build/envDefaults",
63 "tools/dev/bash_profile",
64 "tools/dev/bin/onos-create-app",
65 "tools/test/**/*",
66 "tools/package/runtime/bin/*"
67 ]),
68 outs = ["onos-test.tar.gz"],
69 cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar zcf $(location onos-test.tar.gz) onos-test-%s"\
70 % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
71 output_to_bindir = True,
72)
73
74# Runs ONOS as a single instance from the /tmp directory
75# FIXME: Still work in progress
Ray Milkey0fe0cdb2018-06-12 18:13:35 -070076#genrule(
77# name = "onos-run",
78# outs = ["onos-runner"],
79# srcs = ["onos-run-karaf", "onos-package"],
80# cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)",
81# executable = True,
82# output_to_bindir = True,
83# visibility = ["//visibility:public"],
84#)