| #!/bin/bash -e |
| |
| # NOTE: All Gerrit plugins currently depend on, at a minimum |
| # the bucklets repo, and most plugins don't build outside the |
| # Gerrit tree, even with bucklets. As a result, we need to |
| # graft the plugin onto the Gerrit repo. We do this by checking |
| # out the proper version of Gerrit, removing the plugin if it |
| # exists, then use git read-tree to put the plugin we're |
| # building in place. |
| git checkout -f gerrit/{branch} |
| rm -rf plugins/{name} |
| git read-tree -u --prefix=plugins/{name} origin/{branch} |
| |
| TARGETS=$(echo "{targets}" | sed -e 's/{{name}}/{name}/g') |
| |
| SOURCE_LEVEL=$(grep "source_level" .buckconfig || echo "source_level=7") |
| . set-java.sh $(echo $SOURCE_LEVEL | cut -d '=' -f 2 | tr -d '[[:space:]]') |
| |
| buck build -v 3 $TARGETS |
| |
| for JAR in $(buck targets --show_output $TARGETS | awk '{{print $2}}') |
| do |
| PLUGIN_VERSION=$(git describe --always origin/{branch}) |
| echo -e "Implementation-Version: $PLUGIN_VERSION" > MANIFEST.MF |
| jar ufm $JAR MANIFEST.MF && rm MANIFEST.MF |
| DEST_JAR=buck-out/gen/plugins/{name}/$(basename $JAR) |
| [ "$JAR" -ef "$DEST_JAR" ] || mv $JAR $DEST_JAR |
| echo "$PLUGIN_VERSION" > buck-out/gen/plugins/{name}/$(basename $JAR-version) |
| done |