diff options
author | Ed Willink | 2018-04-22 07:18:26 +0000 |
---|---|---|
committer | Ed Willink | 2018-04-22 09:38:38 +0000 |
commit | 8dbee5849b9f54fba93475f9fc29963b3e110bab (patch) | |
tree | 53566ecfe9f825e0a1a46f339b2a5f9001e4fdca /tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd | |
parent | ff4bf81b1322699a107e4f9b850c7658c8942111 (diff) | |
download | org.eclipse.qvtd-8dbee5849b9f54fba93475f9fc29963b3e110bab.tar.gz org.eclipse.qvtd-8dbee5849b9f54fba93475f9fc29963b3e110bab.tar.xz org.eclipse.qvtd-8dbee5849b9f54fba93475f9fc29963b3e110bab.zip |
[unrelated] Avoid deleting Java files in double compilation test
Diffstat (limited to 'tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd')
-rw-r--r-- | tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java index a556827ac..e66c0561a 100644 --- a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java +++ b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/src/org/eclipse/qvtd/xtext/qvtrelation/tests/QVTrCompilerTests.java @@ -31,6 +31,7 @@ import org.eclipse.ocl.pivot.model.OCLstdlib; import org.eclipse.ocl.pivot.resource.ProjectManager; import org.eclipse.ocl.pivot.utilities.ToStringVisitor; import org.eclipse.ocl.xtext.base.services.BaseLinkingService; +import org.eclipse.qvtd.compiler.CompilerChain; import org.eclipse.qvtd.compiler.CompilerOptions; import org.eclipse.qvtd.compiler.QVTrCompilerChain; import org.eclipse.qvtd.compiler.internal.qvtb2qvts.ConnectivityChecker; @@ -68,13 +69,6 @@ public class QVTrCompilerTests extends LoadTestCase } @Override - public @NonNull ImperativeTransformation compile(@NonNull String enforcedOutputName) throws IOException { - ImperativeTransformation asTransformation = super.compile(enforcedOutputName); - // compilerChain.throwCompilerChainExceptionForWarnings(); - return asTransformation; - } - - @Override protected @NonNull QVTr2QVTsCompilerStep createQVTr2QVTsCompilerStep() { return new QVTr2QVTsCompilerStep(this) { @@ -88,11 +82,22 @@ public class QVTrCompilerTests extends LoadTestCase } } + private boolean keepOldJavaFiles = false; + public MyQVT(@NonNull ProjectManager projectManager, @NonNull String testProjectName, @NonNull URI testBundleURI, @NonNull URI txURI, @NonNull URI intermediateFileNamePrefixURI, @NonNull URI srcFileURI, @NonNull URI binFileURI) { super(projectManager, testProjectName, testBundleURI, txURI, intermediateFileNamePrefixURI, srcFileURI, binFileURI); } @Override + protected @NonNull CompilerOptions createBuildCompilerChainOptions(boolean isIncremental) { + CompilerOptions options = super.createBuildCompilerChainOptions(isIncremental); + if (keepOldJavaFiles) { + options.setOption(CompilerChain.GENMODEL_STEP, CompilerChain.KEEP_OLD_JAVA_FILES_KEY, Boolean.TRUE); + } + return options; + } + + @Override protected @NonNull QVTrCompilerChain createCompilerChain(@NonNull URI txURI, @NonNull URI intermediateFileNamePrefixURI, @NonNull CompilerOptions options) { return new InstrumentedCompilerChain(getEnvironmentFactory(), txURI, intermediateFileNamePrefixURI, options); } @@ -111,6 +116,10 @@ public class QVTrCompilerTests extends LoadTestCase protected @NonNull ProjectManager getTestProjectManager() throws Exception { return EMFPlugin.IS_ECLIPSE_RUNNING ? new ProjectMap(true) : QVTrCompilerTests.this.getTestProjectManager(); } + + protected void setKeepOldJavaFiles() { + this.keepOldJavaFiles = true; + } } protected static class PivotQVTrelationToStringFactory implements QVTtemplateToStringVisitor.Factory @@ -251,6 +260,7 @@ public class QVTrCompilerTests extends LoadTestCase } Class<? extends Transformer> txClass3; MyQVT myQVT3 = createQVT("Families2Persons", txURI2); + myQVT3.setKeepOldJavaFiles(); // MyQVT myQVT3 = new MyQVT(createTestProjectManager(), getTestBundleURI(), "models/families2persons", "samples"); // myQVT3.addRegisteredPackage("org.eclipse.qvtd.xtext.qvtrelation.tests.models.families2persons.Families.FamiliesPackage"); // myQVT3.addRegisteredPackage("org.eclipse.qvtd.xtext.qvtrelation.tests.models.families2persons.Persons.PersonsPackage"); |