This is an automated email from the ASF dual-hosted git repository.

kenn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 225ae69  Add script to set the version of Beam
     new 24f4d4e  Merge pull request #8226: [BEAM-6441] Add script to set the 
version of Beam
225ae69 is described below

commit 225ae69c3c49bc89a52e185a91888c45b3504ba0
Author: Kenneth Knowles <k...@apache.org>
AuthorDate: Thu Apr 4 09:14:18 2019 -0700

    Add script to set the version of Beam
---
 release/src/main/scripts/set_version.sh | 83 +++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/release/src/main/scripts/set_version.sh 
b/release/src/main/scripts/set_version.sh
new file mode 100755
index 0000000..7943e15
--- /dev/null
+++ b/release/src/main/scripts/set_version.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+
+# This script will update apache beam master branch with next release version
+# and cut release branch for current development version.
+
+# Parse parameters passing into the script
+
+set -e
+
+function usage() {
+  echo 'Usage: set_version.sh <version> [--release] [--debug]'
+}
+
+IS_SNAPSHOT_VERSION=yes
+
+while [[ $# -gt 0 ]] ; do
+  arg="$1"
+
+  case $arg in
+      --release)
+      unset IS_SNAPSHOT_VERSION
+      shift
+      ;;
+
+      --debug)
+      set -x
+      shift
+      ;;
+
+      *)
+      if [[ -z "$TARGET_VERSION" ]] ; then
+        TARGET_VERSION="$1"
+        shift
+      else
+        echo "Unknown argument: $1. Target version already set to 
$TARGET_VERSION"
+        usage
+        exit 1
+      fi
+      ;;
+   esac
+done
+
+if [[ -z $TARGET_VERSION ]] ; then
+  echo "No target version supplied"
+  usage
+  exit 1
+fi
+
+if [[ -z "$IS_SNAPSHOT_VERSION" ]] ; then
+  # Fixing a release version
+  sed -i -e "s/version=.*/version=$TARGET_VERSION/" gradle.properties
+  sed -i -e "s/project.version = .*/project.version = '$TARGET_VERSION'/" 
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
+  sed -i -e "s/^__version__ = .*/__version__ = '${TARGET_VERSION}'/" 
sdks/python/apache_beam/version.py
+  # TODO: [BEAM-4767]
+  sed -i -e "s/'dataflow.container_version' : .*/'dataflow.container_version' 
: 'beam-${RELEASE}'/" runners/google-cloud-dataflow-java/build.gradle
+else
+  # For snapshot version:
+  #   Java/gradle appends -SNAPSHOT
+  #   In the Gradle plugin, the -SNAPSHOT is dynamic so we don't add it here
+  #   Python appends .dev
+  #   The Dataflow container remains unchanged as in this case it is 
beam-master-<date> form
+  sed -i -e "s/version=.*/version=$TARGET_VERSION-SNAPSHOT/" gradle.properties
+  sed -i -e "s/project.version = .*/project.version = '$TARGET_VERSION'/" 
buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
+  sed -i -e "s/^__version__ = .*/__version__ = '${TARGET_VERSION}.dev'/" 
sdks/python/apache_beam/version.py
+  sed -i -e "s/'dataflow.container_version' : .*/'dataflow.container_version' 
: 'beam-master-.*'/" runners/google-cloud-dataflow-java/build.gradle
+fi
+

Reply via email to