mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[generator2] make XtextProjectConfig more structured
This commit is contained in:
parent
1ad499f4db
commit
7df92e3ff4
36 changed files with 544 additions and 1692 deletions
|
@ -15,7 +15,7 @@ import org.eclipse.xtext.Grammar
|
|||
abstract class AbstractGeneratorFragment2 implements IGeneratorFragment2 {
|
||||
|
||||
@Accessors(PROTECTED_GETTER)
|
||||
@Inject IXtextProjectConfig projectConfig
|
||||
@Inject XtextProjectConfig projectConfig
|
||||
|
||||
@Accessors(PROTECTED_GETTER)
|
||||
@Inject ILanguageConfig language
|
||||
|
|
|
@ -27,7 +27,7 @@ class DefaultGeneratorModule extends AbstractGenericModule {
|
|||
}
|
||||
|
||||
def void configureXtextProjectConfig(Binder binder) {
|
||||
binder.bind(IXtextProjectConfig).toInstance(project)
|
||||
binder.bind(XtextProjectConfig).toInstance(project)
|
||||
}
|
||||
|
||||
def void configureCodeConfig(Binder binder) {
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess;
|
||||
|
||||
/**
|
||||
* Inject an instance of this interface in order to generate code in a generator fragment.
|
||||
*
|
||||
* <p>This file has been generated with {@link org.eclipse.xtext.xtext.generator.internal.ProjectConfigGenerator}.</p>
|
||||
*/
|
||||
public interface IXtextProjectConfig extends IGuiceAwareGeneratorComponent {
|
||||
|
||||
IXtextGeneratorFileSystemAccess getRuntimeModelGen();
|
||||
|
||||
String getRuntimeProjectName();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeRoot();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeSrc();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeSrcGen();
|
||||
ManifestAccess getRuntimeManifest();
|
||||
PluginXmlAccess getRuntimePluginXml();
|
||||
|
||||
String getRuntimeTestProjectName();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeTestRoot();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeTestMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeTestSrc();
|
||||
IXtextGeneratorFileSystemAccess getRuntimeTestSrcGen();
|
||||
ManifestAccess getRuntimeTestManifest();
|
||||
PluginXmlAccess getRuntimeTestPluginXml();
|
||||
|
||||
String getGenericIdeProjectName();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeRoot();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeSrc();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeSrcGen();
|
||||
ManifestAccess getGenericIdeManifest();
|
||||
PluginXmlAccess getGenericIdePluginXml();
|
||||
|
||||
String getGenericIdeTestProjectName();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeTestRoot();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeTestMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeTestSrc();
|
||||
IXtextGeneratorFileSystemAccess getGenericIdeTestSrcGen();
|
||||
ManifestAccess getGenericIdeTestManifest();
|
||||
PluginXmlAccess getGenericIdeTestPluginXml();
|
||||
|
||||
String getEclipsePluginProjectName();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginRoot();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginSrc();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginSrcGen();
|
||||
ManifestAccess getEclipsePluginManifest();
|
||||
PluginXmlAccess getEclipsePluginPluginXml();
|
||||
|
||||
String getEclipsePluginTestProjectName();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginTestRoot();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginTestMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginTestSrc();
|
||||
IXtextGeneratorFileSystemAccess getEclipsePluginTestSrcGen();
|
||||
ManifestAccess getEclipsePluginTestManifest();
|
||||
PluginXmlAccess getEclipsePluginTestPluginXml();
|
||||
|
||||
String getIdeaPluginProjectName();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginRoot();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginSrc();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginSrcGen();
|
||||
ManifestAccess getIdeaPluginManifest();
|
||||
|
||||
String getIdeaPluginTestProjectName();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginTestRoot();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginTestMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginTestSrc();
|
||||
IXtextGeneratorFileSystemAccess getIdeaPluginTestSrcGen();
|
||||
ManifestAccess getIdeaPluginTestManifest();
|
||||
|
||||
String getWebProjectName();
|
||||
IXtextGeneratorFileSystemAccess getWebRoot();
|
||||
IXtextGeneratorFileSystemAccess getWebMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getWebSrc();
|
||||
IXtextGeneratorFileSystemAccess getWebSrcGen();
|
||||
ManifestAccess getWebManifest();
|
||||
|
||||
String getWebTestProjectName();
|
||||
IXtextGeneratorFileSystemAccess getWebTestRoot();
|
||||
IXtextGeneratorFileSystemAccess getWebTestMetaInf();
|
||||
IXtextGeneratorFileSystemAccess getWebTestSrc();
|
||||
IXtextGeneratorFileSystemAccess getWebTestSrcGen();
|
||||
ManifestAccess getWebTestManifest();
|
||||
|
||||
IXtextGeneratorFileSystemAccess getWebApp();
|
||||
|
||||
}
|
|
@ -19,26 +19,24 @@ import static extension org.eclipse.xtext.xtext.generator.model.TypeReference.*
|
|||
|
||||
package class ImplicitFragment extends AbstractGeneratorFragment2 {
|
||||
|
||||
@Inject IXtextProjectConfig projectConfig
|
||||
|
||||
@Inject extension XbaseUsageDetector
|
||||
|
||||
@Inject extension XtextGeneratorNaming naming
|
||||
|
||||
override generate() {
|
||||
if (projectConfig.runtimeManifest !== null) {
|
||||
projectConfig.runtimeManifest.requiredBundles.addAll(#[
|
||||
if (projectConfig.runtime.manifest !== null) {
|
||||
projectConfig.runtime.manifest.requiredBundles.addAll(#[
|
||||
'org.eclipse.xtext', 'org.eclipse.xtext.util', 'org.eclipse.xtend.lib'
|
||||
])
|
||||
projectConfig.runtimeManifest.importedPackages.add('org.apache.log4j')
|
||||
projectConfig.runtime.manifest.importedPackages.add('org.apache.log4j')
|
||||
}
|
||||
if (projectConfig.eclipsePluginManifest !== null) {
|
||||
projectConfig.eclipsePluginManifest.requiredBundles.addAll(#[
|
||||
if (projectConfig.eclipsePlugin.manifest !== null) {
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles.addAll(#[
|
||||
'org.eclipse.xtext.ui', 'org.eclipse.xtext.ui.shared', 'org.eclipse.ui.editors', 'org.eclipse.ui', 'org.eclipse.xtend.lib'
|
||||
])
|
||||
}
|
||||
if (projectConfig.eclipsePluginPluginXml !== null) {
|
||||
projectConfig.eclipsePluginPluginXml.entries += grammar.implicitPluginXmlEnties
|
||||
if (projectConfig.eclipsePlugin.pluginXml !== null) {
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += grammar.implicitPluginXmlEnties
|
||||
}
|
||||
|
||||
val StringConcatenationClient expression = '''«'org.eclipse.xtext.ui.shared.Access'.typeRef».getJavaProjectsState()'''
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator
|
||||
|
||||
import org.eclipse.emf.mwe2.runtime.Mandatory
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess
|
||||
|
||||
@Accessors
|
||||
class WizardConfig extends XtextProjectConfig {
|
||||
|
||||
boolean mavenLayout
|
||||
boolean createEclipseMetaData
|
||||
String rootPath
|
||||
String baseName
|
||||
|
||||
@Mandatory
|
||||
def setBaseName(String baseName) {
|
||||
this.baseName = baseName
|
||||
}
|
||||
|
||||
@Mandatory
|
||||
def setRootPath(String rootPath) {
|
||||
this.rootPath = rootPath
|
||||
}
|
||||
|
||||
override checkConfiguration(Issues issues) {
|
||||
super.checkConfiguration(issues)
|
||||
if (rootPath === null)
|
||||
issues.addError("The property 'rootPath' must be set", this)
|
||||
if (baseName === null)
|
||||
issues.addError("The property 'baseName' must be set", this)
|
||||
}
|
||||
|
||||
override setDefaults() {
|
||||
super.setDefaults
|
||||
enabledProjects.forEach [
|
||||
if (name === null)
|
||||
name = computeName
|
||||
if (root === null)
|
||||
root = computeRoot
|
||||
if (metaInf === null)
|
||||
metaInf = computeMetaInf
|
||||
if (src === null)
|
||||
src = computeSrc
|
||||
if (srcGen === null)
|
||||
srcGen = computeSrcGen
|
||||
if (it instanceof BundleProjectConfig) {
|
||||
if (createEclipseMetaData) {
|
||||
if (manifest === null)
|
||||
manifest = new ManifestAccess
|
||||
if (pluginXml === null)
|
||||
pluginXml = new PluginXmlAccess
|
||||
}
|
||||
}
|
||||
if (it instanceof RuntimeProjectConfig) {
|
||||
if (ecoreModel === null)
|
||||
ecoreModel = computeEcoreModel
|
||||
}
|
||||
if (it instanceof WebProjectConfig) {
|
||||
if (assets === null)
|
||||
assets = computeAssets
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
protected def computeName(SubProjectConfig project) {
|
||||
switch project {
|
||||
case runtime: baseName
|
||||
case runtimeTest: baseName + '.tests'
|
||||
case genericIde: baseName + '.ide'
|
||||
case eclipsePlugin: baseName + '.ui'
|
||||
case eclipsePluginTest: baseName + '.ui.tests'
|
||||
case ideaPlugin: baseName + '.idea'
|
||||
case web: baseName + '.web'
|
||||
}
|
||||
}
|
||||
|
||||
protected def computeRoot(SubProjectConfig project) {
|
||||
rootPath + '/' + project.name
|
||||
}
|
||||
|
||||
protected def computeSrc(SubProjectConfig project) {
|
||||
project.root.path + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/java' else 'src'
|
||||
}
|
||||
|
||||
protected def computeSrcGen(SubProjectConfig project) {
|
||||
project.root.path + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/xtext-gen' else 'src-gen'
|
||||
}
|
||||
|
||||
protected def computeMetaInf(SubProjectConfig project) {
|
||||
project.root.path + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/resources/META-INF' else 'META-INF'
|
||||
}
|
||||
|
||||
protected def computeEcoreModel(RuntimeProjectConfig project) {
|
||||
project.root.path + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/ecore/generated' else 'model/generated'
|
||||
}
|
||||
|
||||
protected def computeAssets(WebProjectConfig project) {
|
||||
project.root.path + '/' + if(mavenLayout) 'src/' + project.computeSourceSet + '/webapp' else 'WebRoot'
|
||||
}
|
||||
|
||||
protected def computeSourceSet(SubProjectConfig project) {
|
||||
if(testProjects.contains(project)) 'test' else 'main'
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator
|
||||
|
||||
import com.google.inject.Injector
|
||||
import java.util.List
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
|
||||
@Accessors
|
||||
class XtextProjectConfig implements IGuiceAwareGeneratorComponent {
|
||||
RuntimeProjectConfig runtime = new RuntimeProjectConfig
|
||||
BundleProjectConfig runtimeTest = new BundleProjectConfig
|
||||
BundleProjectConfig genericIde = new BundleProjectConfig
|
||||
BundleProjectConfig eclipsePlugin = new BundleProjectConfig
|
||||
BundleProjectConfig eclipsePluginTest = new BundleProjectConfig
|
||||
SubProjectConfig ideaPlugin = new SubProjectConfig
|
||||
WebProjectConfig web = new WebProjectConfig
|
||||
|
||||
def void checkConfiguration(Issues issues) {
|
||||
enabledProjects.forEach[checkConfiguration(issues)]
|
||||
}
|
||||
|
||||
def List<? extends SubProjectConfig> getAllProjects() {
|
||||
val allProjects = newArrayList
|
||||
allProjects += #[
|
||||
runtime,
|
||||
runtimeTest,
|
||||
genericIde,
|
||||
eclipsePlugin,
|
||||
eclipsePluginTest,
|
||||
ideaPlugin,
|
||||
web
|
||||
]
|
||||
allProjects
|
||||
}
|
||||
|
||||
def List<? extends SubProjectConfig> getTestProjects() {
|
||||
val testProjects = newArrayList
|
||||
testProjects += #[
|
||||
runtimeTest,
|
||||
eclipsePluginTest
|
||||
]
|
||||
testProjects
|
||||
}
|
||||
|
||||
def List<? extends SubProjectConfig> getEnabledProjects() {
|
||||
val enabledProjects = newArrayList
|
||||
enabledProjects += allProjects.filter[enabled]
|
||||
enabledProjects
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
setDefaults
|
||||
injector.injectMembers(this)
|
||||
enabledProjects.forEach[initialize(injector)]
|
||||
}
|
||||
|
||||
def setDefaults() {
|
||||
runtime.enabled = true
|
||||
if (#[eclipsePlugin, ideaPlugin, web].exists[enabled])
|
||||
genericIde.enabled = true
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator
|
||||
|
||||
import com.google.common.base.CharMatcher
|
||||
import com.google.inject.Injector
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess
|
||||
|
||||
|
||||
class SubProjectConfig implements IGuiceAwareGeneratorComponent {
|
||||
@Accessors
|
||||
boolean enabled
|
||||
@Accessors
|
||||
String name
|
||||
@Accessors(PUBLIC_GETTER)
|
||||
IXtextGeneratorFileSystemAccess root
|
||||
@Accessors(PUBLIC_GETTER)
|
||||
IXtextGeneratorFileSystemAccess metaInf
|
||||
@Accessors(PUBLIC_GETTER)
|
||||
IXtextGeneratorFileSystemAccess src
|
||||
@Accessors(PUBLIC_GETTER)
|
||||
IXtextGeneratorFileSystemAccess srcGen
|
||||
|
||||
def void setRoot(String path) {
|
||||
root = new XtextGeneratorFileSystemAccess(path, true)
|
||||
}
|
||||
|
||||
def void setMetaInf(String path) {
|
||||
metaInf = new XtextGeneratorFileSystemAccess(path, true)
|
||||
}
|
||||
|
||||
def void setSrc(String path) {
|
||||
src = new XtextGeneratorFileSystemAccess(path, false)
|
||||
}
|
||||
|
||||
def void setSrcGen(String path) {
|
||||
srcGen = new XtextGeneratorFileSystemAccess(path, true)
|
||||
}
|
||||
|
||||
def void checkConfiguration(Issues issues) {
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
injector.injectMembers(this)
|
||||
root?.initialize(injector)
|
||||
metaInf?.initialize(injector)
|
||||
src?.initialize(injector)
|
||||
srcGen?.initialize(injector)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Accessors
|
||||
class BundleProjectConfig extends SubProjectConfig {
|
||||
ManifestAccess manifest
|
||||
PluginXmlAccess pluginXml
|
||||
|
||||
override initialize(Injector injector) {
|
||||
super.initialize(injector)
|
||||
manifest?.initialize(injector)
|
||||
pluginXml?.initialize(injector)
|
||||
}
|
||||
|
||||
override checkConfiguration(Issues issues) {
|
||||
super.checkConfiguration(issues)
|
||||
if (manifest !== null && metaInf === null) {
|
||||
issues.addError("The 'metaInf' outlet must be configured for projects with a manifest", this)
|
||||
}
|
||||
if (pluginXml !== null && root === null) {
|
||||
issues.addError("The 'root' outlet must be configured for projects with a plugin.xml", this)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class RuntimeProjectConfig extends BundleProjectConfig {
|
||||
@Accessors(PUBLIC_GETTER)
|
||||
IXtextGeneratorFileSystemAccess ecoreModel
|
||||
|
||||
def void setEcoreModel(String path) {
|
||||
ecoreModel = new XtextGeneratorFileSystemAccess(path, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the root-relative path of the folder where the generated .ecore and .genmodel can be found.
|
||||
* The path is delimited by and ends with '/'
|
||||
*/
|
||||
def String getEcoreModelFolder() {
|
||||
val ecoreModelFolder = ecoreModel.path.replace(root.path, "").replace('\\', '/')
|
||||
val slashes = CharMatcher.is('/')
|
||||
slashes.trimFrom(ecoreModelFolder) + "/"
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
super.initialize(injector)
|
||||
ecoreModel?.initialize(injector)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class WebProjectConfig extends SubProjectConfig {
|
||||
@Accessors(PUBLIC_GETTER)
|
||||
IXtextGeneratorFileSystemAccess assets
|
||||
|
||||
def void setAssets(String path) {
|
||||
assets = new XtextGeneratorFileSystemAccess(path, true)
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
super.initialize(injector)
|
||||
assets?.initialize(injector)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator
|
||||
|
||||
import com.google.inject.Injector
|
||||
import org.eclipse.emf.mwe2.runtime.Mandatory
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess
|
||||
|
||||
@Accessors
|
||||
class WizardConfig extends XtextProjectConfig {
|
||||
|
||||
boolean eclipseEditor = true
|
||||
|
||||
boolean ideaEditor = false
|
||||
|
||||
boolean webSupport = false
|
||||
|
||||
boolean genericIdeSupport = false
|
||||
|
||||
boolean testingSupport = false
|
||||
|
||||
boolean mavenLayout = false
|
||||
|
||||
String rootPath
|
||||
|
||||
String baseName
|
||||
|
||||
@Mandatory
|
||||
def setBaseName(String baseName) {
|
||||
this.baseName = baseName
|
||||
}
|
||||
|
||||
@Mandatory
|
||||
def setRootPath(String rootPath) {
|
||||
this.rootPath = rootPath
|
||||
}
|
||||
|
||||
override checkConfiguration(Issues issues) {
|
||||
super.checkConfiguration(issues)
|
||||
if (rootPath == null) {
|
||||
issues.addError('The property \'rootPath\' must be set.', this)
|
||||
return
|
||||
}
|
||||
if (baseName == null) {
|
||||
issues.addError('The property \'baseName\' must be set.', this)
|
||||
return
|
||||
}
|
||||
val runtimeBase = runtimeRoot?.path
|
||||
if (!Character.isJavaIdentifierPart(runtimeBase.charAt(runtimeBase.length - 1)))
|
||||
issues.addError('The runtime root path must end with a valid package name.', this)
|
||||
if ((ideaEditor || webSupport) && !genericIdeSupport)
|
||||
issues.addError('Generic IDE support must be enabled when the IDEA or web editors are enabled.', this)
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
var src = 'src'
|
||||
var testSrc = src
|
||||
var srcGen = 'src-gen'
|
||||
var testSrcGen = srcGen
|
||||
var metaInf = 'META-INF'
|
||||
var modelGen = 'model/generated'
|
||||
var srcWeb = 'WebRoot'
|
||||
if (mavenLayout) {
|
||||
src = 'src/main/java'
|
||||
testSrc = 'src/test/java'
|
||||
srcGen = 'src/main/xtext-gen'
|
||||
testSrcGen = 'src/test/xtext-gen'
|
||||
metaInf = 'src/main/resources/META-INF'
|
||||
modelGen = 'src/main/model-gen'
|
||||
srcWeb = 'src/main/webapp'
|
||||
}
|
||||
|
||||
if (runtimeProjectName=== null)
|
||||
runtimeProjectName = baseName
|
||||
if (runtimeRoot === null)
|
||||
runtimeRoot = rootPath + '/' + runtimeProjectName
|
||||
if (runtimeMetaInf === null)
|
||||
runtimeMetaInf = runtimeRoot.path + '/' + metaInf
|
||||
if (runtimeSrc === null)
|
||||
runtimeSrc = runtimeRoot.path + '/' + src
|
||||
if (runtimeSrcGen === null)
|
||||
runtimeSrcGen = runtimeRoot.path + '/' + srcGen
|
||||
if (runtimeManifest === null)
|
||||
runtimeManifest = injector.getInstance(ManifestAccess)
|
||||
if (runtimePluginXml === null)
|
||||
runtimePluginXml = injector.getInstance(PluginXmlAccess)
|
||||
if (runtimeModelGen === null)
|
||||
runtimeModelGen = runtimeRoot.path + '/' + modelGen
|
||||
|
||||
if (testingSupport) {
|
||||
if (runtimeTestProjectName=== null)
|
||||
if(mavenLayout) {
|
||||
runtimeTestProjectName = runtimeProjectName
|
||||
} else {
|
||||
runtimeTestProjectName = runtimeProjectName + ".tests"
|
||||
}
|
||||
if (runtimeTestRoot === null)
|
||||
runtimeTestRoot = rootPath + '/' + runtimeTestProjectName
|
||||
if (runtimeTestMetaInf=== null)
|
||||
runtimeTestMetaInf = runtimeTestRoot.path + '/' + metaInf
|
||||
if (runtimeTestSrc === null)
|
||||
runtimeTestSrc = runtimeTestRoot.path + '/' + testSrc
|
||||
if (runtimeTestSrcGen === null)
|
||||
runtimeTestSrcGen = runtimeTestRoot.path + '/' + testSrcGen
|
||||
if (runtimeTestManifest === null)
|
||||
runtimeTestManifest = injector.getInstance(ManifestAccess)
|
||||
}
|
||||
|
||||
if (eclipseEditor) {
|
||||
if (eclipsePluginProjectName=== null)
|
||||
eclipsePluginProjectName = baseName + '.ui'
|
||||
if (eclipsePluginRoot === null)
|
||||
eclipsePluginRoot = rootPath + '/' + eclipsePluginProjectName
|
||||
if (eclipsePluginMetaInf === null)
|
||||
eclipsePluginMetaInf = eclipsePluginRoot.path + '/' + metaInf
|
||||
if (eclipsePluginSrc === null)
|
||||
eclipsePluginSrc = eclipsePluginRoot.path + '/' + src
|
||||
if (eclipsePluginSrcGen === null)
|
||||
eclipsePluginSrcGen = eclipsePluginRoot.path + '/' + srcGen
|
||||
if (eclipsePluginManifest === null)
|
||||
eclipsePluginManifest = injector.getInstance(ManifestAccess)
|
||||
if (eclipsePluginPluginXml === null)
|
||||
eclipsePluginPluginXml = injector.getInstance(PluginXmlAccess)
|
||||
|
||||
if (testingSupport) {
|
||||
if (eclipsePluginTestProjectName=== null)
|
||||
eclipsePluginTestProjectName = eclipsePluginProjectName + '.tests'
|
||||
if (eclipsePluginTestRoot === null)
|
||||
eclipsePluginTestRoot = rootPath + '/' + eclipsePluginTestProjectName
|
||||
if (eclipsePluginTestRoot === null)
|
||||
eclipsePluginTestRoot = eclipsePluginRoot.path + '.tests'
|
||||
if (eclipsePluginTestMetaInf === null)
|
||||
eclipsePluginTestMetaInf = eclipsePluginTestRoot.path + '/' + metaInf
|
||||
if (eclipsePluginTestSrc === null)
|
||||
eclipsePluginTestSrc = eclipsePluginTestRoot.path + '/' + testSrc
|
||||
if (eclipsePluginTestSrcGen === null)
|
||||
eclipsePluginTestSrcGen = eclipsePluginTestRoot.path + '/' + testSrcGen
|
||||
if (eclipsePluginTestManifest === null)
|
||||
eclipsePluginTestManifest = injector.getInstance(ManifestAccess)
|
||||
}
|
||||
}
|
||||
|
||||
if (ideaEditor) {
|
||||
if (ideaPluginProjectName=== null)
|
||||
ideaPluginProjectName = baseName + '.idea'
|
||||
if (ideaPluginRoot === null)
|
||||
ideaPluginRoot = rootPath + '/' + ideaPluginProjectName
|
||||
if (ideaPluginSrc === null)
|
||||
ideaPluginSrc = ideaPluginRoot.path + '/' + src
|
||||
if (ideaPluginSrcGen === null)
|
||||
ideaPluginSrcGen = ideaPluginRoot.path + '/' + srcGen
|
||||
if (ideaPluginMetaInf === null)
|
||||
ideaPluginMetaInf = ideaPluginRoot.path + '/' + metaInf
|
||||
}
|
||||
|
||||
if (webSupport) {
|
||||
if (webProjectName=== null)
|
||||
webProjectName = baseName + '.web'
|
||||
if (webRoot === null)
|
||||
webRoot = rootPath + '/' + webProjectName
|
||||
if (webSrc === null)
|
||||
webSrc = webRoot.path + '/' + src
|
||||
if (webSrcGen === null)
|
||||
webSrcGen = webRoot.path + '/' + srcGen
|
||||
if (webApp === null)
|
||||
webApp = webRoot.path + '/' + srcWeb
|
||||
}
|
||||
|
||||
if (genericIdeSupport) {
|
||||
if (genericIdeProjectName=== null)
|
||||
genericIdeProjectName = baseName + '.ide'
|
||||
if (genericIdeRoot === null)
|
||||
genericIdeRoot = rootPath + '/' + genericIdeProjectName
|
||||
if (genericIdeMetaInf === null)
|
||||
genericIdeMetaInf = genericIdeRoot.path + '/' + metaInf
|
||||
if (genericIdeSrc === null)
|
||||
genericIdeSrc = genericIdeRoot.path + '/' + src
|
||||
if (genericIdeSrcGen === null)
|
||||
genericIdeSrcGen = genericIdeRoot.path + '/' + srcGen
|
||||
if (genericIdeManifest === null)
|
||||
genericIdeManifest = injector.getInstance(ManifestAccess)
|
||||
}
|
||||
|
||||
super.initialize(injector)
|
||||
}
|
||||
|
||||
}
|
|
@ -15,7 +15,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
|
|||
import java.io.File
|
||||
|
||||
class XtextDirectoryCleaner implements IGuiceAwareGeneratorComponent {
|
||||
@Inject IXtextProjectConfig config
|
||||
@Inject XtextProjectConfig config
|
||||
|
||||
@Accessors(PUBLIC_SETTER)
|
||||
boolean enabled = true
|
||||
|
@ -38,19 +38,7 @@ class XtextDirectoryCleaner implements IGuiceAwareGeneratorComponent {
|
|||
return;
|
||||
|
||||
val directories = newArrayList
|
||||
directories += #[
|
||||
config.runtimeModelGen,
|
||||
config.runtimeSrcGen,
|
||||
config.runtimeTestSrcGen,
|
||||
config.genericIdeSrcGen,
|
||||
config.genericIdeTestSrcGen,
|
||||
config.eclipsePluginSrcGen,
|
||||
config.eclipsePluginTestSrcGen,
|
||||
config.ideaPluginSrcGen,
|
||||
config.ideaPluginTestSrcGen,
|
||||
config.webSrcGen,
|
||||
config.webTestSrcGen
|
||||
].filterNull.map[path].filter[new File(it).isDirectory]
|
||||
directories += (config.enabledProjects.map[srcGen] + #[config.runtime.ecoreModel]).filterNull.map[path].filter[new File(it).isDirectory]
|
||||
directories += extraDirectories
|
||||
|
||||
val delegate = new DirectoryCleaner
|
||||
|
|
|
@ -58,7 +58,7 @@ class XtextGenerator extends AbstractWorkflowComponent2 {
|
|||
|
||||
Injector injector
|
||||
|
||||
@Inject IXtextProjectConfig projectConfig
|
||||
@Inject XtextProjectConfig projectConfig
|
||||
|
||||
@Inject XtextGeneratorTemplates templates
|
||||
|
||||
|
@ -136,40 +136,30 @@ class XtextGenerator extends AbstractWorkflowComponent2 {
|
|||
}
|
||||
|
||||
protected def generateSetups(ILanguageConfig language) {
|
||||
templates.createRuntimeGenSetup(language).writeTo(projectConfig.runtimeSrcGen)
|
||||
templates.createRuntimeSetup(language).writeTo(projectConfig.runtimeSrc)
|
||||
templates.createWebSetup(language).writeTo(projectConfig.webSrc)
|
||||
templates.createRuntimeGenSetup(language).writeTo(projectConfig.runtime.srcGen)
|
||||
templates.createRuntimeSetup(language).writeTo(projectConfig.runtime.src)
|
||||
templates.createWebSetup(language).writeTo(projectConfig.web.src)
|
||||
}
|
||||
|
||||
protected def generateModules(ILanguageConfig language) {
|
||||
templates.createRuntimeGenModule(language).writeTo(projectConfig.runtimeSrcGen)
|
||||
templates.createRuntimeModule(language).writeTo(projectConfig.runtimeSrc)
|
||||
templates.createEclipsePluginGenModule(language).writeTo(projectConfig.eclipsePluginSrcGen)
|
||||
templates.createEclipsePluginModule(language).writeTo(projectConfig.eclipsePluginSrc)
|
||||
templates.createIdeaGenModule(language).writeTo(projectConfig.ideaPluginSrcGen)
|
||||
templates.createIdeaModule(language).writeTo(projectConfig.ideaPluginSrc)
|
||||
templates.createWebGenModule(language).writeTo(projectConfig.webSrcGen)
|
||||
templates.createWebModule(language).writeTo(projectConfig.webSrc)
|
||||
templates.createRuntimeGenModule(language).writeTo(projectConfig.runtime.srcGen)
|
||||
templates.createRuntimeModule(language).writeTo(projectConfig.runtime.src)
|
||||
templates.createEclipsePluginGenModule(language).writeTo(projectConfig.eclipsePlugin.srcGen)
|
||||
templates.createEclipsePluginModule(language).writeTo(projectConfig.eclipsePlugin.src)
|
||||
templates.createIdeaGenModule(language).writeTo(projectConfig.ideaPlugin.srcGen)
|
||||
templates.createIdeaModule(language).writeTo(projectConfig.ideaPlugin.src)
|
||||
templates.createWebGenModule(language).writeTo(projectConfig.web.srcGen)
|
||||
templates.createWebModule(language).writeTo(projectConfig.web.src)
|
||||
}
|
||||
|
||||
protected def generateExecutableExtensionFactory(ILanguageConfig language) {
|
||||
if (projectConfig.eclipsePluginSrcGen !== null)
|
||||
templates.createEclipsePluginExecutableExtensionFactory(language, languageConfigs.head).writeTo(projectConfig.eclipsePluginSrcGen)
|
||||
if (projectConfig.eclipsePlugin.srcGen !== null)
|
||||
templates.createEclipsePluginExecutableExtensionFactory(language, languageConfigs.head).writeTo(projectConfig.eclipsePlugin.srcGen)
|
||||
}
|
||||
|
||||
protected def generateManifests() {
|
||||
val manifests = newLinkedList(
|
||||
Tuples.create(projectConfig.runtimeManifest, projectConfig.runtimeMetaInf, projectConfig.runtimeProjectName),
|
||||
Tuples.create(projectConfig.runtimeTestManifest, projectConfig.runtimeTestMetaInf, projectConfig.runtimeTestProjectName),
|
||||
Tuples.create(projectConfig.genericIdeManifest, projectConfig.genericIdeMetaInf, projectConfig.genericIdeProjectName),
|
||||
Tuples.create(projectConfig.genericIdeTestManifest, projectConfig.genericIdeTestMetaInf, projectConfig.genericIdeTestProjectName),
|
||||
Tuples.create(projectConfig.eclipsePluginManifest, projectConfig.eclipsePluginMetaInf, projectConfig.eclipsePluginProjectName),
|
||||
Tuples.create(projectConfig.eclipsePluginTestManifest, projectConfig.eclipsePluginTestMetaInf, projectConfig.eclipsePluginTestProjectName),
|
||||
Tuples.create(projectConfig.ideaPluginManifest, projectConfig.ideaPluginMetaInf, projectConfig.ideaPluginProjectName),
|
||||
Tuples.create(projectConfig.ideaPluginTestManifest, projectConfig.ideaPluginTestMetaInf, projectConfig.ideaPluginTestProjectName),
|
||||
Tuples.create(projectConfig.webManifest, projectConfig.webMetaInf, projectConfig.webProjectName),
|
||||
Tuples.create(projectConfig.webTestManifest, projectConfig.webTestMetaInf, projectConfig.webTestProjectName)
|
||||
)
|
||||
val manifests = projectConfig.enabledProjects.filter(BundleProjectConfig)
|
||||
.map[Tuples.create(manifest, metaInf, name)].toList
|
||||
// Filter null values and merge duplicate entries
|
||||
val uri2Manifest = Maps.<URI, ManifestAccess>newHashMapWithExpectedSize(manifests.size)
|
||||
val manifestIter = manifests.listIterator
|
||||
|
@ -196,7 +186,7 @@ class XtextGenerator extends AbstractWorkflowComponent2 {
|
|||
if (manifest.bundleName === null) {
|
||||
manifest.bundleName = entry.third
|
||||
}
|
||||
if (manifest === projectConfig.eclipsePluginManifest) {
|
||||
if (manifest === projectConfig.eclipsePlugin.manifest) {
|
||||
val firstLanguage = languageConfigs.head
|
||||
manifest.activator = naming?.getEclipsePluginActivator(firstLanguage.grammar)
|
||||
}
|
||||
|
@ -236,19 +226,12 @@ class XtextGenerator extends AbstractWorkflowComponent2 {
|
|||
}
|
||||
|
||||
protected def generateActivator() {
|
||||
if (projectConfig.eclipsePluginSrcGen !== null && !languageConfigs.empty)
|
||||
templates.createEclipsePluginActivator(languageConfigs).writeTo(projectConfig.eclipsePluginSrcGen)
|
||||
if (projectConfig.eclipsePlugin.srcGen !== null && !languageConfigs.empty)
|
||||
templates.createEclipsePluginActivator(languageConfigs).writeTo(projectConfig.eclipsePlugin.srcGen)
|
||||
}
|
||||
|
||||
protected def generatePluginXmls() {
|
||||
val pluginXmls = newLinkedList(
|
||||
projectConfig.runtimePluginXml -> projectConfig.runtimeRoot,
|
||||
projectConfig.runtimeTestPluginXml -> projectConfig.runtimeTestRoot,
|
||||
projectConfig.genericIdePluginXml -> projectConfig.genericIdeRoot,
|
||||
projectConfig.genericIdeTestPluginXml -> projectConfig.genericIdeTestRoot,
|
||||
projectConfig.eclipsePluginPluginXml -> projectConfig.eclipsePluginRoot,
|
||||
projectConfig.eclipsePluginTestPluginXml -> projectConfig.eclipsePluginTestRoot
|
||||
)
|
||||
val pluginXmls = projectConfig.enabledProjects.filter(BundleProjectConfig).map[pluginXml -> root].toList
|
||||
// Filter null values and merge duplicate entries
|
||||
val uri2PluginXml = Maps.<URI, PluginXmlAccess>newHashMapWithExpectedSize(pluginXmls.size)
|
||||
val pluginXmlIter = pluginXmls.listIterator
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.eclipse.xtext.util.internal.Log
|
|||
|
||||
@Log
|
||||
class XtextGeneratorStandaloneSetup implements IGuiceAwareGeneratorComponent {
|
||||
@Inject IXtextProjectConfig projectConfig
|
||||
@Inject XtextProjectConfig projectConfig
|
||||
|
||||
@Accessors boolean scanClasspath = true
|
||||
|
||||
|
@ -31,23 +31,12 @@ class XtextGeneratorStandaloneSetup implements IGuiceAwareGeneratorComponent {
|
|||
projectMappings.forEach [ mapping |
|
||||
delegate.addProjectMapping(new ProjectMapping => [
|
||||
projectName = mapping.key
|
||||
path = mapping.value.path
|
||||
path = mapping.value
|
||||
])
|
||||
]
|
||||
}
|
||||
|
||||
private def getProjectMappings() {
|
||||
#[
|
||||
projectConfig.runtimeProjectName -> projectConfig.runtimeRoot,
|
||||
projectConfig.runtimeTestProjectName -> projectConfig.runtimeTestRoot,
|
||||
projectConfig.genericIdeProjectName -> projectConfig.genericIdeRoot,
|
||||
projectConfig.genericIdeTestProjectName -> projectConfig.genericIdeTestRoot,
|
||||
projectConfig.eclipsePluginProjectName -> projectConfig.eclipsePluginRoot,
|
||||
projectConfig.eclipsePluginTestProjectName -> projectConfig.eclipsePluginTestRoot,
|
||||
projectConfig.ideaPluginProjectName -> projectConfig.ideaPluginRoot,
|
||||
projectConfig.ideaPluginTestProjectName -> projectConfig.ideaPluginTestRoot,
|
||||
projectConfig.webProjectName -> projectConfig.webRoot,
|
||||
projectConfig.webTestProjectName -> projectConfig.webTestRoot
|
||||
].filter[key != null && value != null]
|
||||
projectConfig.enabledProjects.filter[name != null && root != null].map[name -> root.path]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,912 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess;
|
||||
|
||||
/**
|
||||
* Use this class to configure output paths in the XtextGenerator.
|
||||
*
|
||||
* <p>This file has been generated with {@link org.eclipse.xtext.xtext.generator.internal.ProjectConfigGenerator}.</p>
|
||||
*/
|
||||
public class XtextProjectConfig implements IXtextProjectConfig {
|
||||
|
||||
private IXtextGeneratorFileSystemAccess runtimeModelGen;
|
||||
private String runtimeProjectName;
|
||||
private IXtextGeneratorFileSystemAccess runtimeRoot;
|
||||
private IXtextGeneratorFileSystemAccess runtimeMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess runtimeSrc;
|
||||
private IXtextGeneratorFileSystemAccess runtimeSrcGen;
|
||||
private ManifestAccess runtimeManifest;
|
||||
private PluginXmlAccess runtimePluginXml;
|
||||
private String runtimeTestProjectName;
|
||||
private IXtextGeneratorFileSystemAccess runtimeTestRoot;
|
||||
private IXtextGeneratorFileSystemAccess runtimeTestMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess runtimeTestSrc;
|
||||
private IXtextGeneratorFileSystemAccess runtimeTestSrcGen;
|
||||
private ManifestAccess runtimeTestManifest;
|
||||
private PluginXmlAccess runtimeTestPluginXml;
|
||||
private String genericIdeProjectName;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeRoot;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeSrc;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeSrcGen;
|
||||
private ManifestAccess genericIdeManifest;
|
||||
private PluginXmlAccess genericIdePluginXml;
|
||||
private String genericIdeTestProjectName;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeTestRoot;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeTestMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeTestSrc;
|
||||
private IXtextGeneratorFileSystemAccess genericIdeTestSrcGen;
|
||||
private ManifestAccess genericIdeTestManifest;
|
||||
private PluginXmlAccess genericIdeTestPluginXml;
|
||||
private String eclipsePluginProjectName;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginRoot;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginSrc;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginSrcGen;
|
||||
private ManifestAccess eclipsePluginManifest;
|
||||
private PluginXmlAccess eclipsePluginPluginXml;
|
||||
private String eclipsePluginTestProjectName;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginTestRoot;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginTestMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginTestSrc;
|
||||
private IXtextGeneratorFileSystemAccess eclipsePluginTestSrcGen;
|
||||
private ManifestAccess eclipsePluginTestManifest;
|
||||
private PluginXmlAccess eclipsePluginTestPluginXml;
|
||||
private String ideaPluginProjectName;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginRoot;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginSrc;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginSrcGen;
|
||||
private ManifestAccess ideaPluginManifest;
|
||||
private String ideaPluginTestProjectName;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginTestRoot;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginTestMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginTestSrc;
|
||||
private IXtextGeneratorFileSystemAccess ideaPluginTestSrcGen;
|
||||
private ManifestAccess ideaPluginTestManifest;
|
||||
private String webProjectName;
|
||||
private IXtextGeneratorFileSystemAccess webRoot;
|
||||
private IXtextGeneratorFileSystemAccess webMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess webSrc;
|
||||
private IXtextGeneratorFileSystemAccess webSrcGen;
|
||||
private ManifestAccess webManifest;
|
||||
private String webTestProjectName;
|
||||
private IXtextGeneratorFileSystemAccess webTestRoot;
|
||||
private IXtextGeneratorFileSystemAccess webTestMetaInf;
|
||||
private IXtextGeneratorFileSystemAccess webTestSrc;
|
||||
private IXtextGeneratorFileSystemAccess webTestSrcGen;
|
||||
private ManifestAccess webTestManifest;
|
||||
private IXtextGeneratorFileSystemAccess webApp;
|
||||
|
||||
public void checkConfiguration(Issues issues) {
|
||||
if (runtimeSrc == null) {
|
||||
issues.addError("The property 'runtimeSrc' must be set.", this);
|
||||
}
|
||||
if (runtimeSrcGen == null) {
|
||||
issues.addError("The property 'runtimeSrcGen' must be set.", this);
|
||||
}
|
||||
if (runtimeManifest != null && runtimeMetaInf == null) {
|
||||
issues.addError("The property 'runtimeMetaInf' must be set when 'runtimeManifest' is set.");
|
||||
}
|
||||
if (runtimePluginXml != null && runtimeRoot == null) {
|
||||
issues.addError("The property 'runtimeRoot' must be set when 'runtimePluginXml' is set.");
|
||||
}
|
||||
if (runtimeTestManifest != null && runtimeTestMetaInf == null) {
|
||||
issues.addError("The property 'runtimeTestMetaInf' must be set when 'runtimeTestManifest' is set.");
|
||||
}
|
||||
if (runtimeTestPluginXml != null && runtimeTestRoot == null) {
|
||||
issues.addError("The property 'runtimeTestRoot' must be set when 'runtimeTestPluginXml' is set.");
|
||||
}
|
||||
if (genericIdeManifest != null && genericIdeMetaInf == null) {
|
||||
issues.addError("The property 'genericIdeMetaInf' must be set when 'genericIdeManifest' is set.");
|
||||
}
|
||||
if (genericIdePluginXml != null && genericIdeRoot == null) {
|
||||
issues.addError("The property 'genericIdeRoot' must be set when 'genericIdePluginXml' is set.");
|
||||
}
|
||||
if (genericIdeTestManifest != null && genericIdeTestMetaInf == null) {
|
||||
issues.addError("The property 'genericIdeTestMetaInf' must be set when 'genericIdeTestManifest' is set.");
|
||||
}
|
||||
if (genericIdeTestPluginXml != null && genericIdeTestRoot == null) {
|
||||
issues.addError("The property 'genericIdeTestRoot' must be set when 'genericIdeTestPluginXml' is set.");
|
||||
}
|
||||
if (eclipsePluginManifest != null && eclipsePluginMetaInf == null) {
|
||||
issues.addError("The property 'eclipsePluginMetaInf' must be set when 'eclipsePluginManifest' is set.");
|
||||
}
|
||||
if (eclipsePluginPluginXml != null && eclipsePluginRoot == null) {
|
||||
issues.addError("The property 'eclipsePluginRoot' must be set when 'eclipsePluginPluginXml' is set.");
|
||||
}
|
||||
if (eclipsePluginTestManifest != null && eclipsePluginTestMetaInf == null) {
|
||||
issues.addError("The property 'eclipsePluginTestMetaInf' must be set when 'eclipsePluginTestManifest' is set.");
|
||||
}
|
||||
if (eclipsePluginTestPluginXml != null && eclipsePluginTestRoot == null) {
|
||||
issues.addError("The property 'eclipsePluginTestRoot' must be set when 'eclipsePluginTestPluginXml' is set.");
|
||||
}
|
||||
if (ideaPluginManifest != null && ideaPluginMetaInf == null) {
|
||||
issues.addError("The property 'ideaPluginMetaInf' must be set when 'ideaPluginManifest' is set.");
|
||||
}
|
||||
if (ideaPluginTestManifest != null && ideaPluginTestMetaInf == null) {
|
||||
issues.addError("The property 'ideaPluginTestMetaInf' must be set when 'ideaPluginTestManifest' is set.");
|
||||
}
|
||||
if (webManifest != null && webMetaInf == null) {
|
||||
issues.addError("The property 'webMetaInf' must be set when 'webManifest' is set.");
|
||||
}
|
||||
if (webTestManifest != null && webTestMetaInf == null) {
|
||||
issues.addError("The property 'webTestMetaInf' must be set when 'webTestManifest' is set.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Injector injector) {
|
||||
injector.injectMembers(this);
|
||||
if (runtimeModelGen != null) {
|
||||
runtimeModelGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize runtime configuration
|
||||
if (runtimeRoot != null) {
|
||||
runtimeRoot.initialize(injector);
|
||||
}
|
||||
if (runtimeMetaInf != null) {
|
||||
runtimeMetaInf.initialize(injector);
|
||||
}
|
||||
if (runtimeSrc != null) {
|
||||
runtimeSrc.initialize(injector);
|
||||
}
|
||||
if (runtimeSrcGen != null) {
|
||||
runtimeSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize runtimeTest configuration
|
||||
if (runtimeTestRoot != null) {
|
||||
runtimeTestRoot.initialize(injector);
|
||||
}
|
||||
if (runtimeTestMetaInf != null) {
|
||||
runtimeTestMetaInf.initialize(injector);
|
||||
}
|
||||
if (runtimeTestSrc != null) {
|
||||
runtimeTestSrc.initialize(injector);
|
||||
}
|
||||
if (runtimeTestSrcGen != null) {
|
||||
runtimeTestSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize genericIde configuration
|
||||
if (genericIdeRoot != null) {
|
||||
genericIdeRoot.initialize(injector);
|
||||
}
|
||||
if (genericIdeMetaInf != null) {
|
||||
genericIdeMetaInf.initialize(injector);
|
||||
}
|
||||
if (genericIdeSrc != null) {
|
||||
genericIdeSrc.initialize(injector);
|
||||
}
|
||||
if (genericIdeSrcGen != null) {
|
||||
genericIdeSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize genericIdeTest configuration
|
||||
if (genericIdeTestRoot != null) {
|
||||
genericIdeTestRoot.initialize(injector);
|
||||
}
|
||||
if (genericIdeTestMetaInf != null) {
|
||||
genericIdeTestMetaInf.initialize(injector);
|
||||
}
|
||||
if (genericIdeTestSrc != null) {
|
||||
genericIdeTestSrc.initialize(injector);
|
||||
}
|
||||
if (genericIdeTestSrcGen != null) {
|
||||
genericIdeTestSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize eclipsePlugin configuration
|
||||
if (eclipsePluginRoot != null) {
|
||||
eclipsePluginRoot.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginMetaInf != null) {
|
||||
eclipsePluginMetaInf.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginSrc != null) {
|
||||
eclipsePluginSrc.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginSrcGen != null) {
|
||||
eclipsePluginSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize eclipsePluginTest configuration
|
||||
if (eclipsePluginTestRoot != null) {
|
||||
eclipsePluginTestRoot.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginTestMetaInf != null) {
|
||||
eclipsePluginTestMetaInf.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginTestSrc != null) {
|
||||
eclipsePluginTestSrc.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginTestSrcGen != null) {
|
||||
eclipsePluginTestSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize ideaPlugin configuration
|
||||
if (ideaPluginRoot != null) {
|
||||
ideaPluginRoot.initialize(injector);
|
||||
}
|
||||
if (ideaPluginMetaInf != null) {
|
||||
ideaPluginMetaInf.initialize(injector);
|
||||
}
|
||||
if (ideaPluginSrc != null) {
|
||||
ideaPluginSrc.initialize(injector);
|
||||
}
|
||||
if (ideaPluginSrcGen != null) {
|
||||
ideaPluginSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize ideaPluginTest configuration
|
||||
if (ideaPluginTestRoot != null) {
|
||||
ideaPluginTestRoot.initialize(injector);
|
||||
}
|
||||
if (ideaPluginTestMetaInf != null) {
|
||||
ideaPluginTestMetaInf.initialize(injector);
|
||||
}
|
||||
if (ideaPluginTestSrc != null) {
|
||||
ideaPluginTestSrc.initialize(injector);
|
||||
}
|
||||
if (ideaPluginTestSrcGen != null) {
|
||||
ideaPluginTestSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize web configuration
|
||||
if (webRoot != null) {
|
||||
webRoot.initialize(injector);
|
||||
}
|
||||
if (webMetaInf != null) {
|
||||
webMetaInf.initialize(injector);
|
||||
}
|
||||
if (webSrc != null) {
|
||||
webSrc.initialize(injector);
|
||||
}
|
||||
if (webSrcGen != null) {
|
||||
webSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
// Initialize webTest configuration
|
||||
if (webTestRoot != null) {
|
||||
webTestRoot.initialize(injector);
|
||||
}
|
||||
if (webTestMetaInf != null) {
|
||||
webTestMetaInf.initialize(injector);
|
||||
}
|
||||
if (webTestSrc != null) {
|
||||
webTestSrc.initialize(injector);
|
||||
}
|
||||
if (webTestSrcGen != null) {
|
||||
webTestSrcGen.initialize(injector);
|
||||
}
|
||||
|
||||
if (webApp != null) {
|
||||
webApp.initialize(injector);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeModelGen() {
|
||||
return runtimeModelGen;
|
||||
}
|
||||
|
||||
public void setRuntimeModelGen(String path) {
|
||||
this.runtimeModelGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRuntimeProjectName() {
|
||||
return runtimeProjectName;
|
||||
}
|
||||
|
||||
public void setRuntimeProjectName(String projectName) {
|
||||
this.runtimeProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeRoot() {
|
||||
return runtimeRoot;
|
||||
}
|
||||
|
||||
public void setRuntimeRoot(String path) {
|
||||
this.runtimeRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeMetaInf() {
|
||||
return runtimeMetaInf;
|
||||
}
|
||||
|
||||
public void setRuntimeMetaInf(String path) {
|
||||
this.runtimeMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeSrc() {
|
||||
return runtimeSrc;
|
||||
}
|
||||
|
||||
public void setRuntimeSrc(String path) {
|
||||
this.runtimeSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeSrcGen() {
|
||||
return runtimeSrcGen;
|
||||
}
|
||||
|
||||
public void setRuntimeSrcGen(String path) {
|
||||
this.runtimeSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getRuntimeManifest() {
|
||||
return runtimeManifest;
|
||||
}
|
||||
|
||||
public void setRuntimeManifest(ManifestAccess manifest) {
|
||||
this.runtimeManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginXmlAccess getRuntimePluginXml() {
|
||||
return runtimePluginXml;
|
||||
}
|
||||
|
||||
public void setRuntimePluginXml(PluginXmlAccess pluginXml) {
|
||||
this.runtimePluginXml = pluginXml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRuntimeTestProjectName() {
|
||||
return runtimeTestProjectName;
|
||||
}
|
||||
|
||||
public void setRuntimeTestProjectName(String projectName) {
|
||||
this.runtimeTestProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeTestRoot() {
|
||||
return runtimeTestRoot;
|
||||
}
|
||||
|
||||
public void setRuntimeTestRoot(String path) {
|
||||
this.runtimeTestRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeTestMetaInf() {
|
||||
return runtimeTestMetaInf;
|
||||
}
|
||||
|
||||
public void setRuntimeTestMetaInf(String path) {
|
||||
this.runtimeTestMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeTestSrc() {
|
||||
return runtimeTestSrc;
|
||||
}
|
||||
|
||||
public void setRuntimeTestSrc(String path) {
|
||||
this.runtimeTestSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeTestSrcGen() {
|
||||
return runtimeTestSrcGen;
|
||||
}
|
||||
|
||||
public void setRuntimeTestSrcGen(String path) {
|
||||
this.runtimeTestSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getRuntimeTestManifest() {
|
||||
return runtimeTestManifest;
|
||||
}
|
||||
|
||||
public void setRuntimeTestManifest(ManifestAccess manifest) {
|
||||
this.runtimeTestManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginXmlAccess getRuntimeTestPluginXml() {
|
||||
return runtimeTestPluginXml;
|
||||
}
|
||||
|
||||
public void setRuntimeTestPluginXml(PluginXmlAccess pluginXml) {
|
||||
this.runtimeTestPluginXml = pluginXml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGenericIdeProjectName() {
|
||||
return genericIdeProjectName;
|
||||
}
|
||||
|
||||
public void setGenericIdeProjectName(String projectName) {
|
||||
this.genericIdeProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeRoot() {
|
||||
return genericIdeRoot;
|
||||
}
|
||||
|
||||
public void setGenericIdeRoot(String path) {
|
||||
this.genericIdeRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeMetaInf() {
|
||||
return genericIdeMetaInf;
|
||||
}
|
||||
|
||||
public void setGenericIdeMetaInf(String path) {
|
||||
this.genericIdeMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeSrc() {
|
||||
return genericIdeSrc;
|
||||
}
|
||||
|
||||
public void setGenericIdeSrc(String path) {
|
||||
this.genericIdeSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeSrcGen() {
|
||||
return genericIdeSrcGen;
|
||||
}
|
||||
|
||||
public void setGenericIdeSrcGen(String path) {
|
||||
this.genericIdeSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getGenericIdeManifest() {
|
||||
return genericIdeManifest;
|
||||
}
|
||||
|
||||
public void setGenericIdeManifest(ManifestAccess manifest) {
|
||||
this.genericIdeManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginXmlAccess getGenericIdePluginXml() {
|
||||
return genericIdePluginXml;
|
||||
}
|
||||
|
||||
public void setGenericIdePluginXml(PluginXmlAccess pluginXml) {
|
||||
this.genericIdePluginXml = pluginXml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGenericIdeTestProjectName() {
|
||||
return genericIdeTestProjectName;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestProjectName(String projectName) {
|
||||
this.genericIdeTestProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeTestRoot() {
|
||||
return genericIdeTestRoot;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestRoot(String path) {
|
||||
this.genericIdeTestRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeTestMetaInf() {
|
||||
return genericIdeTestMetaInf;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestMetaInf(String path) {
|
||||
this.genericIdeTestMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeTestSrc() {
|
||||
return genericIdeTestSrc;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestSrc(String path) {
|
||||
this.genericIdeTestSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getGenericIdeTestSrcGen() {
|
||||
return genericIdeTestSrcGen;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestSrcGen(String path) {
|
||||
this.genericIdeTestSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getGenericIdeTestManifest() {
|
||||
return genericIdeTestManifest;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestManifest(ManifestAccess manifest) {
|
||||
this.genericIdeTestManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginXmlAccess getGenericIdeTestPluginXml() {
|
||||
return genericIdeTestPluginXml;
|
||||
}
|
||||
|
||||
public void setGenericIdeTestPluginXml(PluginXmlAccess pluginXml) {
|
||||
this.genericIdeTestPluginXml = pluginXml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEclipsePluginProjectName() {
|
||||
return eclipsePluginProjectName;
|
||||
}
|
||||
|
||||
public void setEclipsePluginProjectName(String projectName) {
|
||||
this.eclipsePluginProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginRoot() {
|
||||
return eclipsePluginRoot;
|
||||
}
|
||||
|
||||
public void setEclipsePluginRoot(String path) {
|
||||
this.eclipsePluginRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginMetaInf() {
|
||||
return eclipsePluginMetaInf;
|
||||
}
|
||||
|
||||
public void setEclipsePluginMetaInf(String path) {
|
||||
this.eclipsePluginMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginSrc() {
|
||||
return eclipsePluginSrc;
|
||||
}
|
||||
|
||||
public void setEclipsePluginSrc(String path) {
|
||||
this.eclipsePluginSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginSrcGen() {
|
||||
return eclipsePluginSrcGen;
|
||||
}
|
||||
|
||||
public void setEclipsePluginSrcGen(String path) {
|
||||
this.eclipsePluginSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getEclipsePluginManifest() {
|
||||
return eclipsePluginManifest;
|
||||
}
|
||||
|
||||
public void setEclipsePluginManifest(ManifestAccess manifest) {
|
||||
this.eclipsePluginManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginXmlAccess getEclipsePluginPluginXml() {
|
||||
return eclipsePluginPluginXml;
|
||||
}
|
||||
|
||||
public void setEclipsePluginPluginXml(PluginXmlAccess pluginXml) {
|
||||
this.eclipsePluginPluginXml = pluginXml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEclipsePluginTestProjectName() {
|
||||
return eclipsePluginTestProjectName;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestProjectName(String projectName) {
|
||||
this.eclipsePluginTestProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginTestRoot() {
|
||||
return eclipsePluginTestRoot;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestRoot(String path) {
|
||||
this.eclipsePluginTestRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginTestMetaInf() {
|
||||
return eclipsePluginTestMetaInf;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestMetaInf(String path) {
|
||||
this.eclipsePluginTestMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginTestSrc() {
|
||||
return eclipsePluginTestSrc;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestSrc(String path) {
|
||||
this.eclipsePluginTestSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getEclipsePluginTestSrcGen() {
|
||||
return eclipsePluginTestSrcGen;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestSrcGen(String path) {
|
||||
this.eclipsePluginTestSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getEclipsePluginTestManifest() {
|
||||
return eclipsePluginTestManifest;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestManifest(ManifestAccess manifest) {
|
||||
this.eclipsePluginTestManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginXmlAccess getEclipsePluginTestPluginXml() {
|
||||
return eclipsePluginTestPluginXml;
|
||||
}
|
||||
|
||||
public void setEclipsePluginTestPluginXml(PluginXmlAccess pluginXml) {
|
||||
this.eclipsePluginTestPluginXml = pluginXml;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdeaPluginProjectName() {
|
||||
return ideaPluginProjectName;
|
||||
}
|
||||
|
||||
public void setIdeaPluginProjectName(String projectName) {
|
||||
this.ideaPluginProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginRoot() {
|
||||
return ideaPluginRoot;
|
||||
}
|
||||
|
||||
public void setIdeaPluginRoot(String path) {
|
||||
this.ideaPluginRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginMetaInf() {
|
||||
return ideaPluginMetaInf;
|
||||
}
|
||||
|
||||
public void setIdeaPluginMetaInf(String path) {
|
||||
this.ideaPluginMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginSrc() {
|
||||
return ideaPluginSrc;
|
||||
}
|
||||
|
||||
public void setIdeaPluginSrc(String path) {
|
||||
this.ideaPluginSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginSrcGen() {
|
||||
return ideaPluginSrcGen;
|
||||
}
|
||||
|
||||
public void setIdeaPluginSrcGen(String path) {
|
||||
this.ideaPluginSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getIdeaPluginManifest() {
|
||||
return ideaPluginManifest;
|
||||
}
|
||||
|
||||
public void setIdeaPluginManifest(ManifestAccess manifest) {
|
||||
this.ideaPluginManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdeaPluginTestProjectName() {
|
||||
return ideaPluginTestProjectName;
|
||||
}
|
||||
|
||||
public void setIdeaPluginTestProjectName(String projectName) {
|
||||
this.ideaPluginTestProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginTestRoot() {
|
||||
return ideaPluginTestRoot;
|
||||
}
|
||||
|
||||
public void setIdeaPluginTestRoot(String path) {
|
||||
this.ideaPluginTestRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginTestMetaInf() {
|
||||
return ideaPluginTestMetaInf;
|
||||
}
|
||||
|
||||
public void setIdeaPluginTestMetaInf(String path) {
|
||||
this.ideaPluginTestMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginTestSrc() {
|
||||
return ideaPluginTestSrc;
|
||||
}
|
||||
|
||||
public void setIdeaPluginTestSrc(String path) {
|
||||
this.ideaPluginTestSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getIdeaPluginTestSrcGen() {
|
||||
return ideaPluginTestSrcGen;
|
||||
}
|
||||
|
||||
public void setIdeaPluginTestSrcGen(String path) {
|
||||
this.ideaPluginTestSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getIdeaPluginTestManifest() {
|
||||
return ideaPluginTestManifest;
|
||||
}
|
||||
|
||||
public void setIdeaPluginTestManifest(ManifestAccess manifest) {
|
||||
this.ideaPluginTestManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebProjectName() {
|
||||
return webProjectName;
|
||||
}
|
||||
|
||||
public void setWebProjectName(String projectName) {
|
||||
this.webProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebRoot() {
|
||||
return webRoot;
|
||||
}
|
||||
|
||||
public void setWebRoot(String path) {
|
||||
this.webRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebMetaInf() {
|
||||
return webMetaInf;
|
||||
}
|
||||
|
||||
public void setWebMetaInf(String path) {
|
||||
this.webMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebSrc() {
|
||||
return webSrc;
|
||||
}
|
||||
|
||||
public void setWebSrc(String path) {
|
||||
this.webSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebSrcGen() {
|
||||
return webSrcGen;
|
||||
}
|
||||
|
||||
public void setWebSrcGen(String path) {
|
||||
this.webSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getWebManifest() {
|
||||
return webManifest;
|
||||
}
|
||||
|
||||
public void setWebManifest(ManifestAccess manifest) {
|
||||
this.webManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWebTestProjectName() {
|
||||
return webTestProjectName;
|
||||
}
|
||||
|
||||
public void setWebTestProjectName(String projectName) {
|
||||
this.webTestProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebTestRoot() {
|
||||
return webTestRoot;
|
||||
}
|
||||
|
||||
public void setWebTestRoot(String path) {
|
||||
this.webTestRoot = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebTestMetaInf() {
|
||||
return webTestMetaInf;
|
||||
}
|
||||
|
||||
public void setWebTestMetaInf(String path) {
|
||||
this.webTestMetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebTestSrc() {
|
||||
return webTestSrc;
|
||||
}
|
||||
|
||||
public void setWebTestSrc(String path) {
|
||||
this.webTestSrc = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebTestSrcGen() {
|
||||
return webTestSrcGen;
|
||||
}
|
||||
|
||||
public void setWebTestSrcGen(String path) {
|
||||
this.webTestSrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess getWebTestManifest() {
|
||||
return webTestManifest;
|
||||
}
|
||||
|
||||
public void setWebTestManifest(ManifestAccess manifest) {
|
||||
this.webTestManifest = manifest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebApp() {
|
||||
return webApp;
|
||||
}
|
||||
|
||||
public void setWebApp(String path) {
|
||||
this.webApp = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
}
|
|
@ -27,8 +27,8 @@ class BuilderIntegrationFragment2 extends AbstractGeneratorFragment2 {
|
|||
addRuntimeGuiceBindings
|
||||
addEclipsePluginGuiceBindings
|
||||
|
||||
if (projectConfig.eclipsePluginManifest !== null) {
|
||||
projectConfig.eclipsePluginManifest.requiredBundles.addAll(#[
|
||||
if (projectConfig.eclipsePlugin.manifest !== null) {
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles.addAll(#[
|
||||
'org.eclipse.xtext.builder', 'org.eclipse.xtext.ui'
|
||||
])
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
protected def String getJavaModelDirectory() {
|
||||
javaModelDirectory ?: projectConfig.runtimeSrcGen.path
|
||||
javaModelDirectory ?: projectConfig.runtime.srcGen.path
|
||||
}
|
||||
|
||||
protected def String getModelName(Grammar grammar) {
|
||||
|
@ -215,7 +215,7 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
protected def String getEcoreFilePath(Grammar grammar) {
|
||||
projectConfig.runtimeModelGen.path + '/' + grammar.modelName + '.ecore'
|
||||
projectConfig.runtime.ecoreModel.path + '/' + grammar.modelName + '.ecore'
|
||||
}
|
||||
|
||||
protected def URI getEcoreFileUri(Grammar grammar) {
|
||||
|
@ -223,7 +223,7 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
protected def String getGenModelPath(Grammar grammar) {
|
||||
genModel ?: projectConfig.runtimeModelGen.path + '/' + grammar.modelName + '.genmodel'
|
||||
genModel ?: projectConfig.runtime.ecoreModel.path + '/' + grammar.modelName + '.genmodel'
|
||||
}
|
||||
|
||||
protected def URI getGenModelUri(Grammar grammar) {
|
||||
|
@ -231,7 +231,7 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
protected def String getRelativePath(String pathInRoot) {
|
||||
val projectRoot = projectConfig.runtimeRoot.path
|
||||
val projectRoot = projectConfig.runtime.root.path
|
||||
if (pathInRoot.startsWith(projectRoot))
|
||||
pathInRoot.substring(projectRoot.length + 1)
|
||||
else
|
||||
|
@ -258,17 +258,17 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
|
||||
protected def String getModelPluginID() {
|
||||
modelPluginID ?: {
|
||||
val path = projectConfig.runtimeRoot.path
|
||||
val path = projectConfig.runtime.root.path
|
||||
path.substring(path.lastIndexOf('/') + 1)
|
||||
}
|
||||
}
|
||||
|
||||
protected def String getEditDirectory() {
|
||||
editDirectory ?: projectConfig.runtimeRoot.path + '.edit/src'
|
||||
editDirectory ?: projectConfig.runtime.root.path + '.edit/src'
|
||||
}
|
||||
|
||||
protected def String getEditorDirectory() {
|
||||
editorDirectory ?: projectConfig.runtimeRoot.path + '.editor/src'
|
||||
editorDirectory ?: projectConfig.runtime.root.path + '.editor/src'
|
||||
}
|
||||
|
||||
protected def String getEditPluginID() {
|
||||
|
@ -346,8 +346,8 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
protected def void addProjectContributions(Grammar grammar, List<EPackage> generatedPackages, ResourceSet rs) {
|
||||
if (projectConfig.runtimePluginXml !== null) {
|
||||
projectConfig.runtimePluginXml.entries += '''
|
||||
if (projectConfig.runtime.pluginXml !== null) {
|
||||
projectConfig.runtime.pluginXml.entries += '''
|
||||
<extension point="org.eclipse.emf.ecore.generated_package">
|
||||
«FOR pack : generatedPackages»
|
||||
<package
|
||||
|
@ -358,13 +358,13 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
</extension>
|
||||
'''
|
||||
}
|
||||
if (projectConfig.runtimeManifest !== null) {
|
||||
projectConfig.runtimeManifest.requiredBundles.addAll('org.eclipse.emf.ecore', 'org.eclipse.emf.common')
|
||||
if (projectConfig.runtime.manifest !== null) {
|
||||
projectConfig.runtime.manifest.requiredBundles.addAll('org.eclipse.emf.ecore', 'org.eclipse.emf.common')
|
||||
}
|
||||
for (pack : generatedPackages) {
|
||||
val genPackage = pack.getGenPackage(rs)
|
||||
if (projectConfig.runtimeManifest !== null && modelPluginID == null) {
|
||||
projectConfig.runtimeManifest.exportedPackages.addAll(
|
||||
if (projectConfig.runtime.manifest !== null && modelPluginID == null) {
|
||||
projectConfig.runtime.manifest.exportedPackages.addAll(
|
||||
genPackage.interfacePackageName,
|
||||
genPackage.classPackageName,
|
||||
genPackage.utilitiesPackageName
|
||||
|
@ -694,12 +694,9 @@ class EMFGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
private def void updateBuildProperties() {
|
||||
if (!updateBuildProperties || modelPluginID !== null)
|
||||
return;
|
||||
val rootOutlet = projectConfig.runtimeRoot
|
||||
val modelOutlet = projectConfig.runtimeModelGen
|
||||
val rootOutlet = projectConfig.runtime.root
|
||||
val buildPropertiesPath = rootOutlet.path + '/build.properties'
|
||||
val modelPath = modelOutlet.path.substring(rootOutlet.path.length + 1)
|
||||
val modelContainerEnd = modelPath.indexOf('/')
|
||||
val modelContainer = if (modelContainerEnd > 0) modelPath.substring(0, modelContainerEnd) else modelPath
|
||||
val modelContainer = projectConfig.runtime.ecoreModelFolder
|
||||
val buildProperties = new Properties
|
||||
val reader = new InputStreamReader(new FileInputStream(new File(buildPropertiesPath)), Charset.forName(codeConfig.encoding))
|
||||
try {
|
||||
|
|
|
@ -81,7 +81,7 @@ class Formatter2Fragment2 extends AbstractGeneratorFragment2 {
|
|||
«ENDFOR»
|
||||
}
|
||||
'''
|
||||
xtendFile.writeTo(projectConfig.runtimeSrc)
|
||||
xtendFile.writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def StringConcatenationClient generateFormatMethod(EClass clazz, Collection<EReference> containmentRefs, boolean isOverriding) '''
|
||||
|
|
|
@ -95,12 +95,13 @@ class GeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
new GuiceModuleAccess.BindingFactory()
|
||||
.addTypeToType(IGenerator.typeRef, language.grammar.generatorStub)
|
||||
.contributeTo(language.runtimeGenModule)
|
||||
if (projectConfig.runtimeManifest !== null)
|
||||
projectConfig.runtimeManifest.requiredBundles += 'org.eclipse.xtext.xbase.lib'
|
||||
if (projectConfig.runtime.manifest !== null)
|
||||
projectConfig.runtime.manifest.requiredBundles += 'org.eclipse.xtext.xbase.lib'
|
||||
doGenerateStubFile
|
||||
}
|
||||
if (isGenerateStub || isGenerateJavaMain) {
|
||||
projectConfig.runtimeManifest.exportedPackages += language.grammar.generatorStub.packageName
|
||||
if (projectConfig.runtime.manifest !== null)
|
||||
projectConfig.runtime.manifest.exportedPackages += language.grammar.generatorStub.packageName
|
||||
}
|
||||
|
||||
if (isGenerateJavaMain)
|
||||
|
@ -111,9 +112,9 @@ class GeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
doGenerateMweFile
|
||||
|
||||
contributeEclipsePluginGuiceBindings
|
||||
if (projectConfig.eclipsePluginManifest !== null)
|
||||
projectConfig.eclipsePluginManifest.requiredBundles += 'org.eclipse.xtext.builder'
|
||||
if (projectConfig.eclipsePluginPluginXml !== null)
|
||||
if (projectConfig.eclipsePlugin.manifest !== null)
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles += 'org.eclipse.xtext.builder'
|
||||
if (projectConfig.eclipsePlugin.pluginXml !== null)
|
||||
contributeEclipsePluginExtensions
|
||||
}
|
||||
|
||||
|
@ -147,7 +148,7 @@ class GeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def void doGenerateJavaMain() {
|
||||
|
@ -197,7 +198,7 @@ class GeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
System.out.println("Code generation finished.");
|
||||
}
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def void doGenerateXtendMain() {
|
||||
|
@ -240,7 +241,7 @@ class GeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
System.out.println('Code generation finished.')
|
||||
}
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def void doGenerateMweFile() {
|
||||
|
@ -278,12 +279,12 @@ class GeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
}
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def contributeEclipsePluginExtensions() {
|
||||
val name = language.grammar.name
|
||||
projectConfig.eclipsePluginPluginXml.entries += '''
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += '''
|
||||
<extension point="org.eclipse.xtext.builder.participant">
|
||||
<participant
|
||||
class="«grammar.eclipsePluginExecutableExtensionFactory»:org.eclipse.xtext.builder.IXtextBuilderParticipant"
|
||||
|
|
|
@ -65,8 +65,8 @@ class GrammarAccessFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
bindingFactory.addTypeToType(IGrammarAccess.typeRef, language.grammar.grammarAccess)
|
||||
.contributeTo(language.runtimeGenModule)
|
||||
if (projectConfig.runtimeManifest !== null) {
|
||||
projectConfig.runtimeManifest.exportedPackages.addAll(#[
|
||||
if (projectConfig.runtime.manifest !== null) {
|
||||
projectConfig.runtime.manifest.exportedPackages.addAll(#[
|
||||
grammar.runtimeBasePackage, grammar.runtimeBasePackage + ".services"
|
||||
])
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ class GrammarAccessFragment2 extends AbstractGeneratorFragment2 {
|
|||
+ ". Therefore, the grammar is persisted as XMI and not as binary. This can be a performance drawback.")
|
||||
copy.classpathRelativePathToXmi
|
||||
}
|
||||
val uri = projectConfig.runtimeSrcGen.getURI(path)
|
||||
val uri = projectConfig.runtime.srcGen.getURI(path)
|
||||
val resource = resourceSet.createResource(uri, ContentHandler.UNSPECIFIED_CONTENT_TYPE)
|
||||
addAllGrammarsToResource(resource, copy, new HashSet<Grammar>())
|
||||
isSaving.set(true)
|
||||
|
@ -243,7 +243,7 @@ class GrammarAccessFragment2 extends AbstractGeneratorFragment2 {
|
|||
«ENDFOR»
|
||||
}
|
||||
'''
|
||||
javaFile.writeTo(projectConfig.runtimeSrcGen)
|
||||
javaFile.writeTo(projectConfig.runtime.srcGen)
|
||||
}
|
||||
|
||||
protected def StringConcatenationClient parserRuleClasses(ParserRule it) '''
|
||||
|
|
|
@ -122,7 +122,7 @@ class IdeaPluginGenerator extends AbstractGeneratorFragment2 {
|
|||
grammar.compileFacetConfiguration,
|
||||
grammar.compileColorSettingsPage
|
||||
].forEach[
|
||||
writeTo(projectConfig.ideaPluginSrc)
|
||||
writeTo(projectConfig.ideaPlugin.src)
|
||||
]
|
||||
|
||||
#[
|
||||
|
@ -145,15 +145,15 @@ class IdeaPluginGenerator extends AbstractGeneratorFragment2 {
|
|||
grammar.compileFacetType,
|
||||
grammar.compileBaseColorSettingsPage
|
||||
].forEach[
|
||||
writeTo(projectConfig.ideaPluginSrcGen)
|
||||
writeTo(projectConfig.ideaPlugin.srcGen)
|
||||
]
|
||||
|
||||
if (deployable) {
|
||||
val pluginXml = grammar.compilePluginXml
|
||||
if (!projectConfig.ideaPluginMetaInf.isFile(pluginXml.path)) {
|
||||
pluginXml.writeTo(projectConfig.ideaPluginMetaInf)
|
||||
if (!projectConfig.ideaPlugin.metaInf.isFile(pluginXml.path)) {
|
||||
pluginXml.writeTo(projectConfig.ideaPlugin.metaInf)
|
||||
}
|
||||
grammar.compilePluginGenXml.writeTo(projectConfig.ideaPluginMetaInf)
|
||||
grammar.compilePluginGenXml.writeTo(projectConfig.ideaPlugin.metaInf)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.eclipse.xtext.xtext.generator.idea.parser.antlr
|
|||
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.xtext.generator.CodeConfig
|
||||
import org.eclipse.xtext.xtext.generator.IXtextProjectConfig
|
||||
import org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2
|
||||
|
||||
class XtextAntlrIDEAGeneratorFragment extends AbstractAntlrGeneratorFragment2 {
|
||||
|
@ -19,12 +18,10 @@ class XtextAntlrIDEAGeneratorFragment extends AbstractAntlrGeneratorFragment2 {
|
|||
|
||||
@Inject CodeConfig codeConfig
|
||||
|
||||
@Inject IXtextProjectConfig projectConfig
|
||||
|
||||
@Inject extension PsiGrammarNaming
|
||||
|
||||
override protected doGenerate() {
|
||||
val fsa = projectConfig.ideaPluginSrcGen
|
||||
val fsa = projectConfig.ideaPlugin.srcGen
|
||||
generator.generate(grammar, options, fsa)
|
||||
|
||||
val encoding = codeConfig.encoding
|
||||
|
|
|
@ -1,263 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* 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.xtext.generator.internal
|
||||
|
||||
import java.io.Closeable
|
||||
import java.util.ArrayList
|
||||
import java.io.FileWriter
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* A utility class for generating XtextProjectConfig. Not intended to be used outside of this project.
|
||||
*/
|
||||
class ProjectConfigGenerator {
|
||||
|
||||
static val INTERFACE_NAME = 'org.eclipse.xtext.xtext.generator.IXtextProjectConfig'
|
||||
static val IMPL_NAME = 'org.eclipse.xtext.xtext.generator.XtextProjectConfig'
|
||||
|
||||
static val PROJECTS = #[
|
||||
'runtime', 'runtimeTest', 'genericIde', 'genericIdeTest', 'eclipsePlugin', 'eclipsePluginTest',
|
||||
'ideaPlugin', 'ideaPluginTest', 'web', 'webTest'
|
||||
]
|
||||
|
||||
static def void main(String[] args) {
|
||||
val closeables = new ArrayList<Closeable>
|
||||
try {
|
||||
val interfaceWriter = new FileWriter('src' + File.separator + INTERFACE_NAME.replace('.', File.separator) + '.java')
|
||||
closeables += interfaceWriter
|
||||
val implWriter = new FileWriter('src' + File.separator + IMPL_NAME.replace('.', File.separator) + '.java')
|
||||
closeables += implWriter
|
||||
|
||||
val generator = new ProjectConfigGenerator
|
||||
interfaceWriter.write(generator.generateInterface().toString)
|
||||
implWriter.write(generator.generateImpl().toString)
|
||||
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace()
|
||||
} finally {
|
||||
closeables.forEach[close()]
|
||||
}
|
||||
}
|
||||
|
||||
private def hasPluginXml(String project) {
|
||||
!project.startsWith('ideaPlugin') && !project.startsWith('web')
|
||||
}
|
||||
|
||||
def generateInterface() '''
|
||||
/*******************************************************************************
|
||||
* 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 «INTERFACE_NAME.substring(0, INTERFACE_NAME.lastIndexOf('.'))»;
|
||||
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent;
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess;
|
||||
|
||||
/**
|
||||
* Inject an instance of this interface in order to generate code in a generator fragment.
|
||||
*
|
||||
* <p>This file has been generated with {@link «ProjectConfigGenerator.name»}.</p>
|
||||
*/
|
||||
public interface «INTERFACE_NAME.substring(INTERFACE_NAME.lastIndexOf('.') + 1)» extends IGuiceAwareGeneratorComponent {
|
||||
|
||||
IXtextGeneratorFileSystemAccess getRuntimeModelGen();
|
||||
|
||||
«FOR p : PROJECTS»
|
||||
String get«p.toFirstUpper»ProjectName();
|
||||
IXtextGeneratorFileSystemAccess get«p.toFirstUpper»Root();
|
||||
IXtextGeneratorFileSystemAccess get«p.toFirstUpper»MetaInf();
|
||||
IXtextGeneratorFileSystemAccess get«p.toFirstUpper»Src();
|
||||
IXtextGeneratorFileSystemAccess get«p.toFirstUpper»SrcGen();
|
||||
ManifestAccess get«p.toFirstUpper»Manifest();
|
||||
«IF p.hasPluginXml»
|
||||
PluginXmlAccess get«p.toFirstUpper»PluginXml();
|
||||
«ENDIF»
|
||||
|
||||
«ENDFOR»
|
||||
IXtextGeneratorFileSystemAccess getWebApp();
|
||||
|
||||
}
|
||||
'''
|
||||
|
||||
def generateImpl() '''
|
||||
/*******************************************************************************
|
||||
* 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 «IMPL_NAME.substring(0, IMPL_NAME.lastIndexOf('.'))»;
|
||||
|
||||
import com.google.inject.Injector;
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.XtextGeneratorFileSystemAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess;
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess;
|
||||
|
||||
/**
|
||||
* Use this class to configure output paths in the XtextGenerator.
|
||||
*
|
||||
* <p>This file has been generated with {@link «ProjectConfigGenerator.name»}.</p>
|
||||
*/
|
||||
public class «IMPL_NAME.substring(IMPL_NAME.lastIndexOf('.') + 1)» implements «INTERFACE_NAME.substring(INTERFACE_NAME.lastIndexOf('.') + 1)» {
|
||||
|
||||
private IXtextGeneratorFileSystemAccess runtimeModelGen;
|
||||
«FOR p : PROJECTS»
|
||||
private String «p»ProjectName;
|
||||
private IXtextGeneratorFileSystemAccess «p»Root;
|
||||
private IXtextGeneratorFileSystemAccess «p»MetaInf;
|
||||
private IXtextGeneratorFileSystemAccess «p»Src;
|
||||
private IXtextGeneratorFileSystemAccess «p»SrcGen;
|
||||
private ManifestAccess «p»Manifest;
|
||||
«IF p.hasPluginXml»
|
||||
private PluginXmlAccess «p»PluginXml;
|
||||
«ENDIF»
|
||||
«ENDFOR»
|
||||
private IXtextGeneratorFileSystemAccess webApp;
|
||||
|
||||
public void checkConfiguration(Issues issues) {
|
||||
if («PROJECTS.head»Src == null) {
|
||||
issues.addError("The property '«PROJECTS.head»Src' must be set.", this);
|
||||
}
|
||||
if («PROJECTS.head»SrcGen == null) {
|
||||
issues.addError("The property '«PROJECTS.head»SrcGen' must be set.", this);
|
||||
}
|
||||
«FOR p : PROJECTS»
|
||||
if («p»Manifest != null && «p»MetaInf == null) {
|
||||
issues.addError("The property '«p»MetaInf' must be set when '«p»Manifest' is set.");
|
||||
}
|
||||
«IF p.hasPluginXml»
|
||||
if («p»PluginXml != null && «p»Root == null) {
|
||||
issues.addError("The property '«p»Root' must be set when '«p»PluginXml' is set.");
|
||||
}
|
||||
«ENDIF»
|
||||
«ENDFOR»
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Injector injector) {
|
||||
injector.injectMembers(this);
|
||||
if (runtimeModelGen != null) {
|
||||
runtimeModelGen.initialize(injector);
|
||||
}
|
||||
«FOR p : PROJECTS»
|
||||
|
||||
// Initialize «p» configuration
|
||||
if («p»Root != null) {
|
||||
«p»Root.initialize(injector);
|
||||
}
|
||||
if («p»MetaInf != null) {
|
||||
«p»MetaInf.initialize(injector);
|
||||
}
|
||||
if («p»Src != null) {
|
||||
«p»Src.initialize(injector);
|
||||
}
|
||||
if («p»SrcGen != null) {
|
||||
«p»SrcGen.initialize(injector);
|
||||
}
|
||||
«ENDFOR»
|
||||
|
||||
if (webApp != null) {
|
||||
webApp.initialize(injector);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getRuntimeModelGen() {
|
||||
return runtimeModelGen;
|
||||
}
|
||||
|
||||
public void setRuntimeModelGen(String path) {
|
||||
this.runtimeModelGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
«FOR p : PROJECTS»
|
||||
@Override
|
||||
public String get«p.toFirstUpper»ProjectName() {
|
||||
return «p»ProjectName;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»ProjectName(String projectName) {
|
||||
this.«p»ProjectName = projectName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess get«p.toFirstUpper»Root() {
|
||||
return «p»Root;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»Root(String path) {
|
||||
this.«p»Root = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess get«p.toFirstUpper»MetaInf() {
|
||||
return «p»MetaInf;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»MetaInf(String path) {
|
||||
this.«p»MetaInf = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess get«p.toFirstUpper»Src() {
|
||||
return «p»Src;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»Src(String path) {
|
||||
this.«p»Src = new XtextGeneratorFileSystemAccess(path, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess get«p.toFirstUpper»SrcGen() {
|
||||
return «p»SrcGen;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»SrcGen(String path) {
|
||||
this.«p»SrcGen = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManifestAccess get«p.toFirstUpper»Manifest() {
|
||||
return «p»Manifest;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»Manifest(ManifestAccess manifest) {
|
||||
this.«p»Manifest = manifest;
|
||||
}
|
||||
|
||||
«IF p.hasPluginXml»
|
||||
@Override
|
||||
public PluginXmlAccess get«p.toFirstUpper»PluginXml() {
|
||||
return «p»PluginXml;
|
||||
}
|
||||
|
||||
public void set«p.toFirstUpper»PluginXml(PluginXmlAccess pluginXml) {
|
||||
this.«p»PluginXml = pluginXml;
|
||||
}
|
||||
|
||||
«ENDIF»
|
||||
«ENDFOR»
|
||||
@Override
|
||||
public IXtextGeneratorFileSystemAccess getWebApp() {
|
||||
return webApp;
|
||||
}
|
||||
|
||||
public void setWebApp(String path) {
|
||||
this.webApp = new XtextGeneratorFileSystemAccess(path, true);
|
||||
}
|
||||
}
|
||||
'''
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@ package org.eclipse.xtext.xtext.generator.junit
|
|||
|
||||
import org.eclipse.xtext.xtext.generator.AbstractGeneratorFragment2
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.xtext.generator.IXtextProjectConfig
|
||||
import org.eclipse.xtext.xtext.generator.XtextGeneratorNaming
|
||||
import org.eclipse.xtext.xtext.generator.model.JavaFileAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.FileAccessFactory
|
||||
|
@ -12,13 +11,12 @@ import static extension org.eclipse.xtext.GrammarUtil.*
|
|||
import org.eclipse.xtext.xtext.generator.util.GenModelUtil2
|
||||
|
||||
class Junit4Fragment2 extends AbstractGeneratorFragment2 {
|
||||
@Inject IXtextProjectConfig projectConfig
|
||||
@Inject extension XtextGeneratorNaming
|
||||
@Inject FileAccessFactory fileAccessFactory
|
||||
|
||||
override generate() {
|
||||
if (projectConfig.runtimeTestManifest != null) {
|
||||
projectConfig.runtimeTestManifest => [
|
||||
if (projectConfig.runtimeTest.manifest != null) {
|
||||
projectConfig.runtimeTest.manifest => [
|
||||
requiredBundles.addAll(
|
||||
"org.eclipse.xtext.junit4",
|
||||
"org.eclipse.xtext.xbase.lib"
|
||||
|
@ -26,8 +24,8 @@ class Junit4Fragment2 extends AbstractGeneratorFragment2 {
|
|||
exportedPackages.add(grammar.runtimeTestBasePackage)
|
||||
]
|
||||
}
|
||||
if (projectConfig.eclipsePluginTestManifest != null) {
|
||||
projectConfig.eclipsePluginTestManifest => [
|
||||
if (projectConfig.eclipsePluginTest.manifest != null) {
|
||||
projectConfig.eclipsePluginTest.manifest => [
|
||||
requiredBundles.addAll(
|
||||
"org.eclipse.core.runtime",
|
||||
"org.eclipse.ui.workbench;resolution:=optional"
|
||||
|
@ -35,13 +33,13 @@ class Junit4Fragment2 extends AbstractGeneratorFragment2 {
|
|||
exportedPackages.add(grammar.eclipsePluginTestBasePackage)
|
||||
]
|
||||
}
|
||||
if (projectConfig.eclipsePluginManifest != null) {
|
||||
projectConfig.eclipsePluginManifest.exportedPackages.add(grammar.eclipsePluginActivator.packageName)
|
||||
if (projectConfig.eclipsePlugin.manifest != null) {
|
||||
projectConfig.eclipsePlugin.manifest.exportedPackages.add(grammar.eclipsePluginActivator.packageName)
|
||||
}
|
||||
|
||||
#[
|
||||
projectConfig.runtimeTestManifest,
|
||||
projectConfig.eclipsePluginTestManifest
|
||||
projectConfig.runtimeTest.manifest,
|
||||
projectConfig.eclipsePluginTest.manifest
|
||||
].filterNull.forEach [
|
||||
importedPackages.addAll(
|
||||
"org.junit;version=\"4.5.0\"",
|
||||
|
@ -53,9 +51,9 @@ class Junit4Fragment2 extends AbstractGeneratorFragment2 {
|
|||
"org.hamcrest.core"
|
||||
)
|
||||
]
|
||||
generateInjectorProvider.writeTo(projectConfig.runtimeTestSrcGen)
|
||||
generateExampleRuntimeTest.writeTo(projectConfig.runtimeTestSrc)
|
||||
generateUiInjectorProvider.writeTo(projectConfig.eclipsePluginTestSrcGen)
|
||||
generateInjectorProvider.writeTo(projectConfig.runtimeTest.srcGen)
|
||||
generateExampleRuntimeTest.writeTo(projectConfig.runtimeTest.src)
|
||||
generateUiInjectorProvider.writeTo(projectConfig.eclipsePluginTest.srcGen)
|
||||
}
|
||||
|
||||
def JavaFileAccess generateExampleRuntimeTest() {
|
||||
|
|
|
@ -15,10 +15,12 @@ import org.eclipse.xtend2.lib.StringConcatenationClient
|
|||
import org.eclipse.xtext.generator.IFileSystemAccess2
|
||||
import org.eclipse.xtext.util.MergeableManifest
|
||||
import org.eclipse.xtext.util.internal.Log
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent
|
||||
import com.google.inject.Injector
|
||||
|
||||
@Log
|
||||
@Accessors
|
||||
class ManifestAccess extends TextFileAccess {
|
||||
class ManifestAccess extends TextFileAccess implements IGuiceAwareGeneratorComponent {
|
||||
|
||||
String bundleName
|
||||
|
||||
|
@ -129,4 +131,8 @@ class ManifestAccess extends TextFileAccess {
|
|||
}
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
injector.injectMembers(this)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@ import org.eclipse.xtext.generator.IFileSystemAccess2
|
|||
import org.eclipse.xtext.util.internal.Log
|
||||
import org.eclipse.xtext.xtext.generator.CodeConfig
|
||||
import com.google.inject.Inject
|
||||
import org.eclipse.xtext.xtext.generator.IGuiceAwareGeneratorComponent
|
||||
import com.google.inject.Injector
|
||||
|
||||
@Log
|
||||
@Accessors
|
||||
class PluginXmlAccess extends TextFileAccess {
|
||||
class PluginXmlAccess extends TextFileAccess implements IGuiceAwareGeneratorComponent {
|
||||
|
||||
@Inject CodeConfig codeConfig
|
||||
|
||||
|
@ -57,4 +59,8 @@ class PluginXmlAccess extends TextFileAccess {
|
|||
}
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
injector.injectMembers(this)
|
||||
}
|
||||
|
||||
}
|
|
@ -72,10 +72,10 @@ class ImportNamespacesScopingFragment2 extends AbstractGeneratorFragment2 {
|
|||
else
|
||||
generateJavaScopeProvider()
|
||||
|
||||
if (projectConfig.runtimeManifest !== null) {
|
||||
projectConfig.runtimeManifest.exportedPackages += grammar.scopeProviderClass.packageName
|
||||
if (projectConfig.runtime.manifest !== null) {
|
||||
projectConfig.runtime.manifest.exportedPackages += grammar.scopeProviderClass.packageName
|
||||
if (codeConfig.preferXtendStubs)
|
||||
projectConfig.runtimeManifest.requiredBundles += 'org.eclipse.xtext.xbase.lib'
|
||||
projectConfig.runtime.manifest.requiredBundles += 'org.eclipse.xtext.xbase.lib'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class ImportNamespacesScopingFragment2 extends AbstractGeneratorFragment2 {
|
|||
public class «grammar.scopeProviderClass.simpleName» extends «grammar.scopeProviderSuperClass» {
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def generateXtendScopeProvider() {
|
||||
|
@ -123,7 +123,7 @@ class ImportNamespacesScopingFragment2 extends AbstractGeneratorFragment2 {
|
|||
class «grammar.scopeProviderClass.simpleName» extends «grammar.scopeProviderSuperClass» {
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
}
|
|
@ -29,21 +29,21 @@ class TypesGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
.contributeTo(language.eclipsePluginGenModule)
|
||||
language.eclipsePluginGenModule.superClass = 'org.eclipse.xtext.common.types.ui.DefaultCommonTypesUiModule'.typeRef
|
||||
|
||||
if (projectConfig.runtimeManifest !== null) {
|
||||
projectConfig.runtimeManifest.requiredBundles.addAll(
|
||||
if (projectConfig.runtime.manifest !== null) {
|
||||
projectConfig.runtime.manifest.requiredBundles.addAll(
|
||||
'org.eclipse.xtext.common.types',
|
||||
'org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional'
|
||||
)
|
||||
}
|
||||
|
||||
if (projectConfig.runtimeTestManifest !== null) {
|
||||
projectConfig.runtimeTestManifest.requiredBundles.add(
|
||||
if (projectConfig.runtimeTest.manifest !== null) {
|
||||
projectConfig.runtimeTest.manifest.requiredBundles.add(
|
||||
'org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional'
|
||||
)
|
||||
}
|
||||
|
||||
if (projectConfig.eclipsePluginManifest !== null) {
|
||||
projectConfig.eclipsePluginManifest.requiredBundles.add(
|
||||
if (projectConfig.eclipsePlugin.manifest !== null) {
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles.add(
|
||||
'org.eclipse.xtext.common.types.ui'
|
||||
)
|
||||
}
|
||||
|
|
|
@ -38,15 +38,15 @@ class OutlineTreeProviderFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
override generate() {
|
||||
if (projectConfig.eclipsePluginManifest != null) {
|
||||
projectConfig.eclipsePluginManifest.requiredBundles += "org.eclipse.xtext.ui"
|
||||
if (projectConfig.eclipsePlugin.manifest != null) {
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles += "org.eclipse.xtext.ui"
|
||||
}
|
||||
|
||||
if (!generateStub) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (projectConfig.eclipsePluginSrc !== null) {
|
||||
if (projectConfig.eclipsePlugin.src !== null) {
|
||||
if (codeConfig.preferXtendStubs) {
|
||||
generateXtendOutlineTreeProvider
|
||||
} else {
|
||||
|
@ -73,7 +73,7 @@ class OutlineTreeProviderFragment2 extends AbstractGeneratorFragment2 {
|
|||
"org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider".typeRef» {
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.eclipsePluginSrc)
|
||||
''').writeTo(projectConfig.eclipsePlugin.src)
|
||||
}
|
||||
|
||||
def protected generateXtendOutlineTreeProvider() {
|
||||
|
@ -87,5 +87,5 @@ class OutlineTreeProviderFragment2 extends AbstractGeneratorFragment2 {
|
|||
"org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider".typeRef» {
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.eclipsePluginSrc)
|
||||
''').writeTo(projectConfig.eclipsePlugin.src)
|
||||
}}
|
|
@ -88,10 +88,10 @@ class ValidatorFragment2 extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
generateAbstractValidator()
|
||||
|
||||
if (projectConfig.runtimeManifest !== null)
|
||||
projectConfig.runtimeManifest.exportedPackages += grammar.validatorClass.packageName
|
||||
if (projectConfig.runtime.manifest !== null)
|
||||
projectConfig.runtime.manifest.exportedPackages += grammar.validatorClass.packageName
|
||||
|
||||
if (projectConfig.eclipsePluginPluginXml !== null)
|
||||
if (projectConfig.eclipsePlugin.pluginXml !== null)
|
||||
contributeEclipsePluginExtensions()
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ class ValidatorFragment2 extends AbstractGeneratorFragment2 {
|
|||
// }
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def generateJavaValidatorStub() {
|
||||
|
@ -140,7 +140,7 @@ class ValidatorFragment2 extends AbstractGeneratorFragment2 {
|
|||
// }
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def generateAbstractValidator() {
|
||||
|
@ -165,7 +165,7 @@ class ValidatorFragment2 extends AbstractGeneratorFragment2 {
|
|||
|
||||
}
|
||||
'''
|
||||
javaFile.writeTo(projectConfig.runtimeSrcGen)
|
||||
javaFile.writeTo(projectConfig.runtime.srcGen)
|
||||
}
|
||||
|
||||
protected def getGeneratedPackagesToValidate() {
|
||||
|
@ -184,7 +184,7 @@ class ValidatorFragment2 extends AbstractGeneratorFragment2 {
|
|||
|
||||
protected def contributeEclipsePluginExtensions() {
|
||||
val simpleName = getSimpleName(grammar)
|
||||
projectConfig.eclipsePluginPluginXml.entries += '''
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += '''
|
||||
<!-- marker definitions for «grammar.name» -->
|
||||
<extension
|
||||
id="«simpleName.toLowerCase».check.fast"
|
||||
|
|
|
@ -179,13 +179,13 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
super.checkConfiguration(issues)
|
||||
if (framework === null)
|
||||
issues.addError('The property \'framework\' is required.')
|
||||
if (generateJsHighlighting && projectConfig.webApp === null)
|
||||
if (generateJsHighlighting && projectConfig.web.assets === null)
|
||||
issues.addWarning('The \'webApp\' outlet is not defined in the project configuration; JS syntax highlighting is disabled.')
|
||||
if (generateServlet && projectConfig.webSrc === null)
|
||||
issues.addWarning('The \'webSrc\' outlet is not defined in the project configuration; the generated servlet is disabled.')
|
||||
if (generateJettyLauncher && projectConfig.webSrc === null)
|
||||
issues.addWarning('The \'webSrc\' outlet is not defined in the project configuration; the Jetty launcher is disabled.')
|
||||
if (generateHtmlExample && projectConfig.webApp === null)
|
||||
if (generateServlet && projectConfig.web.src === null)
|
||||
issues.addWarning('The \'web.src\' outlet is not defined in the project configuration; the generated servlet is disabled.')
|
||||
if (generateJettyLauncher && projectConfig.web.src === null)
|
||||
issues.addWarning('The \'web.src\' outlet is not defined in the project configuration; the Jetty launcher is disabled.')
|
||||
if (generateHtmlExample && projectConfig.web.assets === null)
|
||||
issues.addWarning('The \'webApp\' outlet is not defined in the project configuration; the example HTML page is disabled.')
|
||||
for (pattern : enabledPatterns.filter[suppressedPatterns.contains(it)]) {
|
||||
issues.addError('The pattern \'' + pattern + '\' cannot be enabled and suppressed.')
|
||||
|
@ -193,7 +193,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
override generate() {
|
||||
if (generateJsHighlighting && projectConfig.webApp !== null) {
|
||||
if (generateJsHighlighting && projectConfig.web.assets !== null) {
|
||||
val langId = language.fileExtensions.head
|
||||
if (highlightingModuleName.nullOrEmpty) {
|
||||
highlightingModuleName = switch framework {
|
||||
|
@ -208,17 +208,17 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
generateJsHighlighting(langId)
|
||||
}
|
||||
|
||||
if (generateServlet && projectConfig.webSrc !== null) {
|
||||
if (generateServlet && projectConfig.web.src !== null) {
|
||||
generateServlet()
|
||||
}
|
||||
if (generateJettyLauncher && projectConfig.webSrc !== null) {
|
||||
if (generateJettyLauncher && projectConfig.web.src !== null) {
|
||||
generateServerLauncher()
|
||||
}
|
||||
if (generateHtmlExample && projectConfig.webApp !== null) {
|
||||
if (generateHtmlExample && projectConfig.web.assets !== null) {
|
||||
generateIndexDoc()
|
||||
generateStyleSheet()
|
||||
}
|
||||
if (generateWebXml && projectConfig.webApp !== null) {
|
||||
if (generateWebXml && projectConfig.web.assets !== null) {
|
||||
generateWebXml()
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
}
|
||||
jsFile.writeTo(projectConfig.webApp)
|
||||
jsFile.writeTo(projectConfig.web.assets)
|
||||
}
|
||||
|
||||
protected def Collection<String> createOrionPatterns(String langId, Set<String> keywords) {
|
||||
|
@ -460,7 +460,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
protected def void generateIndexDoc() {
|
||||
if (projectConfig.webApp.isFile('index.html')) {
|
||||
if (projectConfig.web.assets.isFile('index.html')) {
|
||||
// Don't overwrite an existing index document
|
||||
return
|
||||
}
|
||||
|
@ -561,11 +561,11 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
</body>
|
||||
</html>
|
||||
'''
|
||||
indexFile.writeTo(projectConfig.webApp)
|
||||
indexFile.writeTo(projectConfig.web.assets)
|
||||
}
|
||||
|
||||
protected def void generateStyleSheet() {
|
||||
if (projectConfig.webApp.isFile('style.css')) {
|
||||
if (projectConfig.web.assets.isFile('style.css')) {
|
||||
// Don't overwrite an existing style sheet
|
||||
return
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
*/
|
||||
«ENDIF»
|
||||
'''
|
||||
styleFile.writeTo(projectConfig.webApp)
|
||||
styleFile.writeTo(projectConfig.web.assets)
|
||||
}
|
||||
|
||||
protected def void generateServerLauncher() {
|
||||
|
@ -661,7 +661,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
def static void main(String[] args) {
|
||||
val server = new «'org.eclipse.jetty.server.Server'.typeRef»(new «'java.net.InetSocketAddress'.typeRef»('localhost', 8080))
|
||||
server.handler = new «'org.eclipse.jetty.webapp.WebAppContext'.typeRef» => [
|
||||
resourceBase = '«projectConfig.webApp.path.replace(projectConfig.webRoot.path + "/", "")»'
|
||||
resourceBase = '«projectConfig.web.assets.path.replace(projectConfig.web.root.path + "/", "")»'
|
||||
welcomeFiles = #["index.html"]
|
||||
contextPath = "/"
|
||||
configurations = #[
|
||||
|
@ -670,7 +670,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
new «'org.eclipse.jetty.webapp.WebInfConfiguration'.typeRef»,
|
||||
new «'org.eclipse.jetty.webapp.MetaInfConfiguration'.typeRef»
|
||||
]
|
||||
setAttribute(«'org.eclipse.jetty.webapp.WebInfConfiguration'.typeRef».CONTAINER_JAR_PATTERN, '.*/«projectConfig.webProjectName.replace('.', '\\\\.')»/.*,.*/org\\.eclipse\\.xtext\\.web.*,.*/org\\.webjars.*')
|
||||
setAttribute(«'org.eclipse.jetty.webapp.WebInfConfiguration'.typeRef».CONTAINER_JAR_PATTERN, '.*/«projectConfig.web.name.replace('.', '\\\\.')»/.*,.*/org\\.eclipse\\.xtext\\.web.*,.*/org\\.webjars.*')
|
||||
]
|
||||
val log = new «'org.eclipse.jetty.util.log.Slf4jLog'.typeRef»(«grammar.serverLauncherClass.simpleName».name)
|
||||
try {
|
||||
|
@ -692,7 +692,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
}
|
||||
}
|
||||
''').writeTo(projectConfig.webSrc)
|
||||
''').writeTo(projectConfig.web.src)
|
||||
}
|
||||
|
||||
protected def void generateServlet() {
|
||||
|
@ -720,11 +720,11 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
}
|
||||
|
||||
}
|
||||
''').writeTo(projectConfig.webSrc)
|
||||
''').writeTo(projectConfig.web.src)
|
||||
}
|
||||
|
||||
protected def void generateWebXml() {
|
||||
if (projectConfig.webApp.isFile('WEB-INF/web.xml')) {
|
||||
if (projectConfig.web.assets.isFile('WEB-INF/web.xml')) {
|
||||
// Don't overwrite an existing web.xml
|
||||
return
|
||||
}
|
||||
|
@ -787,7 +787,7 @@ class WebIntegrationFragment extends AbstractGeneratorFragment2 {
|
|||
</session-config>
|
||||
</web-app>
|
||||
'''
|
||||
xmlFile.writeTo(projectConfig.webApp)
|
||||
xmlFile.writeTo(projectConfig.web.assets)
|
||||
}
|
||||
|
||||
}
|
|
@ -68,21 +68,21 @@ class XbaseGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
|
||||
contributeRuntimeGuiceBindings()
|
||||
contributeEclipsePluginGuiceBindings()
|
||||
if (projectConfig.eclipsePluginPluginXml !== null)
|
||||
if (projectConfig.eclipsePlugin.pluginXml !== null)
|
||||
contributeEclipsePluginExtensions()
|
||||
if (generateXtendInferrer)
|
||||
doGenerateXtendInferrer()
|
||||
|
||||
if (projectConfig.runtimeManifest !== null) {
|
||||
projectConfig.runtimeManifest.requiredBundles.addAll(#[
|
||||
if (projectConfig.runtime.manifest !== null) {
|
||||
projectConfig.runtime.manifest.requiredBundles.addAll(#[
|
||||
'org.eclipse.xtext.xbase', 'org.eclipse.xtext.xbase.lib'
|
||||
])
|
||||
if ((generateXtendInferrer || useInferredJvmModel) && !skipExportedPackage) {
|
||||
projectConfig.runtimeManifest.exportedPackages += jvmModelInferrer.packageName
|
||||
projectConfig.runtime.manifest.exportedPackages += jvmModelInferrer.packageName
|
||||
}
|
||||
}
|
||||
if (projectConfig.eclipsePluginManifest !== null) {
|
||||
projectConfig.eclipsePluginManifest.requiredBundles.addAll(#[
|
||||
if (projectConfig.eclipsePlugin.manifest !== null) {
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles.addAll(#[
|
||||
'org.eclipse.xtext.xbase.ui', 'org.eclipse.jdt.debug.ui'
|
||||
])
|
||||
}
|
||||
|
@ -259,13 +259,13 @@ class XbaseGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
// ]
|
||||
}
|
||||
}
|
||||
''').writeTo(projectConfig.runtimeSrc)
|
||||
''').writeTo(projectConfig.runtime.src)
|
||||
}
|
||||
|
||||
protected def contributeEclipsePluginExtensions() {
|
||||
val name = language.grammar.name
|
||||
if (jdtTypeHierarchy) {
|
||||
projectConfig.eclipsePluginPluginXml.entries += '''
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += '''
|
||||
<!-- Type Hierarchy -->
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
|
@ -338,7 +338,7 @@ class XbaseGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
'''
|
||||
}
|
||||
if (jdtCallHierarchy) {
|
||||
projectConfig.eclipsePluginPluginXml.entries += '''
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += '''
|
||||
<!-- Call Hierachy -->
|
||||
<extension point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
|
@ -365,7 +365,7 @@ class XbaseGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
</extension>
|
||||
'''
|
||||
}
|
||||
projectConfig.eclipsePluginPluginXml.entries += '''
|
||||
projectConfig.eclipsePlugin.pluginXml.entries += '''
|
||||
<extension point="org.eclipse.core.runtime.adapters">
|
||||
<factory class="«grammar.eclipsePluginExecutableExtensionFactory»:org.eclipse.xtext.builder.smap.StratumBreakpointAdapterFactory"
|
||||
adaptableType="org.eclipse.xtext.ui.editor.XtextEditor">
|
||||
|
|
|
@ -15,8 +15,8 @@ class XtypeGeneratorFragment2 extends AbstractGeneratorFragment2 {
|
|||
@Inject extension XbaseUsageDetector
|
||||
|
||||
override generate() {
|
||||
if (language.grammar.inheritsXtype && projectConfig.eclipsePluginManifest !== null)
|
||||
projectConfig.eclipsePluginManifest.requiredBundles += 'org.eclipse.xtext.xbase.ui'
|
||||
if (language.grammar.inheritsXtype && projectConfig.eclipsePlugin.manifest !== null)
|
||||
projectConfig.eclipsePlugin.manifest.requiredBundles += 'org.eclipse.xtext.xbase.ui'
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -166,24 +166,43 @@ class RuntimeProjectDescriptor extends TestedProjectDescriptor {
|
|||
component = XtextGenerator auto-inject {
|
||||
configuration = {
|
||||
project = WizardConfig auto-inject {
|
||||
«IF !config.uiProject.enabled»
|
||||
eclipseEditor = false
|
||||
«IF testProject.enabled»
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
}
|
||||
«ENDIF»
|
||||
«IF config.ideProject.enabled
|
||||
&& !#[config.webProject, config.intellijProject, config.uiProject].exists[enabled]»
|
||||
genericIde = {
|
||||
enabled = true
|
||||
}
|
||||
«ENDIF»
|
||||
«IF config.uiProject.enabled»
|
||||
eclipsePlugin = {
|
||||
enabled = true
|
||||
}
|
||||
«ENDIF»
|
||||
«IF config.uiProject.testProject.enabled»
|
||||
eclipsePluginTest = {
|
||||
enabled = true
|
||||
}
|
||||
«ENDIF»
|
||||
«IF config.intellijProject.enabled»
|
||||
ideaEditor = true
|
||||
ideaPlugin = {
|
||||
enabled = true
|
||||
}
|
||||
«ENDIF»
|
||||
«IF config.webProject.enabled»
|
||||
webSupport = true
|
||||
«ENDIF»
|
||||
«IF config.ideProject.enabled»
|
||||
genericIdeSupport = true
|
||||
«ENDIF»
|
||||
«IF testProject.enabled»
|
||||
testingSupport = true
|
||||
web = {
|
||||
enabled = true
|
||||
}
|
||||
«ENDIF»
|
||||
«IF config.sourceLayout == SourceLayout.MAVEN»
|
||||
mavenLayout = true
|
||||
«ENDIF»
|
||||
«IF isEclipsePluginProject»
|
||||
createEclipseMetaData = true
|
||||
«ENDIF»
|
||||
}
|
||||
code = auto-inject {
|
||||
encoding = "«config.encoding»"
|
||||
|
|
|
@ -15,8 +15,16 @@ Workflow {
|
|||
component = XtextGenerator auto-inject {
|
||||
configuration = {
|
||||
project = WizardConfig auto-inject {
|
||||
genericIdeSupport = true
|
||||
testingSupport = true
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
}
|
||||
eclipsePlugin = {
|
||||
enabled = true
|
||||
}
|
||||
eclipsePluginTest = {
|
||||
enabled = true
|
||||
}
|
||||
createEclipseMetaData = true
|
||||
}
|
||||
code = auto-inject {
|
||||
encoding = "UTF-8"
|
||||
|
|
|
@ -15,10 +15,22 @@ Workflow {
|
|||
component = XtextGenerator auto-inject {
|
||||
configuration = {
|
||||
project = WizardConfig auto-inject {
|
||||
ideaEditor = true
|
||||
webSupport = true
|
||||
genericIdeSupport = true
|
||||
testingSupport = true
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
}
|
||||
eclipsePlugin = {
|
||||
enabled = true
|
||||
}
|
||||
eclipsePluginTest = {
|
||||
enabled = true
|
||||
}
|
||||
ideaPlugin = {
|
||||
enabled = true
|
||||
}
|
||||
web = {
|
||||
enabled = true
|
||||
}
|
||||
createEclipseMetaData = true
|
||||
}
|
||||
code = auto-inject {
|
||||
encoding = "UTF-8"
|
||||
|
|
|
@ -15,11 +15,15 @@ Workflow {
|
|||
component = XtextGenerator auto-inject {
|
||||
configuration = {
|
||||
project = WizardConfig auto-inject {
|
||||
eclipseEditor = false
|
||||
ideaEditor = true
|
||||
webSupport = true
|
||||
genericIdeSupport = true
|
||||
testingSupport = true
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
}
|
||||
ideaPlugin = {
|
||||
enabled = true
|
||||
}
|
||||
web = {
|
||||
enabled = true
|
||||
}
|
||||
mavenLayout = true
|
||||
}
|
||||
code = auto-inject {
|
||||
|
|
|
@ -15,9 +15,19 @@ Workflow {
|
|||
component = XtextGenerator auto-inject {
|
||||
configuration = {
|
||||
project = WizardConfig auto-inject {
|
||||
webSupport = true
|
||||
genericIdeSupport = true
|
||||
testingSupport = true
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
}
|
||||
eclipsePlugin = {
|
||||
enabled = true
|
||||
}
|
||||
eclipsePluginTest = {
|
||||
enabled = true
|
||||
}
|
||||
web = {
|
||||
enabled = true
|
||||
}
|
||||
createEclipseMetaData = true
|
||||
}
|
||||
code = auto-inject {
|
||||
encoding = "UTF-8"
|
||||
|
|
|
@ -15,10 +15,12 @@ Workflow {
|
|||
component = XtextGenerator auto-inject {
|
||||
configuration = {
|
||||
project = WizardConfig auto-inject {
|
||||
eclipseEditor = false
|
||||
webSupport = true
|
||||
genericIdeSupport = true
|
||||
testingSupport = true
|
||||
runtimeTest = {
|
||||
enabled = true
|
||||
}
|
||||
web = {
|
||||
enabled = true
|
||||
}
|
||||
mavenLayout = true
|
||||
}
|
||||
code = auto-inject {
|
||||
|
|
Loading…
Reference in a new issue