diff options
author | Eike Stepper | 2018-04-13 12:38:11 +0000 |
---|---|---|
committer | Eike Stepper | 2018-04-13 12:38:11 +0000 |
commit | f2f3042368d546194de9444c4270a0d51eec4403 (patch) | |
tree | 4e790efeaa755c6a5d4d8acf5f437f4308659c85 | |
parent | 8b093e62318d58853151c6bd96e1f9da45abd88f (diff) | |
download | cdo-f2f3042368d546194de9444c4270a0d51eec4403.tar.gz cdo-f2f3042368d546194de9444c4270a0d51eec4403.tar.xz cdo-f2f3042368d546194de9444c4270a0d51eec4403.zip |
[Releng] Add Ant task to migrate GenModels
2 files changed, 7 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/CDOTask.java b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/CDOTask.java index 559ca5ffe5..f5d5e06b8a 100644 --- a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/CDOTask.java +++ b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/CDOTask.java @@ -25,9 +25,9 @@ import org.apache.tools.ant.Task; */ public abstract class CDOTask extends Task { - protected IWorkspace workspace; + protected final IWorkspace workspace = ResourcesPlugin.getWorkspace(); - protected IWorkspaceRoot root; + protected final IWorkspaceRoot root = workspace.getRoot(); @Override public final void execute() throws BuildException @@ -36,8 +36,6 @@ public abstract class CDOTask extends Task try { - workspace = ResourcesPlugin.getWorkspace(); - root = workspace.getRoot(); doExecute(); } diff --git a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/MigrateModelTask.java b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/MigrateModelTask.java index fd1229ef36..ce7c2f9ada 100644 --- a/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/MigrateModelTask.java +++ b/plugins/org.eclipse.emf.cdo.migrator/src/org/eclipse/emf/cdo/internal/migrator/tasks/MigrateModelTask.java @@ -17,20 +17,18 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenModel; import org.apache.tools.ant.BuildException; -import java.io.File; - /** * @author Eike Stepper */ public class MigrateModelTask extends CDOTask { - private File modelLocation; + private String modelPath; private boolean dynamicFeatureDelegation; - public void setModelLocation(File modelLocation) + public void setModelPath(String modelPath) { - this.modelLocation = modelLocation; + this.modelPath = modelPath; } public void setDynamicFeatureDelegation(boolean dynamicFeatureDelegation) @@ -41,14 +39,13 @@ public class MigrateModelTask extends CDOTask @Override protected void checkAttributes() throws BuildException { - assertTrue("'modelLocation' must be specified.", modelLocation != null); - assertTrue("'modelLocation' must be point to an existing file.", modelLocation.isFile()); + assertTrue("'modelPath' must be specified.", modelPath != null && modelPath.length() != 0); } @Override protected void doExecute() throws Exception { - GenModel genModel = CDOMigratorUtil.getGenModel(modelLocation.getAbsolutePath()); + GenModel genModel = CDOMigratorUtil.getGenModel(modelPath); GenDelegationKind featureDelegation = dynamicFeatureDelegation ? GenDelegationKind.DYNAMIC_LITERAL : GenDelegationKind.REFLECTIVE_LITERAL; String result = CDOMigratorUtil.adjustGenModel(genModel, featureDelegation); |