mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
JPMS: compile main sources with module-info.java to make sure that compiler reports errors if classes are used from other modules that are not specified in module dependencies (#1)
This commit is contained in:
@@ -28,18 +28,17 @@ repositories {
|
|||||||
|
|
||||||
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
|
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
|
||||||
sourceSets {
|
sourceSets {
|
||||||
create( "main9" ) {
|
create( "module-info" ) {
|
||||||
java {
|
java {
|
||||||
setSrcDirs( listOf( "src/main9/java" ) )
|
// include "src/main/java" here to get compile errors if classes are
|
||||||
|
// used from other modules that are not specified in module dependencies
|
||||||
|
setSrcDirs( listOf( "src/main/module-info", "src/main/java" ) )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 )
|
|
||||||
"main9Implementation"( files( sourceSets["main"].output.classesDirs ).builtBy( "compileJava" ) )
|
|
||||||
|
|
||||||
testImplementation( "com.miglayout:miglayout-swing:5.2" )
|
testImplementation( "com.miglayout:miglayout-swing:5.2" )
|
||||||
testImplementation( "com.jgoodies:jgoodies-forms:1.9.0" )
|
testImplementation( "com.jgoodies:jgoodies-forms:1.9.0" )
|
||||||
}
|
}
|
||||||
@@ -51,14 +50,9 @@ java {
|
|||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
|
if( JavaVersion.current() >= JavaVersion.VERSION_1_9 ) {
|
||||||
named<JavaCompile>( "compileMain9Java" ) {
|
named<JavaCompile>( "compileModuleInfoJava" ) {
|
||||||
doFirst {
|
sourceCompatibility = "9"
|
||||||
options.compilerArgs = listOf(
|
targetCompatibility = "9"
|
||||||
"-source", "9", "-target", "9",
|
|
||||||
"--patch-module", "com.formdev.flatlaf=" + classpath.asPath
|
|
||||||
)
|
|
||||||
classpath = files()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +65,8 @@ tasks {
|
|||||||
)
|
)
|
||||||
|
|
||||||
into( "META-INF/versions/9" ) {
|
into( "META-INF/versions/9" ) {
|
||||||
from( sourceSets["main9"].output )
|
from( sourceSets["module-info"].output )
|
||||||
|
include( "module-info.class" )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user