mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
One can customize the compilation scope in pom.xml. As such following snipet in pom will include compile & runtime dependencies in the compilation:
<compileScopes> <compileScope>compile</compileScope> <compileScope>runtime</compileScope> </compileScopes>
This commit is contained in:
parent
6b03fd4227
commit
ad7f30a0de
|
@ -40,12 +40,9 @@ import org.teavm.tooling.*;
|
||||||
*
|
*
|
||||||
* @author Alexey Andreev
|
* @author Alexey Andreev
|
||||||
*/
|
*/
|
||||||
@Mojo(name = "build-javascript", requiresDependencyResolution = ResolutionScope.COMPILE,
|
@Mojo(name = "build-javascript", requiresDependencyResolution = ResolutionScope.RUNTIME,
|
||||||
requiresDependencyCollection = ResolutionScope.COMPILE)
|
requiresDependencyCollection = ResolutionScope.RUNTIME)
|
||||||
public class BuildJavascriptMojo extends AbstractMojo {
|
public class BuildJavascriptMojo extends AbstractMojo {
|
||||||
private static Set<String> compileScopes = new HashSet<>(Arrays.asList(
|
|
||||||
Artifact.SCOPE_COMPILE, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_SYSTEM));
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
private MavenProject project;
|
private MavenProject project;
|
||||||
|
|
||||||
|
@ -67,6 +64,9 @@ public class BuildJavascriptMojo extends AbstractMojo {
|
||||||
@Parameter(defaultValue = "${project.build.outputDirectory}")
|
@Parameter(defaultValue = "${project.build.outputDirectory}")
|
||||||
private File classFiles;
|
private File classFiles;
|
||||||
|
|
||||||
|
@Parameter
|
||||||
|
private List<String> compileScopes;
|
||||||
|
|
||||||
@Parameter
|
@Parameter
|
||||||
private String targetFileName = "classes.js";
|
private String targetFileName = "classes.js";
|
||||||
|
|
||||||
|
@ -305,8 +305,15 @@ public class BuildJavascriptMojo extends AbstractMojo {
|
||||||
log.info("Preparing classpath for JavaScript generation");
|
log.info("Preparing classpath for JavaScript generation");
|
||||||
List<URL> urls = new ArrayList<>();
|
List<URL> urls = new ArrayList<>();
|
||||||
StringBuilder classpath = new StringBuilder();
|
StringBuilder classpath = new StringBuilder();
|
||||||
|
Set<String> scopes;
|
||||||
|
if (compileScopes == null) {
|
||||||
|
scopes = new HashSet<>(Arrays.asList(
|
||||||
|
Artifact.SCOPE_COMPILE, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_SYSTEM));
|
||||||
|
} else {
|
||||||
|
scopes = new HashSet<>(compileScopes);
|
||||||
|
}
|
||||||
for (Artifact artifact : project.getArtifacts()) {
|
for (Artifact artifact : project.getArtifacts()) {
|
||||||
if (!compileScopes.contains(artifact.getScope())) {
|
if (!scopes.contains(artifact.getScope())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
File file = artifact.getFile();
|
File file = artifact.getFile();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user