Skip to content

Commit

Permalink
Maven plugin adds source files from project source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
konsoletyper committed Oct 21, 2015
1 parent fb3412b commit f8452e6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ protected final List<SourceFileProvider> getSourceFileProviders() {
lookup.setLocalRepository(localRepository);
lookup.setRemoteRepositories(remoteRepositories);
lookup.setPluginDependencies(pluginArtifacts);
return lookup.resolve();
List<SourceFileProvider> providers = lookup.resolve();
addSourceProviders(providers);
return providers;
}

protected void addSourceProviders(@SuppressWarnings("unused") List<SourceFileProvider> providers) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.File;
import java.util.Arrays;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.LifecyclePhase;
Expand All @@ -28,6 +29,8 @@
import org.teavm.tooling.RuntimeCopyOperation;
import org.teavm.tooling.TeaVMTool;
import org.teavm.tooling.TeaVMToolException;
import org.teavm.tooling.sources.DirectorySourceFileProvider;
import org.teavm.tooling.sources.SourceFileProvider;

/**
*
Expand All @@ -40,6 +43,9 @@ public class BuildJavascriptMojo extends AbstractJavascriptMojo {
@Parameter(defaultValue = "${project.build.directory}/javascript")
private File targetDirectory;

@Parameter(defaultValue = "${project.build.sourceDirectory}")
private File sourceDirectory;

@Parameter
private String targetFileName = "classes.js";

Expand Down Expand Up @@ -102,4 +108,9 @@ public void execute() throws MojoExecutionException {
throw new MojoExecutionException("IO error occured", e);
}
}

@Override
protected void addSourceProviders(List<SourceFileProvider> providers) {
providers.add(new DirectorySourceFileProvider(sourceDirectory));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import org.teavm.testing.JUnitTestAdapter;
import org.teavm.testing.TestAdapter;
import org.teavm.tooling.TeaVMToolException;
import org.teavm.tooling.sources.DirectorySourceFileProvider;
import org.teavm.tooling.sources.SourceFileProvider;
import org.teavm.tooling.testing.TeaVMTestTool;
import org.teavm.tooling.testing.TestPlan;

Expand All @@ -60,6 +62,12 @@ public class BuildJavascriptTestMojo extends AbstractJavascriptMojo {
@Parameter(defaultValue = "${project.build.directory}/javascript-test")
private File targetDirectory;

@Parameter(defaultValue = "${project.build.sourceDirectory}")
private File sourceDirectory;

@Parameter(defaultValue = "${project.build.testSourceDirectory}")
private File testSourceDirectory;

@Parameter(defaultValue = "${project.build.testOutputDirectory}")
private File testFiles;

Expand Down Expand Up @@ -243,4 +251,10 @@ protected List<File> getAdditionalClassPath() {
protected boolean isSupportedScope(String scope) {
return testScopes.contains(scope);
}

@Override
protected void addSourceProviders(List<SourceFileProvider> providers) {
providers.add(new DirectorySourceFileProvider(sourceDirectory));
providers.add(new DirectorySourceFileProvider(testSourceDirectory));
}
}

0 comments on commit f8452e6

Please sign in to comment.