-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tool: newVersion.sh #1686
Merged
Merged
Tool: newVersion.sh #1686
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright 2021 Axel Huebl | ||
# | ||
# This file is part of WarpX.# | ||
|
||
# This file is a maintainer tool to bump the versions inside WarpX' | ||
# source directory at all places where necessary. | ||
# | ||
# Note: this script is only tested with GNUtools (Linux) | ||
|
||
set -eu -o pipefail | ||
|
||
|
||
# Maintainer Inputs ########################################################### | ||
|
||
echo "Hi there, this is a WarpX maintainer tool to update the source" | ||
echo "code of WarpX to a new version number on all places where" | ||
echo "necessary." | ||
echo "For it to work, you need write access on the source directory and" | ||
echo "you should be working in a clean git branch without ongoing" | ||
echo "rebase/merge/conflict resolves and without unstaged changes." | ||
|
||
# check source dir | ||
REPO_DIR=$(cd $(dirname ${BASH_SOURCE})/../../ && pwd) | ||
echo | ||
echo "Your current source directory is: ${REPO_DIR}" | ||
echo | ||
|
||
read -p "Are you sure you want to continue? [y/N] " -r | ||
echo | ||
|
||
if [[ ! ${REPLY} =~ ^[Yy]$ ]] | ||
then | ||
echo "You did not confirm with 'y', aborting." | ||
exit 1 | ||
fi | ||
|
||
echo "We will now run a few sed commands on your source directory." | ||
echo "Please answer the following questions about the version number" | ||
echo "you want to set first:" | ||
echo | ||
|
||
read -p "MAJOR version? (e.g. year: $(date +%y)) " -r | ||
MAJOR=${REPLY} | ||
echo | ||
read -p "MINOR version? (e.g. month: $(date +%m)) " -r | ||
MINOR=${REPLY} | ||
echo | ||
read -p "PATCH version? (e.g. usually empty) " -r | ||
PATCH=${REPLY} | ||
echo | ||
read -p "SUFFIX? (e.g. rc2, dev, ... usually empty) " -r | ||
SUFFIX=${REPLY} | ||
echo | ||
|
||
if [[ -n "${SUFFIX}" ]] | ||
then | ||
SUFFIX_STR="-$SUFFIX" | ||
else | ||
SUFFIX_STR="" | ||
fi | ||
if [[ ! -n "${PATCH}" ]] | ||
then | ||
PATCH="" | ||
fi | ||
|
||
VERSION_STR_NOSUFFIX="${MAJOR}.${MINOR}${PATCH}" | ||
VERSION_STR="${MAJOR}.${MINOR}${PATCH}${SUFFIX_STR}" | ||
|
||
echo | ||
echo "Your new version is: ${VERSION_STR}" | ||
echo | ||
|
||
read -p "Is this information correct? Will now start updating! [y/N] " -r | ||
echo | ||
|
||
if [[ ! ${REPLY} =~ ^[Yy]$ ]] | ||
then | ||
echo "You did not confirm with 'y', aborting." | ||
exit 1 | ||
fi | ||
|
||
|
||
# Updates ##################################################################### | ||
|
||
# CMake scripts | ||
# CMakeLists.txt: project(WarpX VERSION YY.MM) | ||
sed -i -E "s/"\ | ||
"(project\(WarpX VERSION[[:blank:]]+)(.*)(\))/"\ | ||
"\1${VERSION_STR_NOSUFFIX}\3/g" \ | ||
${REPO_DIR}/CMakeLists.txt | ||
|
||
# cmake/dependencies/AMReX.cmake: | ||
# set(WarpX_amrex_branch "development" ... (future) | ||
# find_package(AMReX YY.MM CONFIG ... | ||
sed -i -E "s/"\ | ||
"(find_package\(AMReX[[:blank:]]+)(.*)([[:blank:]]+CONFIG.+)/"\ | ||
"\1${VERSION_STR_NOSUFFIX}\3/g" \ | ||
${REPO_DIR}/cmake/dependencies/AMReX.cmake | ||
|
||
# cmake/dependencies/PICSAR.cmake (future) | ||
|
||
# setup.py: version = '21.02', | ||
sed -i -E "s/"\ | ||
"([[:blank:]]*version[[:blank:]]*=[[:blank:]]*')(.*)('.+)/"\ | ||
"\1${VERSION_STR}\3/g" \ | ||
${REPO_DIR}/setup.py | ||
|
||
# Python/setup.py: version = '21.02', | ||
sed -i -E "s/"\ | ||
"([[:blank:]]*version[[:blank:]]*=[[:blank:]]*')(.*)('.+)/"\ | ||
"\1${VERSION_STR}\3/g" \ | ||
${REPO_DIR}/Python/setup.py | ||
|
||
# sphinx / RTD | ||
# docs/source/conf.py | ||
sed -i "s/"\ | ||
"[[:blank:]]*version[[:blank:]]*=[[:blank:]]*u.*/"\ | ||
"version = u'${VERSION_STR_NOSUFFIX}'/g" \ | ||
${REPO_DIR}/Docs/source/conf.py | ||
sed -i "s/"\ | ||
"[[:blank:]]*release[[:blank:]]*=[[:blank:]]*u.*/"\ | ||
"release = u'${VERSION_STR}'/g" \ | ||
${REPO_DIR}/Docs/source/conf.py | ||
|
||
ax3l marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# LICENSE | ||
# LICENSE.txt: WarpX vYY.MM Copyright (c) 20YY, The Regents of ... | ||
sed -i -E "s/"\ | ||
"(WarpX v)(.*)([[:blank:]]+Copyright \(c\) 2018-)(.*)(, The Regents of.*)/"\ | ||
"\1${VERSION_STR_NOSUFFIX}\3$(date +%Y)\5/g" \ | ||
${REPO_DIR}/LICENSE.txt | ||
|
||
|
||
# Epilog ###################################################################### | ||
|
||
echo | ||
echo "Done. Please check your source, e.g. via" | ||
echo " git diff" | ||
echo "now and commit the changes if no errors occured." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note:
sed -E
only works with GNU sed (see comment above)Since I am currently doing the releases, this is good for now and avoids complicating the script.