Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 1 | load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION") |
Thomas Vachuska | 1ae26c6 | 2018-07-09 13:40:16 -0700 | [diff] [blame] | 2 | load(":modules.bzl", "APPS", "CORE", "FEATURES") |
Thomas Vachuska | aab45d1 | 2018-06-05 16:39:46 -0700 | [diff] [blame] | 3 | |
Ray Milkey | 7dac7da | 2017-08-01 16:56:05 -0700 | [diff] [blame] | 4 | filegroup( |
| 5 | name = "onos", |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 6 | srcs = CORE + APPS + [ |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 7 | ":onos-package-admin", |
| 8 | ":onos-package-test", |
| 9 | ":onos-package", |
| 10 | ], |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame] | 11 | visibility = ["//visibility:public"], |
| 12 | ) |
| 13 | |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 14 | KARAF = "@apache_karaf//file" |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 15 | |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 16 | PATCHES = "@apache_karaf_patches//file" |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 17 | |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 18 | BRANDING = "//tools/package/branding:onos-tools-package-branding" |
| 19 | |
| 20 | # Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools |
| 21 | genrule( |
| 22 | name = "onos-karaf", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 23 | srcs = [ |
| 24 | KARAF, |
| 25 | PATCHES, |
| 26 | BRANDING, |
| 27 | ] + glob([ |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 28 | "tools/package/bin/*", |
| 29 | "tools/package/etc/*", |
| 30 | "tools/package/init/*", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 31 | "tools/package/runtime/bin/*", |
| 32 | ]), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 33 | outs = ["karaf.zip"], |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 34 | 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 Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 36 | tools = ["tools/package/onos-prep-karaf"], |
| 37 | ) |
| 38 | |
| 39 | # Generates the principal onos.tar.gz bundle |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 40 | genrule( |
| 41 | name = "onos-package", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 42 | srcs = [ |
| 43 | "//tools/package/features:onos-features", |
| 44 | ":onos-karaf", |
Thomas Vachuska | 1ae26c6 | 2018-07-09 13:40:16 -0700 | [diff] [blame] | 45 | ] + APPS + FEATURES, |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 46 | outs = ["onos.tar.gz"], |
| 47 | cmd = "$(location tools/package/onos_stage.py) $(location onos.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION, |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 48 | output_to_bindir = True, |
Thomas Vachuska | e7433b8 | 2018-07-24 13:57:37 -0700 | [diff] [blame] | 49 | tags = ["local"], |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 50 | tools = ["tools/package/onos_stage.py"], |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 51 | ) |
| 52 | |
| 53 | # Generates the onos-admin.tar.gz file with remote admin tools |
| 54 | genrule( |
| 55 | name = "onos-package-admin", |
| 56 | srcs = glob([ |
| 57 | "tools/package/runtime/bin/*", |
| 58 | "tools/dev/bin/onos-create-app", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 59 | "tools/test/bin/onos", |
| 60 | ]), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 61 | outs = ["onos-admin.tar.gz"], |
Thomas Vachuska | 1506abb | 2018-07-31 16:28:37 -0700 | [diff] [blame] | 62 | cmd = "mkdir onos-admin-%s; cp $(SRCS) onos-admin-%s; tar hzcf $(location onos-admin.tar.gz) onos-admin-%s" % |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 63 | (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 64 | output_to_bindir = True, |
| 65 | ) |
| 66 | |
| 67 | # Generates the onos-test.tar.gz file with test tools |
| 68 | genrule( |
| 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 Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 75 | "tools/package/runtime/bin/*", |
| 76 | ]), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 77 | outs = ["onos-test.tar.gz"], |
Thomas Vachuska | 1506abb | 2018-07-31 16:28:37 -0700 | [diff] [blame] | 78 | cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar hzcf $(location onos-test.tar.gz) onos-test-%s" % |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 79 | (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 80 | output_to_bindir = True, |
| 81 | ) |
| 82 | |
| 83 | # Runs ONOS as a single instance from the /tmp directory |
Thomas Vachuska | 510419f | 2018-06-28 17:05:09 -0700 | [diff] [blame] | 84 | genrule( |
Thomas Vachuska | 8e022a9 | 2018-07-10 14:47:38 -0700 | [diff] [blame] | 85 | name = "onos-local", |
Ray Milkey | 2f380c7 | 2018-07-10 09:28:32 -0700 | [diff] [blame] | 86 | srcs = [ |
| 87 | ":onos-package", |
| 88 | "tools/package/onos-run-karaf", |
Jian Li | d486a73 | 2018-08-03 00:32:11 +0900 | [diff] [blame] | 89 | ] + glob(["tools/package/config/**"]), |
Thomas Vachuska | 510419f | 2018-06-28 17:05:09 -0700 | [diff] [blame] | 90 | outs = ["onos-runner"], |
Thomas Vachuska | 510419f | 2018-06-28 17:05:09 -0700 | [diff] [blame] | 91 | 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 | ) |