Skip to content

Commit cbacd8b

Browse files
authored
Update to Kotlin 1.4.30 and Maven Central for publishing (#79)
1 parent 820eb1c commit cbacd8b

24 files changed

+350
-269
lines changed

.github/workflows/gradle-wrapper-validation.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 23 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ on:
1010
branches:
1111
- main
1212

13-
env:
14-
CI: "true"
15-
1613
jobs:
17-
build:
14+
validation:
15+
name: "Validation"
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: gradle/wrapper-validation-action@v1
1820

21+
build:
22+
needs: [validation]
1923
runs-on: ubuntu-latest
2024

2125
steps:
@@ -26,41 +30,25 @@ jobs:
2630
with:
2731
java-version: 1.8
2832

29-
- name: gradle cache
30-
uses: actions/cache@v1
31-
with:
32-
path: ~/.gradle/caches
33-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
34-
restore-keys: |
35-
${{ runner.os }}-gradle-
36-
37-
- name: gradle wrapper cache
38-
uses: actions/cache@v1
39-
with:
40-
path: ~/.gradle/wrapper/dists
41-
key: ${{ runner.os }}-gradlewrapper
33+
- name: Build with Gradle
34+
run: ./gradlew assemble check --stacktrace
4235

43-
- name: NVD CVE cache
44-
uses: actions/cache@v1
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v1.0.6
4538
with:
46-
path: ~/.gradle/dependency-check-data
47-
key: ${{ runner.os }}-dependency-check-data
48-
49-
- name: Build with Gradle
50-
run: ./gradlew --build-cache assemble check --stacktrace
39+
token: ${{secrets.CODECOV_TOKEN}}
5140

52-
- name: Set tag version
53-
run: echo "CIRCLE_TAG=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
41+
- name: Prepare tag properties
42+
run: |
43+
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > ~/.gradle/sonatype-appmattus-keys.gpg.b64
44+
base64 -d ~/.gradle/sonatype-appmattus-keys.gpg.b64 > ~/.gradle/sonatype-appmattus-keys.gpg
45+
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > ~/.gradle/gradle.properties
5446
if: startsWith(github.ref, 'refs/tags/')
55-
47+
5648
- name: Upload tag
57-
env:
58-
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
59-
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
60-
run: ./gradlew bintrayUpload
49+
run: ./gradlew publish --no-daemon --no-parallel -Psigning.secretKeyRingFile=$(echo ~/.gradle/sonatype-appmattus-keys.gpg)
6150
if: startsWith(github.ref, 'refs/tags/')
6251

63-
- name: Upload coverage to Codecov
64-
uses: codecov/[email protected]
65-
with:
66-
token: ${{secrets.CODECOV_TOKEN}}
52+
- name: Close and release tag
53+
run: ./gradlew closeAndReleaseRepository
54+
if: startsWith(github.ref, 'refs/tags/')

.idea/codeStyles/Project.xml

Lines changed: 9 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/libraries-with-intellij-classes.xml

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Appmattus Limited
2+
* Copyright 2021 Appmattus Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,24 +14,24 @@
1414
* limitations under the License.
1515
*/
1616

17-
import com.android.build.gradle.internal.tasks.factory.dependsOn
18-
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
17+
import org.jetbrains.dokka.gradle.DokkaPlugin
1918
import org.jetbrains.dokka.gradle.DokkaTask
2019
import java.net.URL
2120

2221
plugins {
23-
kotlin("jvm") version "1.4.10" apply false
24-
id("io.gitlab.arturbosch.detekt") version "1.14.2"
25-
id("com.appmattus.markdown") version "0.6.0"
26-
id("org.jetbrains.dokka") version "1.4.10.2"
22+
kotlin("jvm") version Versions.kotlin apply false
23+
id("io.gitlab.arturbosch.detekt") version Versions.detektGradlePlugin
24+
id("com.appmattus.markdown") version Versions.markdownlintGradlePlugin
25+
id("com.vanniktech.maven.publish") version Versions.gradleMavenPublishPlugin apply false
26+
id("org.jetbrains.dokka") version Versions.dokkaPlugin
2727
}
2828

2929
buildscript {
3030
repositories {
3131
google()
3232
}
3333
dependencies {
34-
classpath("com.android.tools.build:gradle:4.1.0")
34+
classpath("com.android.tools.build:gradle:${Versions.androidGradlePlugin}")
3535
}
3636
}
3737

@@ -46,17 +46,24 @@ allprojects {
4646
maven { setUrl("https://jitpack.io") }
4747
}
4848

49-
tasks.withType<DokkaTask> {
50-
outputDirectory.set(buildDir.resolve("reports/dokka"))
49+
version = (System.getenv("GITHUB_REF") ?: System.getProperty("GITHUB_REF"))
50+
?.replaceFirst("refs/tags/", "") ?: "unspecified"
5151

52-
dokkaSourceSets {
53-
configureEach {
54-
skipDeprecated.set(true)
52+
plugins.withType<DokkaPlugin> {
53+
tasks.withType<DokkaTask>().configureEach {
54+
dokkaSourceSets {
55+
configureEach {
56+
skipDeprecated.set(true)
5557

56-
sourceLink {
57-
localDirectory.set(rootDir)
58-
remoteUrl.set(URL("https://github.com/appmattus/kotlinfixture/blob/main/"))
59-
remoteLineSuffix.set("#L")
58+
if (name.startsWith("ios")) {
59+
displayName.set("ios")
60+
}
61+
62+
sourceLink {
63+
localDirectory.set(rootDir)
64+
remoteUrl.set(URL("https://github.com/appmattus/kotlinfixture/blob/main"))
65+
remoteLineSuffix.set("#L")
66+
}
6067
}
6168
}
6269
}
@@ -68,7 +75,7 @@ tasks.register<Delete>("clean") {
6875
}
6976

7077
dependencies {
71-
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.14.2")
78+
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.detektGradlePlugin}")
7279
}
7380

7481
detekt {
@@ -80,10 +87,3 @@ detekt {
8087

8188
config = files("detekt-config.yml")
8289
}
83-
84-
val dokka = tasks.named<DokkaMultiModuleTask>("dokkaHtmlMultiModule") {
85-
outputDirectory.set(buildDir.resolve("dokkaCustomMultiModuleOutput"))
86-
// documentationFileName.set("module.md")
87-
}
88-
89-
tasks.register("check").dependsOn(dokka)

gradle/scripts/dokka-javadoc.gradle.kts renamed to buildSrc/build.gradle.kts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 Appmattus Limited
2+
* Copyright 2021 Appmattus Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,9 +14,22 @@
1414
* limitations under the License.
1515
*/
1616

17-
tasks.register<Jar>("dokkaJar") {
18-
dependsOn(tasks.named("dokkaJavadoc"))
17+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1918

20-
archiveClassifier.set("javadoc")
21-
from("$buildDir/reports/dokka")
19+
plugins {
20+
`kotlin-dsl`
21+
}
22+
23+
repositories {
24+
jcenter()
25+
}
26+
27+
kotlinDslPluginOptions {
28+
experimentalWarning.set(false)
29+
}
30+
31+
tasks.withType(KotlinCompile::class.java).all {
32+
kotlinOptions {
33+
jvmTarget = JavaVersion.VERSION_1_8.toString()
34+
}
2235
}

0 commit comments

Comments
 (0)