-
Notifications
You must be signed in to change notification settings - Fork 102
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
#999: add feature to check minimum require version #1034
Conversation
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.
@Ttring thanks for this PR.
I assume we will take over and do the rework from the new team.
current_devon_version="$("${DEVON_HOME_DIR}/scripts/devon.bat" -v)" | ||
min_devon_ide_version_month=${DEVON_IDE_MIN_VERSION##${DEVON_IDE_MIN_VERSION%%.*}.} | ||
current_devon_version_month=${current_devon_version##${current_devon_version%%.*}.} | ||
if [[ ${DEVON_IDE_MIN_VERSION%%.*} -gt ${current_devon_version%%.*} ]] |
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.
we should use doVersionCompare
for this as -gt
is not suitable for comparing versions. In the worst case, we later have to change versioning schema again (see devonfw Teams discussion) and this will break and stop working.
local update_version | ||
if [ -z "${1}" ] | ||
then | ||
update_version="LATEST" | ||
else | ||
update_version=${1} | ||
fi | ||
doUpgradeMavenArtifact "${DEVON_IDE_HOME}" "${DEVON_IDE_REPO_URL}" "devonfw-ide-scripts" "${update_version}" ".tar.gz" "${devon_ide_version}" |
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.
I do not see how this relates to #999.
Here we do update to a new version while checking for a minimum required version should happen during the setup after the settings are cloned and devon.properties
are read.
read -r -p "(yes/no): " answer | ||
if [ "${answer}" = "yes" ] || [ -z "${answer}" ] | ||
then | ||
doUpdateScripts "${DEVON_IDE_MIN_VERSION}" | ||
doEcho "Version ${target_version} had been successfully downloaded. Please rerun 'devon ide setup' to complete the setup." | ||
return 0 | ||
elif [ "${answer}" = "no" ] | ||
then | ||
doEcho "\nUpdate to the minimum required version is aborted.\nTo complete the setup, please run 'devon ide update scripts' then rerun 'devon ide setup'." | ||
return 1 | ||
fi |
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.
function doAskToContinue
already does this job and can be reused.
if [ ${min_devon_ide_version_month%%.${DEVON_IDE_MIN_VERSION##*.}} -gt ${current_devon_version_month%%.${current_devon_version##*.}} ] | ||
then | ||
doEcho "\nYour version of devonfw-ide is currently '${current_devon_version}'" | ||
doEcho "However, your project requires at least version '${DEVON_IDE_MIN_VERSION}'." | ||
doEcho "Newer features will be required for your project so you need to update your devonfw-ide via the following command:" | ||
doEcho "'devon ide update scripts'" | ||
doEcho "Do you want to run the update now, so you can rerun 'devon ide setup' after that?" | ||
read -r -p "(yes/no): " answer | ||
if [ "${answer}" = "yes" ] || [ -z "${answer}" ] | ||
then | ||
doUpdateScripts "${DEVON_IDE_MIN_VERSION}" | ||
doEcho "Version ${target_version} had been successfully downloaded. Please rerun 'devon ide setup' to complete the setup." | ||
return 0 | ||
elif [ "${answer}" = "no" ] | ||
then | ||
doEcho "\nUpdate to the minimum required version is aborted.\nTo complete the setup, please run 'devon ide update scripts' then rerun 'devon ide setup'." | ||
return 1 | ||
fi | ||
fi | ||
if [ ${DEVON_IDE_MIN_VERSION##*.} -gt ${current_devon_version##*.} ] | ||
then | ||
doEcho "\nYour version of devonfw-ide is currently '${current_devon_version}'" | ||
doEcho "However, your project requires at least version '${DEVON_IDE_MIN_VERSION}'." | ||
doEcho "Newer features will be required for your project so you need to update your devonfw-ide via the following command:" | ||
doEcho "'devon ide update scripts'" | ||
doEcho "Do you want to run the update now, so you can rerun 'devon ide setup' after that?" | ||
read -r -p "(yes/no): " answer | ||
if [ "${answer}" = "yes" ] || [ -z "${answer}" ] | ||
then | ||
doUpdateScripts "${DEVON_IDE_MIN_VERSION}" | ||
doEcho "Version ${target_version} had been successfully downloaded. Please rerun 'devon ide setup' to complete the setup." | ||
return 0 | ||
elif [ "${answer}" = "no" ] | ||
then | ||
doEcho "\nUpdate to the minimum required version is aborted.\nTo complete the setup, please run 'devon ide update scripts' then rerun 'devon ide setup'." | ||
return 1 | ||
fi |
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.
This is highly redundant and should be reworked.
This PR is replaced by #1056 so the work is not lost and the story will be completed. Hence, I can now close this PR. |
To test it,
DEVON_IDE_MIN_VERSION=2023.01.001
needs to be added in settings\properties.If the current Devon version is smaller than the minimum required version, it is updated to the minimum required version.
If the current Devon version is greater than the minimum required version, it remains at the current version.
If the given minimum version is not available, the operation is terminated with code 22.