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