blob: 1226cc27e7fe2c22711c951ff0fe1310281e437a [file] [log] [blame]
Thomas Vachuskae17756d2018-10-31 15:23:55 -07001load("//tools/build/bazel:variables.bzl", "ONOS_VERSION")
Ray Milkey5a520c72018-11-01 10:35:06 -07002load("//tools/build/bazel: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
Thomas Vachuska1e3ed802019-02-01 14:51:30 -080051# Generates the minimal onos-minimal.tar.gz bundle
52genrule(
53 name = "onos-package-minimal",
54 srcs = [
55 "//tools/package/features:onos-features",
56 ":onos-karaf",
57 "//drivers/default:onos-drivers-default-oar",
58 ] + FEATURES,
59 outs = ["onos-minimal.tar.gz"],
60 cmd = "$(location tools/package/onos_stage.py) $(location onos-minimal.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION,
61 output_to_bindir = True,
62 tags = ["local"],
63 tools = ["tools/package/onos_stage.py"],
64)
65
66# Generates SEBA-specific onos-seba.tar.gz bundle
67genrule(
68 name = "onos-package-seba",
69 srcs = [
70 "//tools/package/features:onos-features",
71 ":onos-karaf",
72 "//drivers/default:onos-drivers-default-oar",
73 "//apps/optical-model:onos-apps-optical-model-oar",
74 "//providers/openflow/app:onos-providers-openflow-app-oar",
75 "//providers/openflow/base:onos-providers-openflow-base-oar",
76 "//providers/host:onos-providers-host-oar",
77 "//providers/lldp:onos-providers-lldp-oar",
78 "//apps/mcast:onos-apps-mcast-oar",
79 "//providers/netcfghost:onos-providers-netcfghost-oar",
80 "//apps/segmentrouting:onos-apps-segmentrouting-oar",
81 "//apps/route-service:onos-apps-route-service-oar",
82 ] + FEATURES,
83 outs = ["onos-seba.tar.gz"],
84 cmd = "$(location tools/package/onos_stage.py) $(location onos-seba.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION,
85 output_to_bindir = True,
86 tags = ["local"],
87 tools = ["tools/package/onos_stage.py"],
88)
89
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070090# Generates the onos-admin.tar.gz file with remote admin tools
91genrule(
92 name = "onos-package-admin",
93 srcs = glob([
94 "tools/package/runtime/bin/*",
95 "tools/dev/bin/onos-create-app",
Ray Milkey15053f02018-06-13 10:00:45 -070096 "tools/test/bin/onos",
97 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -070098 outs = ["onos-admin.tar.gz"],
Thomas Vachuska1506abb2018-07-31 16:28:37 -070099 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 -0700100 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -0700101 output_to_bindir = True,
102)
103
104# Generates the onos-test.tar.gz file with test tools
105genrule(
106 name = "onos-package-test",
107 srcs = glob([
108 "tools/build/envDefaults",
109 "tools/dev/bash_profile",
110 "tools/dev/bin/onos-create-app",
111 "tools/test/**/*",
Ray Milkey15053f02018-06-13 10:00:45 -0700112 "tools/package/runtime/bin/*",
113 ]),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -0700114 outs = ["onos-test.tar.gz"],
Thomas Vachuska1506abb2018-07-31 16:28:37 -0700115 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 -0700116 (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION),
Thomas Vachuskaf5d17202018-06-12 17:28:13 -0700117 output_to_bindir = True,
118)
119
120# Runs ONOS as a single instance from the /tmp directory
Thomas Vachuska510419f2018-06-28 17:05:09 -0700121genrule(
Thomas Vachuska8e022a92018-07-10 14:47:38 -0700122 name = "onos-local",
Ray Milkey2f380c72018-07-10 09:28:32 -0700123 srcs = [
124 ":onos-package",
Carmelo Cascone395b2312019-06-18 17:34:16 -0700125 "//tools/build/jdk:default_jdk_tar",
Ray Milkey2f380c72018-07-10 09:28:32 -0700126 "tools/package/onos-run-karaf",
Jian Lid486a732018-08-03 00:32:11 +0900127 ] + glob(["tools/package/config/**"]),
Thomas Vachuska510419f2018-06-28 17:05:09 -0700128 outs = ["onos-runner"],
Carmelo Cascone395b2312019-06-18 17:34:16 -0700129 cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location tools/package/onos-run-karaf) > foo; " +
130 "sed \"s#JDK_TAR=#JDK_TAR=$(location //tools/build/jdk:default_jdk_tar)#\" foo > $(location onos-runner); " +
131 "chmod +x $(location onos-runner)",
Thomas Vachuska510419f2018-06-28 17:05:09 -0700132 executable = True,
133 output_to_bindir = True,
134 visibility = ["//visibility:public"],
135)
Ray Milkey5063f5b2018-08-15 16:22:30 -0700136
137load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
138
139buildifier(
140 name = "buildifier_check",
Ray Milkey678767f2018-08-27 17:38:33 -0700141 exclude_patterns = ["./tools/build/bazel/generate_workspace.bzl"],
Ray Milkey5063f5b2018-08-15 16:22:30 -0700142 mode = "check",
143)
144
145buildifier(
146 name = "buildifier_fix",
Ray Milkey678767f2018-08-27 17:38:33 -0700147 exclude_patterns = ["./tools/build/bazel/generate_workspace.bzl"],
Ray Milkey5063f5b2018-08-15 16:22:30 -0700148 mode = "fix",
149)