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 | |
Thomas Vachuska | c534812 | 2018-08-08 17:48:45 -0700 | [diff] [blame] | 12 | # Required to avoid having Bazel re-build stuff unnecessarily |
| 13 | export SHLVL=1 |
Thomas Vachuska | 2988e14 | 2018-07-23 16:20:01 -0700 | [diff] [blame] | 14 | |
| 15 | function writeCatalog { |
| 16 | bazel build $* --aspects tools/build/bazel/publish_catalog.bzl%publish_catalog 2>&1 \ |
Thomas Vachuska | 74d28d8 | 2018-08-09 15:40:43 -0700 | [diff] [blame] | 17 | | egrep "^DEBUG: .*/publish_catalog.bzl:" | cut -d\ -f3- >> $CATALOG |
Thomas Vachuska | 2988e14 | 2018-07-23 16:20:01 -0700 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | function jars { |
| 21 | egrep -v '(\# |grpc/api|build/conf)' tools/build/publish-target-list |
| 22 | } |
| 23 | |
| 24 | function testJars { |
| 25 | egrep -v '(# |grpc/api|build/conf)' tools/build/publish-test-target-list |
| 26 | } |
| 27 | |
Thomas Vachuska | c534812 | 2018-08-08 17:48:45 -0700 | [diff] [blame] | 28 | # Extract the version from the Bazel variables file |
Thomas Vachuska | b969769 | 2018-07-30 13:33:29 -0700 | [diff] [blame] | 29 | VERSION=$(egrep ONOS_VERSION tools/build/bazel/variables.bzl | cut -d\" -f2) |
Thomas Vachuska | c534812 | 2018-08-08 17:48:45 -0700 | [diff] [blame] | 30 | |
| 31 | # Inject the onos-dependencies pom, ONOS tar, admin tar and test tar. |
| 32 | echo "Cataloging tar files..." |
| 33 | cat >> $CATALOG <<EOF |
| 34 | lib/pom.xml org/onosproject/onos-dependencies/$VERSION/onos-dependencies-$VERSION.pom |
| 35 | bazel-bin/onos.tar.gz org/onosproject/onos-releases/$VERSION/onos-$VERSION.tar.gz |
| 36 | bazel-bin/onos-admin.tar.gz org/onosproject/onos-releases/$VERSION/onos-admin-$VERSION.tar.gz |
| 37 | bazel-bin/onos-test.tar.gz org/onosproject/onos-releases/$VERSION/onos-test-$VERSION.tar.gz |
| 38 | EOF |
Thomas Vachuska | 2988e14 | 2018-07-23 16:20:01 -0700 | [diff] [blame] | 39 | |
| 40 | echo "Cataloging jar files..." |
| 41 | writeCatalog $(jars) |
| 42 | |
| 43 | echo "Cataloging test jars..." |
| 44 | writeCatalog $(testJars) |
| 45 | |
| 46 | echo "Cataloging source jars..." |
| 47 | writeCatalog $(jars | sed 's/$/-sources/') |
| 48 | echo "Cataloging javadoc jars..." |
| 49 | writeCatalog $(jars | sed 's/$/-javadoc/') |
| 50 | echo "Cataloging pom files..." |
| 51 | writeCatalog $(jars | sed 's/$/-pom/') |
| 52 | |
| 53 | echo "Cataloging oar files..." |
| 54 | writeCatalog $(bazel query 'kind("_onos_oar rule", //...)') |