Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 1 | load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION") |
| 2 | |
| 3 | KARAF = "@apache_karaf//file" |
| 4 | PATCHES = "@apache_karaf_patches//file" |
| 5 | BRANDING = "//tools/package/branding:onos-tools-package-branding" |
| 6 | |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 7 | BRANDED_KARAF_REQUIREMENTS = [ |
| 8 | KARAF, |
| 9 | PATCHES, |
| 10 | BRANDING, |
| 11 | ] |
| 12 | |
| 13 | # Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 14 | genrule( |
| 15 | name = "onos-karaf", |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 16 | srcs = BRANDED_KARAF_REQUIREMENTS + glob(["bin/*", "etc/*", "init/*", "runtime/bin/*"]), |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 17 | outs = ["karaf.zip"], |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 18 | cmd = "$(location onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) $(location %s) tools/package" \ |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 19 | % (KARAF, ONOS_VERSION, BRANDING, PATCHES), |
| 20 | tools = ["onos-prep-karaf"], |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 21 | ) |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 22 | |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 23 | # FIXME: Move /features to under tools/package/features |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 24 | PACKAGING_REQUIREMENTS = [ |
| 25 | "//features:onos-features", |
| 26 | ":onos-karaf", |
| 27 | ] |
| 28 | |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 29 | # FIXME: Need to add OAR files as dependencies |
| 30 | # Generates the principal distributable onos.tar.gz file |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 31 | genrule( |
| 32 | name = "onos-package", |
| 33 | srcs = PACKAGING_REQUIREMENTS + glob(["bin/*", "etc/*", "init/*", "config/*", "runtime/bin/*"]), |
| 34 | outs = ["onos.tar.gz"], |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 35 | cmd = "$(location onos_stage.py) $(location onos.tar.gz) %s $(location :onos-karaf) $(SRCS)" % ONOS_VERSION, |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 36 | visibility = ["//visibility:public"], |
| 37 | tools = ["onos_stage.py"], |
| 38 | ) |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 39 | |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame^] | 40 | # Generates auxiliary tar file with ONOS runtime tools |
| 41 | filegroup( |
| 42 | name = "onos-runtime-tools", |
| 43 | srcs = glob(["runtime/bin/*"]), |
| 44 | ) |
| 45 | |
| 46 | # Generates the onos-admin.tar.gz file with remote admin tools |
| 47 | genrule( |
| 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"], |
| 54 | ) |
| 55 | |
| 56 | genrule( |
| 57 | name = "onos-package-test", |
| 58 | srcs = ["//tools/dev:onos-test", "//tools/test:onos-test", ":onos-runtime-tools", "//:onos-env-defaults"], |
| 59 | outs = ["onos-test.tar.gz"], |
| 60 | cmd = "mkdir onos-test-%s; cp -r tools onos-test-%s; tar zcf $(location onos-test.tar.gz) onos-test-%s"\ |
| 61 | % (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION), |
| 62 | visibility = ["//visibility:public"], |
| 63 | ) |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 64 | |
| 65 | #staged_repos = ['$(location %s-repo)' % f for f in FEATURES] |
| 66 | #staged_apps = ['$(location %s)' % a for a in APPS] |
| 67 | # |
| 68 | ## feature_coords = 'foo:bar:1.3' |
| 69 | #sources = [ '$(location :onos-features)', ] |
| 70 | #sources += staged_repos + staged_apps |
| 71 | # |
Thomas Vachuska | a8e1bd4 | 2018-06-11 15:45:11 -0700 | [diff] [blame] | 72 | #genrule( |
| 73 | # name = 'onos-run', |
| 74 | # out = 'onos-run', |
| 75 | # srcs = [ 'onos-run-karaf' ], |
| 76 | # bash = 'sed "s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#" $SRCS > $OUT; chmod +x $OUT', |
| 77 | # executable = True, |
| 78 | # visibility = [ 'PUBLIC' ], |
| 79 | #) |