blob: 1b88c5111adc8086b4e033f441d73a2e7037f821 [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------------
# Generates a catalog for publishing ONOS artifacts to a Maven repository.
# -----------------------------------------------------------------------------
set -e -o pipefail
CATALOG=${1:-/tmp/onos.catalog}
rm -f $CATALOG
SHLVL=1 # Required not to have Bazel rebuild everything!
function writeCatalog {
bazel build $* --aspects tools/build/bazel/publish_catalog.bzl%publish_catalog 2>&1 \
| egrep "^DEBUG: " | cut -d\ -f3- >> $CATALOG
}
function jars {
egrep -v '(\# |grpc/api|build/conf)' tools/build/publish-target-list
}
function testJars {
egrep -v '(# |grpc/api|build/conf)' tools/build/publish-test-target-list
}
# Required to avoid having Bazel re-build stuff unnecessarily
export SHLVL=1
# Inject the onos-dependencies pom from lib/pom.xml
VERSION=$(egrep ONOS_VERSION tools/build/bazel/variables.bzl | cut -d\" -f2)
echo "lib/pom.xml org/onosproject/onos-dependencies/$VERSION/onos-dependencies-$VERSION.pom" >> $CATALOG
echo "Cataloging jar files..."
writeCatalog $(jars)
echo "Cataloging test jars..."
writeCatalog $(testJars)
echo "Cataloging source jars..."
writeCatalog $(jars | sed 's/$/-sources/')
echo "Cataloging javadoc jars..."
writeCatalog $(jars | sed 's/$/-javadoc/')
echo "Cataloging pom files..."
writeCatalog $(jars | sed 's/$/-pom/')
echo "Cataloging oar files..."
writeCatalog $(bazel query 'kind("_onos_oar rule", //...)')