1*6f06be9bSShawn O. Pearce#!/bin/sh 2*6f06be9bSShawn O. Pearce# Copyright (C) 2009, Google Inc. 3*6f06be9bSShawn O. Pearce# and other copyright owners as documented in the project's IP log. 4*6f06be9bSShawn O. Pearce# 5*6f06be9bSShawn O. Pearce# This program and the accompanying materials are made available 6*6f06be9bSShawn O. Pearce# under the terms of the Eclipse Distribution License v1.0 which 7*6f06be9bSShawn O. Pearce# accompanies this distribution, is reproduced below, and is 8*6f06be9bSShawn O. Pearce# available at http://www.eclipse.org/org/documents/edl-v10.php 9*6f06be9bSShawn O. Pearce# 10*6f06be9bSShawn O. Pearce# All rights reserved. 11*6f06be9bSShawn O. Pearce# 12*6f06be9bSShawn O. Pearce# Redistribution and use in source and binary forms, with or 13*6f06be9bSShawn O. Pearce# without modification, are permitted provided that the following 14*6f06be9bSShawn O. Pearce# conditions are met: 15*6f06be9bSShawn O. Pearce# 16*6f06be9bSShawn O. Pearce# - Redistributions of source code must retain the above copyright 17*6f06be9bSShawn O. Pearce# notice, this list of conditions and the following disclaimer. 18*6f06be9bSShawn O. Pearce# 19*6f06be9bSShawn O. Pearce# - Redistributions in binary form must reproduce the above 20*6f06be9bSShawn O. Pearce# copyright notice, this list of conditions and the following 21*6f06be9bSShawn O. Pearce# disclaimer in the documentation and/or other materials provided 22*6f06be9bSShawn O. Pearce# with the distribution. 23*6f06be9bSShawn O. Pearce# 24*6f06be9bSShawn O. Pearce# - Neither the name of the Eclipse Foundation, Inc. nor the 25*6f06be9bSShawn O. Pearce# names of its contributors may be used to endorse or promote 26*6f06be9bSShawn O. Pearce# products derived from this software without specific prior 27*6f06be9bSShawn O. Pearce# written permission. 28*6f06be9bSShawn O. Pearce# 29*6f06be9bSShawn O. Pearce# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 30*6f06be9bSShawn O. Pearce# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 31*6f06be9bSShawn O. Pearce# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 32*6f06be9bSShawn O. Pearce# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33*6f06be9bSShawn O. Pearce# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 34*6f06be9bSShawn O. Pearce# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35*6f06be9bSShawn O. Pearce# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 36*6f06be9bSShawn O. Pearce# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 37*6f06be9bSShawn O. Pearce# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 38*6f06be9bSShawn O. Pearce# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39*6f06be9bSShawn O. Pearce# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 40*6f06be9bSShawn O. Pearce# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 41*6f06be9bSShawn O. Pearce# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42*6f06be9bSShawn O. Pearce 43*6f06be9bSShawn O. Pearce 44*6f06be9bSShawn O. Pearce# Update all pom.xml and MANIFEST.MF with new build number 45*6f06be9bSShawn O. Pearce# 46*6f06be9bSShawn O. Pearce# TODO(spearce) This should be converted to some sort of 47*6f06be9bSShawn O. Pearce# Java based Maven plugin so its fully portable. 48*6f06be9bSShawn O. Pearce# 49*6f06be9bSShawn O. Pearce 50*6f06be9bSShawn O. Pearcecase "$1" in 51*6f06be9bSShawn O. Pearce--snapshot=*) 52*6f06be9bSShawn O. Pearce V=$(echo "$1" | perl -pe 's/^--snapshot=//') 53*6f06be9bSShawn O. Pearce if [ -z "$V" ] 54*6f06be9bSShawn O. Pearce then 55*6f06be9bSShawn O. Pearce echo >&2 "usage: $0 --snapshot=0.n.0" 56*6f06be9bSShawn O. Pearce exit 1 57*6f06be9bSShawn O. Pearce fi 58*6f06be9bSShawn O. Pearce case "$V" in 59*6f06be9bSShawn O. Pearce *-SNAPSHOT) : ;; 60*6f06be9bSShawn O. Pearce *) V=$V-SNAPSHOT ;; 61*6f06be9bSShawn O. Pearce esac 62*6f06be9bSShawn O. Pearce ;; 63*6f06be9bSShawn O. Pearce 64*6f06be9bSShawn O. Pearce--release) 65*6f06be9bSShawn O. Pearce V=$(git describe HEAD) || exit 66*6f06be9bSShawn O. Pearce ;; 67*6f06be9bSShawn O. Pearce 68*6f06be9bSShawn O. Pearce*) 69*6f06be9bSShawn O. Pearce echo >&2 "usage: $0 {--snapshot=0.n.0 | --release}" 70*6f06be9bSShawn O. Pearce exit 1 71*6f06be9bSShawn O. Pearceesac 72*6f06be9bSShawn O. Pearce 73*6f06be9bSShawn O. Pearcecase "$V" in 74*6f06be9bSShawn O. Pearcev*) V=$(echo "$V" | perl -pe s/^v//) ;; 75*6f06be9bSShawn O. Pearceesac 76*6f06be9bSShawn O. Pearce 77*6f06be9bSShawn O. Pearcecase "$V" in 78*6f06be9bSShawn O. Pearce*-SNAPSHOT) 79*6f06be9bSShawn O. Pearce POM_V=$V 80*6f06be9bSShawn O. Pearce MF_V=$(echo "$V" | perl -pe 's/-SNAPSHOT$/.qualifier/') 81*6f06be9bSShawn O. Pearce ;; 82*6f06be9bSShawn O. Pearce*-[1-9]*-g[0-9a-f]*) 83*6f06be9bSShawn O. Pearce POM_V=$(echo "$V" | perl -pe 's/-(\d+-g.*)$/.$1/') 84*6f06be9bSShawn O. Pearce MF_V=$POM_V 85*6f06be9bSShawn O. Pearce ;; 86*6f06be9bSShawn O. Pearce*) 87*6f06be9bSShawn O. Pearce POM_V=$V 88*6f06be9bSShawn O. Pearce MF_V=$V 89*6f06be9bSShawn O. Pearce ;; 90*6f06be9bSShawn O. Pearceesac 91*6f06be9bSShawn O. Pearce 92*6f06be9bSShawn O. Pearceperl -pi -e ' 93*6f06be9bSShawn O. Pearce s/^(Bundle-Version:).*/$1 '"$MF_V"'/ 94*6f06be9bSShawn O. Pearce ' $(git ls-files | grep META-INF/MANIFEST.MF) 95*6f06be9bSShawn O. Pearce 96*6f06be9bSShawn O. Pearceperl -pi -e ' 97*6f06be9bSShawn O. Pearce if ($ARGV ne $old_argv) { 98*6f06be9bSShawn O. Pearce $seen_version = 0; 99*6f06be9bSShawn O. Pearce $old_argv = $ARGV; 100*6f06be9bSShawn O. Pearce } 101*6f06be9bSShawn O. Pearce if (!$seen_version) { 102*6f06be9bSShawn O. Pearce $seen_version = 1 if 103*6f06be9bSShawn O. Pearce s{(<version>).*(</version>)}{${1}'"$POM_V"'${2}}; 104*6f06be9bSShawn O. Pearce } 105*6f06be9bSShawn O. Pearce ' $(git ls-files | grep pom.xml) 106*6f06be9bSShawn O. Pearce 107*6f06be9bSShawn O. Pearcegit diff 108