Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 1 | load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION") |
| 2 | load(":modules.bzl", "CORE", "APPS") |
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 + [ |
| 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" |
| 15 | PATCHES = "@apache_karaf_patches//file" |
| 16 | BRANDING = "//tools/package/branding:onos-tools-package-branding" |
| 17 | |
| 18 | # Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools |
| 19 | genrule( |
| 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 |
| 35 | genrule( |
| 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 |
| 45 | genrule( |
| 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 |
| 59 | genrule( |
| 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 Milkey | 0fe0cdb | 2018-06-12 18:13:35 -0700 | [diff] [blame] | 76 | #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 | #) |