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

Current state of Metafix implementation #60

Merged
merged 59 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
f328a13
Re-approach record-based Metafix implementation (#35)
fsteeg Jul 2, 2021
3045dbb
Implement `elsif` and `else` blocks (#35)
fsteeg Aug 19, 2021
6981259
Implement `unless` conditional (#35)
fsteeg Aug 19, 2021
e7b872a
Basic `list` bind implementation (#35)
fsteeg Aug 19, 2021
ebcf650
Update flux-commands.properties (#35)
fsteeg Aug 19, 2021
a786f73
Rename non-generated `fix` package to `metafix` (#35)
fsteeg Aug 19, 2021
191351b
Move `metamorph` package to `metafix` (#35)
fsteeg Aug 19, 2021
7ba8f99
Add array- and hash-related record level methods (#35)
fsteeg Aug 20, 2021
4659439
Implement `format`, `parse_text`, and `paste` (#35)
fsteeg Aug 20, 2021
0d903b3
Switch internal record map to `Object` values (#35)
fsteeg Aug 24, 2021
f59faf5
Emit `Map` values in record as entities (#35)
fsteeg Aug 24, 2021
92fdf53
Basic implementation of `exists` and `reject` (#35)
fsteeg Aug 24, 2021
506e5fd
Emit arrays as entities, support `.$append` (#35)
fsteeg Aug 24, 2021
b022b51
Implement `retain` method (#35)
fsteeg Aug 26, 2021
78c9ec9
Skip non-existing fields in `paste` (#35)
fsteeg Aug 26, 2021
998da3d
Implement `vacuum` method (#35)
fsteeg Aug 26, 2021
b5604b8
Add disabled tests for list binds and entity representation (#35)
fsteeg Aug 30, 2021
db1c437
Switch internal record from Multimap to Map<String,Object> (#35)
fsteeg Aug 31, 2021
cea496e
Support dot notation for nested entities in set_field (#35)
fsteeg Sep 1, 2021
46719da
Support dot notation for nested entities in add_field (#35)
fsteeg Sep 1, 2021
8e104a8
Rename class for testing record level methods (#35)
fsteeg Sep 2, 2021
c5343a8
Don't flatten incoming entites, use nested maps internally (#35)
fsteeg Sep 6, 2021
f08252a
Support dot notation for nested maps in remove_field (#35)
fsteeg Sep 7, 2021
c36235c
Support dot notation for nested maps in copy and move (#35)
fsteeg Sep 7, 2021
e19352c
Support dot notation for nested maps in predicates (#35)
fsteeg Sep 7, 2021
e4c440a
Support dot notation for nested maps in `path` option of bind (#35)
fsteeg Sep 20, 2021
e1b06fb
Support dot notation for nested maps in `paste` method (#35)
fsteeg Sep 20, 2021
878fd8d
Merge repeated entities into single map (#35)
fsteeg Sep 22, 2021
e5b395a
Fix output for arrays, always emit like `field[].1` (#35)
fsteeg Sep 23, 2021
b6af4a1
Fix array processing issues, work on `$append` & `$last` (#35)
fsteeg Sep 27, 2021
3a55ab8
Support dot notation for nested maps in field-level methods (#35)
fsteeg Sep 30, 2021
6603417
Fix issue when merging lists (#35)
fsteeg Sep 30, 2021
cc6ff0a
Add disabled failing tests for unclear entity behavior (#35)
fsteeg Sep 30, 2021
5b60a58
Upgrade Gradle wrapper to version 7.2.
blackwinter Oct 4, 2021
f8aab37
Replace unresolvable `runtimeOnly` configuration with resolvable `run…
blackwinter Oct 5, 2021
f310be8
Initial logging setup.
blackwinter Oct 6, 2021
24d72f0
Make internal ID available in `_id`, don't emit `_` fields (#35)
fsteeg Oct 11, 2021
1df4361
Replace print statements with logging. (#58)
blackwinter Oct 11, 2021
adf3f7d
Let Checkstyle enforce alphabetical sorting of imports.
blackwinter Oct 11, 2021
d57a4f7
Merge pull request #57 from metafacture/upgradeGradleWrapper
fsteeg Oct 14, 2021
e3ab686
Merge branch '35-metafix' into initialLoggingSetup
fsteeg Oct 14, 2021
f613bf7
Merge pull request #58 from metafacture/initialLoggingSetup
fsteeg Oct 14, 2021
6393b4d
Consolidate Xtext/Fix file validation.
blackwinter Oct 29, 2021
9c8a0b8
Wrap and rethrow exceptions as MetafactureException
fsteeg Nov 2, 2021
171ab7d
Avoid redundant wrapping of BiConsumer (#35)
fsteeg Nov 3, 2021
9009c39
Simplify map manipulation (#35)
fsteeg Nov 3, 2021
efa2223
Remove unused import (#35)
fsteeg Nov 3, 2021
5a3bd03
Change logging dependency to `runtimeOnly` (#35)
fsteeg Nov 3, 2021
43d1325
Replace `contains` with `endsWith` (#35)
fsteeg Nov 3, 2021
111e554
Use constants for `$append` and `$last` (#35)
fsteeg Nov 3, 2021
25adea6
Merge branch '35-metafix-consolidateXtextFixValidation' into 35-metafix
fsteeg Nov 3, 2021
15977a4
Remove trailing empty comments (#35)
fsteeg Nov 3, 2021
4f06e3a
Move comments into `@Disabled` arguments (#35)
fsteeg Nov 3, 2021
ea54a0e
Switch `checkstyle-disable-line` to `@SuppressWarnings` (#35)
fsteeg Nov 3, 2021
5395e90
Extract named groups for `parse_text`.
blackwinter Nov 4, 2021
26d2a9e
Fix named group access in `parse_text`. (5395e90)
blackwinter Nov 4, 2021
bdc43ee
Fix Checkstyle violations in MetafixMethodTest. (26d2a9e)
blackwinter Nov 4, 2021
e4dec3a
Restore FixServlet and ServerLauncher (#35)
fsteeg Nov 5, 2021
1fe336b
Rename Gradle project from metafacture-fix to metafix (#35)
fsteeg Oct 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(':metafacture-fix')

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(':metafacture-fix')
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