Skip to content
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

Change default version to 0.0.0 #359

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 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,6 +94,12 @@ public static String getCurrentBallerinaVersion() {
setInstallerVersion(installerVersionFilePath);
}
}
String ballerinaVersionFilePath = OSUtils.getBallerinaVersionFilePath();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using this variable right? Shall we avoid ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR. OSUtils.getBallerinaVersionFilePath() has been used in a below step as well.

if (!new File(ballerinaVersionFilePath).exists()) {
String defaultBallerinaVersion = DEFAULT_BALLERINA_VERSION;
setCurrentBallerinaVersion(defaultBallerinaVersion);
setInstallerVersion(installerVersionFilePath);
}
String userVersion = getVersion(OSUtils.getBallerinaVersionFilePath());
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
Loading