代码拉取完成,页面将自动刷新
#!/bin/sh
#
# 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.
#
update_pom_version() {
pom=$1
version=$2
echo "bump up $pom"
sed -i'' -e "s/${version}/${new_version}/g" "$pom"
if ! grep -C 1 "$new_version" $pom; then
echo "Failed to update new version $new_version in $pom"
exit 1
fi
}
update_ivy() {
module=$1
ivy_file=`find $module -type f -name '*.ivy'`
new_ivy_file="$module/$module-$new_version.ivy"
if [ -f $ivy_file ]; then
echo "bump up $ivy_file"
git mv "$ivy_file" "$new_ivy_file"
current_ivy_version=`get_version_from_ivy $new_ivy_file`
sed -i'' -e "s/${current_ivy_version}/${new_version}/g" "$new_ivy_file"
if ! grep -C 1 "$new_version" "$new_ivy_file"; then
echo "Failed to update new version $new_version in $new_ivy_file"
exit 1
fi
else
echo "$module/$ivy_file not exist"
fi
}
get_version_from_pom() {
grep -A 1 "<artifactId>helix</artifactId>" $1 |tail -1 | awk 'BEGIN {FS="[<,>]"};{print $3}'
}
get_version_from_ivy() {
grep revision "$1" | awk 'BEGIN {FS="[=,\"]"};{print $3}'
}
current_version=`get_version_from_pom pom.xml`
echo There are $# arguments to $0: $*
if [ "$#" -eq 1 ]; then
new_version=$1
elif [ "$#" -eq 2 ]; then
new_version=$2
else
minor_version=`echo $current_version | cut -d'.' -f3 | cut -d'-' -f1`
major_version=`echo $current_version | cut -d'.' -f1`
submajor_version=`echo $current_version | cut -d'.' -f2`
new_minor_version=`expr $minor_version + 1`
new_version="$major_version.$submajor_version.$new_minor_version"
fi
echo "bump up: $current_version -> $new_version"
update_pom_version "pom.xml" $current_version
for module in "metrics-common" "metadata-store-directory-common" "zookeeper-api" "helix-common" "helix-core" \
"helix-rest" "helix-lock" "helix-view-aggregator" "helix-agent" "meta-client"; do
update_ivy $module
update_pom_version $module/pom.xml $current_version
done
for module in recipes/task-execution recipes \
recipes/distributed-lock-manager recipes/rsync-replicated-file-system \
recipes/rabbitmq-consumer-group recipes/service-discovery; do
update_pom_version $module/pom.xml $current_version
done
#END
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。