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