Skip to content

Commit

Permalink
Merge pull request #212 from keizer619/master
Browse files Browse the repository at this point in the history
Remove ballerina to bal change message
  • Loading branch information
anupama-pathirage authored Feb 1, 2022
2 parents 06ce6a7 + 2f3e0c3 commit a10de84
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ballerinaJreVersion=0.8.0
# For test purpose
swan-lake-version=slp1
swan-lake-spec-version=v2020-06-18
swan-lake-latest-version=slbeta6
swan-lake-latest-spec-version=2021R1
swan-lake-latest-version=2201.0.0
swan-lake-latest-spec-version=2022R1
1-x-channel-version=1.2.0
1-x-channel-spec-version=2020R1
1-x-channel-latest-version=1.2.16
5 changes: 0 additions & 5 deletions resources/scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ then
chmod 755 /Library/Ballerina/bin/bal
fi

echo "The ‘ballerina’ command was changed to ‘bal’. Please use ‘bal’ command from now onwards."
echo "Ie : $ bal build"
echo " $ bal dist list"
echo " $ bal dist update"

echo "Update tool version updated to the latest version: @version@"
echo "Cleaning old files..."

Expand Down
5 changes: 0 additions & 5 deletions resources/scripts/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ if %errorlevel% neq 0 (
exit /b %errorlevel%
)

echo The ‘ballerina’ command was changed to ‘bal’. Please use ‘bal’ command from now onwards.
echo Ie : $ bal build
echo $ bal dist list
echo $ bal dist update

echo Tool version updated to the latest version: @version@
echo Cleaning old files...

Expand Down
27 changes: 26 additions & 1 deletion src/test/java/org/ballerinalang/distribution/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ public static String getVersionOutput(String ballerinaVersion, String specVersio
"\n" + toolText + " " + toolVersion + "\n";
}

if (isSwanLakeGA(ballerinaVersion)) {
return "Ballerina " + versionDisplayText + " (Swan Lake)\n" + "Language specification " + specVersion +
"\n" + toolText + " " + toolVersion + "\n";
}

String ballerinaReference = isSupportedRelease(ballerinaVersion) ? "jBallerina" : "Ballerina";
return ballerinaReference + " " + ballerinaVersion + "\n" + "Language specification " + specVersion + "\n" +
toolText + " " + toolVersion + "\n";
Expand Down Expand Up @@ -275,7 +280,7 @@ private static boolean isSupportedRelease(String version) {
* @return returns distribution path for the version
*/
public static Path getDistPath (String version) {
String type = version.contains("sl") ? "ballerina" : "jballerina";
String type = version.contains("sl") ? "ballerina" : isSwanLakeGA(version) ? "ballerina" : "jballerina";
return DIST_PATH.resolve(type + "-" + version);
}

Expand All @@ -286,6 +291,10 @@ public static Path getDistPath (String version) {
* @return returns display text
*/
public static String getDisplayText(String version) {
if (isSwanLakeGA(version)) {
return version;
}

char lastChar = version.charAt(version.length() - 1);
if (version.contains("slp")) {
return "Preview " + lastChar;
Expand All @@ -294,4 +303,20 @@ public static String getDisplayText(String version) {
return versionId.substring(0, 1).toUpperCase() + versionId.substring(1);
}
}

/**
* Check current version is a Swan Lake GA or later release
* @param version current version text
* @return is a Swan Lake GA or later release
*/
public static boolean isSwanLakeGA(String version) {
String[] versions = version.split("\\.");
if (versions.length == 3) {
int releaseVersion = Integer.parseInt(versions[0]);
if(releaseVersion >= 2201) {
return true;
}
}
return false;
}
}

0 comments on commit a10de84

Please sign in to comment.