[xtext tests] introduced 'src-gen2' source folder, introduced dedicated 'TestProjectConfig', activated class-splitting in 'TestLanguage', updated 'GenerateAllTestLanguages2' workflow; added documentation in 'StandardProjectConfig'

Signed-off-by: Christian Schneider <christian.schneider@itemis.de>
This commit is contained in:
Christian Schneider 2015-11-16 15:59:39 +01:00
parent 5901b857e5
commit 076807b17b
5 changed files with 47 additions and 4 deletions

View file

@ -17,6 +17,7 @@ import org.eclipse.xtext.xtext.generator.Issues
@Accessors
class StandardProjectConfig extends XtextProjectConfig {
/** set to {@code true} by the project wizard(s) in case "Maven/Gradle" source layout is selected. */
boolean mavenLayout
boolean createEclipseMetaData
String rootPath
@ -88,10 +89,19 @@ class StandardProjectConfig extends XtextProjectConfig {
rootPath + '/' + project.name
}
/**
* In case of "Maven/Gradle" source layout the src outlet is named 'src/main/java',
* test classes go into 'src/test/java' instead of any dedicated '...tests' project.
*/
protected def computeSrc(SubProjectConfig project) {
project.rootPath + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/java' else 'src'
}
/**
* In case of "Maven/Gradle" source layout the srcGen outlet is named 'src/main/xtext-gen',
* test-related srcGen classes go into 'src/test/xtext-gen' instead of any dedicated '...tests' project.
* Don't confuse it with 'src/main/xtend-gen'!
*/
protected def computeSrcGen(SubProjectConfig project) {
project.rootPath + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/xtext-gen' else 'src-gen'
}

View file

@ -13,6 +13,11 @@
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src-gen2">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="src" path="suites"/>
<classpathentry exported="true" kind="lib" path="lib/simple.jar"/>

View file

@ -64,7 +64,7 @@ Workflow {
* generated by Xtext
*/"
}
project = xtext.generator.model.project.StandardProjectConfig {
project = TestProjectConfig {
baseName = projectName
rootPath = ".."
runtime = {
@ -90,9 +90,9 @@ Workflow {
language = TestLanguage {
name = "org.eclipse.xtext.generator.ecore.SuperTestLanguage"
}
// language = TestLanguage {
// name = "org.eclipse.xtext.generator.ecore.SubTestLanguage"
// }
language = TestLanguage {
name = "org.eclipse.xtext.generator.ecore.SubTestLanguage"
}
// language = TestLanguage {
// name = "org.eclipse.xtext.XtextGrammarTestLanguage"
// }

View file

@ -34,6 +34,9 @@ class TestLanguage extends XtextGeneratorLanguage {
EMFGeneratorFragment2 emfGenerator = new EMFGeneratorFragment2
XtextAntlrGeneratorFragment2 parserGenerator = new XtextAntlrGeneratorFragment2 => [
debugGrammar = true
options => [
classSplitting = true
]
]
XtextAntlrIDEAGeneratorFragment ideaParser = new XtextAntlrIDEAGeneratorFragment

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2015 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext
import org.eclipse.xtext.xtext.generator.model.project.StandardProjectConfig
import org.eclipse.xtext.xtext.generator.model.project.SubProjectConfig
/**
* @author Christian Schneider - Initial contribution and API
*/
class TestProjectConfig extends StandardProjectConfig {
/**
* Put the 'srcGen' classes generated for those test languages that are migrated
* to the new generator infrastructure into a separate source folder!
*/
override protected computeSrcGen(SubProjectConfig project) {
return super.computeSrcGen(project) + "2"
}
}