Skip to content

Commit

Permalink
add next version to cmake file
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmad Rezaii <[email protected]>
  • Loading branch information
arezaii committed Dec 4, 2024
1 parent 81f6373 commit 21cc6dc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ set(CHPL_MAJOR_VERSION 2)
set(CHPL_MINOR_VERSION 3)
set(CHPL_PATCH_VERSION 0)
set(CHPL_BUILD_VERSION 0)

set(CHPL_PREV_MAJOR_VERSION 2)
set(CHPL_PREV_MINOR_VERSION 2)
set(CHPL_PREV_PATCH_VERSION 0)
set(CHPL_PREV_BUILD_VERSION 0)

set(CHPL_NEXT_MAJOR_VERSION 2)
set(CHPL_NEXT_MINOR_VERSION 4)
set(CHPL_NEXT_PATCH_VERSION 0)


# Flip this to 'true' when we're ready to roll out a release; then back
# after branching
set(CHPL_OFFICIAL_RELEASE true)
set(CHPL_OFFICIAL_RELEASE false)

### END config.h version value setting - configured_prefix set below ###

Expand Down Expand Up @@ -414,6 +419,9 @@ add_custom_target(update-release-and-version-info ALL
${CHPL_PREV_MAJOR_VERSION}
${CHPL_PREV_MINOR_VERSION}
${CHPL_PREV_PATCH_VERSION}
${CHPL_NEXT_MAJOR_VERSION}
${CHPL_NEXT_MINOR_VERSION}
${CHPL_NEXT_PATCH_VERSION}
"--files"
${SRC_DIR}/doc/rst/conf.py
${SRC_DIR}/man/confchpl.rst
Expand Down
29 changes: 17 additions & 12 deletions util/config/update-release-and-version-info
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@ import argparse

# Represents a file or maybe a group of similar files that are updated the same way
class FileUpdater:
def __init__(self, file_path, major_version, minor_version, patch_version, release, prev_major_version, prev_minor_version, prev_patch_version):
def __init__(self, file_path, major_version, minor_version, patch_version, release, prev_major_version, prev_minor_version, prev_patch_version, next_major_version, next_minor_version, next_patch_version):
self.file_path = file_path
self.major_version = major_version
self.minor_version = minor_version
self.patch_version = patch_version
self.prev_major_version = prev_major_version
self.prev_minor_version = prev_minor_version
self.prev_patch_version = prev_patch_version
self.next_major_version = next_major_version
self.next_minor_version = next_minor_version
self.next_patch_version = next_patch_version
self.release = release

# TODO: would be nice to have preformatted version strings in the base class
Expand Down Expand Up @@ -157,10 +160,9 @@ class VersionButtonUpdater(FileUpdater):
next_rel = 'var nextRelease = "{}.{}";'
if self.release:
for i, line in enumerate(lines):
# TODO: Store the next release in cmake too? This is a pretty naive way, just incrementing the minor version by 1.
if line.strip().startswith('var nextRelease = ') and not line.strip() == 'var nextRelease = "{}.{}"; // what\'s the next release? (on docs/main)'.format(self.major_version, self.minor_version + 1):
if line.strip().startswith('var nextRelease = ') and not line.strip() == 'var nextRelease = "{}.{}"; // what\'s the next release? (on docs/main)'.format(self.next_major_version, self.next_minor_version):
any_changed = True
lines[i] = ' var nextRelease = "{}.{}"; // what\'s the next release? (on docs/main)\n'.format(self.major_version, self.minor_version + 1)
lines[i] = ' var nextRelease = "{}.{}"; // what\'s the next release? (on docs/main)\n'.format(self.next_major_version, self.next_minor_version)
else:
for i, line in enumerate(lines):
if line.strip().startswith('var currentRelease = ') and not line.strip() == 'var currentRelease = "{}.{}"; // what does the public have?'.format(self.prev_major_version, self.prev_minor_version):
Expand Down Expand Up @@ -194,27 +196,30 @@ def main():
parser.add_argument('prev_major_version', type=int, help='The previous major version of Chapel')
parser.add_argument('prev_minor_version', type=int, help='The previous minor version of Chapel')
parser.add_argument('prev_patch_version', type=int, help='The previous patch version of Chapel')
parser.add_argument('next_major_version', type=int, help='The next major version of Chapel')
parser.add_argument('next_minor_version', type=int, help='The next minor version of Chapel')
parser.add_argument('next_patch_version', type=int, help='The next patch version of Chapel')
parser.add_argument('--official-release', dest='release', action="store_true", help='Is this an official release?')

args = parser.parse_args()
for fpath in args.files:
# Determine which updater to use based on the file name or other criteria
if fpath.endswith('conf.py'):
updater = ConfPyUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = ConfPyUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('confchpl.rst') or fpath.endswith('confchpldoc.rst'):
updater = ManConfUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = ManConfUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('archivedSpecs.rst'):
updater = ArchivedSpecUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = ArchivedSpecUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('QUICKSTART.rst'):
updater = QuickStartUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = QuickStartUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('chplenv.rst'):
updater = ChplEnvUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = ChplEnvUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('versionhelp.sh') or fpath.endswith('versionhelp-chpldoc.sh'):
updater = VersionHelpUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = VersionHelpUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('versionButton.php'):
updater = VersionButtonUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = VersionButtonUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
elif fpath.endswith('version.goodstart'):
updater = GoodStartUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version)
updater = GoodStartUpdater(fpath, args.major_version, args.minor_version, args.patch_version, args.release, args.prev_major_version, args.prev_minor_version, args.prev_patch_version, args.next_major_version, args.next_minor_version, args.next_patch_version)
else:
raise ValueError("Unrecognized file name: {}".format(fpath))

Expand Down

0 comments on commit 21cc6dc

Please sign in to comment.