Skip to content

Commit

Permalink
Merge f51fe72 into 3d1a8df
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Dec 13, 2019
2 parents 3d1a8df + f51fe72 commit a8af018
Show file tree
Hide file tree
Showing 32 changed files with 750 additions and 73 deletions.
43 changes: 33 additions & 10 deletions edelta.parent/edelta.lib/pom.xml
@@ -1,12 +1,35 @@
<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>edelta</groupId>
<artifactId>edelta.parent</artifactId>
<version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>edelta.lib</artifactId>
<packaging>eclipse-plugin</packaging>
<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>edelta</groupId>
<artifactId>edelta.parent</artifactId>
<version>0.7.0-SNAPSHOT</version>
</parent>
<artifactId>edelta.lib</artifactId>
<packaging>eclipse-plugin</packaging>

<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase.lib</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
</dependency>
</dependencies>
</project>
39 changes: 39 additions & 0 deletions edelta.parent/edelta.maven.example/.classpath
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="model">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src-gen">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
29 changes: 29 additions & 0 deletions edelta.parent/edelta.maven.example/.project
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>edelta.maven.example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
15 changes: 15 additions & 0 deletions edelta.parent/edelta.maven.example/.settings/edelta.Edelta.prefs
@@ -0,0 +1,15 @@
BuilderConfiguration.is_project_specific=true
autobuilding=true
eclipse.preferences.version=1
outlet.DEFAULT_OUTPUT.cleanDirectory=false
outlet.DEFAULT_OUTPUT.cleanupDerived=true
outlet.DEFAULT_OUTPUT.createDirectory=true
outlet.DEFAULT_OUTPUT.derived=true
outlet.DEFAULT_OUTPUT.description=
outlet.DEFAULT_OUTPUT.directory=src-gen
outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
outlet.DEFAULT_OUTPUT.keepLocalHistory=false
outlet.DEFAULT_OUTPUT.name=DEFAULT_OUTPUT
outlet.DEFAULT_OUTPUT.override=true
outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=false
@@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
encoding/src-gen=UTF-8
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
12 changes: 12 additions & 0 deletions edelta.parent/edelta.maven.example/model/My.ecore
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="myecore" nsURI="http://www.eclipse.org/emf/2002/Myecore" nsPrefix="myecore">
<eClassifiers xsi:type="ecore:EClass" name="MyEClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="astring" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="MyENum">
<eLiterals name="FirstEnumLiteral"/>
<eLiterals name="SecondEnumLiteral" value="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MyOtherEClass"/>
</ecore:EPackage>
17 changes: 17 additions & 0 deletions edelta.parent/edelta.maven.example/modified/My.ecore
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="myecore" nsURI="http://www.eclipse.org/emf/2002/Myecore" nsPrefix="myecore">
<eClassifiers xsi:type="ecore:EClass" name="MyEClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="astring" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="MyENum">
<eLiterals name="FirstEnumLiteral"/>
<eLiterals name="SecondEnumLiteral" value="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="MyOtherEClass"/>
<eClassifiers xsi:type="ecore:EClass" name="MyNewClass">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="ANewAttribute" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ANewDerivedEClass" abstract="true" eSuperTypes="#//MyEClass"/>
</ecore:EPackage>
153 changes: 153 additions & 0 deletions edelta.parent/edelta.maven.example/pom.xml
@@ -0,0 +1,153 @@
<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>

<groupId>edelta</groupId>
<artifactId>edelta.maven.example</artifactId>
<version>0.7.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>example</name>
<url>http://maven.apache.org</url>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<edelta.version>${project.version}</edelta.version>
<xtextVersion>2.20.0</xtextVersion>
<xtext-version>${xtextVersion}</xtext-version>
<emf.mwe-version>1.5.1</emf.mwe-version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-dev-bom</artifactId>
<version>${xtextVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.xbase.lib</artifactId>
<version>${xtextVersion}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>edelta</groupId>
<artifactId>edelta.lib</artifactId>
<version>${edelta.version}</version>
</dependency>
<dependency>
<groupId>edelta</groupId>
<artifactId>edelta.refactorings.lib</artifactId>
<version>${edelta.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets combine.children="append">
<fileset>
<directory>${basedir}/src-gen/</directory>
<excludes>
<exclude>.gitignore</exclude>
</excludes>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<!-- Where Edelta generates Java files -->
<source>src-gen/</source>
<!-- Where the .ecore file(s) are placed -->
<source>model/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtextVersion}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<failOnValidationError>true</failOnValidationError>
<languages>
<language>
<setup>org.eclipse.xtext.ecore.EcoreSupport</setup>
</language>
<language>
<setup>edelta.EdeltaStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>${basedir}/src-gen</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.mwe.core</artifactId>
<version>${emf.mwe-version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>org.eclipse.xtext.ecore</artifactId>
<version>${xtext-version}</version>
</dependency>
<dependency>
<groupId>edelta</groupId>
<artifactId>edelta</artifactId>
<version>${edelta.version}</version>
</dependency>
<!-- If you use a library in the .edelta file, it must be available
also during Edelta compilation with xtext-maven-plugin -->
<dependency>
<groupId>edelta</groupId>
<artifactId>edelta.refactorings.lib</artifactId>
<version>${edelta.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions edelta.parent/edelta.maven.example/src-gen/.gitignore
@@ -0,0 +1 @@
*.java._trace
@@ -0,0 +1,52 @@
package com.example;

import edelta.lib.AbstractEdelta;
import gssi.refactorings.MMrefactorings;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.xtext.xbase.lib.ObjectExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@SuppressWarnings("all")
public class Example extends AbstractEdelta {
private MMrefactorings refactorings;

public Example() {
refactorings = new MMrefactorings(this);
}

public Example(final AbstractEdelta other) {
super(other);
}

public EClass createClass(final String name) {
EClass _newEClass = this.lib.newEClass(name);
final Procedure1<EClass> _function = new Procedure1<EClass>() {
public void apply(final EClass it) {
EList<EClass> _eSuperTypes = it.getESuperTypes();
_eSuperTypes.add(getEClass("myecore", "MyEClass"));
}
};
return ObjectExtensions.<EClass>operator_doubleArrow(_newEClass, _function);
}

@Override
public void performSanityChecks() throws Exception {
ensureEPackageIsLoaded("myecore");
ensureEPackageIsLoaded("ecore");
}

@Override
protected void doExecute() throws Exception {
createEClass("myecore", "MyNewClass", createList(this::_createEClass_MyNewClass_in_myecore));
}

public void _createEClass_MyNewClass_in_myecore(final EClass it) {
{
this.refactorings.addMandatoryAttr(it, "ANewAttribute", getEDataType("ecore", "EString"));
getEAttribute("myecore", "MyNewClass", "ANewAttribute").setEType(getEDataType("ecore", "EInt"));
this.lib.addEClass(it.getEPackage(), this.createClass("ANewDerivedEClass"));
getEClass("myecore", "ANewDerivedEClass").setAbstract(true);
}
}
}

0 comments on commit a8af018

Please sign in to comment.