@@ -33,7 +33,7 @@ sourceSets {
33
33
}
34
34
35
35
java {
36
- sourceCompatibility = JavaVersion . VERSION_11
36
+ sourceCompatibility = JavaVersion . VERSION_1_8
37
37
withJavadocJar()
38
38
withSourcesJar()
39
39
registerFeature(' dtdparse' ) {
@@ -51,44 +51,44 @@ dependencies {
51
51
testImplementation " junit:junit:4.13.1"
52
52
}
53
53
54
- tasks. register(' jvmVersionAttribute' ) {
55
- description = " Set the correct 'org.gradle.jvm.version' attribute"
56
- def jvmVersionAttribute = Attribute . of(' org.gradle.jvm.version' , Integer )
57
- configurations. each {
58
- if (it. canBeConsumed) {
59
- def categoryAttr = it. attributes. getAttribute(Category . CATEGORY_ATTRIBUTE )
60
- if (categoryAttr != null && categoryAttr. name == Category . LIBRARY ) {
61
- def usageAttr = it. attributes. getAttribute(Usage . USAGE_ATTRIBUTE )
62
- if (usageAttr != null && (usageAttr. name == Usage . JAVA_API
63
- || usageAttr. name == Usage . JAVA_RUNTIME )) {
64
- it. attributes. attribute(jvmVersionAttribute, 8 )
65
- }
66
- }
54
+ repositories {
55
+ maven {
56
+ url = uri(' https://repo.maven.apache.org/maven2/' )
57
+ }
58
+ maven {
59
+ url " https://css4j.github.io/maven/"
60
+ mavenContent {
61
+ releasesOnly()
62
+ }
63
+ content {
64
+ includeGroup ' io.sf.carte'
65
+ includeGroup ' io.sf.jclf'
67
66
}
68
67
}
69
68
}
70
69
71
- compileJava. dependsOn tasks. jvmVersionAttribute
70
+ tasks. compileJava {
71
+ excludes + = [' module-info.java' ]
72
+ modularity. inferModulePath = false
73
+ }
72
74
73
- tasks. register(' compileLegacyJava ' , JavaCompile ) {
74
- description = ' Compile to Java 8 bytecode, except module-info '
75
+ tasks. register(' compileModuleInfo ' , JavaCompile ) {
76
+ description = ' Compile module-info to Java 11 bytecode'
75
77
dependsOn tasks. compileJava
76
- sourceCompatibility = JavaVersion . VERSION_1_8
77
- targetCompatibility = JavaVersion . VERSION_1_8
78
- source = tasks. compileJava. stableSources
79
- classpath = tasks. compileJava. classpath
80
- destinationDirectory = tasks. compileJava. destinationDirectory
81
- modularity. inferModulePath = false
82
- includes = tasks. compileJava. includes
83
- excludes = tasks. compileJava. excludes
84
- excludes + = [' module-info.java' ]
78
+ sourceCompatibility = JavaVersion . VERSION_11
79
+ targetCompatibility = JavaVersion . VERSION_11
80
+ source = sourceSets. main. java
81
+ classpath = sourceSets. main. compileClasspath
82
+ destinationDirectory = sourceSets. main. java. destinationDirectory
83
+ modularity. inferModulePath = true
84
+ includes = [' module-info.java' ]
85
85
}
86
86
87
- classes. dependsOn compileLegacyJava
87
+ classes. dependsOn compileModuleInfo
88
88
89
89
// Check bytecode version, in case some other task screws it
90
90
tasks. register(' checkLegacyJava' ) {
91
- description = ' Check Java 8 bytecode'
91
+ description = ' Check that classes are Java 8 bytecode (except module-info) '
92
92
def classdir = sourceSets. main. output. classesDirs. files. stream(). findAny(). get()
93
93
def classfiles = fileTree(classdir). matching({it. exclude(' module-info.class' )}). files
94
94
doFirst() {
@@ -108,22 +108,6 @@ tasks.register('checkLegacyJava') {
108
108
109
109
classes. finalizedBy checkLegacyJava
110
110
111
- repositories {
112
- maven {
113
- url = uri(' https://repo.maven.apache.org/maven2/' )
114
- }
115
- maven {
116
- url " https://css4j.github.io/maven/"
117
- mavenContent {
118
- releasesOnly()
119
- }
120
- content {
121
- includeGroup ' io.sf.carte'
122
- includeGroup ' io.sf.jclf'
123
- }
124
- }
125
- }
126
-
127
111
tasks. register(' lineEndingConversion' , CRLFConvert ) {
128
112
description ' Convert LICENSE.txt to Windows line endings'
129
113
file " $rootDir /LICENSE.txt"
@@ -149,6 +133,7 @@ tasks.withType(Javadoc) {
149
133
options. addStringOption(' Xdoclint:none' , ' -quiet' )
150
134
options. addStringOption(' encoding' , ' UTF-8' )
151
135
options. addStringOption(' charset' , ' UTF-8' )
136
+ options. links ' https://docs.oracle.com/en/java/javase/11/docs/api/'
152
137
}
153
138
154
139
// Reproducible build
0 commit comments