Skip to content

Commit 794049e

Browse files
committed
Ignores changes to Build.java
1 parent 50c7e11 commit 794049e

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

libs/sparkpost-lib/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/main/java/com/sparkpost/Build.java
2+

tools/bin/doRelease.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#! /usr/bin/env bash
2+
3+
# web-client/tools/bin
4+
bin=`dirname "$0"`
5+
6+
# web-client
7+
bin=`cd $bin/../..; pwd`
8+
echo "project base directory: $bin"
9+
10+
echo "Checking project..."
11+
12+
version=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | egrep -v '^\[|Downloading:' | tr -d ' \n' | sed -E 's/\[.*\]//g')
13+
echo "Current project version: $version"
14+
15+
if [ $# == 0 ]
16+
then
17+
echo "------------------------------------------------ "
18+
19+
echo "Usage Error: you must specify two arguments..."
20+
echo "Usage: doRelease [FROM_VERSION] [TO_VERSION]"
21+
echo " "
22+
echo " Example: doRelease $version 0.0.1"
23+
echo " "
24+
echo "------------------------------------------------ "
25+
echo " "
26+
exit -1
27+
fi
28+
29+
toVersion='0.0.1'
30+
# Single argument
31+
if [ $# == 1 ]
32+
then
33+
echo "doing single argument path ($1)"
34+
toVersion = $1
35+
fi
36+
37+
38+
# Single argument
39+
if [ $# == 2 ]
40+
then
41+
echo "doing two argument path ($1,$2)"
42+
version=$1
43+
toVersion=$2
44+
fi
45+
46+
47+
echo "Will change project from $version to $toVersion"
48+
49+
echo reset Build.java
50+
git checkout ./libs/sparkpost-lib/src/main/java/com/sparkpost/Build.java
51+
52+
# Update pom files with new version
53+
mvn versions:set -DoldVersion=$version -DnewVersion=$toVersion
54+
55+
56+
GIT_LOG_LINES=`git log --oneline | wc -l | sed -e 's/^[[:space:]]*//'`
57+
TGT_BUILD_FILE="./libs/sparkpost-lib/src/main/java/com/sparkpost/Build.java "
58+
SHORT_HASH=`git log -1 --pretty=format:%h`
59+
LONG_HASH=`git log -1 --pretty=format:%H`
60+
CURRENT_DATE=`date`
61+
JOB_NAME="SparkPost Library"
62+
63+
echo "log lines: $GIT_LOG_LINES"
64+
65+
echo "[PRE_BUILD_SCRIPT] ${TGT_BUILD_FILE} BEFORE adding build specifics"
66+
echo "`grep = ${TGT_BUILD_FILE}`"
67+
perl -p -i -e "s/BUILD_VERSION_NAME/${toVersion}/" ${TGT_BUILD_FILE}
68+
perl -p -i -e "s/BUILD_GENERATED_NAME/${JOB_NAME}/" ${TGT_BUILD_FILE}
69+
perl -p -i -e "s/BUILD_GENERATED_VERSION/${GIT_LOG_LINES}/" ${TGT_BUILD_FILE}
70+
perl -p -i -e "s/BUILD_GENERATED_SHORT_GIT_HASH/${SHORT_HASH:0:7}/" ${TGT_BUILD_FILE}
71+
perl -p -i -e "s/BUILD_GENERATED_GIT_HASH/${LONG_HASH}/" ${TGT_BUILD_FILE}
72+
perl -p -i -e "s/BUILD_GENERATED_DATE/${CURRENT_DATE}/" ${TGT_BUILD_FILE}
73+
echo "[PRE_BUILD_SCRIPT] ${TGT_BUILD_FILE} AFTER adding build specifics"
74+
echo "`grep = ${TGT_BUILD_FILE}`"
75+
76+
77+
78+
79+
# Done
80+
echo " "
81+
echo "*** You SHOULD do a 'git diff' to make sure everything looks correct before pushing to master."
82+
echo " "

0 commit comments

Comments
 (0)