Brian O'Connor | b86c920 | 2016-04-05 20:15:04 -0700 | [diff] [blame] | 1 | import random |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 2 | |
| 3 | DEBUG_ARG='JAVA_TOOL_OPTIONS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=y"' |
Brian O'Connor | e5817c9 | 2016-04-06 15:41:48 -0700 | [diff] [blame] | 4 | FORCE_INSTALL=True |
| 5 | NONE='NONE' |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 6 | |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 7 | SRC = 'src/main/java/**/' |
| 8 | TEST = 'src/test/java/**/' |
Brian O'Connor | 0f6677d | 2016-04-06 23:26:51 -0700 | [diff] [blame] | 9 | RESOURCES_ROOT = 'src/main/resources/' |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 10 | TEST_RESOURCES_ROOT = 'src/test/resources/' |
| 11 | |
Ray Milkey | 171b89a | 2016-07-28 15:22:26 -0700 | [diff] [blame] | 12 | include_defs('//onos.defs') |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 13 | |
| 14 | def _get_name(): |
| 15 | base_path = get_base_path() |
| 16 | return ONOS_ARTIFACT_BASE + base_path.replace('/', '-') #TODO Unix-separator |
Brian O'Connor | 1f16598 | 2016-04-06 21:36:09 -0700 | [diff] [blame] | 17 | |
Brian O'Connor | 40a3fbd | 2016-06-08 13:54:46 -0700 | [diff] [blame] | 18 | def checkstyle( |
| 19 | name, |
| 20 | srcs = None, |
| 21 | jar_target = None, |
| 22 | ): |
| 23 | |
Yuta HIGUCHI | 295ee07 | 2017-06-21 15:48:21 -0700 | [diff] [blame] | 24 | if srcs: |
Brian O'Connor | 40a3fbd | 2016-06-08 13:54:46 -0700 | [diff] [blame] | 25 | base = get_base_path() |
| 26 | files = '%s\n%s\n' % (name, base) + '\n'.join(['%s/%s' % (base, s) for s in srcs]) |
| 27 | |
| 28 | genrule( |
| 29 | name = name + '-checkstyle-files', |
| 30 | bash = "echo '%s' > $OUT" % files, |
| 31 | srcs = srcs, |
| 32 | out = 'checkstyle-files.txt', |
| 33 | ) |
| 34 | |
| 35 | sh_test( |
| 36 | name = name + '-checkstyle', |
Thomas Vachuska | 275d2e8 | 2016-07-14 17:41:34 -0700 | [diff] [blame] | 37 | test = '//tools/build/conf:start-buck-daemon', |
Yuta HIGUCHI | 295ee07 | 2017-06-21 15:48:21 -0700 | [diff] [blame] | 38 | deps = [ ':' + name + '-checkstyle-files', |
Ray Milkey | 2d572dd | 2017-04-14 10:01:24 -0700 | [diff] [blame] | 39 | '//tools/build/conf:onos-java-header', |
| 40 | '//tools/build/conf:onos-build-conf', ], |
Brian O'Connor | 40a3fbd | 2016-06-08 13:54:46 -0700 | [diff] [blame] | 41 | args = [ |
Thomas Vachuska | 275d2e8 | 2016-07-14 17:41:34 -0700 | [diff] [blame] | 42 | '$(location //tools/build/conf:buck-daemon-jar)', |
| 43 | 'checkstyle', |
Brian O'Connor | 40a3fbd | 2016-06-08 13:54:46 -0700 | [diff] [blame] | 44 | '$(location :' + name + '-checkstyle-files)', |
| 45 | '$(location //tools/build/conf:checkstyle-xml)', |
| 46 | '$(location //tools/build/conf:suppressions-xml)', |
| 47 | ], |
Ray Milkey | 84dafd9 | 2017-10-25 16:20:23 -0700 | [diff] [blame] | 48 | test_rule_timeout_ms = 45000, |
Brian O'Connor | 40a3fbd | 2016-06-08 13:54:46 -0700 | [diff] [blame] | 49 | labels = [ 'checkstyle' ], |
| 50 | ) |
Brian O'Connor | 40a3fbd | 2016-06-08 13:54:46 -0700 | [diff] [blame] | 51 | |
Ray Milkey | c340e28 | 2016-06-30 14:45:42 -0700 | [diff] [blame] | 52 | def java_doc( |
| 53 | name, |
| 54 | title, |
| 55 | pkgs, |
| 56 | paths, |
| 57 | srcs = [], |
| 58 | deps = [], |
| 59 | visibility = [], |
| 60 | do_it_wrong = False, |
| 61 | ): |
| 62 | if do_it_wrong: |
| 63 | sourcepath = paths |
| 64 | else: |
| 65 | sourcepath = ['$SRCDIR/' + n for n in paths] |
Ray Milkey | 2a74983 | 2016-08-02 15:22:20 -0700 | [diff] [blame] | 66 | |
| 67 | if len(srcs) != 0: |
Ray Milkey | c340e28 | 2016-06-30 14:45:42 -0700 | [diff] [blame] | 68 | cmd = ' '.join([ |
Ray Milkey | 2a74983 | 2016-08-02 15:22:20 -0700 | [diff] [blame] | 69 | 'while ! test -f .buckconfig; do cd ..; done;', |
| 70 | 'javadoc', |
| 71 | '-tag onos.rsModel:a:"onos model"', |
| 72 | '-quiet', |
| 73 | '-protected', |
| 74 | '-encoding UTF-8', |
| 75 | '-charset UTF-8', |
| 76 | '-notimestamp', |
| 77 | '-windowtitle "' + title + '"', |
| 78 | '-link http://docs.oracle.com/javase/8/docs/api', |
| 79 | '-subpackages ', |
| 80 | ':'.join(pkgs), |
| 81 | '-sourcepath ', |
| 82 | ':'.join(sourcepath), |
| 83 | ' -classpath ', |
| 84 | ':'.join(['$(classpath %s)' % n for n in deps]), |
| 85 | '-d $TMP', |
| 86 | ]) + ';jar cf $OUT -C $TMP .' |
| 87 | |
| 88 | genrule( |
| 89 | name = name, |
| 90 | cmd = cmd, |
| 91 | srcs = srcs, |
| 92 | out = name + '.jar', |
| 93 | visibility = visibility, |
Ray Milkey | c340e28 | 2016-06-30 14:45:42 -0700 | [diff] [blame] | 94 | ) |
| 95 | |
Brian O'Connor | 9c2c823 | 2016-11-08 17:13:14 -0800 | [diff] [blame] | 96 | def sonar( |
| 97 | name, |
| 98 | test = False |
| 99 | ): |
| 100 | |
| 101 | cmd = '; '.join([ 'rm -f $OUT', |
| 102 | 'printf "%(src_base)s = " >> $OUT', |
| 103 | '%(srcs)s >> $OUT', |
| 104 | 'echo "%(binary_base)s = %(classes)s" >> $OUT', |
| 105 | 'printf "%(lib_base)s = " >> $OUT', |
| 106 | '%(libraries)s >> $OUT' |
| 107 | ]) % { |
| 108 | 'srcs' : "echo $(srcs :%s) | sed 's/ /,/g'" % name, |
| 109 | 'classes' : ("$(bin_dir :%s#non-osgi)" if not test else "$(bin_dir :%s)") % name, |
| 110 | 'libraries' : "echo $(classpath :%s) | sed 's/:/,/g'" % name, |
| 111 | 'src_base' : 'sonar.sources' if not test else 'sonar.tests', |
| 112 | 'binary_base' : 'sonar.java.binaries' if not test else 'sonar.java.test.binaries', |
| 113 | 'lib_base' : 'sonar.java.libraries' if not test else 'sonar.java.test.libraries' |
| 114 | } |
| 115 | # FIXME do we need to specify dep here or with the expander cover it? |
| 116 | genrule( |
| 117 | name = name + "-sonar", |
| 118 | cmd = cmd, |
| 119 | out = 'sonar-project.properties' |
| 120 | ) |
Ray Milkey | c340e28 | 2016-06-30 14:45:42 -0700 | [diff] [blame] | 121 | |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 122 | def osgi_jar( |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 123 | name = None, |
| 124 | srcs = None, |
Brian O'Connor | 1f16598 | 2016-04-06 21:36:09 -0700 | [diff] [blame] | 125 | group_id = ONOS_GROUP_ID, |
| 126 | version = ONOS_VERSION, |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 127 | deps = [], |
| 128 | visibility = ['PUBLIC'], |
| 129 | license = 'NONE', |
| 130 | description = '', |
| 131 | debug = False, |
Brian O'Connor | e5817c9 | 2016-04-06 15:41:48 -0700 | [diff] [blame] | 132 | import_packages = '*', |
Yuta HIGUCHI | f05db40 | 2016-08-12 18:36:33 -0700 | [diff] [blame] | 133 | dynamicimport_packages = '', |
Viswanath KSP | d4923cf | 2017-05-24 13:03:51 +0530 | [diff] [blame] | 134 | embedded_dependencies = '', |
Yuta HIGUCHI | 29d640c | 2017-04-19 19:37:18 -0700 | [diff] [blame] | 135 | export_packages = '!.,!*.impl.*,!*.internal.*,*', |
Ray Milkey | 2a74983 | 2016-08-02 15:22:20 -0700 | [diff] [blame] | 136 | package_name_root = 'org.onosproject', |
Brian O'Connor | 79b7067 | 2016-10-20 13:44:52 -0700 | [diff] [blame] | 137 | include_resources = {}, |
Brian O'Connor | e5817c9 | 2016-04-06 15:41:48 -0700 | [diff] [blame] | 138 | web_context = NONE, |
Brian O'Connor | 79b7067 | 2016-10-20 13:44:52 -0700 | [diff] [blame] | 139 | api_title = None, |
Brian O'Connor | e8468b5 | 2016-07-25 13:42:36 -0700 | [diff] [blame] | 140 | api_version = NONE, |
| 141 | api_package = NONE, |
| 142 | api_description = NONE, |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 143 | resources = NONE, |
Brian O'Connor | 0f6677d | 2016-04-06 23:26:51 -0700 | [diff] [blame] | 144 | resources_root = None, |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 145 | tests = None, |
Thomas Vachuska | 73436b5 | 2017-03-22 19:50:47 -0700 | [diff] [blame] | 146 | do_javadocs = True, |
| 147 | do_checkstyle = True, |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 148 | **kwargs |
| 149 | ): |
| 150 | |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 151 | # if name and _get_name() != name: |
| 152 | # print _get_name(), '!=', name |
| 153 | if name is None: |
| 154 | name = _get_name() |
| 155 | |
| 156 | if srcs is None: |
| 157 | srcs = glob([SRC + '/*.java']) |
| 158 | |
| 159 | if resources == NONE and resources_root is not None: |
| 160 | resources = glob([resources_root + '**']) |
| 161 | elif resources == NONE: |
| 162 | resources = glob([RESOURCES_ROOT + '**']) |
| 163 | |
| 164 | if resources and not resources_root: |
| 165 | resources_root = RESOURCES_ROOT |
| 166 | |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 167 | mvn_coords = group_id + ':' + name + ':' + version |
| 168 | |
Brian O'Connor | e8468b5 | 2016-07-25 13:42:36 -0700 | [diff] [blame] | 169 | onos_jar( |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 170 | name = name, |
| 171 | srcs = srcs + glob(['src/main/webapp/**']), |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 172 | deps = deps, |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 173 | visibility = visibility, |
Brian O'Connor | 0f6677d | 2016-04-06 23:26:51 -0700 | [diff] [blame] | 174 | resources = resources, |
| 175 | resources_root = resources_root, |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 176 | bundle_name = name, |
| 177 | group_id = group_id, |
| 178 | bundle_version = version, |
| 179 | bundle_license = license, |
| 180 | bundle_description = description, |
| 181 | import_packages = import_packages, |
| 182 | export_packages = export_packages, |
| 183 | include_resources = include_resources, |
| 184 | dynamicimport_packages = dynamicimport_packages, |
Viswanath KSP | d4923cf | 2017-05-24 13:03:51 +0530 | [diff] [blame] | 185 | embedded_dependencies = embedded_dependencies, |
Brian O'Connor | e8468b5 | 2016-07-25 13:42:36 -0700 | [diff] [blame] | 186 | web_context = web_context, |
| 187 | api_title = api_title, |
| 188 | api_version = api_version, |
| 189 | api_package = api_package, |
| 190 | api_description = api_description, |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 191 | tests = tests, |
| 192 | maven_coords = mvn_coords, |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 193 | **kwargs |
| 194 | ) |
| 195 | |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 196 | ### Checkstyle |
Thomas Vachuska | 73436b5 | 2017-03-22 19:50:47 -0700 | [diff] [blame] | 197 | if do_checkstyle: |
| 198 | checkstyle( |
Yuta HIGUCHI | 9312a80 | 2017-06-12 20:01:27 -0700 | [diff] [blame] | 199 | name = name, |
Thomas Vachuska | 73436b5 | 2017-03-22 19:50:47 -0700 | [diff] [blame] | 200 | srcs = srcs, |
Thomas Vachuska | 73436b5 | 2017-03-22 19:50:47 -0700 | [diff] [blame] | 201 | ) |
Brian O'Connor | b3cc604 | 2016-04-25 11:55:51 -0700 | [diff] [blame] | 202 | |
Thomas Vachuska | 73436b5 | 2017-03-22 19:50:47 -0700 | [diff] [blame] | 203 | if do_javadocs: |
| 204 | java_doc( |
| 205 | name = name + '-javadoc', |
| 206 | title = 'Java Docs', |
| 207 | pkgs = [ package_name_root ], |
| 208 | paths = [ 'src/main/java' ], |
| 209 | srcs = srcs, |
| 210 | deps = deps, |
| 211 | visibility = visibility, |
| 212 | do_it_wrong = False, |
| 213 | ) |
Ray Milkey | c340e28 | 2016-06-30 14:45:42 -0700 | [diff] [blame] | 214 | |
Brian O'Connor | b3cc604 | 2016-04-25 11:55:51 -0700 | [diff] [blame] | 215 | # TODO add project config for intellij |
| 216 | # project_config( |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 217 | # src_target = ':' + name, |
Brian O'Connor | b3cc604 | 2016-04-25 11:55:51 -0700 | [diff] [blame] | 218 | # src_roots = [ 'src/main/java' ], |
| 219 | # test_target = ':' + name + '-tests', |
| 220 | # test_roots = [ 'src/test/java' ], |
| 221 | # ) |
| 222 | |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 223 | ### .m2 Install |
Brian O'Connor | b86c920 | 2016-04-05 20:15:04 -0700 | [diff] [blame] | 224 | mvn_cmd = ' '.join(( 'mvn install:install-file', |
| 225 | '-Dfile=$(location :%s)' % name, |
| 226 | '-DgroupId=%s' % group_id, |
| 227 | '-DartifactId=%s' % name, |
| 228 | '-Dversion=%s' % version, |
| 229 | '-Dpackaging=jar' )) |
Brian O'Connor | e5817c9 | 2016-04-06 15:41:48 -0700 | [diff] [blame] | 230 | cmd = mvn_cmd + ' > $OUT' |
| 231 | if FORCE_INSTALL: |
| 232 | # Add a random number to the command to force this rule to run. |
| 233 | # TODO We should make this configurable from CLI, perhaps with a flag. |
| 234 | cmd = 'FOO=%s ' % random.random() + cmd |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 235 | genrule( |
| 236 | name = name + '-install', |
Brian O'Connor | b86c920 | 2016-04-05 20:15:04 -0700 | [diff] [blame] | 237 | bash = cmd, |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 238 | out = 'install.log', |
| 239 | visibility = visibility, |
| 240 | ) |
Brian O'Connor | 9c2c823 | 2016-11-08 17:13:14 -0800 | [diff] [blame] | 241 | sonar( |
| 242 | name = name, |
| 243 | ) |
Brian O'Connor | 42c38cf | 2016-04-05 17:05:57 -0700 | [diff] [blame] | 244 | |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 245 | def osgi_jar_with_tests( |
| 246 | name = None, |
| 247 | deps = [], |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 248 | group_id = ONOS_GROUP_ID, |
| 249 | version = ONOS_VERSION, |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 250 | test_srcs = None, |
| 251 | test_deps = [ '//lib:TEST' ], |
| 252 | test_resources = None, |
| 253 | test_resources_root = None, |
| 254 | visibility = [ 'PUBLIC' ], |
| 255 | **kwargs |
| 256 | ): |
| 257 | |
| 258 | if name is None: |
| 259 | name = _get_name() |
| 260 | |
Brian O'Connor | 0f6677d | 2016-04-06 23:26:51 -0700 | [diff] [blame] | 261 | if test_resources and not test_resources_root: |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 262 | test_resources_root = TEST_RESOURCES_ROOT |
| 263 | if test_resources_root and not test_resources: |
| 264 | test_resources = glob([test_resources_root + '**']) |
| 265 | if not test_resources and not test_resources_root: |
| 266 | test_resources = glob([TEST_RESOURCES_ROOT + '**']) |
| 267 | if test_resources: |
| 268 | test_resources_root = TEST_RESOURCES_ROOT |
Brian O'Connor | 0f6677d | 2016-04-06 23:26:51 -0700 | [diff] [blame] | 269 | |
Brian O'Connor | e4da59d | 2016-04-08 00:32:18 -0700 | [diff] [blame] | 270 | if test_srcs is None: |
| 271 | test_srcs = glob([TEST + '/*.java']) |
| 272 | |
Brian O'Connor | ee67495 | 2016-09-13 16:31:45 -0700 | [diff] [blame] | 273 | mvn_coords = group_id + ':' + name + ':jar:tests:' + version |
| 274 | |
Brian O'Connor | 9c2c823 | 2016-11-08 17:13:14 -0800 | [diff] [blame] | 275 | if test_srcs: |
| 276 | java_test( |
| 277 | name = name + '-tests', |
| 278 | srcs = test_srcs, |
| 279 | deps = deps + |
| 280 | test_deps + |
| 281 | [':' + name + '#non-osgi'], |
| 282 | resources = test_resources, |
| 283 | resources_root = test_resources_root, |
| 284 | maven_coords = mvn_coords, |
| 285 | visibility = visibility, |
| 286 | ) |
Brian O'Connor | be95f68 | 2016-05-18 15:40:19 -0700 | [diff] [blame] | 287 | |
Brian O'Connor | 9c2c823 | 2016-11-08 17:13:14 -0800 | [diff] [blame] | 288 | checkstyle( |
Yuta HIGUCHI | 295ee07 | 2017-06-21 15:48:21 -0700 | [diff] [blame] | 289 | name = name + '-tests', |
Brian O'Connor | 9c2c823 | 2016-11-08 17:13:14 -0800 | [diff] [blame] | 290 | srcs = test_srcs, |
Brian O'Connor | 9c2c823 | 2016-11-08 17:13:14 -0800 | [diff] [blame] | 291 | ) |
| 292 | |
| 293 | sonar( |
| 294 | name = name + '-tests', |
| 295 | test = True |
| 296 | ) |
| 297 | |
| 298 | osgi_jar(name = name, |
| 299 | deps = deps, |
| 300 | group_id = group_id, |
| 301 | version = version, |
| 302 | visibility = visibility, |
| 303 | tests = [':' + name + '-tests'], |
| 304 | **kwargs) |
| 305 | else: |
| 306 | osgi_jar(name = name, |
| 307 | deps = deps, |
| 308 | group_id = group_id, |
| 309 | version = version, |
| 310 | visibility = visibility, |
| 311 | **kwargs) |
Thomas Vachuska | be1a196 | 2016-10-25 16:59:29 -0700 | [diff] [blame] | 312 | |
| 313 | def tar_file( |
| 314 | name, |
| 315 | srcs, |
Brian O'Connor | 30322dd | 2017-08-14 19:11:29 -0700 | [diff] [blame] | 316 | other_tars = [], |
Thomas Vachuska | be1a196 | 2016-10-25 16:59:29 -0700 | [diff] [blame] | 317 | root = None, |
| 318 | out = None, |
| 319 | visibility = [ 'PUBLIC' ], |
| 320 | ): |
| 321 | |
Brian O'Connor | 30322dd | 2017-08-14 19:11:29 -0700 | [diff] [blame] | 322 | cmds = [ 'mkdir -p $TMP/%(root_dir)s', |
| 323 | 'cp -R -L $SRCDIR/* $TMP/%(root_dir)s' ] |
| 324 | for t in other_tars: |
| 325 | cmds += [ 'tar -zxf $(location %s)' % t + ' -C $TMP/%(root_dir)s' ] |
| 326 | cmds += [ 'tar -C $TMP -zcf $OUT %(root_dir)s' ] |
| 327 | |
| 328 | cmd = ' && '.join(cmds) % { |
Thomas Vachuska | be1a196 | 2016-10-25 16:59:29 -0700 | [diff] [blame] | 329 | 'root_dir': root if root is not None else name |
| 330 | } |
| 331 | |
| 332 | genrule( |
| 333 | name = name, |
| 334 | srcs = srcs, |
| 335 | bash = cmd, |
| 336 | out = out if out is not None else ( root if root is not None else name ) + '.tar.gz', |
| 337 | visibility = visibility, |
| 338 | ) |
Ray Milkey | 5c5454b | 2017-01-25 13:26:30 -0800 | [diff] [blame] | 339 | |
| 340 | def only_lib_dep_pom( |
| 341 | name, |
| 342 | src, |
| 343 | out, |
| 344 | version = ONOS_VERSION, |
| 345 | onosGroupId = ONOS_GROUP_ID, |
| 346 | visibility = [ 'PUBLIC' ], |
| 347 | ): |
| 348 | |
Ray Milkey | e46d31a | 2017-02-01 12:16:18 -0800 | [diff] [blame] | 349 | cmd = 'grep -v \<module\> ' + src + ' | sed "s#<modules>#<modules><module>lib</module>#" >$OUT' |
Ray Milkey | 5c5454b | 2017-01-25 13:26:30 -0800 | [diff] [blame] | 350 | |
| 351 | genrule( |
| 352 | name = name, |
| 353 | srcs = [ src ], |
| 354 | bash = cmd, |
| 355 | out = out, |
| 356 | visibility = visibility, |
| 357 | maven_coords = onosGroupId + ':onos:pom:' + version, |
| 358 | ) |
| 359 | |
| 360 | def pass_thru_pom( |
| 361 | name, |
| 362 | src, |
| 363 | out, |
| 364 | artifactId, |
| 365 | version = ONOS_VERSION, |
| 366 | onosGroupId = ONOS_GROUP_ID, |
| 367 | visibility = [ 'PUBLIC' ], |
| 368 | ): |
| 369 | |
| 370 | cmd = 'cp ' + src + ' $OUT' |
| 371 | |
| 372 | genrule( |
| 373 | name = name, |
| 374 | srcs = [ src ], |
| 375 | bash = cmd, |
| 376 | out = out, |
| 377 | visibility = visibility, |
| 378 | maven_coords = onosGroupId + ':' + artifactId + ':pom:' + version, |
| 379 | ) |