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

LPD-38770 Unable to Select a Quarterly Release as Target Version or Configure Workspace Product Key to a Quarterly Release in LDS 3.10.1.202408201331 #389

Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ protected Status compute() {

String liferayVersionString = get(op.getLiferayVersion());

Version liferayVersion = new Version(CoreUtil.parseVersion(liferayVersionString));

ReleaseEntry releaseEntry = ReleaseUtil.getReleaseEntry(liferayWorkspaceProject.getTargetPlatformVersion());

if (releaseEntry != null) {
Expand All @@ -97,6 +95,8 @@ protected Status compute() {
"import here.");
}

Version liferayVersion = new Version(CoreUtil.parseVersion(liferayVersionString));

if (projectTemplateName.startsWith("form-field")) {
NewLiferayProjectProvider<BaseModuleOp> newLiferayProjectProvider = get(op.getProjectProvider());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.liferay.ide.upgrade.commands.ui.internal;

import com.liferay.ide.core.util.CoreUtil;
import com.liferay.ide.core.util.ReleaseUtil;
import com.liferay.ide.core.util.SapphireContentAccessor;
import com.liferay.ide.project.core.workspace.NewLiferayWorkspaceOp;
import com.liferay.ide.ui.util.UIUtil;
Expand All @@ -23,6 +24,7 @@
import com.liferay.ide.upgrade.plan.core.UpgradeCommandPerformedEvent;
import com.liferay.ide.upgrade.plan.core.UpgradePlan;
import com.liferay.ide.upgrade.plan.core.UpgradePlanner;
import com.liferay.release.util.ReleaseEntry;

import java.nio.file.Paths;

Expand Down Expand Up @@ -74,27 +76,34 @@ public IStatus perform(IProgressMonitor progressMonitor) {

NewLiferayWorkspaceOp newLiferayWorkspaceOp = NewLiferayWorkspaceOp.TYPE.instantiate();

switch (upgradePlan.getTargetVersion()) {
case "7.0":
newLiferayWorkspaceOp.setProductVersion("portal-7.0-ga7");
ReleaseEntry releaseEntry = ReleaseUtil.getReleaseEntry("portal", upgradePlan.getTargetVersion());

break;
case "7.1":
newLiferayWorkspaceOp.setProductVersion("portal-7.1-ga4");
if (releaseEntry != null) {
newLiferayWorkspaceOp.setProductVersion(releaseEntry.getReleaseKey());
}
else {
switch (upgradePlan.getTargetVersion()) {
case "7.0":
newLiferayWorkspaceOp.setProductVersion("portal-7.0-ga7");

break;
case "7.1":
newLiferayWorkspaceOp.setProductVersion("portal-7.1-ga4");

break;
case "7.2":
newLiferayWorkspaceOp.setProductVersion("portal-7.2-ga2");
break;
case "7.2":
newLiferayWorkspaceOp.setProductVersion("portal-7.2-ga2");

break;
case "7.3":
newLiferayWorkspaceOp.setProductVersion("portal-7.3-ga8");
break;
case "7.3":
newLiferayWorkspaceOp.setProductVersion("portal-7.3-ga8");

break;
case "7.4":
newLiferayWorkspaceOp.setProductVersion("portal-7.4-ga4");
break;
case "7.4":
newLiferayWorkspaceOp.setProductVersion("portal-7.4-ga4");

break;
break;
}
}

newLiferayWorkspaceOp.setLiferayVersion(upgradePlan.getTargetVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@

package com.liferay.ide.upgrade.plan.core;

import com.liferay.ide.core.util.CoreUtil;
import com.liferay.ide.core.util.ReleaseUtil;
import com.liferay.ide.upgrade.plan.core.internal.NameValidationService;
import com.liferay.ide.upgrade.plan.core.internal.NewUpgradePlanOpMethods;
import com.liferay.ide.upgrade.plan.core.internal.OutlineDefaultValueService;
import com.liferay.ide.upgrade.plan.core.internal.OutlinePossibleValuesService;
import com.liferay.ide.upgrade.plan.core.internal.TargetVersionValidationService;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Set;

import org.eclipse.sapphire.DefaultValueService;
import org.eclipse.sapphire.ElementType;
import org.eclipse.sapphire.ExecutableElement;
import org.eclipse.sapphire.PossibleValues;
import org.eclipse.sapphire.PossibleValuesService;
import org.eclipse.sapphire.Type;
import org.eclipse.sapphire.Value;
import org.eclipse.sapphire.ValueProperty;
Expand Down Expand Up @@ -72,16 +81,16 @@ public interface NewUpgradePlanOp extends ExecutableElement {

@DefaultValue(text = "6.2")
@Label(standard = "Current Liferay Version")
@PossibleValues(values = {"6.2", "7.0", "7.1", "7.2", "7.3"})
@Service(impl = CurrentVersionPossibleValuesService.class)
public ValueProperty PROP_CURRENT_VERSION = new ValueProperty(TYPE, "CurrentVersion");

@Required
@Service(impl = NameValidationService.class)
public ValueProperty PROP_NAME = new ValueProperty(TYPE, "Name");

@DefaultValue(text = "7.4")
@Label(standard = "Target Liferay Version")
@PossibleValues(values = {"7.0", "7.1", "7.2", "7.3", "7.4"})
@Service(impl = TargetVersionDefaultValueService.class)
@Service(impl = TargetVersionPossibleValuesService.class)
@Service(impl = TargetVersionValidationService.class)
public ValueProperty PROP_TARGET_VERSION = new ValueProperty(TYPE, "TargetVersion");

Expand All @@ -91,4 +100,54 @@ public interface NewUpgradePlanOp extends ExecutableElement {
@Type(base = IUpgradePlanOutline.class)
public ValueProperty PROP_UPGRADE_PLAN_OUTLINE = new ValueProperty(TYPE, "UpgradePlanOutline");

public class CurrentVersionPossibleValuesService extends PossibleValuesService {

@Override
protected void compute(Set<String> values) {
List<String> productGroupVersions = new ArrayList<>(Arrays.asList(ReleaseUtil.getProductGroupVersions()));

productGroupVersions.add("6.2");

productGroupVersions.sort(new ProductGroupComparator());

values.addAll(productGroupVersions.subList(0, productGroupVersions.size() - 1));
}

}

public class ProductGroupComparator implements Comparator<String> {

@Override
public int compare(String o1, String o2) {
return CoreUtil.compareVersions(CoreUtil.parseVersion(o1), CoreUtil.parseVersion(o2));
}

}

public class TargetVersionDefaultValueService extends DefaultValueService {

@Override
protected String compute() {
List<String> productGroupVersions = Arrays.asList(ReleaseUtil.getProductGroupVersions());

productGroupVersions.sort(new ProductGroupComparator());

return productGroupVersions.get(productGroupVersions.size() - 1);
}

}

public class TargetVersionPossibleValuesService extends PossibleValuesService {

@Override
protected void compute(Set<String> values) {
List<String> productGroupVersions = Arrays.asList(ReleaseUtil.getProductGroupVersions());

productGroupVersions.sort(new ProductGroupComparator());

values.addAll(productGroupVersions);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ protected Status compute() {

NewUpgradePlanOp op = context(NewUpgradePlanOp.class);

Version currentVersion = new Version(get(op.getCurrentVersion()));
Version targetVersion = new Version(get(op.getTargetVersion()));
Version currentVersion = CoreUtil.parseVersion(get(op.getCurrentVersion()));
Version targetVersion = CoreUtil.parseVersion(get(op.getTargetVersion()));

if (CoreUtil.compareVersions(currentVersion, targetVersion) >= 0) {
retval = Status.createErrorStatus("Target version must be greater than current version.");
Expand Down
Loading