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 + [ |
Thomas Vachuska | 5538d9e | 2018-08-14 09:59:35 -0700 | [diff] [blame] | 7 | "//tools/build/conf:onos-build-conf", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 8 | ":onos-package-admin", |
| 9 | ":onos-package-test", |
| 10 | ":onos-package", |
| 11 | ], |
Thomas Vachuska | 0f95603 | 2018-06-12 10:41:12 -0700 | [diff] [blame] | 12 | visibility = ["//visibility:public"], |
| 13 | ) |
| 14 | |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 15 | KARAF = "@apache_karaf//file" |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 16 | |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 17 | PATCHES = "@apache_karaf_patches//file" |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 18 | |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 19 | BRANDING = "//tools/package/branding:onos-tools-package-branding" |
| 20 | |
| 21 | # Generates auxiliary karaf.zip file; branded and augmented with ONOS runtime tools |
| 22 | genrule( |
| 23 | name = "onos-karaf", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 24 | srcs = [ |
| 25 | KARAF, |
| 26 | PATCHES, |
| 27 | BRANDING, |
| 28 | ] + glob([ |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 29 | "tools/package/bin/*", |
| 30 | "tools/package/etc/*", |
| 31 | "tools/package/init/*", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 32 | "tools/package/runtime/bin/*", |
| 33 | ]), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 34 | outs = ["karaf.zip"], |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 35 | cmd = "$(location tools/package/onos-prep-karaf) $(location karaf.zip) $(location %s) %s $(location %s) $(location %s) tools/package" % |
| 36 | (KARAF, ONOS_VERSION, BRANDING, PATCHES), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 37 | tools = ["tools/package/onos-prep-karaf"], |
| 38 | ) |
| 39 | |
| 40 | # Generates the principal onos.tar.gz bundle |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 41 | genrule( |
| 42 | name = "onos-package", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 43 | srcs = [ |
| 44 | "//tools/package/features:onos-features", |
| 45 | ":onos-karaf", |
Thomas Vachuska | 1ae26c6 | 2018-07-09 13:40:16 -0700 | [diff] [blame] | 46 | ] + APPS + FEATURES, |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 47 | outs = ["onos.tar.gz"], |
| 48 | 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] | 49 | output_to_bindir = True, |
Thomas Vachuska | e7433b8 | 2018-07-24 13:57:37 -0700 | [diff] [blame] | 50 | tags = ["local"], |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 51 | tools = ["tools/package/onos_stage.py"], |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 52 | ) |
| 53 | |
| 54 | # Generates the onos-admin.tar.gz file with remote admin tools |
| 55 | genrule( |
| 56 | name = "onos-package-admin", |
| 57 | srcs = glob([ |
| 58 | "tools/package/runtime/bin/*", |
| 59 | "tools/dev/bin/onos-create-app", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 60 | "tools/test/bin/onos", |
| 61 | ]), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 62 | outs = ["onos-admin.tar.gz"], |
Thomas Vachuska | 1506abb | 2018-07-31 16:28:37 -0700 | [diff] [blame] | 63 | 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] | 64 | (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 65 | output_to_bindir = True, |
| 66 | ) |
| 67 | |
| 68 | # Generates the onos-test.tar.gz file with test tools |
| 69 | genrule( |
| 70 | name = "onos-package-test", |
| 71 | srcs = glob([ |
| 72 | "tools/build/envDefaults", |
| 73 | "tools/dev/bash_profile", |
| 74 | "tools/dev/bin/onos-create-app", |
| 75 | "tools/test/**/*", |
Ray Milkey | 15053f0 | 2018-06-13 10:00:45 -0700 | [diff] [blame] | 76 | "tools/package/runtime/bin/*", |
| 77 | ]), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 78 | outs = ["onos-test.tar.gz"], |
Thomas Vachuska | 1506abb | 2018-07-31 16:28:37 -0700 | [diff] [blame] | 79 | 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] | 80 | (ONOS_VERSION, ONOS_VERSION, ONOS_VERSION), |
Thomas Vachuska | f5d1720 | 2018-06-12 17:28:13 -0700 | [diff] [blame] | 81 | output_to_bindir = True, |
| 82 | ) |
| 83 | |
| 84 | # Runs ONOS as a single instance from the /tmp directory |
Thomas Vachuska | 510419f | 2018-06-28 17:05:09 -0700 | [diff] [blame] | 85 | genrule( |
Thomas Vachuska | 8e022a9 | 2018-07-10 14:47:38 -0700 | [diff] [blame] | 86 | name = "onos-local", |
Ray Milkey | 2f380c7 | 2018-07-10 09:28:32 -0700 | [diff] [blame] | 87 | srcs = [ |
| 88 | ":onos-package", |
| 89 | "tools/package/onos-run-karaf", |
Jian Li | d486a73 | 2018-08-03 00:32:11 +0900 | [diff] [blame] | 90 | ] + glob(["tools/package/config/**"]), |
Thomas Vachuska | 510419f | 2018-06-28 17:05:09 -0700 | [diff] [blame] | 91 | outs = ["onos-runner"], |
Thomas Vachuska | 510419f | 2018-06-28 17:05:09 -0700 | [diff] [blame] | 92 | cmd = "sed \"s#ONOS_TAR=#ONOS_TAR=$(location :onos-package)#\" $(location tools/package/onos-run-karaf) > $(location onos-runner); chmod +x $(location onos-runner)", |
| 93 | executable = True, |
| 94 | output_to_bindir = True, |
| 95 | visibility = ["//visibility:public"], |
| 96 | ) |
Ray Milkey | 5063f5b | 2018-08-15 16:22:30 -0700 | [diff] [blame] | 97 | |
| 98 | load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") |
| 99 | |
| 100 | buildifier( |
| 101 | name = "buildifier_check", |
| 102 | mode = "check", |
| 103 | ) |
| 104 | |
| 105 | buildifier( |
| 106 | name = "buildifier_fix", |
| 107 | mode = "fix", |
| 108 | ) |