forked from java9-modularity/gradle-modules-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
java9-modularity#79: clean-up of test-projects + bumped Gradle to 5.3…
….1 in SmokeTest
- Loading branch information
1 parent
227b4f7
commit 95e7a9c
Showing
36 changed files
with
248 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,53 @@ | ||
buildscript { | ||
repositories { | ||
maven { | ||
url = uri("https://plugins.gradle.org/m2/") | ||
} | ||
} | ||
dependencies { | ||
classpath("org.javamodularity:moduleplugin:1.+") | ||
} | ||
} | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
val kotlinVersion = "1.3.20" | ||
kotlin("jvm") version kotlinVersion | ||
kotlin("jvm") version "1.3.20" apply false | ||
id("org.javamodularity.moduleplugin") version "1.5.0" apply false | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
subprojects { | ||
repositories { | ||
mavenCentral() | ||
} | ||
apply { | ||
plugin("kotlin") | ||
apply(plugin = "kotlin") | ||
apply(plugin = "org.javamodularity.moduleplugin") | ||
|
||
//region https://docs.gradle.org/current/userguide/kotlin_dsl.html#using_kotlin_delegated_properties | ||
val test by tasks.existing(Test::class) | ||
val build by tasks | ||
val javadoc by tasks | ||
|
||
val implementation by configurations | ||
val testImplementation by configurations | ||
val testRuntimeOnly by configurations | ||
|
||
val jUnitVersion: String by project | ||
//endregion | ||
|
||
//region KOTLIN | ||
tasks.withType<KotlinCompile> { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} | ||
if (!project.hasProperty("INTERNAL_TEST_IN_PROGRESS")) { | ||
apply(plugin = "org.javamodularity.moduleplugin") | ||
dependencies { | ||
implementation(kotlin("stdlib-jdk8")) | ||
} | ||
//endregion | ||
|
||
project.version = "1.1.1" | ||
|
||
configure<JavaPluginExtension> { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
val test by tasks.getting(Test::class) { | ||
test { | ||
useJUnitPlatform() | ||
|
||
testLogging { | ||
events("PASSED", "FAILED", "SKIPPED") | ||
stackTraceFilters = listOf() | ||
setStackTraceFilters(listOf()) | ||
} | ||
} | ||
|
||
val implementation by configurations | ||
val testImplementation by configurations | ||
val testRuntimeOnly by configurations | ||
dependencies { | ||
implementation(kotlin("stdlib-jdk8")) | ||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1") | ||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.3.1") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1") | ||
testImplementation("org.junit.jupiter:junit-jupiter-api:$jUnitVersion") | ||
testImplementation("org.junit.jupiter:junit-jupiter-params:$jUnitVersion") | ||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$jUnitVersion") | ||
} | ||
|
||
// build.dependsOn(javadoc) // TODO: No public or protected classes found to document | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jUnitVersion = 5.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
import org.javamodularity.moduleplugin.extensions.CompileModuleOptions | ||
import org.javamodularity.moduleplugin.tasks.TestModuleOptions | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
//region NO-OP (DSL testing) | ||
tasks { | ||
compileJava { | ||
extensions.configure(CompileModuleOptions::class) { | ||
addModules = listOf() | ||
compileModuleInfoSeparately = false | ||
} | ||
tasks.compileJava { | ||
extensions.configure<CompileModuleOptions> { | ||
addModules = listOf() | ||
compileModuleInfoSeparately = false | ||
} | ||
} | ||
|
||
test { | ||
extensions.configure(TestModuleOptions::class) { | ||
addModules = listOf() | ||
runOnClasspath = false | ||
} | ||
tasks.test { | ||
extensions.configure<TestModuleOptions> { | ||
addModules = listOf() | ||
runOnClasspath = false | ||
} | ||
} | ||
|
||
modularity { | ||
} | ||
//endregion | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,24 @@ | ||
import java.io.FilenameFilter | ||
import org.javamodularity.moduleplugin.tasks.ModularJavaExec | ||
import org.javamodularity.moduleplugin.tasks.ModuleOptions | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
val moduleName: String by project | ||
|
||
dependencies { | ||
implementation(project(":greeter.api")) | ||
runtimeOnly(project(":greeter.provider")) | ||
} | ||
|
||
val moduleName: String by project | ||
|
||
for(file in File("${project.projectDir}/src/main/kotlin/demo") | ||
.listFiles(FilenameFilter { _, name -> name.matches(Regex("Demo.*\\.kt"))})) { | ||
val demoClassName = file.name.substring(0, file.name.length - ".kt".length) | ||
tasks.create<ModularJavaExec>("run$demoClassName") { | ||
group = "Demo" | ||
description = "Run the $demoClassName program" | ||
main = "$moduleName/demo.${demoClassName}Kt" | ||
jvmArgs = listOf("-Xmx128m") | ||
} | ||
} | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
patchModules.config = listOf( | ||
"java.annotation=jsr305-3.0.2.jar" | ||
) | ||
|
||
patchModules.config = listOf("java.annotation=jsr305-3.0.2.jar") | ||
File("${project.projectDir}/src/main/kotlin/demo") | ||
.listFiles({ _, name -> Regex("Demo.*\\.kt") matches name }) | ||
.forEach { file -> | ||
val demoClassName = file.name.removeSuffix(".kt") | ||
tasks.create<ModularJavaExec>("run$demoClassName") { | ||
group = "Demo" | ||
description = "Run the $demoClassName program" | ||
main = "$moduleName/demo.${demoClassName}Kt" | ||
jvmArgs = listOf("-Xmx128m") | ||
} | ||
} |
15 changes: 3 additions & 12 deletions
15
test-project-kotlin/greeter.provider.test/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
dependencies { | ||
implementation(project(":greeter.api")) | ||
runtimeOnly(project(":greeter.provider")) | ||
} | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
patchModules.config = listOf("java.annotation=jsr305-3.0.2.jar") | ||
patchModules.config = listOf( | ||
"java.annotation=jsr305-3.0.2.jar" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
import org.javamodularity.moduleplugin.tasks.ModuleOptions | ||
|
||
dependencies { | ||
implementation(project(":greeter.api")) | ||
compile("javax.annotation:javax.annotation-api:1.3.2") | ||
compile("com.google.code.findbugs:jsr305:3.0.2") | ||
|
||
testImplementation("org.hamcrest:hamcrest:2.1+") | ||
} | ||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
patchModules.config = listOf("java.annotation=jsr305-3.0.2.jar") | ||
patchModules.config = listOf( | ||
"java.annotation=jsr305-3.0.2.jar" | ||
) | ||
|
||
tasks.javadoc { | ||
extensions.configure<ModuleOptions> { | ||
addModules = listOf("java.sql") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,32 @@ | ||
import org.gradle.api.tasks.JavaExec | ||
import org.javamodularity.moduleplugin.tasks.ModuleOptions | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
application | ||
} | ||
|
||
//region https://docs.gradle.org/current/userguide/kotlin_dsl.html#using_kotlin_delegated_properties | ||
val moduleName: String by project | ||
val run by tasks.existing(JavaExec::class) // https://youtrack.jetbrains.com/issue/KT-28013 | ||
//endregion | ||
|
||
dependencies { | ||
implementation(project(":greeter.api")) | ||
runtimeOnly(project(":greeter.provider")) | ||
} | ||
|
||
val moduleName: String by project | ||
application { | ||
mainClassName = "$moduleName/examples.RunnerKt" | ||
applicationDefaultJvmArgs = listOf("-XX:+PrintGCDetails") | ||
} | ||
|
||
val run by tasks.getting(JavaExec::class) { | ||
extensions.configure(typeOf<ModuleOptions>()) { | ||
patchModules.config = listOf( | ||
"java.annotation=jsr305-3.0.2.jar" | ||
) | ||
|
||
(run) { | ||
extensions.configure<ModuleOptions> { | ||
addModules = listOf("java.sql") | ||
} | ||
jvmArgs = listOf("-XX:+PrintGCDetails") | ||
} | ||
|
||
val compileKotlin: KotlinCompile by tasks | ||
compileKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
val compileTestKotlin: KotlinCompile by tasks | ||
compileTestKotlin.kotlinOptions { | ||
jvmTarget = "1.8" | ||
jvmArgs = listOf("-XX:+PrintGCDetails") | ||
} | ||
|
||
patchModules.config = listOf("java.annotation=jsr305-3.0.2.jar") |
Oops, something went wrong.