blob: 2067140001e4d02652130d3cb079d2c0f843247d [file] [log] [blame]
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -07001load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION")
2
3KARAF = "@apache_karaf//file"
4PATCHES = "@apache_karaf_patches//file"
5BRANDING = "//tools/package/branding:onos-tools-package-branding"
6
Thomas Vachuska0f956032018-06-12 10:41:12 -07007BRANDED_KARAF_REQUIREMENTS = [
8 KARAF,
9 PATCHES,
10 BRANDING,
11]
12
13# Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070014genrule(
15 name = "onos-karaf",
Thomas Vachuska0f956032018-06-12 10:41:12 -070016 srcs = BRANDED_KARAF_REQUIREMENTS + glob(["bin/*", "etc/*", "init/*", "runtime/bin/*"]),
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070017 outs = ["karaf.zip"],
Thomas Vachuska0f956032018-06-12 10:41:12 -070018 cmd = "$(location onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) $(location %s) tools/package" \
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070019 % (KARAF, ONOS_VERSION, BRANDING, PATCHES),
20 tools = ["onos-prep-karaf"],
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070021)
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070022
Thomas Vachuska0f956032018-06-12 10:41:12 -070023# FIXME: Move /features to under tools/package/features
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070024PACKAGING_REQUIREMENTS = [
Thomas Vachuskaf25c2482018-06-12 13:18:45 -070025 "//tools/package/features:onos-features",
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070026 ":onos-karaf",
27]
28
Thomas Vachuska0f956032018-06-12 10:41:12 -070029# FIXME: Need to add OAR files as dependencies
30# Generates the principal distributable onos.tar.gz file
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070031genrule(
32 name = "onos-package",
33 srcs = PACKAGING_REQUIREMENTS + glob(["bin/*", "etc/*", "init/*", "config/*", "runtime/bin/*"]),
34 outs = ["onos.tar.gz"],
Thomas Vachuska0f956032018-06-12 10:41:12 -070035 cmd = "$(location onos_stage.py) $(location onos.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION,
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070036 visibility = ["//visibility:public"],
37 tools = ["onos_stage.py"],
Thomas Vachuskaf25c2482018-06-12 13:18:45 -070038 output_to_bindir = True,
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070039)
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070040
Thomas Vachuska0f956032018-06-12 10:41:12 -070041filegroup(
42 name = "onos-runtime-tools",
43 srcs = glob(["runtime/bin/*"]),
44)
45
46# Generates the onos-admin.tar.gz file with remote admin tools
47genrule(
48 name = "onos-package-admin",
49 srcs = ["//tools/dev:onos-admin", "//tools/test:onos-admin", ":onos-runtime-tools"],
50 outs = ["onos-admin.tar.gz"],
51 cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar zcf $(location onos-admin.tar.gz) onos-admin-%s"\
52 % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
53 visibility = ["//visibility:public"],
Thomas Vachuskaf25c2482018-06-12 13:18:45 -070054 output_to_bindir = True,
Thomas Vachuska0f956032018-06-12 10:41:12 -070055)
56
Thomas Vachuska8fcd2042018-06-12 12:00:16 -070057# Generates the onos-test.tar.gz file with test tools
Thomas Vachuska0f956032018-06-12 10:41:12 -070058genrule(
59 name = "onos-package-test",
60 srcs = ["//tools/dev:onos-test", "//tools/test:onos-test", ":onos-runtime-tools", "//:onos-env-defaults"],
61 outs = ["onos-test.tar.gz"],
62 cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar zcf $(location onos-test.tar.gz) onos-test-%s"\
63 % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
64 visibility = ["//visibility:public"],
Thomas Vachuskaf25c2482018-06-12 13:18:45 -070065 output_to_bindir = True,
Thomas Vachuska0f956032018-06-12 10:41:12 -070066)
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070067
Thomas Vachuska8fcd2042018-06-12 12:00:16 -070068# Runs ONOS as a single instance from the /tmp directory
69# FIXME: Still work in progress
70genrule(
71 name = "onos-run",
72 outs = ["onos-runner"],
73 srcs = ["onos-run-karaf", "onos-package"],
74 cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)",
75 executable = True,
Thomas Vachuskaf25c2482018-06-12 13:18:45 -070076 output_to_bindir = True,
Thomas Vachuska8fcd2042018-06-12 12:00:16 -070077 visibility = ["//visibility:public"],
78)
79
Thomas Vachuskaa8e1bd42018-06-11 15:45:11 -070080#staged_repos = ['$(location %s-repo)' % f for f in FEATURES]
81#staged_apps = ['$(location %s)' % a for a in APPS]
82#
83## feature_coords = 'foo:bar:1.3'
84#sources = [ '$(location :onos-features)', ]
85#sources += staged_repos + staged_apps
Thomas Vachuska8fcd2042018-06-12 12:00:16 -070086
87