3 selfdir=$(dirname $(readlink -f $0))
5 selfpath=$selfdir/$self
7 version_xyz=`echo $version | awk 'BEGIN { FS="." } { printf("%d.%d.%d", $1, $2, $3); }'`
11 tagForVersion=v${version}
15 versiondir=$rundir/$version
17 ###############################################################################
19 declare -a repositories=(
20 "simantics/third-party.git" "third-party"
21 "simantics/platform.git" "platform"
22 "simantics/fmil.git" "fmil"
23 "simantics/interop.git" "interop"
24 "simantics/district.git" "district"
25 "simantics/matlab.git" "matlab"
26 "simantics/python.git" "python"
28 "simantics/sysdyn.git" "sysdyn"
29 "simantics/3d.git" "3d"
30 "members/fmi.git" "fmi"
31 "members/simupedia.git" "simupedia"
32 "gold-members/proteus.git" "proteus"
35 repositoryCount=$((${#repositories[@]} / 2))
38 eval $1=\${repositories[$(($2 * 2))]}
42 eval $1=\${repositories[$(($2 * 2 + 1))]}
45 function version_xyz {
49 ###############################################################################
52 echo "[$(($1+1))/${repositoryCount}] $2"
56 echo "git clone ssh://${user}@www.simantics.org:29418/$1"
57 git clone ssh://${user}@www.simantics.org:29418/$1
76 echo "git fetch --all"
86 echo "git push origin $1"
91 echo "git checkout $1"
96 echo "git tag $1 -m \"Simantics $1 simultaneous release\""
97 git tag $1 -m "Simantics $1 simultaneous release"
106 echo "git push origin --tags"
107 git push origin --tags
115 git diff --stat --patch $@
119 git log --pretty --oneline --graph --decorate=full $@
126 function listBranches {
135 echo "Replacing $from' with '$to' in file $i"
136 cat $i | awk "{ gsub(\"$from\", \"$to\"); print }" > $i.tmp
141 function bumpSequenceNumber {
142 echo "bumpSequenceNumber '$1'"
145 regex="sequenceNumber=\"[0-9]+\"";
151 if (match($0, regex)) {
152 before = substr($0,1,RSTART-1);
153 after = substr($0,RSTART+RLENGTH);
154 printf("%ssequenceNumber=\"%s\"%s\n", before, epoch, after);
163 ###############################################################################
168 pushd $version > /dev/null
169 for (( i=0; i<${repositoryCount}; i++ )); do
179 if [ -n "$version" ] && [ -d $version ]; then
180 pushd $version >/dev/null || action="*"
181 elif [ -n "$version" ]; then
182 # The directory does not exist yet so don't do anything
188 for (( i=0; i<${repositoryCount}; i++ )); do
190 msg $i "Stage changes in $lp"
191 pushd $lp > /dev/null
197 for (( i=0; i<${repositoryCount}; i++ )); do
199 msg $i "Create $branch branch in $lp"
200 pushd $lp > /dev/null
206 for (( i=0; i<${repositoryCount}; i++ )); do
208 msg $i "Checkout $branch branch in $lp"
209 pushd $lp > /dev/null
215 for (( i=0; i<${repositoryCount}; i++ )); do
217 msg $i "Checkout $branch branch in $lp"
218 pushd $lp > /dev/null
224 for (( i=0; i<${repositoryCount}; i++ )); do
226 msg $i "Tag ${version} for $lp"
227 pushd $lp > /dev/null
234 for (( i=0; i<${repositoryCount}; i++ )); do
236 msg $i "List branches in $lp"
237 pushd $lp > /dev/null
243 for (( i=0; i<${repositoryCount}; i++ )); do
245 msg $i "List tags in $lp"
246 pushd $lp > /dev/null
252 for (( i=0; i<${repositoryCount}; i++ )); do
254 msg $i "Remove tag $tagForVersion from $lp"
255 pushd $lp > /dev/null
256 removeTag ${tagForVersion}
261 for (( i=0; i<${repositoryCount}; i++ )); do
263 msg $i "Fetch from remote origin in $lp"
264 pushd $lp > /dev/null
270 for (( i=0; i<${repositoryCount}; i++ )); do
272 msg $i "Pull from remote origin in $lp"
273 pushd $lp > /dev/null
279 for (( i=0; i<${repositoryCount}; i++ )); do
281 msg $i "Push branch $branch to remote origin in $lp"
282 pushd $lp > /dev/null
288 for (( i=0; i<${repositoryCount}; i++ )); do
290 msg $i "Push tags to remote origin in $lp"
291 pushd $lp > /dev/null
297 for (( i=0; i<${repositoryCount}; i++ )); do
299 msg $i "Status of $lp"
300 pushd $lp > /dev/null
306 for (( i=0; i<${repositoryCount}; i++ )); do
308 msg $i "Diff $branch branch in $lp"
309 pushd $lp > /dev/null
315 for (( i=0; i<${repositoryCount}; i++ )); do
318 pushd $lp > /dev/null
324 for (( i=0; i<${repositoryCount}; i++ )); do
326 msg $i "'git reset $@' in $lp"
327 pushd $lp > /dev/null
333 prepare-release-branch)
336 # Fix branch name from P2 repository locations
337 for i in platform/releng/org.simantics.sdk.build.targetdefinition/*.{tpd,target} \
338 simupedia/fi.semantum.simupedia.build.targetdefinition/*.{tpd,target}
340 repl "/$fromBranch/" "/$branch/" $i
343 # Bump .target file sequenceNumbers
344 for i in platform/releng/org.simantics.sdk.build.targetdefinition/*.target \
345 simupedia/fi.semantum.simupedia.build.targetdefinition/*.{tpd,target}
347 bumpSequenceNumber $i
351 git commit -a -m "Configured $branch branch for SDK builds"
356 git commit -a -m "Configured $branch branch for SDK builds"
365 bash $selfpath $version master $user checkout
367 repl "$fromVersion" "$toVersion" platform/bundles/org.simantics.desktop.product/splash.svg
368 repl "$fromVersion" "$toVersion" platform/features/org.simantics.sdk.feature/feature.xml
369 repl "$fromVersion" "$toVersion" platform/releng/org.simantics.sdk.repository/pom.xml
370 repl "Simantics $fromVersion" "Simantics $toVersion" platform/releng/org.simantics.sdk.build.targetdefinition/simantics.{tpd,target}
371 repl "Simupedia $fromVersion" "Simupedia $toVersion" simupedia/fi.semantum.simupedia.build.targetdefinition/*.{tpd,target}
372 repl "Simupedia SDK $fromVersion" "Simupedia SDK $toVersion" simupedia/fi.semantum.simupedia.build.targetdefinition/*.{tpd,target}
375 git commit -a -m "Bumped master version to $toVersion"
380 git commit -a -m "Bumped master version to $toVersion"
388 bash $selfpath $version $fromBranch $user checkout
389 bash $selfpath $version $branch $user branch
390 bash $selfpath $version $branch $user checkout
391 bash $selfpath $version $branch $user prepare-release-branch $fromBranch
392 #$selfpath $version $branch $user push
396 if [ "$version" ] && [ ! -d $versiondir ]; then
397 echo -e "Version directory ('$versiondir') does not exist yet. Run 'clone' action first.\n"
399 echo "Usage: ${self} <version> <branch-name> <user-name> <command> [<command-arguments>]"
402 echo " clone The first thing that needs to be done before anything else"
403 echo " Clones all platform repositories under directory <version>"
405 echo "Inspection commands:"
406 echo " diff [args] Run git diff [args] for each platform repository"
407 echo " log [args] Run git log [args] for each platform repository"
408 echo " status [args] Run git status [args] for each platform repository"
409 echo " list-tags Run git tag -l for each repository"
413 echo " branch Run git branch <branch-name> for each platform repository"
414 echo " checkout Run git checkout <branch-name> for each repository"
416 echo " fetch Run git fetch --all for each repository"
417 echo " pull Run git pull --all for each repository"
418 echo " push Run git push origin <branch> for each repository"
419 echo " push-tags Run git push --tags for each repository"
420 echo " remove-tag Run git tag -d v<branch> for each repository"
421 echo " reset [args] Run git reset [args] for each repository"
422 echo " tag Run git checkout <branch> and"
423 echo " git tag -a v<branch> -m \"Simantics <branch> simultaneous release\""
424 echo " for each repository"
426 echo "Compound release commands:"
427 echo " prepare-release-branch <from-branch>"
428 echo " <from-branch> the name of the branch that the codebase is currently on"
430 echo "Top-level release commands:"
431 echo " bump-master-version <from-version> <to-version>"
432 echo " <from-version> the version string to replace"
433 echo " <to-version> the replacing new version string"
435 echo " branch-release <from-branch>"
436 echo " <from-branch> the branch to create the service branch from"
437 echo " e.g. master or release/x.y.z"
439 echo "Processed repositories:"
440 for (( i=0; i<${repositoryCount}; i++ )); do