@@ -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
1618plugins {
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}
0 commit comments