rmetzger commented on a change in pull request #12340: URL: https://github.com/apache/flink/pull/12340#discussion_r431413495
########## File path: tools/releasing/update_japicmp_configuration.sh ########## @@ -0,0 +1,83 @@ +#!/usr/bin/env 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. +# + +if [ -z "${NEW_VERSION}" ]; then + echo "NEW_VERSION was not set." + exit 1 +fi + +CURR_DIR=`pwd` +if [[ `basename $CURR_DIR` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +# Idealized use-cases: +# Scenario A) New major release X.Y.0 +# Premise: +# There is a master branch with a version X.Y-SNAPSHOT, with a japicmp reference version of X.(Y-1).0 . +# Release flow: +# - update the master to X.(Y+1)-SNAPSHOT, but keep the reference version intact since X.Y.0 is not released (yet) +# - create X.Y-SNAPSHOT branch, but keep the reference version intact since X.Y.0 is not released (yet) +# - release X.Y.0 +# - update the japicmp reference version of both master and X.Y-SNAPSHOT to X.Y.0 +# - enable stronger compatibility constraints for X.Y-SNAPSHOT to ensure compatibility for PublicEvolving +# Scenario B) New minor release X.Y.Z +# Premise: +# There is a snapshot branch with a version X.Y-SNAPSHOT, with a japicmp reference version of X.Y.(Z-1) +# Release flow: +# - create X.Y.Z-rc branch +# - update the japicmp reference version of X.Y.Z to X.Y.(Z-1) +# - release X.Y.Z +# - update the japicmp reference version of X.Y-SNAPSHOT to X.Y.Z + +POM=../pom.xml +function enable_public_evolving_compatibility_checks() { + perl -pi -e 's#<!--(<include>\@org.apache.flink.annotation.PublicEvolving</include>)-->#${1}#' ${POM} + perl -pi -e 's#\t+<exclude>\@org.apache.flink.annotation.PublicEvolving.*\n##' ${POM} +} + +function set_japicmp_reference_version() { + local version=$1 + + perl -pi -e 's#(<japicmp.referenceVersion>).*(</japicmp.referenceVersion>)#${1}'${version}'${2}#' ${POM} +} + +current_branch=$(git rev-parse --abbrev-ref HEAD) + +if [[ ${current_branch} =~ -rc ]]; then + # release branch + version_prefix=$(echo "${NEW_VERSION}" | perl -p -e 's#(\d+\.\d+)\.\d+#$1#') + minor=$(echo "${NEW_VERSION}" | perl -p -e 's#\d+\.\d+\.(\d+)#$1#') + if ! [[ ${minor} == "0" ]]; then + set_japicmp_reference_version ${version_prefix}.$((minor - 1)) + # this is a safeguard in case the manual step of enabling checks after the X.Y.0 release was forgotten + enable_public_evolving_compatibility_checks + fi +elif [[ ${current_branch} =~ -SNAPSHOT ]]; then Review comment: when do we have a branch name containing "-SNAPSHOT"? Shouldn't this be a check on the version set in the ./pom.xml ? ########## File path: tools/releasing/update_japicmp_configuration.sh ########## @@ -0,0 +1,83 @@ +#!/usr/bin/env 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. +# + +if [ -z "${NEW_VERSION}" ]; then + echo "NEW_VERSION was not set." + exit 1 +fi + +CURR_DIR=`pwd` +if [[ `basename $CURR_DIR` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +# Idealized use-cases: +# Scenario A) New major release X.Y.0 +# Premise: +# There is a master branch with a version X.Y-SNAPSHOT, with a japicmp reference version of X.(Y-1).0 . +# Release flow: +# - update the master to X.(Y+1)-SNAPSHOT, but keep the reference version intact since X.Y.0 is not released (yet) +# - create X.Y-SNAPSHOT branch, but keep the reference version intact since X.Y.0 is not released (yet) +# - release X.Y.0 +# - update the japicmp reference version of both master and X.Y-SNAPSHOT to X.Y.0 +# - enable stronger compatibility constraints for X.Y-SNAPSHOT to ensure compatibility for PublicEvolving +# Scenario B) New minor release X.Y.Z +# Premise: +# There is a snapshot branch with a version X.Y-SNAPSHOT, with a japicmp reference version of X.Y.(Z-1) +# Release flow: +# - create X.Y.Z-rc branch +# - update the japicmp reference version of X.Y.Z to X.Y.(Z-1) +# - release X.Y.Z +# - update the japicmp reference version of X.Y-SNAPSHOT to X.Y.Z + +POM=../pom.xml +function enable_public_evolving_compatibility_checks() { + perl -pi -e 's#<!--(<include>\@org.apache.flink.annotation.PublicEvolving</include>)-->#${1}#' ${POM} + perl -pi -e 's#\t+<exclude>\@org.apache.flink.annotation.PublicEvolving.*\n##' ${POM} +} + +function set_japicmp_reference_version() { + local version=$1 + + perl -pi -e 's#(<japicmp.referenceVersion>).*(</japicmp.referenceVersion>)#${1}'${version}'${2}#' ${POM} +} + +current_branch=$(git rev-parse --abbrev-ref HEAD) + +if [[ ${current_branch} =~ -rc ]]; then + # release branch + version_prefix=$(echo "${NEW_VERSION}" | perl -p -e 's#(\d+\.\d+)\.\d+#$1#') + minor=$(echo "${NEW_VERSION}" | perl -p -e 's#\d+\.\d+\.(\d+)#$1#') + if ! [[ ${minor} == "0" ]]; then + set_japicmp_reference_version ${version_prefix}.$((minor - 1)) + # this is a safeguard in case the manual step of enabling checks after the X.Y.0 release was forgotten + enable_public_evolving_compatibility_checks + fi +elif [[ ${current_branch} =~ -SNAPSHOT ]]; then + # snapshot branch + set_japicmp_reference_version ${NEW_VERSION} + enable_public_evolving_compatibility_checks +elif [[ ${current_branch} =~ ^master$ ]]; then Review comment: This case (and the previous one) require a manual invocation of `update_japicmp_configuration.sh` by the RM, right? (I assume you'll update the wiki?) ########## File path: tools/releasing/update_japicmp_configuration.sh ########## @@ -0,0 +1,83 @@ +#!/usr/bin/env 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. +# + +if [ -z "${NEW_VERSION}" ]; then + echo "NEW_VERSION was not set." + exit 1 +fi + +CURR_DIR=`pwd` +if [[ `basename $CURR_DIR` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +# Idealized use-cases: +# Scenario A) New major release X.Y.0 +# Premise: +# There is a master branch with a version X.Y-SNAPSHOT, with a japicmp reference version of X.(Y-1).0 . +# Release flow: +# - update the master to X.(Y+1)-SNAPSHOT, but keep the reference version intact since X.Y.0 is not released (yet) +# - create X.Y-SNAPSHOT branch, but keep the reference version intact since X.Y.0 is not released (yet) +# - release X.Y.0 +# - update the japicmp reference version of both master and X.Y-SNAPSHOT to X.Y.0 +# - enable stronger compatibility constraints for X.Y-SNAPSHOT to ensure compatibility for PublicEvolving +# Scenario B) New minor release X.Y.Z +# Premise: +# There is a snapshot branch with a version X.Y-SNAPSHOT, with a japicmp reference version of X.Y.(Z-1) +# Release flow: +# - create X.Y.Z-rc branch +# - update the japicmp reference version of X.Y.Z to X.Y.(Z-1) +# - release X.Y.Z +# - update the japicmp reference version of X.Y-SNAPSHOT to X.Y.Z + +POM=../pom.xml +function enable_public_evolving_compatibility_checks() { + perl -pi -e 's#<!--(<include>\@org.apache.flink.annotation.PublicEvolving</include>)-->#${1}#' ${POM} + perl -pi -e 's#\t+<exclude>\@org.apache.flink.annotation.PublicEvolving.*\n##' ${POM} +} + +function set_japicmp_reference_version() { + local version=$1 + + perl -pi -e 's#(<japicmp.referenceVersion>).*(</japicmp.referenceVersion>)#${1}'${version}'${2}#' ${POM} +} + +current_branch=$(git rev-parse --abbrev-ref HEAD) + +if [[ ${current_branch} =~ -rc ]]; then Review comment: for this case, the RM doesn't need to invoke this script, because it is called from the `create_release_branch.sh` script, right? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
