Skip to content

Commit

Permalink
[chore] Remove unused imported folder from the test-gen plugin (#504)
Browse files Browse the repository at this point in the history
minor follow up cleanup.
  • Loading branch information
andreaTP authored Aug 30, 2024
1 parent 29aa68a commit 19d7311
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.github.javaparser.ast.expr.StringLiteralExpr;
import com.github.javaparser.ast.expr.VariableDeclarationExpr;
import com.github.javaparser.ast.stmt.BlockStmt;
import com.github.javaparser.utils.SourceRoot;
import com.github.javaparser.utils.StringEscapeUtils;
import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -69,8 +68,7 @@ public JavaTestGen(
this.excludedUnlinkableWasts = excludedUnlinkableWasts;
}

public CompilationUnit generate(
String name, Wast wast, File wasmFilesFolder, SourceRoot importsSourceRoot) {
public CompilationUnit generate(String name, Wast wast, File wasmFilesFolder) {
var cu = new CompilationUnit("com.dylibso.chicory.test.gen");
var testName = "SpecV1" + capitalize(escapedCamelCase(name)) + "Test";
cu.setStorage(sourceTargetFolder.toPath().resolve(testName + ".java"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public class TestGenMojo extends AbstractMojo {
defaultValue = "${project.build.directory}/generated-test-sources/test-gen")
private File sourceDestinationFolder;

/**
* Location of the imports sources.
*/
@Parameter(required = true, defaultValue = "${project.basedir}/src/test/java")
private File importsSourcesFolder;

@Parameter(required = true, defaultValue = "${project.build.directory}/compiled-wast")
private File compiledWastTargetFolder;

Expand Down Expand Up @@ -191,9 +185,8 @@ public void execute() throws MojoExecutionException {

// generate the tests
final SourceRoot dest = new SourceRoot(sourceDestinationFolder.toPath());
final SourceRoot importSourceRoot = new SourceRoot(importsSourcesFolder.toPath());

TestGenerator testGenerator = new TestGenerator(testGen, importSourceRoot, dest);
TestGenerator testGenerator = new TestGenerator(testGen, dest);

includedWasts.parallelStream().forEach(testGenerator::generateTests);

Expand Down Expand Up @@ -225,12 +218,10 @@ private static void validate(List<String> items, String name, boolean requireSor
private final class TestGenerator {

private final JavaTestGen testGen;
private final SourceRoot importSourceRoot;
private final SourceRoot dest;

private TestGenerator(JavaTestGen testGen, SourceRoot importSourceRoot, SourceRoot dest) {
private TestGenerator(JavaTestGen testGen, SourceRoot dest) {
this.testGen = testGen;
this.importSourceRoot = importSourceRoot;
this.dest = dest;
}

Expand All @@ -252,7 +243,7 @@ private void generateTests(String spec) {
Wast2Json.builder().withFile(wastFile).withOutput(specFile).build().process();

var name = specFile.toPath().getParent().toFile().getName();
var cu = testGen.generate(name, readWast(specFile), wasmFilesFolder, importSourceRoot);
var cu = testGen.generate(name, readWast(specFile), wasmFilesFolder);
dest.add(cu);
}

Expand Down

0 comments on commit 19d7311

Please sign in to comment.