blob: d57e44210780c6a4cafa7fd103d1a4e85d3d22f1 [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 + [
Thomas Vachuska5538d9e2018-08-14 09:59:35 -07007 "//tools/build/conf:onos-build-conf",
Ray Milkey15053f02018-06-13 10:00:45 -07008 ":onos-package-admin",
9 ":onos-package-test",
10 ":onos-package",
11 ],
Thomas Vachuska0f956032018-06-12 10:41:12 -070012 visibility = ["//visibility:public"],
13)
14
Ray Milkeya8ac7e32018-09-04 15:52:14 -070015KARAF = "@apache_karaf//:apache_karaf"
Ray Milkey15053f02018-06-13 10:00:45 -070016
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070017BRANDING = "//tools/package/branding:onos-tools-package-branding"
18
19# Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools
20genrule(
21 name = "onos-karaf",
Ray Milkey15053f02018-06-13 10:00:45 -070022 srcs = [
23 KARAF,
Ray Milkey15053f02018-06-13 10:00:45 -070024 BRANDING,
25 ] + glob([
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070026 "tools/package/bin/*",
27 "tools/package/etc/*",
28 "tools/package/init/*",
Ray Milkey15053f02018-06-13 10:00:45 -070029 "tools/package/runtime/bin/*",
30 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070031 outs = ["karaf.zip"],
Ray Milkey3f274d92018-09-28 14:23:34 -070032 cmd = "$(location tools/package/onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) '' tools/package" %
33 (KARAF, ONOS_VERSION, BRANDING),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070034 tools = ["tools/package/onos-prep-karaf"],
35)
36
37# Generates the principal onos.tar.gz bundle
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070038genrule(
39 name = "onos-package",
Ray Milkey15053f02018-06-13 10:00:45 -070040 srcs = [
41 "//tools/package/features:onos-features",
42 ":onos-karaf",
Thomas Vachuska1ae26c62018-07-09 13:40:16 -070043 ] + APPS + FEATURES,
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070044 outs = ["onos.tar.gz"],
45 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 -070046 output_to_bindir = True,
Thomas Vachuskae7433b82018-07-24 13:57:37 -070047 tags = ["local"],
Ray Milkey15053f02018-06-13 10:00:45 -070048 tools = ["tools/package/onos_stage.py"],
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070049)
50
51# Generates the onos-admin.tar.gz file with remote admin tools
52genrule(
53 name = "onos-package-admin",
54 srcs = glob([
55 "tools/package/runtime/bin/*",
56 "tools/dev/bin/onos-create-app",
Ray Milkey15053f02018-06-13 10:00:45 -070057 "tools/test/bin/onos",
58 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070059 outs = ["onos-admin.tar.gz"],
Thomas Vachuska1506abb2018-07-31 16:28:37 -070060 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 -070061 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070062 output_to_bindir = True,
63)
64
65# Generates the onos-test.tar.gz file with test tools
66genrule(
67 name = "onos-package-test",
68 srcs = glob([
69 "tools/build/envDefaults",
70 "tools/dev/bash_profile",
71 "tools/dev/bin/onos-create-app",
72 "tools/test/**/*",
Ray Milkey15053f02018-06-13 10:00:45 -070073 "tools/package/runtime/bin/*",
74 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070075 outs = ["onos-test.tar.gz"],
Thomas Vachuska1506abb2018-07-31 16:28:37 -070076 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 -070077 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070078 output_to_bindir = True,
79)
80
81# Runs ONOS as a single instance from the /tmp directory
Thomas Vachuska510419f2018-06-28 17:05:09 -070082genrule(
Thomas Vachuska8e022a92018-07-10 14:47:38 -070083 name = "onos-local",
Ray Milkey2f380c72018-07-10 09:28:32 -070084 srcs = [
85 ":onos-package",
86 "tools/package/onos-run-karaf",
Jian Lid486a732018-08-03 00:32:11 +090087 ] + glob(["tools/package/config/**"]),
Thomas Vachuska510419f2018-06-28 17:05:09 -070088 outs = ["onos-runner"],
Thomas Vachuska510419f2018-06-28 17:05:09 -070089 cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location tools/package/onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)",
90 executable = True,
91 output_to_bindir = True,
92 visibility = ["//visibility:public"],
93)
Ray Milkey5063f5b2018-08-15 16:22:30 -070094
95load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
96
97buildifier(
98 name = "buildifier_check",
Ray Milkey678767f2018-08-27 17:38:33 -070099 exclude_patterns = ["./tools/build/bazel/generate_workspace.bzl"],
Ray Milkey5063f5b2018-08-15 16:22:30 -0700100 mode = "check",
101)
102
103buildifier(
104 name = "buildifier_fix",
Ray Milkey678767f2018-08-27 17:38:33 -0700105 exclude_patterns = ["./tools/build/bazel/generate_workspace.bzl"],
Ray Milkey5063f5b2018-08-15 16:22:30 -0700106 mode = "fix",
107)