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