1
1
import com.vanniktech.maven.publish.JavadocJar
2
2
import com.vanniktech.maven.publish.KotlinJvm
3
- import java.io.DataInputStream
4
- import java.io.FileInputStream
5
3
import java.util.Base64
6
- import java.util.zip.GZIPInputStream
7
4
8
5
plugins {
9
6
kotlin(" jvm" )
@@ -18,8 +15,10 @@ fun ByteArray.toByteStringExpression(): String {
18
15
}
19
16
20
17
val copyKotlinTemplates = tasks.register<Copy >(" copyKotlinTemplates" ) {
18
+ val kotlinTemplatesOutput = layout.buildDirectory.dir(" generated/sources/kotlinTemplates" )
19
+
21
20
from(" src/main/kotlinTemplates" )
22
- into(layout.buildDirectory.dir( " generated/sources/kotlinTemplates " ) )
21
+ into(kotlinTemplatesOutput )
23
22
24
23
// Tag as an input to regenerate after an update
25
24
inputs.file(" src/test/resources/okhttp3/internal/publicsuffix/PublicSuffixDatabase.gz" )
@@ -43,18 +42,20 @@ val generateIdnaMappingTableConfiguration: Configuration by configurations.creat
43
42
dependencies {
44
43
generateIdnaMappingTableConfiguration(projects.okhttpIdnaMappingTable)
45
44
}
46
- val generateIdnaMappingTable by tasks.creating(JavaExec ::class .java) {
47
- outputs.dir(layout.buildDirectory.dir(" generated/sources/idnaMappingTable" ))
45
+ val generateIdnaMappingTable = tasks.register<JavaExec >(" generateIdnaMappingTable" ) {
46
+ val idnaOutput = layout.buildDirectory.dir(" generated/sources/idnaMappingTable" )
47
+
48
+ outputs.dir(idnaOutput)
48
49
mainClass.set(" okhttp3.internal.idn.GenerateIdnaMappingTableCode" )
49
- args(layout.buildDirectory.dir( " generated/sources/idnaMappingTable " ) .get())
50
+ args(idnaOutput .get())
50
51
classpath = generateIdnaMappingTableConfiguration
51
52
}
52
53
53
54
kotlin {
54
55
sourceSets {
55
56
getByName(" main" ) {
56
- kotlin.srcDir(copyKotlinTemplates.get() .outputs)
57
- kotlin.srcDir(generateIdnaMappingTable.outputs)
57
+ kotlin.srcDir(copyKotlinTemplates.map { it .outputs } )
58
+ kotlin.srcDir(generateIdnaMappingTable.map { it. outputs } )
58
59
}
59
60
}
60
61
}
@@ -107,11 +108,13 @@ normalization {
107
108
// Expose OSGi jars to the test environment.
108
109
val osgiTestDeploy: Configuration by configurations.creating
109
110
110
- val copyOsgiTestDeployment by tasks.creating(Copy ::class .java) {
111
+ val test by tasks.existing(Test ::class )
112
+ val copyOsgiTestDeployment = tasks.register<Copy >(" copyOsgiTestDeployment" ) {
111
113
from(osgiTestDeploy)
112
114
into(layout.buildDirectory.dir(" resources/test/okhttp3/osgi/deployments" ))
113
115
}
114
- tasks.getByName(" test" ) {
116
+
117
+ test.configure {
115
118
dependsOn(copyOsgiTestDeployment)
116
119
}
117
120
0 commit comments