-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
899 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
generators/generator-runner/src/main/resources/generators/generator_template.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
vorto.service.name=Vorto Code Generator Template | ||
vorto.service.description=Generates a Vorto Code Generator as part of the Generator Plugin SDK | ||
vorto.service.creator= Eclipse Vorto Team | ||
vorto.service.documentationUrl = https://github.com/eclipse/vorto/tree/development/plugin-sdk/plugin-generator/Readme.md | ||
vorto.service.image32x32= img/icon32x32.png | ||
vorto.service.image144x144= img/icon144x144.png | ||
vorto.service.classifier=platform | ||
vorto.service.tags=infra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target/ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.eclipse.vorto</groupId> | ||
<artifactId>plugin-generator</artifactId> | ||
<version>0.10.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>generator-template</artifactId> | ||
|
||
<name>Vorto Code Generator Template Plugin</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.eclipse.vorto</groupId> | ||
<artifactId>org.eclipse.vorto.core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.eclipse.vorto</groupId> | ||
<artifactId>generator-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>org.eclipse.xtend.lib</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
<version>1.7</version> | ||
<executions> | ||
<execution> | ||
<id>add-source</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>add-source</goal> | ||
</goals> | ||
<configuration> | ||
<sources> | ||
<source>${basedir}/src/main/xtend-gen</source> | ||
</sources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.eclipse.xtend</groupId> | ||
<artifactId>xtend-maven-plugin</artifactId> | ||
<version>${xtext.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${basedir}/src/main/xtend-gen</outputDirectory> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.4.1</version> | ||
<configuration> | ||
<filesets> | ||
<fileset> | ||
<directory>${basedir}/src/main/xtend-gen</directory> | ||
</fileset> | ||
</filesets> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<configuration> | ||
<failOnMissingWebXml>false</failOnMissingWebXml> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
76 changes: 76 additions & 0 deletions
76
...late/src/main/java/org/eclipse/vorto/codegen/template/CodeGeneratorTemplateGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Copyright (c) 2015-2016 Bosch Software Innovations GmbH and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v1.0 which accompany this distribution. | ||
* | ||
* The Eclipse Public License is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* The Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* Contributors: | ||
* Bosch Software Innovations GmbH - Please refer to git log | ||
*/ | ||
package org.eclipse.vorto.codegen.template; | ||
|
||
import java.util.Optional; | ||
|
||
import org.eclipse.vorto.codegen.api.ChainedCodeGeneratorTask; | ||
import org.eclipse.vorto.codegen.api.GenerationResultZip; | ||
import org.eclipse.vorto.codegen.api.GeneratorInfo; | ||
import org.eclipse.vorto.codegen.api.GeneratorTaskFromFileTemplate; | ||
import org.eclipse.vorto.codegen.api.IGenerationResult; | ||
import org.eclipse.vorto.codegen.api.IVortoCodeGenProgressMonitor; | ||
import org.eclipse.vorto.codegen.api.IVortoCodeGenerator; | ||
import org.eclipse.vorto.codegen.api.InvocationContext; | ||
import org.eclipse.vorto.codegen.template.plugin.GeneratorMainTemplate; | ||
import org.eclipse.vorto.codegen.template.plugin.HelloWorldTemplate; | ||
import org.eclipse.vorto.codegen.template.runner.GenPropertiesFileTemplate; | ||
import org.eclipse.vorto.codegen.template.runner.GeneratorConfigurationTemplate; | ||
import org.eclipse.vorto.codegen.template.runner.GeneratorRunnerTemplate; | ||
import org.eclipse.vorto.codegen.template.runner.LocalPropertiesFileTemplate; | ||
import org.eclipse.vorto.codegen.template.runner.PomTemplate; | ||
import org.eclipse.vorto.core.api.model.informationmodel.InformationModel; | ||
|
||
public class CodeGeneratorTemplateGenerator implements IVortoCodeGenerator { | ||
|
||
@Override | ||
public IGenerationResult generate(InformationModel model, InvocationContext context, | ||
IVortoCodeGenProgressMonitor monitor) { | ||
|
||
final String serviceKey = context.getConfigurationProperties().getOrDefault("serviceKey", "myplatform").replace(" ", ""); | ||
|
||
GenerationResultZip output = new GenerationResultZip(model, getServiceKey()); | ||
ChainedCodeGeneratorTask<InformationModel> generator = new ChainedCodeGeneratorTask<InformationModel>(); | ||
|
||
// Generates the parent project | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new org.eclipse.vorto.codegen.template.parent.PomTemplate())); | ||
|
||
// Generates the Vorto Code Generator Runner Project | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new GeneratorConfigurationTemplate())); | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new GeneratorRunnerTemplate())); | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new GenPropertiesFileTemplate(serviceKey))); | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new LocalPropertiesFileTemplate())); | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new PomTemplate())); | ||
|
||
// Generates the Vorto Code Generator Plugin Project | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new org.eclipse.vorto.codegen.template.plugin.PomTemplate(serviceKey))); | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new GeneratorMainTemplate(serviceKey))); | ||
generator.addTask(new GeneratorTaskFromFileTemplate<InformationModel>(new HelloWorldTemplate(serviceKey))); | ||
|
||
generator.generate(model, context, output); | ||
return output; | ||
} | ||
@Override | ||
public String getServiceKey() { | ||
return "generator_template"; | ||
} | ||
|
||
@Override | ||
public GeneratorInfo getInfo() { | ||
return GeneratorInfo.basicInfo("Vorto Generator Template", | ||
"Generates a Vorto Code Generator template", | ||
"Vorto Team").withTextConfigurationItem("serviceKey", "Key", Optional.of("MyPlatform")).infra(); | ||
} | ||
} |
Oops, something went wrong.