Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
Merge pull request #60 from metafacture/35-metafix
Browse files Browse the repository at this point in the history
Current state of Metafix implementation
  • Loading branch information
fsteeg authored Nov 9, 2021
2 parents 92f27fb + 1fe336b commit 2cac372
Show file tree
Hide file tree
Showing 52 changed files with 3,415 additions and 3,087 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ subprojects {
targetCompatibility = '1.8'

repositories {
jcenter()
mavenCentral()
maven githubPackage.invoke("metafacture")
}

dependencies {
compile platform("org.eclipse.xtext:xtext-dev-bom:${versions.xtext}")
implementation platform("org.eclipse.xtext:xtext-dev-bom:${versions.xtext}")
}

configurations.all {
Expand Down
1 change: 1 addition & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<module name="CustomImportOrder">
<property name="customImportOrderRules" value="SAME_PACKAGE(2)###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###STATIC"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
</module>
<module name="CyclomaticComplexity"/>
<module name="DeclarationOrder"/>
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
distributionSha256Sum=f581709a9c35e9cb92e16f585d2c4bc99b2b1a5f85d2badbd3dc6bff59e1e6dd
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 4 additions & 4 deletions org.metafacture.fix.ide/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ plugins {
}

dependencies {
compile project(':metafacture-fix')
implementation project(':metafix')

compile "org.eclipse.xtext:org.eclipse.xtext.ide:${versions.xtext}"
compile "org.eclipse.xtext:org.eclipse.xtext.xbase.ide:${versions.xtext}"
implementation "org.eclipse.xtext:org.eclipse.xtext.ide:${versions.xtext}"
implementation "org.eclipse.xtext:org.eclipse.xtext.xbase.ide:${versions.xtext}"
}

apply plugin: 'application'
Expand All @@ -17,7 +17,7 @@ applicationName = 'xtext-server'

shadowJar {
from(project.convention.getPlugin(JavaPluginConvention).sourceSets.main.output)
configurations = [project.configurations.runtime]
configurations = [project.configurations.runtimeClasspath]

exclude(
'*.html',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package org.metafacture.fix.ide;
package org.metafacture.metafix.ide;

/**
* Use this class to register ide components.
*/
public class FixIdeModule extends AbstractFixIdeModule {

public FixIdeModule() {
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.metafacture.fix.ide;
package org.metafacture.metafix.ide;

import org.metafacture.fix.FixRuntimeModule;
import org.metafacture.fix.FixStandaloneSetup;
import org.metafacture.metafix.FixRuntimeModule;
import org.metafacture.metafix.FixStandaloneSetup;

import com.google.inject.Guice;
import com.google.inject.Injector;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.metafacture.fix.ide.contentassist.antlr;
package org.metafacture.metafix.ide.contentassist.antlr;

import org.metafacture.fix.ide.contentassist.antlr.internal.InternalFixParser;
import org.metafacture.metafix.ide.contentassist.antlr.internal.InternalFixParser;

import org.antlr.runtime.Token;
import org.antlr.runtime.TokenSource;
Expand Down Expand Up @@ -31,5 +31,4 @@ protected int getEndTokenType() {
protected boolean shouldEmitPendingEndTokens() {
return false;
}

}
18 changes: 9 additions & 9 deletions org.metafacture.fix.web/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ plugins {
}

dependencies {
compile project(':metafacture-fix')
compile project(':org.metafacture.fix.ide')
implementation project(':metafix')
implementation project(':org.metafacture.fix.ide')

compile "org.eclipse.xtend:org.eclipse.xtend.lib:${versions.xtext}"
compile "org.eclipse.xtext:org.eclipse.xtext.web.servlet:${versions.xtext}"
compile "org.eclipse.xtext:org.eclipse.xtext.xbase.web:${versions.xtext}"
compile "org.webjars:ace:${versions.ace}"
compile "org.webjars:jquery:${versions.jquery}"
compile "org.webjars:requirejs:${versions.requirejs}"
implementation "org.eclipse.xtend:org.eclipse.xtend.lib:${versions.xtext}"
implementation "org.eclipse.xtext:org.eclipse.xtext.web.servlet:${versions.xtext}"
implementation "org.eclipse.xtext:org.eclipse.xtext.xbase.web:${versions.xtext}"
implementation "org.webjars:ace:${versions.ace}"
implementation "org.webjars:jquery:${versions.jquery}"
implementation "org.webjars:requirejs:${versions.requirejs}"

providedCompile "org.eclipse.jetty:jetty-annotations:${versions.jetty}"
providedCompile "org.slf4j:slf4j-simple:${versions.slf4j}"
Expand All @@ -27,7 +27,7 @@ dependencies {
task jettyRun(type: JavaExec) {
dependsOn(sourceSets.main.runtimeClasspath)
classpath = sourceSets.main.runtimeClasspath.filter { it.exists() }
main = 'org.metafacture.fix.web.ServerLauncher'
mainClass = 'org.metafacture.metafix.web.ServerLauncher'
standardInput = System.in
group = 'run'
description = 'Starts an example Jetty server with your language'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.metafacture.fix.web;
package org.metafacture.metafix.web;

import org.metafacture.metamorph.Metafix;
import org.metafacture.metafix.FixStandaloneSetup;
import org.metafacture.runner.Flux;

import org.antlr.runtime.RecognitionException;
Expand Down Expand Up @@ -86,7 +86,7 @@ private boolean process(final HttpServletRequest request, final HttpServletRespo

builder.append(request.getParameter(PARAM_FLUX).replaceAll("\\s?\\|\\s?", "|").replace(
"|" + COMMAND_FIX + "|",
"|org.metafacture.metamorph.Metafix(fixFile=\"" + fixFile + "\")|"));
"|org.metafacture.metafix.Metafix(\"" + fixFile + "\")|"));
builder.append("|write(\"");
builder.append(outFile);
builder.append("\");");
Expand All @@ -106,7 +106,7 @@ private boolean process(final HttpServletRequest request, final HttpServletRespo
}

private String absPathToTempFile(final String content, final String suffix) throws IOException {
return Metafix.absPathToTempFile(new StringReader(content), suffix);
return FixStandaloneSetup.absPathToTempFile(new StringReader(content), suffix);
}

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.metafacture.fix.web;
package org.metafacture.metafix.web;

/**
* Use this class to register additional components to be used within the web application.
* Use this class to register additional components to be used within the web
* application.
*/
public class FixWebModule extends AbstractFixWebModule {

public FixWebModule() {
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.metafacture.fix.web;
package org.metafacture.metafix.web;

import org.metafacture.fix.FixRuntimeModule;
import org.metafacture.fix.FixStandaloneSetup;
import org.metafacture.fix.ide.FixIdeModule;
import org.metafacture.metafix.FixRuntimeModule;
import org.metafacture.metafix.FixStandaloneSetup;
import org.metafacture.metafix.ide.FixIdeModule;

import com.google.inject.Guice;
import com.google.inject.Injector;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.metafacture.fix.web;
package org.metafacture.metafix.web;

import org.eclipse.jetty.annotations.AnnotationConfiguration;
import org.eclipse.jetty.server.Server;
Expand All @@ -16,7 +16,8 @@
* This program starts an HTTP server for testing the web integration of your DSL.
* Just execute it and point a web browser to http://localhost:8080/
*/
public class ServerLauncher { // checkstyle-disable-line ClassDataAbstractionCoupling
@SuppressWarnings({"checkstyle:ClassDataAbstractionCoupling", "checkstyle:IllegalCatch"})
public class ServerLauncher {

private ServerLauncher() {
throw new IllegalAccessError("Utility class");
Expand Down Expand Up @@ -52,14 +53,14 @@ public static void main(final String[] args) {
log.warn("Console input is not available. In order to stop the server, you need to cancel the process manually.");
}
}
catch (final Exception e) { // checkstyle-disable-line IllegalCatch
catch (final Exception e) {
throw Exceptions.sneakyThrow(e);
}
}).start();

server.join();
}
catch (final Throwable e) { // checkstyle-disable-line IllegalCatch
catch (final Throwable e) {
if (e instanceof Exception) {
log.warn(((Exception) e).getMessage());
System.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion org.metafacture.fix.web/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<script>
function loadContent() {
var editor = ace.edit("xtext-editor");
editor.setValue('map(_id, id)\nmap(a,title)\nmap(b.n,author)\n/*map(_else)*/\n');
editor.setValue('move_field(_id, id)\nmove_field(a,title)\nmove_field(b.n,author)\nretain(id,title,author)\n');
document.getElementById("data").value = "1{a: Faust, b {n: Goethe, v: JW}, c: Weimar}\n 2{a: Räuber, b {n: Schiller, v: F}, c: Weimar}";
document.getElementById("flux").value = "as-lines|decode-formeta|fix|stream-to-xml(rootTag=\"collection\")";
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<listAttribute key="tasks">
<listEntry value="build"/>
</listAttribute>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/org.metafacture.fix&quot; type=&quot;4&quot;/&gt;&#10;&lt;item path=&quot;/org.metafacture.fix.ide&quot; type=&quot;4&quot;/&gt;&#10;&lt;item path=&quot;/org.metafacture.fix.web&quot; type=&quot;4&quot;/&gt;&#10;&lt;item path=&quot;/org.metafacture.fix.tests&quot; type=&quot;4&quot;/&gt;&#10;;&lt;/resources&gt;}"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;resources&gt;&#10;&lt;item path=&quot;/org.metafacture.metafix&quot; type=&quot;4&quot;/&gt;&#10;&lt;item path=&quot;/org.metafacture.metafix.ide&quot; type=&quot;4&quot;/&gt;&#10;&lt;item path=&quot;/org.metafacture.metafix.web&quot; type=&quot;4&quot;/&gt;&#10;&lt;item path=&quot;/org.metafacture.metafix.tests&quot; type=&quot;4&quot;/&gt;&#10;;&lt;/resources&gt;}"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.metafacture.fix}"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:/org.metafacture.metafix}"/>
</launchConfiguration>
44 changes: 29 additions & 15 deletions org.metafacture.fix/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
plugins {
id 'com.adarshr.test-logger' version '1.7.0'
id 'maven'
id 'maven-publish'
}

dependencies {
compile "org.eclipse.xtext:org.eclipse.xtext:${versions.xtext}"
compile "org.eclipse.xtext:org.eclipse.xtext.xbase:${versions.xtext}"
compile "com.google.guava:guava:${versions.guava}"
implementation "org.eclipse.xtext:org.eclipse.xtext:${versions.xtext}"
implementation "org.eclipse.xtext:org.eclipse.xtext.xbase:${versions.xtext}"
implementation "com.google.guava:guava:${versions.guava}"
implementation "org.slf4j:slf4j-api:${versions.slf4j}"

testCompile "org.junit.jupiter:junit-jupiter-api:${versions.junit_jupiter}"
testCompile "org.junit.platform:junit-platform-launcher:${versions.junit_platform}"
testCompile "org.eclipse.xtext:org.eclipse.xtext.testing:${versions.xtext}"
testCompile "org.eclipse.xtext:org.eclipse.xtext.xbase.testing:${versions.xtext}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${versions.junit_jupiter}"
testImplementation "org.junit.platform:junit-platform-launcher:${versions.junit_platform}"
testImplementation "org.eclipse.xtext:org.eclipse.xtext.testing:${versions.xtext}"
testImplementation "org.eclipse.xtext:org.eclipse.xtext.xbase.testing:${versions.xtext}"

testRuntime "org.junit.jupiter:junit-jupiter-engine:${versions.junit_jupiter}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${versions.junit_jupiter}"

runtimeOnly "org.slf4j:slf4j-simple:${versions.slf4j}"

implementation "org.metafacture:metafacture-commons:${versions.metafacture}"
implementation "org.metafacture:metafacture-mangling:${versions.metafacture}"
Expand All @@ -27,7 +30,7 @@ dependencies {

configurations {
mwe2 {
extendsFrom compile
extendsFrom implementation
}
}

Expand All @@ -42,25 +45,36 @@ test {
useJUnitPlatform()
}

def xtextFile = 'src/main/java/org/metafacture/fix/Fix.xtext'
task install(dependsOn: publishToMavenLocal,
description: "Installs the 'archives' artifacts into the local Maven repository. [deprecated]") {
doFirst { println "This task is deprecated; use 'publishToMavenLocal' instead." }
}

task validateFixFile(type: JavaExec) {
mainClass = 'org.metafacture.metafix.FixStandaloneSetup'
classpath = sourceSets.main.runtimeClasspath
}

def xtextFile = 'src/main/java/org/metafacture/metafix/Fix.xtext'

task validateXtextLanguage(type: JavaExec) {
main = 'org.metafacture.fix.validation.XtextValidator'
mainClass = 'org.metafacture.metafix.validation.XtextValidator'
classpath = sourceSets.main.runtimeClasspath
args += xtextFile
}

task generateXtextLanguage(type: JavaExec) {
main = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
mainClass = 'org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher'
classpath = configurations.mwe2
inputs.file 'src/main/java/org/metafacture/fix/GenerateFix.mwe2'
inputs.file 'src/main/java/org/metafacture/metafix/GenerateFix.mwe2'
inputs.file xtextFile
outputs.dir 'src/main/xtext-gen'
args += 'src/main/java/org/metafacture/fix/GenerateFix.mwe2'
args += 'src/main/java/org/metafacture/metafix/GenerateFix.mwe2'
args += '-p'
args += "rootPath=/${projectDir}/.."
}

processResources.dependsOn(generateXtextLanguage)
generateXtext.dependsOn(generateXtextLanguage)
compileJava.dependsOn(generateXtextLanguage)
clean.dependsOn(cleanGenerateXtextLanguage)
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2cac372

Please sign in to comment.