mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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
|
||||
*/
|
||||
@Mojo(name = "build-javascript", requiresDependencyResolution = ResolutionScope.COMPILE,
|
||||
requiresDependencyCollection = ResolutionScope.COMPILE)
|
||||
@Mojo(name = "build-javascript", requiresDependencyResolution = ResolutionScope.RUNTIME,
|
||||
requiresDependencyCollection = ResolutionScope.RUNTIME)
|
||||
public class BuildJavascriptMojo extends AbstractMojo {
|
||||
private static Set<String> compileScopes = new HashSet<>(Arrays.asList(
|
||||
Artifact.SCOPE_COMPILE, Artifact.SCOPE_PROVIDED, Artifact.SCOPE_SYSTEM));
|
||||
|
||||
@Component
|
||||
private MavenProject project;
|
||||
|
||||
|
@ -67,6 +64,9 @@ public class BuildJavascriptMojo extends AbstractMojo {
|
|||
@Parameter(defaultValue = "${project.build.outputDirectory}")
|
||||
private File classFiles;
|
||||
|
||||
@Parameter
|
||||
private List<String> compileScopes;
|
||||
|
||||
@Parameter
|
||||
private String targetFileName = "classes.js";
|
||||
|
||||
|
@ -305,8 +305,15 @@ public class BuildJavascriptMojo extends AbstractMojo {
|
|||
log.info("Preparing classpath for JavaScript generation");
|
||||
List<URL> urls = new ArrayList<>();
|
||||
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()) {
|
||||
if (!compileScopes.contains(artifact.getScope())) {
|
||||
if (!scopes.contains(artifact.getScope())) {
|
||||
continue;
|
||||
}
|
||||
File file = artifact.getFile();
|
||||
|
|
Loading…
Reference in New Issue
Block a user