Skip to content

Commit aae053d

Browse files
committed
Update to Kotlin 1.4.0 and move files to submodules
1 parent 1800441 commit aae053d

32 files changed

+166
-381
lines changed

.idea/misc.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@ before_install:
3636

3737
install:
3838
- ./gradlew assemble --info --no-daemon
39-
- ./gradlew -p ksp assemble --info --no-daemon
4039

4140
script:
42-
- ./gradlew check --info --no-daemon
43-
- ./gradlew -p ksp check --info --no-daemon
41+
- ./gradlew --info --no-daemon
4442

4543
notifications:
4644
email: false

appveyor.yml

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ build:
1717

1818
build_script:
1919
- gradlew.bat assemble --info --no-daemon
20-
- gradlew.bat -p ksp assemble --info --no-daemon
2120

2221
test_script:
2322
- gradlew.bat check --info --no-daemon
24-
- gradlew.bat -p ksp check --info --no-daemon

build.gradle

+106-56
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,136 @@ buildscript {
33

44
repositories {
55
mavenCentral()
6+
jcenter()
67
maven { url 'https://jitpack.io' }
8+
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
9+
google()
710
}
811

912
dependencies {
1013
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0'
12-
14+
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.12.0'
1315
}
1416
}
1517

1618
plugins {
17-
id 'java'
18-
id 'org.jetbrains.kotlin.jvm' version "$kotlin_version"
19-
id "com.github.gmazzo.buildconfig" version "2.0.1"
19+
id 'io.codearte.nexus-staging' version '0.22.0' //can only be applied to root project
2020
}
2121

22-
apply plugin: 'kotlin'
23-
apply plugin: 'kotlin-kapt'
24-
apply plugin: 'idea'
25-
apply plugin: 'maven'
26-
apply plugin: 'com.vanniktech.maven.publish'
2722

28-
sourceCompatibility = 1.8
23+
allprojects {
24+
group 'com.github.tschuchortdev'
2925

30-
repositories {
31-
mavenCentral()
32-
maven { url 'https://jitpack.io' }
33-
maven { url 'https://kotlin.bintray.com/kotlinx' }
34-
jcenter()
35-
}
26+
buildscript {
27+
ext.kotlin_version = '1.4.0'
3628

37-
idea {
38-
module {
39-
sourceDirs += files('build/generated/source/kapt/main', 'build/generated/source/kaptKotlin/main')
40-
generatedSourceDirs += files('build/generated/source/kapt/main', 'build/generated/source/kaptKotlin/main')
29+
repositories {
30+
mavenCentral()
31+
jcenter()
32+
maven { url 'https://jitpack.io' }
33+
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
34+
google()
35+
}
4136
}
42-
}
4337

44-
buildConfig {
45-
className = "BuildConfig"
46-
packageName = "com.tschuchort.compiletesting"
47-
sourceSets {
48-
test {
49-
buildConfigField 'String', 'KOTLIN_VERSION', "\"$kotlin_version\""
38+
repositories {
39+
mavenCentral()
40+
maven { url 'https://jitpack.io' }
41+
maven { url 'https://kotlin.bintray.com/kotlinx' }
42+
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
43+
google()
44+
jcenter()
45+
}
46+
47+
apply plugin: 'kotlin'
48+
apply plugin: 'java'
49+
apply plugin: 'idea'
50+
apply plugin: 'maven-publish'
51+
52+
if (JavaVersion.current().isJava8Compatible()) {
53+
tasks.withType(Javadoc) {
54+
options.addStringOption('Xdoclint:none', '-quiet')
5055
}
5156
}
5257
}
5358

54-
dependencies {
55-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
56-
testImplementation group: 'junit', name: 'junit', version: '4.12'
57-
58-
compileOnly "com.google.auto.service:auto-service:1.0-rc7"
59-
kapt "com.google.auto.service:auto-service:1.0-rc7"
59+
subprojects {
60+
task sourcesJar(type: Jar, dependsOn: classes) {
61+
//noinspection GroovyAccessibility // alternatively replace this with archiveClassifier.set('...')
62+
archiveClassifier = 'sources'
63+
from sourceSets.main.allSource, 'build/generated/source/kapt/main', 'build/generated/source/kaptKotlin/main'
64+
}
6065

61-
testImplementation "org.assertj:assertj-core:3.11.1"
62-
testImplementation "org.mockito:mockito-core:3.2.4"
63-
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
66+
task javadocJar(type: Jar, dependsOn: javadoc) {
67+
//noinspection GroovyAccessibility //alternatively replace this with archiveClassifier.set('...')
68+
archiveClassifier = 'javadoc'
69+
from javadoc.destinationDir
70+
}
71+
publishing {
72+
publications {
73+
mavenJava(MavenPublication) {
74+
pom {
75+
groupId = GROUP
76+
artifactId = POM_ARTIFACT_ID
77+
version = VERSION_NAME
78+
79+
name = POM_NAME
80+
packaging = POM_PACKAGING
81+
description = POM_DESCRIPTION
82+
url = POM_URL
83+
84+
from components.java
85+
artifact sourcesJar
86+
artifact javadocJar
87+
88+
scm {
89+
url = POM_SCM_URL
90+
connection = POM_SCM_CONNECTION
91+
developerConnection = POM_SCM_DEV_CONNECTION
92+
}
93+
licenses {
94+
license {
95+
name = POM_LICENCE_NAME
96+
url = POM_LICENCE_URL
97+
distribution = POM_LICENCE_DIST
98+
}
99+
}
100+
developers {
101+
developer {
102+
id = POM_DEVELOPER_ID
103+
name = POM_DEVELOPER_NAME
104+
}
105+
}
106+
}
107+
}
108+
}
109+
repositories {
110+
maven {
111+
credentials {
112+
username "$System.env.SONATYPE_NEXUS_USERNAME"
113+
password "$System.env.SONATYPE_NEXUS_PASSWORD"
114+
}
115+
url = VERSION_NAME.endsWith('SNAPSHOT') ? SNAPSHOT_REPOSITORY : RELEASE_REPOSITORY
116+
}
117+
}
118+
}
64119

65-
testImplementation 'com.squareup:kotlinpoet:1.4.0'
66-
testImplementation 'com.squareup:javapoet:1.11.1'
120+
dependencies {
121+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
67122

68-
implementation "com.squareup.okio:okio:2.1.0"
69-
implementation 'io.github.classgraph:classgraph:4.8.86'
123+
testImplementation group: 'junit', name: 'junit', version: '4.12'
124+
testImplementation "org.mockito:mockito-core:3.2.4"
125+
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
126+
testImplementation "org.assertj:assertj-core:3.11.1"
127+
}
70128

71-
// This dependency is only needed as a "sample" compiler plugin to test that
72-
// running compiler plugins passed via the pluginClasspath CLI option works
73-
testRuntime "org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlin_version"
129+
sourceCompatibility = 1.8
74130

75-
// The Kotlin compiler should be near the end of the list because its .jar file includes
76-
// an obsolete version of Guava
77-
implementation "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
78-
implementation "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:$kotlin_version"
79-
}
131+
compileKotlin {
132+
kotlinOptions.jvmTarget = "1.8"
133+
}
80134

81-
compileKotlin {
82-
kotlinOptions.jvmTarget = "1.8"
83-
kotlinOptions.freeCompilerArgs += ["-Xskip-runtime-version-check"]
84-
}
85-
compileTestKotlin {
86-
kotlinOptions.jvmTarget = "1.8"
87-
kotlinOptions.freeCompilerArgs += ["-Xskip-runtime-version-check"]
135+
compileTestKotlin {
136+
kotlinOptions.jvmTarget = "1.8"
137+
}
88138
}

core/build.gradle

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
plugins {
3+
id "com.github.gmazzo.buildconfig" version "2.0.1"
4+
}
5+
6+
apply plugin: 'kotlin-kapt'
7+
8+
9+
10+
buildConfig {
11+
className = "BuildConfig"
12+
packageName = "com.tschuchort.compiletesting"
13+
sourceSets {
14+
test {
15+
buildConfigField 'String', 'KOTLIN_VERSION', "\"$kotlin_version\""
16+
}
17+
}
18+
}
19+
20+
dependencies {
21+
compileOnly "com.google.auto.service:auto-service:1.0-rc7"
22+
kapt "com.google.auto.service:auto-service:1.0-rc7"
23+
24+
25+
testImplementation 'com.squareup:kotlinpoet:1.4.0'
26+
testImplementation 'com.squareup:javapoet:1.11.1'
27+
28+
implementation "com.squareup.okio:okio:2.1.0"
29+
implementation 'io.github.classgraph:classgraph:4.8.86'
30+
31+
// This dependency is only needed as a "sample" compiler plugin to test that
32+
// running compiler plugins passed via the pluginClasspath CLI option works
33+
testRuntime "org.jetbrains.kotlin:kotlin-scripting-compiler:$kotlin_version"
34+
35+
// The Kotlin compiler should be near the end of the list because its .jar file includes
36+
// an obsolete version of Guava
37+
implementation "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
38+
implementation "org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:$kotlin_version"
39+
}
40+
41+
compileKotlin {
42+
kotlinOptions.freeCompilerArgs += ["-Xskip-runtime-version-check"]
43+
}
44+
45+
compileTestKotlin {
46+
kotlinOptions.freeCompilerArgs += ["-Xskip-runtime-version-check"]
47+
}

core/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
POM_ARTIFACT_ID=kotlin-compile-testing

gradle.properties

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ kotlin.code.style=official
22
kotlin.incremental=false
33

44
GROUP=com.github.tschuchortdev
5-
VERSION_NAME=1.2.8
5+
VERSION_NAME=1.2.10
66
POM_DESCRIPTION=A library that enables testing of Kotlin annotation processors, compiler plugins and code generation.
77
POM_INCEPTION_YEAR=2019
88
POM_URL=https://github.com/tschuchortdev/kotlin-compile-testing
@@ -14,6 +14,7 @@ POM_LICENCE_URL=https://www.mozilla.org/en-US/MPL/2.0/
1414
POM_LICENCE_DIST=repo
1515
POM_DEVELOPER_ID=tschuchortdev
1616
POM_DEVELOPER_NAME=Thilo Schuchort
17-
POM_ARTIFACT_ID=kotlin-compile-testing
1817
POM_NAME=kotlin-compile-testing
19-
POM_PACKAGING=jar
18+
POM_PACKAGING=jar
19+
RELEASE_REPOSITORY=https://oss.sonatype.org/service/local/staging/deploy/maven2/
20+
SNAPSHOT_REPOSITORY=https://oss.sonatype.org/content/repositories/snapshots/

ksp/build.gradle

+2-52
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,12 @@
1+
12
buildscript {
2-
ext.kotlin_version = '1.4.0-rc'
33
ext.ksp_version='1.4.0-rc-dev-experimental-20200731'
4-
// copy properties from the main project's properties file
5-
def mainProjectProperties = new File(
6-
gradle.includedBuild("kotlin-compile-testing").projectDir,
7-
"gradle.properties"
8-
)
9-
def props = new Properties()
10-
mainProjectProperties.newInputStream().withStream {
11-
props.load(it)
12-
}
13-
props.forEach { key, value ->
14-
rootProject.extensions.putAt(key, value)
15-
}
16-
repositories {
17-
mavenCentral()
18-
jcenter()
19-
maven { url 'https://jitpack.io' }
20-
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
21-
}
22-
23-
dependencies {
24-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
25-
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0'
26-
}
27-
}
28-
apply plugin: 'kotlin'
29-
apply plugin: 'maven'
30-
apply plugin: 'com.vanniktech.maven.publish'
31-
32-
group 'com.github.tschuchortdev'
33-
34-
repositories {
35-
mavenCentral()
36-
maven { url 'https://jitpack.io' }
37-
maven { url 'https://kotlin.bintray.com/kotlinx' }
38-
jcenter()
39-
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
40-
google()
414
}
425

436
dependencies {
44-
// We do not specify a version here because `kotlin-compile-testing` is an included build and gradle will use the
45-
// main module of the main project as the dependency.
46-
api("com.github.tschuchortdev:kotlin-compile-testing:$VERSION_NAME")
47-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
7+
api project(':core')
488
implementation "org.jetbrains.kotlin:kotlin-symbol-processing-api:$ksp_version"
499
implementation "org.jetbrains.kotlin:kotlin-ksp:$ksp_version"
5010
implementation "org.jetbrains.kotlin:kotlin-compiler-embeddable:$kotlin_version"
51-
52-
testImplementation group: 'junit', name: 'junit', version: '4.12'
53-
testImplementation "org.assertj:assertj-core:3.11.1"
54-
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
5511
}
5612

57-
compileKotlin {
58-
kotlinOptions.jvmTarget = "1.8"
59-
}
60-
compileTestKotlin {
61-
kotlinOptions.jvmTarget = "1.8"
62-
}

ksp/gradle/wrapper/gradle-wrapper.properties

-5
This file was deleted.

0 commit comments

Comments
 (0)