mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 16:58:56 +00:00
[generator] Added wizard configuration, added validation, added file merging
Signed-off-by: Miro Spönemann <miro.spoenemann@itemis.de>
This commit is contained in:
parent
84b71efadf
commit
2971ce7151
8 changed files with 461 additions and 39 deletions
|
@ -9,6 +9,7 @@ package org.eclipse.xtext.xtext.generator
|
|||
|
||||
import com.google.inject.Injector
|
||||
import java.util.List
|
||||
import org.eclipse.emf.mwe.core.issues.Issues
|
||||
|
||||
/**
|
||||
* A composite generator fragment delegates to its contained fragments.
|
||||
|
@ -23,6 +24,12 @@ class CompositeGeneratorFragment2 implements IGeneratorFragment2 {
|
|||
this.fragments.add(fragment)
|
||||
}
|
||||
|
||||
override checkConfiguration(XtextGenerator generator, Issues issues) {
|
||||
for (fragment : fragments) {
|
||||
fragment.checkConfiguration(generator, issues)
|
||||
}
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
injector.injectMembers(this)
|
||||
for (fragment : fragments) {
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.eclipse.xtext.xtext.generator
|
|||
|
||||
import com.google.inject.Binder
|
||||
import org.eclipse.emf.ecore.resource.ResourceSet
|
||||
import org.eclipse.emf.mwe.core.issues.Issues
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.parser.EclipseProjectPropertiesEncodingProvider
|
||||
import org.eclipse.xtext.parser.IEncodingProvider
|
||||
|
@ -16,6 +17,7 @@ import org.eclipse.xtext.resource.XtextResourceSet
|
|||
import org.eclipse.xtext.service.AbstractGenericModule
|
||||
import org.eclipse.xtext.xtext.generator.model.CodeConfig
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextProjectConfig
|
||||
import org.eclipse.xtext.xtext.generator.model.WizardConfig
|
||||
import org.eclipse.xtext.xtext.generator.model.XtextProjectConfig
|
||||
|
||||
class DefaultGeneratorModule extends AbstractGenericModule {
|
||||
|
@ -26,9 +28,15 @@ class DefaultGeneratorModule extends AbstractGenericModule {
|
|||
@Accessors
|
||||
CodeConfig code
|
||||
|
||||
protected def checkConfiguration(XtextGenerator generator, Issues issues) {
|
||||
if (project !== null) {
|
||||
project.checkConfiguration(generator, issues)
|
||||
}
|
||||
}
|
||||
|
||||
def configureXtextProjectConfig(Binder binder) {
|
||||
if (project === null)
|
||||
project = new XtextProjectConfig
|
||||
project = new WizardConfig
|
||||
binder.bind(IXtextProjectConfig).toInstance(project)
|
||||
}
|
||||
|
||||
|
|
|
@ -7,11 +7,15 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator
|
||||
|
||||
import org.eclipse.emf.mwe.core.issues.Issues
|
||||
|
||||
/**
|
||||
* A fragment that contributes to the {@link XtextGenerator}.
|
||||
*/
|
||||
interface IGeneratorFragment2 extends IGuiceAwareGeneratorComponent {
|
||||
|
||||
def void checkConfiguration(XtextGenerator generator, Issues issues)
|
||||
|
||||
def void generate(LanguageConfig2 language)
|
||||
|
||||
}
|
|
@ -69,8 +69,7 @@ class LanguageConfig2 extends CompositeGeneratorFragment2 {
|
|||
def List<String> getFileExtensions() {
|
||||
if (fileExtensions === null || fileExtensions.empty) {
|
||||
val lowerCase = GrammarUtil.getName(grammar).toLowerCase
|
||||
if (LOG.infoEnabled)
|
||||
LOG.info("No explicit fileExtensions configured. Using '*." + lowerCase + "'.")
|
||||
LOG.info("No explicit fileExtensions configured. Using '*." + lowerCase + "'.")
|
||||
return Collections.singletonList(lowerCase)
|
||||
}
|
||||
return fileExtensions
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.eclipse.xtext.util.MergeableManifest
|
|||
import org.eclipse.xtext.xtext.generator.model.CodeConfig
|
||||
import org.eclipse.xtext.xtext.generator.model.IXtextProjectConfig
|
||||
import org.eclipse.xtext.xtext.generator.model.ManifestAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.PluginXmlAccess
|
||||
import org.eclipse.xtext.xtext.generator.model.TypeReference
|
||||
|
||||
/**
|
||||
|
@ -65,6 +64,15 @@ class XtextGenerator extends AbstractWorkflowComponent2 implements IGuiceAwareGe
|
|||
this.languageConfigs.add(language)
|
||||
}
|
||||
|
||||
override protected checkConfigurationInternal(Issues issues) {
|
||||
if (configuration !== null) {
|
||||
configuration.checkConfiguration(this, issues)
|
||||
}
|
||||
for (language : languageConfigs) {
|
||||
language.checkConfiguration(this, issues)
|
||||
}
|
||||
}
|
||||
|
||||
protected def Injector createInjector() {
|
||||
if (injector === null) {
|
||||
if (configuration === null)
|
||||
|
@ -120,26 +128,28 @@ class XtextGenerator extends AbstractWorkflowComponent2 implements IGuiceAwareGe
|
|||
}
|
||||
|
||||
protected def generateManifests() {
|
||||
val firstGrammar = languageConfigs.head?.grammar
|
||||
generateManifest(projectConfig.runtimeManifest, null)
|
||||
generateManifest(projectConfig.runtimeTestManifest, null)
|
||||
generateManifest(projectConfig.genericIdeManifest, null)
|
||||
generateManifest(projectConfig.genericIdeTestManifest, null)
|
||||
generateManifest(projectConfig.eclipsePluginManifest, firstGrammar.eclipsePluginActivator)
|
||||
generateManifest(projectConfig.eclipsePluginTestManifest, null)
|
||||
generateManifest(projectConfig.ideaPluginManifest, null)
|
||||
generateManifest(projectConfig.ideaPluginTestManifest, null)
|
||||
generateManifest(projectConfig.webManifest, null)
|
||||
generateManifest(projectConfig.webTestManifest, null)
|
||||
}
|
||||
|
||||
protected def generateManifest(ManifestAccess manifest, TypeReference activator) {
|
||||
if (manifest !== null) {
|
||||
val manifests = #{
|
||||
projectConfig.runtimeManifest,
|
||||
projectConfig.runtimeTestManifest,
|
||||
projectConfig.genericIdeManifest,
|
||||
projectConfig.genericIdeTestManifest,
|
||||
projectConfig.eclipsePluginManifest,
|
||||
projectConfig.eclipsePluginTestManifest,
|
||||
projectConfig.ideaPluginManifest,
|
||||
projectConfig.ideaPluginTestManifest,
|
||||
projectConfig.webManifest,
|
||||
projectConfig.webTestManifest
|
||||
}
|
||||
manifests.filterNull.sortBy[path].forEach[ manifest |
|
||||
if (manifest.bundleName === null) {
|
||||
val segments = manifest.path.split('/')
|
||||
if (segments.length >= 3 && segments.get(segments.length - 2) == 'META-INF')
|
||||
manifest.bundleName = segments.get(segments.length - 3)
|
||||
}
|
||||
var TypeReference activator
|
||||
if (manifest === projectConfig.eclipsePluginManifest) {
|
||||
activator = languageConfigs.head?.grammar.eclipsePluginActivator
|
||||
}
|
||||
val file = new File(manifest.path)
|
||||
if (file.exists) {
|
||||
if (manifest.merge) {
|
||||
|
@ -151,12 +161,7 @@ class XtextGenerator extends AbstractWorkflowComponent2 implements IGuiceAwareGe
|
|||
} else {
|
||||
templates.createManifest(manifest, activator).writeToFile()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected def generateActivator() {
|
||||
if (projectConfig.eclipsePluginSrcGen !== null)
|
||||
templates.createEclipsePluginActivator(languageConfigs).writeTo(projectConfig.eclipsePluginSrcGen)
|
||||
]
|
||||
}
|
||||
|
||||
protected def mergeManifest(ManifestAccess manifest, File file, TypeReference activator) throws IOException {
|
||||
|
@ -183,21 +188,25 @@ class XtextGenerator extends AbstractWorkflowComponent2 implements IGuiceAwareGe
|
|||
}
|
||||
}
|
||||
|
||||
protected def generatePluginXmls() {
|
||||
generatePluginXml(projectConfig.runtimePluginXml)
|
||||
generatePluginXml(projectConfig.runtimeTestPluginXml)
|
||||
generatePluginXml(projectConfig.genericIdePluginXml)
|
||||
generatePluginXml(projectConfig.genericIdeTestPluginXml)
|
||||
generatePluginXml(projectConfig.eclipsePluginPluginXml)
|
||||
generatePluginXml(projectConfig.eclipsePluginTestPluginXml)
|
||||
generatePluginXml(projectConfig.ideaPluginPluginXml)
|
||||
generatePluginXml(projectConfig.ideaPluginTestPluginXml)
|
||||
generatePluginXml(projectConfig.webPluginXml)
|
||||
generatePluginXml(projectConfig.webTestPluginXml)
|
||||
protected def generateActivator() {
|
||||
if (projectConfig.eclipsePluginSrcGen !== null)
|
||||
templates.createEclipsePluginActivator(languageConfigs).writeTo(projectConfig.eclipsePluginSrcGen)
|
||||
}
|
||||
|
||||
protected def generatePluginXml(PluginXmlAccess pluginXml) {
|
||||
if (pluginXml !== null) {
|
||||
protected def generatePluginXmls() {
|
||||
val pluginXmls = #{
|
||||
projectConfig.runtimePluginXml,
|
||||
projectConfig.runtimeTestPluginXml,
|
||||
projectConfig.genericIdePluginXml,
|
||||
projectConfig.genericIdeTestPluginXml,
|
||||
projectConfig.eclipsePluginPluginXml,
|
||||
projectConfig.eclipsePluginTestPluginXml,
|
||||
projectConfig.ideaPluginPluginXml,
|
||||
projectConfig.ideaPluginTestPluginXml,
|
||||
projectConfig.webPluginXml,
|
||||
projectConfig.webTestPluginXml
|
||||
}
|
||||
pluginXmls.filterNull.sortBy[path].forEach[ pluginXml |
|
||||
if (new File(pluginXml.path).exists) {
|
||||
if (pluginXml.path.endsWith('.xml')) {
|
||||
pluginXml.path = pluginXml.path + '_gen'
|
||||
|
@ -206,7 +215,7 @@ class XtextGenerator extends AbstractWorkflowComponent2 implements IGuiceAwareGe
|
|||
} else {
|
||||
templates.createPluginXml(pluginXml).writeToFile()
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
}
|
|
@ -87,8 +87,13 @@ class ProjectConfigGenerator {
|
|||
*******************************************************************************/
|
||||
package «IMPL_NAME.substring(0, IMPL_NAME.lastIndexOf('.'))»;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.inject.Injector;
|
||||
import java.util.Map;
|
||||
import org.eclipse.emf.mwe.core.issues.Issues;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.util.Strings;
|
||||
import org.eclipse.xtext.xtext.generator.XtextGenerator;
|
||||
|
||||
/**
|
||||
* Use this class to configure output paths in the XtextGenerator.
|
||||
|
@ -106,16 +111,47 @@ class ProjectConfigGenerator {
|
|||
private FileSystemAccess orionJsGen;
|
||||
private FileSystemAccess aceJsGen;
|
||||
|
||||
public void checkConfiguration(XtextGenerator generator, Issues issues) {
|
||||
«FOR p : PROJECTS»
|
||||
if («p»Manifest != null && Strings.isEmpty(«p»Manifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", «p»Manifest);
|
||||
}
|
||||
if («p»PluginXml != null && Strings.isEmpty(«p»PluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", «p»PluginXml);
|
||||
}
|
||||
«ENDFOR»
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Injector injector) {
|
||||
injector.injectMembers(this);
|
||||
Map<String, ManifestAccess> manifestPaths = Maps.newHashMapWithExpectedSize(«PROJECTS.size»);
|
||||
Map<String, PluginXmlAccess> pluginXmlPaths = Maps.newHashMapWithExpectedSize(«PROJECTS.size»);
|
||||
«FOR p : PROJECTS»
|
||||
|
||||
// Initialize «p» configuration
|
||||
if («p»Src != null) {
|
||||
«p»Src.initialize(injector);
|
||||
}
|
||||
if («p»SrcGen != null) {
|
||||
«p»SrcGen.initialize(injector);
|
||||
}
|
||||
if («p»Manifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(«p»Manifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(«p»Manifest.getPath(), «p»Manifest);
|
||||
} else if (access != «p»Manifest) {
|
||||
set«p.toFirstUpper»Manifest(access);
|
||||
}
|
||||
}
|
||||
if («p»PluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(«p»PluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(«p»PluginXml.getPath(), «p»PluginXml);
|
||||
} else if (access != «p»PluginXml) {
|
||||
set«p.toFirstUpper»PluginXml(access);
|
||||
}
|
||||
}
|
||||
«ENDFOR»
|
||||
if (orionJsGen != null) {
|
||||
orionJsGen.initialize(injector);
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
/*******************************************************************************
|
||||
* 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.model
|
||||
|
||||
import com.google.inject.Injector
|
||||
import org.eclipse.emf.mwe.core.issues.Issues
|
||||
import org.eclipse.xtend.lib.annotations.Accessors
|
||||
import org.eclipse.xtext.xtext.generator.XtextGenerator
|
||||
|
||||
@Accessors
|
||||
class WizardConfig extends XtextProjectConfig {
|
||||
|
||||
String runtimeBase
|
||||
|
||||
boolean eclipseEditor = true
|
||||
|
||||
boolean ideaEditor = false
|
||||
|
||||
boolean orionEditor = false
|
||||
|
||||
boolean genericIdeSupport = false
|
||||
|
||||
boolean testingSupport = false
|
||||
|
||||
boolean mavenLayout = true
|
||||
|
||||
override checkConfiguration(XtextGenerator generator, Issues issues) {
|
||||
super.checkConfiguration(generator, issues)
|
||||
if (runtimeBase.nullOrEmpty)
|
||||
issues.addError(generator, 'The property \'runtimeBase\' must be set.', this)
|
||||
if (!Character.isJavaIdentifierPart(runtimeBase.charAt(runtimeBase.length - 1)))
|
||||
issues.addError(generator, 'The runtime base path must end with a valid package name.', this)
|
||||
if ((ideaEditor || orionEditor) && !genericIdeSupport)
|
||||
issues.addError(generator, 'Generic IDE support must be enabled when the IDEA or Orion editors are enabled.', this)
|
||||
}
|
||||
|
||||
override initialize(Injector injector) {
|
||||
var src = 'src'
|
||||
var srcGen = 'src-gen'
|
||||
var srcWeb = 'web'
|
||||
if (mavenLayout) {
|
||||
src = 'src/main/java'
|
||||
srcGen = 'src/main/xtext-gen'
|
||||
srcWeb = 'src/main/webapp'
|
||||
}
|
||||
|
||||
if (runtimeSrc === null)
|
||||
runtimeSrc = runtimeBase + '/' + src
|
||||
if (runtimeSrcGen === null)
|
||||
runtimeSrcGen = runtimeBase + '/' + srcGen
|
||||
if (runtimeManifest === null)
|
||||
runtimeManifest = new ManifestAccess => [path = runtimeBase + '/META-INF/MANIFEST.MF']
|
||||
if (runtimePluginXml === null)
|
||||
runtimePluginXml = new PluginXmlAccess => [path = runtimeBase + '/plugin.xml']
|
||||
|
||||
if (eclipseEditor) {
|
||||
if (eclipsePluginSrc === null)
|
||||
eclipsePluginSrc = runtimeBase + '.ui/' + src
|
||||
if (eclipsePluginSrcGen === null)
|
||||
eclipsePluginSrcGen = runtimeBase + '.ui/' + srcGen
|
||||
if (eclipsePluginManifest === null)
|
||||
eclipsePluginManifest = new ManifestAccess => [path = runtimeBase + '.ui/META-INF/MANIFEST.MF']
|
||||
if (eclipsePluginPluginXml === null)
|
||||
eclipsePluginPluginXml = new PluginXmlAccess => [path = runtimeBase + '.ui/plugin.xml']
|
||||
}
|
||||
|
||||
if (ideaEditor) {
|
||||
if (ideaPluginSrc === null)
|
||||
ideaPluginSrc = runtimeBase + '.idea/' + src
|
||||
if (ideaPluginSrcGen === null)
|
||||
ideaPluginSrcGen = runtimeBase + '.idea/' + srcGen
|
||||
}
|
||||
|
||||
if (orionEditor) {
|
||||
if (webSrc === null)
|
||||
webSrc = runtimeBase + '.web/' + src
|
||||
if (webSrcGen === null)
|
||||
webSrcGen = runtimeBase + '.web/' + srcGen
|
||||
if (orionJsGen === null)
|
||||
orionJsGen = runtimeBase + '.web/' + srcWeb + '/xtext/generated'
|
||||
}
|
||||
|
||||
if (genericIdeSupport) {
|
||||
if (genericIdeSrc === null)
|
||||
genericIdeSrc = runtimeBase + '.ide/' + src
|
||||
if (genericIdeSrcGen === null)
|
||||
genericIdeSrcGen = runtimeBase + '.ide/' + srcGen
|
||||
if (genericIdeManifest === null)
|
||||
genericIdeManifest = new ManifestAccess => [path = runtimeBase + '.ide/META-INF/MANIFEST.MF']
|
||||
}
|
||||
|
||||
if (testingSupport) {
|
||||
if (runtimeTestSrc === null)
|
||||
runtimeTestSrc = runtimeBase + '.test/' + src
|
||||
if (runtimeTestSrcGen === null)
|
||||
runtimeTestSrcGen = runtimeBase + '.test/' + srcGen
|
||||
if (runtimeTestManifest === null)
|
||||
runtimeTestManifest = new ManifestAccess => [path = runtimeBase + '.test/META-INF/MANIFEST.MF']
|
||||
}
|
||||
|
||||
super.initialize(injector)
|
||||
}
|
||||
|
||||
}
|
|
@ -7,8 +7,13 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.xtext.generator.model;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.inject.Injector;
|
||||
import java.util.Map;
|
||||
import org.eclipse.emf.mwe.core.issues.Issues;
|
||||
import org.eclipse.xtext.generator.IFileSystemAccess2;
|
||||
import org.eclipse.xtext.util.Strings;
|
||||
import org.eclipse.xtext.xtext.generator.XtextGenerator;
|
||||
|
||||
/**
|
||||
* Use this class to configure output paths in the XtextGenerator.
|
||||
|
@ -60,69 +65,314 @@ public class XtextProjectConfig implements IXtextProjectConfig {
|
|||
private FileSystemAccess orionJsGen;
|
||||
private FileSystemAccess aceJsGen;
|
||||
|
||||
public void checkConfiguration(XtextGenerator generator, Issues issues) {
|
||||
if (runtimeManifest != null && Strings.isEmpty(runtimeManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", runtimeManifest);
|
||||
}
|
||||
if (runtimePluginXml != null && Strings.isEmpty(runtimePluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", runtimePluginXml);
|
||||
}
|
||||
if (runtimeTestManifest != null && Strings.isEmpty(runtimeTestManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", runtimeTestManifest);
|
||||
}
|
||||
if (runtimeTestPluginXml != null && Strings.isEmpty(runtimeTestPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", runtimeTestPluginXml);
|
||||
}
|
||||
if (genericIdeManifest != null && Strings.isEmpty(genericIdeManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", genericIdeManifest);
|
||||
}
|
||||
if (genericIdePluginXml != null && Strings.isEmpty(genericIdePluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", genericIdePluginXml);
|
||||
}
|
||||
if (genericIdeTestManifest != null && Strings.isEmpty(genericIdeTestManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", genericIdeTestManifest);
|
||||
}
|
||||
if (genericIdeTestPluginXml != null && Strings.isEmpty(genericIdeTestPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", genericIdeTestPluginXml);
|
||||
}
|
||||
if (eclipsePluginManifest != null && Strings.isEmpty(eclipsePluginManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", eclipsePluginManifest);
|
||||
}
|
||||
if (eclipsePluginPluginXml != null && Strings.isEmpty(eclipsePluginPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", eclipsePluginPluginXml);
|
||||
}
|
||||
if (eclipsePluginTestManifest != null && Strings.isEmpty(eclipsePluginTestManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", eclipsePluginTestManifest);
|
||||
}
|
||||
if (eclipsePluginTestPluginXml != null && Strings.isEmpty(eclipsePluginTestPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", eclipsePluginTestPluginXml);
|
||||
}
|
||||
if (ideaPluginManifest != null && Strings.isEmpty(ideaPluginManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", ideaPluginManifest);
|
||||
}
|
||||
if (ideaPluginPluginXml != null && Strings.isEmpty(ideaPluginPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", ideaPluginPluginXml);
|
||||
}
|
||||
if (ideaPluginTestManifest != null && Strings.isEmpty(ideaPluginTestManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", ideaPluginTestManifest);
|
||||
}
|
||||
if (ideaPluginTestPluginXml != null && Strings.isEmpty(ideaPluginTestPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", ideaPluginTestPluginXml);
|
||||
}
|
||||
if (webManifest != null && Strings.isEmpty(webManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", webManifest);
|
||||
}
|
||||
if (webPluginXml != null && Strings.isEmpty(webPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", webPluginXml);
|
||||
}
|
||||
if (webTestManifest != null && Strings.isEmpty(webTestManifest.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", webTestManifest);
|
||||
}
|
||||
if (webTestPluginXml != null && Strings.isEmpty(webTestPluginXml.getPath())) {
|
||||
issues.addError(generator, "The property 'path' must be set.", webTestPluginXml);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(Injector injector) {
|
||||
injector.injectMembers(this);
|
||||
Map<String, ManifestAccess> manifestPaths = Maps.newHashMapWithExpectedSize(10);
|
||||
Map<String, PluginXmlAccess> pluginXmlPaths = Maps.newHashMapWithExpectedSize(10);
|
||||
|
||||
// Initialize runtime configuration
|
||||
if (runtimeSrc != null) {
|
||||
runtimeSrc.initialize(injector);
|
||||
}
|
||||
if (runtimeSrcGen != null) {
|
||||
runtimeSrcGen.initialize(injector);
|
||||
}
|
||||
if (runtimeManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(runtimeManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(runtimeManifest.getPath(), runtimeManifest);
|
||||
} else if (access != runtimeManifest) {
|
||||
setRuntimeManifest(access);
|
||||
}
|
||||
}
|
||||
if (runtimePluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(runtimePluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(runtimePluginXml.getPath(), runtimePluginXml);
|
||||
} else if (access != runtimePluginXml) {
|
||||
setRuntimePluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize runtimeTest configuration
|
||||
if (runtimeTestSrc != null) {
|
||||
runtimeTestSrc.initialize(injector);
|
||||
}
|
||||
if (runtimeTestSrcGen != null) {
|
||||
runtimeTestSrcGen.initialize(injector);
|
||||
}
|
||||
if (runtimeTestManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(runtimeTestManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(runtimeTestManifest.getPath(), runtimeTestManifest);
|
||||
} else if (access != runtimeTestManifest) {
|
||||
setRuntimeTestManifest(access);
|
||||
}
|
||||
}
|
||||
if (runtimeTestPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(runtimeTestPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(runtimeTestPluginXml.getPath(), runtimeTestPluginXml);
|
||||
} else if (access != runtimeTestPluginXml) {
|
||||
setRuntimeTestPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize genericIde configuration
|
||||
if (genericIdeSrc != null) {
|
||||
genericIdeSrc.initialize(injector);
|
||||
}
|
||||
if (genericIdeSrcGen != null) {
|
||||
genericIdeSrcGen.initialize(injector);
|
||||
}
|
||||
if (genericIdeManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(genericIdeManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(genericIdeManifest.getPath(), genericIdeManifest);
|
||||
} else if (access != genericIdeManifest) {
|
||||
setGenericIdeManifest(access);
|
||||
}
|
||||
}
|
||||
if (genericIdePluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(genericIdePluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(genericIdePluginXml.getPath(), genericIdePluginXml);
|
||||
} else if (access != genericIdePluginXml) {
|
||||
setGenericIdePluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize genericIdeTest configuration
|
||||
if (genericIdeTestSrc != null) {
|
||||
genericIdeTestSrc.initialize(injector);
|
||||
}
|
||||
if (genericIdeTestSrcGen != null) {
|
||||
genericIdeTestSrcGen.initialize(injector);
|
||||
}
|
||||
if (genericIdeTestManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(genericIdeTestManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(genericIdeTestManifest.getPath(), genericIdeTestManifest);
|
||||
} else if (access != genericIdeTestManifest) {
|
||||
setGenericIdeTestManifest(access);
|
||||
}
|
||||
}
|
||||
if (genericIdeTestPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(genericIdeTestPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(genericIdeTestPluginXml.getPath(), genericIdeTestPluginXml);
|
||||
} else if (access != genericIdeTestPluginXml) {
|
||||
setGenericIdeTestPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize eclipsePlugin configuration
|
||||
if (eclipsePluginSrc != null) {
|
||||
eclipsePluginSrc.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginSrcGen != null) {
|
||||
eclipsePluginSrcGen.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(eclipsePluginManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(eclipsePluginManifest.getPath(), eclipsePluginManifest);
|
||||
} else if (access != eclipsePluginManifest) {
|
||||
setEclipsePluginManifest(access);
|
||||
}
|
||||
}
|
||||
if (eclipsePluginPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(eclipsePluginPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(eclipsePluginPluginXml.getPath(), eclipsePluginPluginXml);
|
||||
} else if (access != eclipsePluginPluginXml) {
|
||||
setEclipsePluginPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize eclipsePluginTest configuration
|
||||
if (eclipsePluginTestSrc != null) {
|
||||
eclipsePluginTestSrc.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginTestSrcGen != null) {
|
||||
eclipsePluginTestSrcGen.initialize(injector);
|
||||
}
|
||||
if (eclipsePluginTestManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(eclipsePluginTestManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(eclipsePluginTestManifest.getPath(), eclipsePluginTestManifest);
|
||||
} else if (access != eclipsePluginTestManifest) {
|
||||
setEclipsePluginTestManifest(access);
|
||||
}
|
||||
}
|
||||
if (eclipsePluginTestPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(eclipsePluginTestPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(eclipsePluginTestPluginXml.getPath(), eclipsePluginTestPluginXml);
|
||||
} else if (access != eclipsePluginTestPluginXml) {
|
||||
setEclipsePluginTestPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize ideaPlugin configuration
|
||||
if (ideaPluginSrc != null) {
|
||||
ideaPluginSrc.initialize(injector);
|
||||
}
|
||||
if (ideaPluginSrcGen != null) {
|
||||
ideaPluginSrcGen.initialize(injector);
|
||||
}
|
||||
if (ideaPluginManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(ideaPluginManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(ideaPluginManifest.getPath(), ideaPluginManifest);
|
||||
} else if (access != ideaPluginManifest) {
|
||||
setIdeaPluginManifest(access);
|
||||
}
|
||||
}
|
||||
if (ideaPluginPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(ideaPluginPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(ideaPluginPluginXml.getPath(), ideaPluginPluginXml);
|
||||
} else if (access != ideaPluginPluginXml) {
|
||||
setIdeaPluginPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize ideaPluginTest configuration
|
||||
if (ideaPluginTestSrc != null) {
|
||||
ideaPluginTestSrc.initialize(injector);
|
||||
}
|
||||
if (ideaPluginTestSrcGen != null) {
|
||||
ideaPluginTestSrcGen.initialize(injector);
|
||||
}
|
||||
if (ideaPluginTestManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(ideaPluginTestManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(ideaPluginTestManifest.getPath(), ideaPluginTestManifest);
|
||||
} else if (access != ideaPluginTestManifest) {
|
||||
setIdeaPluginTestManifest(access);
|
||||
}
|
||||
}
|
||||
if (ideaPluginTestPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(ideaPluginTestPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(ideaPluginTestPluginXml.getPath(), ideaPluginTestPluginXml);
|
||||
} else if (access != ideaPluginTestPluginXml) {
|
||||
setIdeaPluginTestPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize web configuration
|
||||
if (webSrc != null) {
|
||||
webSrc.initialize(injector);
|
||||
}
|
||||
if (webSrcGen != null) {
|
||||
webSrcGen.initialize(injector);
|
||||
}
|
||||
if (webManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(webManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(webManifest.getPath(), webManifest);
|
||||
} else if (access != webManifest) {
|
||||
setWebManifest(access);
|
||||
}
|
||||
}
|
||||
if (webPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(webPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(webPluginXml.getPath(), webPluginXml);
|
||||
} else if (access != webPluginXml) {
|
||||
setWebPluginXml(access);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize webTest configuration
|
||||
if (webTestSrc != null) {
|
||||
webTestSrc.initialize(injector);
|
||||
}
|
||||
if (webTestSrcGen != null) {
|
||||
webTestSrcGen.initialize(injector);
|
||||
}
|
||||
if (webTestManifest != null) {
|
||||
ManifestAccess access = manifestPaths.get(webTestManifest.getPath());
|
||||
if (access == null) {
|
||||
manifestPaths.put(webTestManifest.getPath(), webTestManifest);
|
||||
} else if (access != webTestManifest) {
|
||||
setWebTestManifest(access);
|
||||
}
|
||||
}
|
||||
if (webTestPluginXml != null) {
|
||||
PluginXmlAccess access = pluginXmlPaths.get(webTestPluginXml.getPath());
|
||||
if (access == null) {
|
||||
pluginXmlPaths.put(webTestPluginXml.getPath(), webTestPluginXml);
|
||||
} else if (access != webTestPluginXml) {
|
||||
setWebTestPluginXml(access);
|
||||
}
|
||||
}
|
||||
if (orionJsGen != null) {
|
||||
orionJsGen.initialize(injector);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue