Skip to content

Commit

Permalink
Merge pull request #359 from NipunaMadhushan/fix-default-version
Browse files Browse the repository at this point in the history
Change default version to 0.0.0
  • Loading branch information
NipunaMadhushan authored Aug 22, 2024
2 parents 6444e21 + e25c062 commit bfde5b2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/org/ballerinalang/command/util/ToolUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class ToolUtil {
public static final String LATEST_PULL_INPUT = "latest";
public static final boolean TEST_MODE = Boolean.parseBoolean(
System.getenv("TEST_MODE_ACTIVE"));
public static final String DEFAULT_BALLERINA_VERSION = "0.0.0";

/**
* Provides used Ballerina version.
Expand All @@ -93,7 +94,13 @@ public static String getCurrentBallerinaVersion() {
setInstallerVersion(installerVersionFilePath);
}
}
String userVersion = getVersion(OSUtils.getBallerinaVersionFilePath());
String ballerinaVersionFilePath = OSUtils.getBallerinaVersionFilePath();
if (!new File(ballerinaVersionFilePath).exists()) {
String defaultBallerinaVersion = DEFAULT_BALLERINA_VERSION;
setCurrentBallerinaVersion(defaultBallerinaVersion);
setInstallerVersion(installerVersionFilePath);
}
String userVersion = getVersion(ballerinaVersionFilePath);
if (checkDistributionAvailable(userVersion)) {
return userVersion;
}
Expand All @@ -113,7 +120,7 @@ public static String getCurrentInstalledBallerinaVersion() {
return getVersion(OSUtils.getInstalledConfigPath());
} catch (IOException e) {
//If we files does not exist it will be empty and update tool continues without a distribution
return "";
return DEFAULT_BALLERINA_VERSION;
}
}

Expand Down Expand Up @@ -701,7 +708,7 @@ private static void downloadAndSetupDependency(HttpURLConnection conn, PrintStre
zipFile.delete();
}
}

public static void removeUnusedDependencies(String distributionVersion, PrintStream printStream) {
String dependencyForDistribution = "";
String channelForDistribution = "";
Expand Down

0 comments on commit bfde5b2

Please sign in to comment.