Eliminate dependency on antlr4 Maven plugin

After porting the build from Maven to Gradle (see prior commits), the
org.ethereum.serpent.ParserGenerator class is no longer necessary as the
configuration of the antlr compiler that happened in this class now
happens directly in build.gradle. This class is thus removed in this
commit.

The plexus FileUtils class introduced by the antlr4 Maven plugin had
also been used in several locations in the codebase, probably just for
reasons of convenience. These uses have been replaced with Spring's
FileSystemUtils in order to allow for dropping the dependency on the
antlr4 Maven plugin entirely.
This commit is contained in:
Chris Beams 2014-12-26 17:26:39 +01:00
parent f9bcd2abad
commit f845a3b751
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
5 changed files with 4 additions and 38 deletions

View File

@ -50,7 +50,6 @@ dependencies {
compile "org.iq80.leveldb:leveldb:${leveldbVersion}"
compile "com.cedarsoftware:java-util:1.8.0" // for deep equals
compile "org.antlr:antlr4-runtime:4.3" // for serpent compilation
compile "org.antlr:antlr4-maven-plugin:4.3"
compile "com.yuvalshavit:antlr-denter:1.1"
compile "org.javassist:javassist:3.15.0-GA"
compile "commons-logging:commons-logging:1.0" // TODO: provided scope

View File

@ -1,6 +1,5 @@
package org.ethereum.core;
import org.codehaus.plexus.util.FileUtils;
import org.ethereum.db.BlockStore;
import org.ethereum.facade.Blockchain;
import org.ethereum.facade.Repository;
@ -15,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.FileSystemUtils;
import java.io.BufferedWriter;
import java.io.File;
@ -473,10 +473,7 @@ public class BlockchainImpl implements Blockchain {
if (!CONFIG.recordBlocks()) return;
if (bestBlock.isGenesis()) {
try {
FileUtils.deleteDirectory(CONFIG.dumpDir());
} catch (IOException e) {
}
FileSystemUtils.deleteRecursively(new File(CONFIG.dumpDir()));
}
String dir = CONFIG.dumpDir() + "/";

View File

@ -2,7 +2,6 @@ package org.ethereum.db;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.codehaus.plexus.util.FileUtils;
import org.ethereum.core.AccountState;
import org.ethereum.core.Block;
import org.ethereum.facade.Repository;

View File

@ -2,7 +2,6 @@ package org.ethereum.db;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.codehaus.plexus.util.FileUtils;
import org.ethereum.core.AccountState;
import org.ethereum.core.Block;
import org.ethereum.facade.Repository;
@ -16,6 +15,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongycastle.util.encoders.Hex;
import org.springframework.stereotype.Component;
import org.springframework.util.FileSystemUtils;
import java.io.BufferedWriter;
import java.io.File;
@ -161,10 +161,7 @@ public class RepositoryImpl implements Repository {
if (block.getNumber() == 0 && txNumber == 0)
if (CONFIG.dumpCleanOnRestart()) {
try {
FileUtils.deleteDirectory(CONFIG.dumpDir());
} catch (IOException e) {
}
FileSystemUtils.deleteRecursively(new File(CONFIG.dumpDir()));
}
String dir = CONFIG.dumpDir() + "/";

View File

@ -1,26 +0,0 @@
package org.ethereum.serpent;
import org.antlr.v4.Tool;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
* @author Roman Mandeleil
* @since 25.04.14
*/
public class ParserGenerator {
public static void main(String args[]) throws MojoFailureException, MojoExecutionException {
String userDir = System.getProperty("user.dir");
String grammarName = userDir + "\\src\\main\\antlr4\\org\\ethereum\\serpent\\Serpent.g4";
String options[] = {grammarName, "-visitor", "-package", "org.ethereum.serpent"};
Tool tool = new Tool(options);
tool.outputDirectory = userDir + "\\src\\main\\java\\org\\ethereum\\serpent\\";
tool.processGrammarsOnCommandLine();
// org.antlr.Tool.main(new String[]{userDir + "\\src\\main\\antlr4\\org\\ethereum\\serpent\\Serpent.g4"});
}
}