Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | BUCK_LOCAL_CONFIG=${BUCK_LOCAL_CONFIG:-$ONOS_ROOT/.buckconfig.local} |
| 4 | MVN_REPO="https://oss.sonatype.org/content/repositories/snapshots" |
| 5 | NO_BUCKD=1 |
| 6 | |
| 7 | set -e |
| 8 | set -x |
| 9 | |
| 10 | #FIXME if pwd != buck |
| 11 | pushd buck |
| 12 | |
| 13 | # build buck |
| 14 | scripts/create_tag.sh |
| 15 | buck build buck --show-output |
| 16 | |
| 17 | # publish cli:main-fixed as buck-api |
| 18 | cp $BUCK_LOCAL_CONFIG . |
| 19 | buck publish //src/com/facebook/buck/cli:main-fixed \ |
| 20 | --remote-repo=https://oss.sonatype.org/content/repositories/snapshots/ \ |
| 21 | | tee ../api-publish.txt |
| 22 | |
| 23 | # Alternatively, we can deploy org.onosproject:buck-api with the following: |
| 24 | #mvn deploy:deploy-file -DgroupId=org.onosproject -DartifactId=buck-api \ |
| 25 | # -Dversion=0.1-SNAPSHOT -DgeneratePom=true -Dpackaging=jar \ |
| 26 | # -DrepositoryId=snapshot -Durl=https://oss.sonatype.org/content/repositories/snapshots/ \ |
| 27 | # -Dfile=buck-out/gen/src/com/facebook/buck/cli/main-fixed/main-fixed.jar |
| 28 | |
| 29 | #FIXME upload API to S3 for backup |
| 30 | |
| 31 | popd #buck |
| 32 | |
| 33 | SNAPSHOT_VERSION=$(cat api-publish.txt | grep "^org.onosproject:buck-api:jar" \ |
| 34 | | cut -d' ' -f1 | cut -d: -f4) |
| 35 | BUCK_API_URL="$MVN_REPO/org/onosproject/buck-api/0.1-SNAPSHOT/buck-api-$SNAPSHOT_VERSION.jar" |
| 36 | echo $BUCK_API_URL |
| 37 | |
| 38 | BUCK_API_SHA=$(shasum buck-out/gen/src/com/facebook/buck/cli/main-fixed/main-fixed.jar | cut -d' ' -f1) |
| 39 | echo $BUCK_API_SHA |
| 40 | |
| 41 | pushd onos |
| 42 | sed -i "" -E "s#url =.*#url = '$BUCK_API_URL',#" tools/build/buck-plugin/BUCK |
| 43 | sed -i "" -E "s#sha1 =.*#sha1 = '$BUCK_API_SHA',#" tools/build/buck-plugin/BUCK |
| 44 | popd #onos |
| 45 | |
| 46 | #pushd onos-yang-tools |
| 47 | #FIXME update version (assume 0.1-SNAPSHOT for now) |
| 48 | #popd #onos-yang-tools |
| 49 | |
| 50 | set +x |
| 51 | |
| 52 | echo |
| 53 | echo "Please build and verify the ONOS Buck plugin and the Yang tools plugin:" |
| 54 | echo " cd onos; buck build //tools/build/buck-plugin:onosjar" |
| 55 | echo " cd onos-yang-tools; mvn clean package" |
| 56 | echo "You should commit and push any required changes." |