Thomas Vachuska | 2988e14 | 2018-07-23 16:20:01 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Generates a catalog for publishing ONOS artifacts to a Maven repository. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Ray Milkey | 7f46b1f | 2018-07-24 19:01:58 -0700 | [diff] [blame] | 6 | set -e -o pipefail |
| 7 | |
Thomas Vachuska | 22a662b | 2018-07-24 11:25:19 -0700 | [diff] [blame] | 8 | CATALOG=${1:-/tmp/onos.catalog} |
Thomas Vachuska | 2988e14 | 2018-07-23 16:20:01 -0700 | [diff] [blame] | 9 | |
| 10 | rm -f $CATALOG |
| 11 | |
| 12 | SHLVL=1 # Required not to have Bazel rebuild everything! |
| 13 | |
| 14 | function writeCatalog { |
| 15 | bazel build $* --aspects tools/build/bazel/publish_catalog.bzl%publish_catalog 2>&1 \ |
| 16 | | egrep "^DEBUG: " | cut -d\ -f3- >> $CATALOG |
| 17 | } |
| 18 | |
| 19 | function jars { |
| 20 | egrep -v '(\# |grpc/api|build/conf)' tools/build/publish-target-list |
| 21 | } |
| 22 | |
| 23 | function testJars { |
| 24 | egrep -v '(# |grpc/api|build/conf)' tools/build/publish-test-target-list |
| 25 | } |
| 26 | |
Thomas Vachuska | b969769 | 2018-07-30 13:33:29 -0700 | [diff] [blame^] | 27 | # Required to avoid having Bazel re-build stuff unnecessarily |
| 28 | export SHLVL=1 |
| 29 | |
| 30 | # Inject the onos-dependencies pom from lib/pom.xml |
| 31 | VERSION=$(egrep ONOS_VERSION tools/build/bazel/variables.bzl | cut -d\" -f2) |
| 32 | echo "lib/pom.xml org/onosproject/onos-dependencies/$VERSION/onos-dependencies-$VERSION.pom" >> $CATALOG |
Thomas Vachuska | 2988e14 | 2018-07-23 16:20:01 -0700 | [diff] [blame] | 33 | |
| 34 | echo "Cataloging jar files..." |
| 35 | writeCatalog $(jars) |
| 36 | |
| 37 | echo "Cataloging test jars..." |
| 38 | writeCatalog $(testJars) |
| 39 | |
| 40 | echo "Cataloging source jars..." |
| 41 | writeCatalog $(jars | sed 's/$/-sources/') |
| 42 | echo "Cataloging javadoc jars..." |
| 43 | writeCatalog $(jars | sed 's/$/-javadoc/') |
| 44 | echo "Cataloging pom files..." |
| 45 | writeCatalog $(jars | sed 's/$/-pom/') |
| 46 | |
| 47 | echo "Cataloging oar files..." |
| 48 | writeCatalog $(bazel query 'kind("_onos_oar rule", //...)') |