16f06be9bSShawn O. Pearce#!/bin/sh 26f06be9bSShawn O. Pearce# Copyright (C) 2009, Google Inc. 36f06be9bSShawn O. Pearce# and other copyright owners as documented in the project's IP log. 46f06be9bSShawn O. Pearce# 56f06be9bSShawn O. Pearce# This program and the accompanying materials are made available 66f06be9bSShawn O. Pearce# under the terms of the Eclipse Distribution License v1.0 which 76f06be9bSShawn O. Pearce# accompanies this distribution, is reproduced below, and is 86f06be9bSShawn O. Pearce# available at http://www.eclipse.org/org/documents/edl-v10.php 96f06be9bSShawn O. Pearce# 106f06be9bSShawn O. Pearce# All rights reserved. 116f06be9bSShawn O. Pearce# 126f06be9bSShawn O. Pearce# Redistribution and use in source and binary forms, with or 136f06be9bSShawn O. Pearce# without modification, are permitted provided that the following 146f06be9bSShawn O. Pearce# conditions are met: 156f06be9bSShawn O. Pearce# 166f06be9bSShawn O. Pearce# - Redistributions of source code must retain the above copyright 176f06be9bSShawn O. Pearce# notice, this list of conditions and the following disclaimer. 186f06be9bSShawn O. Pearce# 196f06be9bSShawn O. Pearce# - Redistributions in binary form must reproduce the above 206f06be9bSShawn O. Pearce# copyright notice, this list of conditions and the following 216f06be9bSShawn O. Pearce# disclaimer in the documentation and/or other materials provided 226f06be9bSShawn O. Pearce# with the distribution. 236f06be9bSShawn O. Pearce# 246f06be9bSShawn O. Pearce# - Neither the name of the Eclipse Foundation, Inc. nor the 256f06be9bSShawn O. Pearce# names of its contributors may be used to endorse or promote 266f06be9bSShawn O. Pearce# products derived from this software without specific prior 276f06be9bSShawn O. Pearce# written permission. 286f06be9bSShawn O. Pearce# 296f06be9bSShawn O. Pearce# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 306f06be9bSShawn O. Pearce# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 316f06be9bSShawn O. Pearce# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 326f06be9bSShawn O. Pearce# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 336f06be9bSShawn O. Pearce# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 346f06be9bSShawn O. Pearce# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 356f06be9bSShawn O. Pearce# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 366f06be9bSShawn O. Pearce# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 376f06be9bSShawn O. Pearce# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 386f06be9bSShawn O. Pearce# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 396f06be9bSShawn O. Pearce# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 406f06be9bSShawn O. Pearce# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 416f06be9bSShawn O. Pearce# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 426f06be9bSShawn O. Pearce 436f06be9bSShawn O. Pearce 44fc5fc70eSShawn O. Pearce# Update all pom.xml with new build number 456f06be9bSShawn O. Pearce# 466f06be9bSShawn O. Pearce# TODO(spearce) This should be converted to some sort of 476f06be9bSShawn O. Pearce# Java based Maven plugin so its fully portable. 486f06be9bSShawn O. Pearce# 496f06be9bSShawn O. Pearce 506f06be9bSShawn O. Pearcecase "$1" in 516f06be9bSShawn O. Pearce--snapshot=*) 526f06be9bSShawn O. Pearce V=$(echo "$1" | perl -pe 's/^--snapshot=//') 536f06be9bSShawn O. Pearce if [ -z "$V" ] 546f06be9bSShawn O. Pearce then 556f06be9bSShawn O. Pearce echo >&2 "usage: $0 --snapshot=0.n.0" 566f06be9bSShawn O. Pearce exit 1 576f06be9bSShawn O. Pearce fi 586f06be9bSShawn O. Pearce case "$V" in 596f06be9bSShawn O. Pearce *-SNAPSHOT) : ;; 606f06be9bSShawn O. Pearce *) V=$V-SNAPSHOT ;; 616f06be9bSShawn O. Pearce esac 626f06be9bSShawn O. Pearce ;; 636f06be9bSShawn O. Pearce 646f06be9bSShawn O. Pearce--release) 656f06be9bSShawn O. Pearce V=$(git describe HEAD) || exit 666f06be9bSShawn O. Pearce ;; 676f06be9bSShawn O. Pearce 686f06be9bSShawn O. Pearce*) 696f06be9bSShawn O. Pearce echo >&2 "usage: $0 {--snapshot=0.n.0 | --release}" 706f06be9bSShawn O. Pearce exit 1 716f06be9bSShawn O. Pearceesac 726f06be9bSShawn O. Pearce 736f06be9bSShawn O. Pearcecase "$V" in 746f06be9bSShawn O. Pearcev*) V=$(echo "$V" | perl -pe s/^v//) ;; 756f06be9bSShawn O. Pearceesac 766f06be9bSShawn O. Pearce 776f06be9bSShawn O. Pearcecase "$V" in 786f06be9bSShawn O. Pearce*-SNAPSHOT) 796f06be9bSShawn O. Pearce POM_V=$V 80764f1635SShawn O. Pearce OSGI_V="${V%%-SNAPSHOT}.qualifier" 816f06be9bSShawn O. Pearce ;; 826f06be9bSShawn O. Pearce*-[1-9]*-g[0-9a-f]*) 836f06be9bSShawn O. Pearce POM_V=$(echo "$V" | perl -pe 's/-(\d+-g.*)$/.$1/') 84764f1635SShawn O. Pearce OSGI_V=$(perl -e ' 858d88a842SShawn O. Pearce die unless $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?(?:\.\d{12}-r)?)?-(\d+)-g(.*)$/; 86764f1635SShawn O. Pearce my ($a, $b, $c, $p, $r) = ($1, $2, $3, $4, $5); 87764f1635SShawn O. Pearce $b = '0' unless defined $b; 88764f1635SShawn O. Pearce $c = '0' unless defined $c; 89764f1635SShawn O. Pearce 90764f1635SShawn O. Pearce printf "%s.%s.%s.%6.6i_g%s\n", $a, $b, $c, $p, $r; 91764f1635SShawn O. Pearce ' "$V") 926f06be9bSShawn O. Pearce ;; 936f06be9bSShawn O. Pearce*) 946f06be9bSShawn O. Pearce POM_V=$V 95764f1635SShawn O. Pearce OSGI_V=$V 966f06be9bSShawn O. Pearce ;; 976f06be9bSShawn O. Pearceesac 986f06be9bSShawn O. Pearce 99764f1635SShawn O. PearceAPI_V=$(perl -e ' 100764f1635SShawn O. Pearce $ARGV[0] =~ /^(\d+(?:\.\d+(?:\.\d+)?)?)/; 101764f1635SShawn O. Pearce print $1 102764f1635SShawn O. Pearce ' "$V") 103764f1635SShawn O. Pearce 104764f1635SShawn O. PearceAPI_N=$(perl -e ' 105764f1635SShawn O. Pearce $ARGV[0] =~ /^(\d+)(?:\.(\d+)(?:\.(\d+))?)?/; 106764f1635SShawn O. Pearce my ($a, $b) = ($1, $2); 107764f1635SShawn O. Pearce $b = 0 unless defined $b; 108764f1635SShawn O. Pearce $b++; 109764f1635SShawn O. Pearce print "$a.$b.0"; 110764f1635SShawn O. Pearce ' "$API_V") 111764f1635SShawn O. Pearce 112200f3caeSShawn O. Pearceperl -pi~ -e ' 113764f1635SShawn O. Pearce s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/; 114764f1635SShawn O. Pearce s/(org.eclipse.jgit.*;version=")[^"[(]*(")/${1}'"$API_V"'${2}/; 115764f1635SShawn O. Pearce s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$API_V,$API_N"'${2}/; 116764f1635SShawn O. Pearce ' $(git ls-files | grep META-INF/MANIFEST.MF) 117764f1635SShawn O. Pearce 118200f3caeSShawn O. Pearceperl -pi~ -e ' 119e2a35242SMatthias Sohn s/^(Bundle-Version:\s*).*$/${1}'"$OSGI_V"'/; 120e2a35242SMatthias Sohn s/(org.eclipse.jgit.*;version=")[^"[(]*(")/${1}'"$API_V"'${2}/; 121e2a35242SMatthias Sohn s/(org.eclipse.jgit.*;version="\[)[^"]*(\)")/${1}'"$API_V,$API_N"'${2}/; 122e2a35242SMatthias Sohn ' $(git ls-files | grep META-INF/SOURCE-MANIFEST.MF) 123e2a35242SMatthias Sohn 124e2a35242SMatthias Sohnperl -pi~ -e ' 125764f1635SShawn O. Pearce if ($ARGV ne $old_argv) { 126764f1635SShawn O. Pearce $seen_version = 0; 127764f1635SShawn O. Pearce $old_argv = $ARGV; 128764f1635SShawn O. Pearce } 129764f1635SShawn O. Pearce if (!$seen_version) { 130764f1635SShawn O. Pearce $seen_version = 1 if (!/<\?xml/ && 131764f1635SShawn O. Pearce s/(version=")[^"]*(")/${1}'"$OSGI_V"'${2}/); 132764f1635SShawn O. Pearce } 1337804045cSShawn O. Pearce ' org.eclipse.jgit.packaging/org.*.feature/feature.xml 134764f1635SShawn O. Pearce 135200f3caeSShawn O. Pearceperl -pi~ -e ' 136*79a2e28aSMatthias Sohn if ($ARGV ne $old_argv) { 137*79a2e28aSMatthias Sohn $seen_version = 0; 138*79a2e28aSMatthias Sohn $old_argv = $ARGV; 139*79a2e28aSMatthias Sohn } 140*79a2e28aSMatthias Sohn if (!$seen_version) { 141*79a2e28aSMatthias Sohn $seen_version = 1 if 142764f1635SShawn O. Pearce s{<(version)>.*</\1>}{<${1}>'"$POM_V"'</${1}>}; 143*79a2e28aSMatthias Sohn } 1447804045cSShawn O. Pearce ' org.eclipse.jgit.packaging/org.*.feature/pom.xml 145764f1635SShawn O. Pearce 146200f3caeSShawn O. Pearceperl -pi~ -e ' 147764f1635SShawn O. Pearce if ($ARGV ne $old_argv) { 148764f1635SShawn O. Pearce $seen_version = 0; 149764f1635SShawn O. Pearce $old_argv = $ARGV; 150764f1635SShawn O. Pearce } 151c1f352c1SMatthias Sohn if ($seen_version < 5) { 152764f1635SShawn O. Pearce $seen_version++ if 153764f1635SShawn O. Pearce s{<(version)>.*</\1>}{<${1}>'"$POM_V"'</${1}>}; 154764f1635SShawn O. Pearce } 155764f1635SShawn O. Pearce ' org.eclipse.jgit.packaging/org.eclipse.jgit.updatesite/pom.xml 156764f1635SShawn O. Pearce 157200f3caeSShawn O. Pearceperl -pi~ -e ' 1586f06be9bSShawn O. Pearce if ($ARGV ne $old_argv) { 1596f06be9bSShawn O. Pearce $seen_version = 0; 1606f06be9bSShawn O. Pearce $old_argv = $ARGV; 1616f06be9bSShawn O. Pearce } 162*79a2e28aSMatthias Sohn if (!$seen_version) { 163*79a2e28aSMatthias Sohn $seen_version = 1 if 164e2a35242SMatthias Sohn s{<(version)>.*</\1>}{<${1}>'"$POM_V"'</${1}>}; 165e2a35242SMatthias Sohn } 166e2a35242SMatthias Sohn ' org.eclipse.jgit.packaging/pom.xml 167e2a35242SMatthias Sohn 168e2a35242SMatthias Sohnperl -pi~ -e ' 169e2a35242SMatthias Sohn if ($ARGV ne $old_argv) { 170e2a35242SMatthias Sohn $seen_version = 0; 171e2a35242SMatthias Sohn $old_argv = $ARGV; 172e2a35242SMatthias Sohn } 1736f06be9bSShawn O. Pearce if (!$seen_version) { 1746f06be9bSShawn O. Pearce $seen_version = 1 if 175fc5fc70eSShawn O. Pearce s{<(version)>.*</\1>}{<${1}>'"$POM_V"'</${1}>}; 1766f06be9bSShawn O. Pearce } 1776f06be9bSShawn O. Pearce ' $(git ls-files | grep pom.xml) 1786f06be9bSShawn O. Pearce 179200f3caeSShawn O. Pearcefind . -name '*~' | xargs rm -f 1806f06be9bSShawn O. Pearcegit diff 181