Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@
import org.gradle.api.Project;

public class CompileTestModuleOptions extends ModuleOptions {

private boolean compileOnClasspath;

public CompileTestModuleOptions(Project project) {
super(project);
}

@Deprecated(since = "1.8.16", forRemoval = true)
public boolean isCompileOnClasspath() {
return compileOnClasspath;
}

public boolean getCompileOnClasspath() {
return compileOnClasspath;
}

public void setCompileOnClasspath(boolean compileOnClasspath) {
this.compileOnClasspath = compileOnClasspath;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ private void configureCompileTestJava(JavaCompile compileTestJava) {
var moduleOptions = compileTestJava.getExtensions()
.create("moduleOptions", CompileTestModuleOptions.class, project);
project.afterEvaluate(p -> {
LOGGER.info(compileTestJava.getName() + ".compileOnClasspath: {}", moduleOptions.isCompileOnClasspath());
if(!moduleOptions.isCompileOnClasspath()) {
LOGGER.info(compileTestJava.getName() + ".compileOnClasspath: {}", moduleOptions.getCompileOnClasspath());
if(!moduleOptions.getCompileOnClasspath()) {
// don't convert to lambda: https://github.com/java9-modularity/gradle-modules-plugin/issues/54
compileTestJava.doFirst(new Action<>() {
@Override
Expand Down
13 changes: 13 additions & 0 deletions test-project-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,17 @@ subprojects {
exclude module: 'groovy-xml'
}
}

test {
moduleOptions {
runOnClasspath = false
}
}

compileTestJava {
moduleOptions {
compileOnClasspath = false
}
}

}
11 changes: 11 additions & 0 deletions test-project-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ subprojects {

//region https://docs.gradle.org/current/userguide/kotlin_dsl.html#using_kotlin_delegated_properties
val test by tasks.existing(Test::class)
val compileTestJava by tasks.existing(JavaCompile::class)

val implementation by configurations
val testImplementation by configurations
Expand Down Expand Up @@ -53,6 +54,16 @@ subprojects {
testLogging {
events("PASSED", "FAILED", "SKIPPED", "STANDARD_OUT")
}

extensions.configure(org.javamodularity.moduleplugin.extensions.TestModuleOptions::class) {
runOnClasspath = false
}
}

compileTestJava {
extensions.configure(org.javamodularity.moduleplugin.extensions.CompileTestModuleOptions::class) {
compileOnClasspath = false
}
}

dependencies {
Expand Down