Skip to content

Commit

Permalink
Fix: normalize the gradle version between build and publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
xethorn committed Jul 9, 2023
1 parent 169bb1e commit 0926de9
Show file tree
Hide file tree
Showing 8 changed files with 237 additions and 176 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

publish:
name: Publish
if: ${{ github.ref == 'refs/heads/main' && github.repository == 'cashapp/kfactories' }}
# if: ${{ github.ref == 'refs/heads/main' && github.repository == 'cashapp/kfactories' }}
runs-on: ubuntu-latest
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
Expand All @@ -34,7 +34,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v2.3.4
- uses: gradle/wrapper-validation-action@v1.0.4
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: 11

- name: Assign a version
run: |
Expand Down
100 changes: 45 additions & 55 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,83 +1,73 @@
buildscript {
apply from: 'dependencies.gradle'
apply from: 'dependencies.gradle'

dependencies {
classpath deps.kotlinGradlePlugin
classpath "org.jetbrains.kotlin:kotlin-serialization:${versions.kotlin}"
classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.1.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32'
classpath 'de.undercouch:gradle-download-task:4.1.1'
}
dependencies {
classpath deps.kotlinGradlePlugin
classpath "org.jetbrains.kotlin:kotlin-serialization:${versions.kotlin}"
classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.1.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32'
classpath 'de.undercouch:gradle-download-task:4.1.1'
}

repositories {
mavenCentral()
gradlePluginPortal()
}
repositories {
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id 'org.jetbrains.kotlin.jvm' version "1.5.10"
id 'org.jetbrains.kotlin.jvm' version "1.8.10"
id 'com.vanniktech.maven.publish' version "0.25.3"
}

dependencies {
compileOnly gradleApi()
compileOnly deps.kotlinGradlePlugin
compileOnly gradleApi()
compileOnly deps.kotlinGradlePlugin

implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.0'

testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0-M1'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.0-M1'
testImplementation 'org.junit.platform:junit-platform-gradle-plugin:1.2.0'
testImplementation 'org.jetbrains.kotlin:kotlin-test:1.4.32'
testImplementation 'org.assertj:assertj-core:3.19.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0-M1'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.0-M1'
testImplementation 'org.junit.platform:junit-platform-gradle-plugin:1.2.0'
testImplementation 'org.jetbrains.kotlin:kotlin-test:1.4.32'
}

repositories {
mavenCentral()
google()
mavenCentral()
google()
}

test {
useJUnitPlatform()
useJUnitPlatform()

testLogging {
if (System.getenv("CI") == "true") {
events = ["failed", "skipped", "passed"]
testLogging {
if (System.getenv("CI") == "true") {
events = ["failed", "skipped", "passed"]
}
exceptionFormat "full"
}
exceptionFormat "full"
}
}

apply plugin: 'com.vanniktech.maven.publish'
import com.vanniktech.maven.publish.SonatypeHost

mavenPublish {
targets {
installArchives {
def url = file("${rootProject.buildDir}/localMaven").toURI().toString()
releaseRepositoryUrl = url
snapshotRepositoryUrl = url
}
}
}

signing {
def signingKey = findProperty('signingKey')
def signingPassword = ''
useInMemoryPgpKeys(signingKey, signingPassword)
mavenPublishing {
publishToMavenCentral(SonatypeHost.DEFAULT, true)
signAllPublications()
}

apply plugin: 'com.diffplug.spotless'

spotless {
kotlin {
target('**/*.kt')
licenseHeaderFile(rootProject.file('gradle/license-header.txt'))
// Spotless doesn't read .editorconfig yet: https://github.com/diffplug/spotless/issues/142
ktlint('0.41.0').userData([
'insert_final_newline': 'true',
'end_of_line': 'lf',
'indent_size': '2',
])
}
kotlin {
target('**/*.kt')
licenseHeaderFile(rootProject.file('gradle/license-header.txt'))
// Spotless doesn't read .editorconfig yet: https://github.com/diffplug/spotless/issues/142
ktlint('0.41.0').userData([
'insert_final_newline': 'true',
'end_of_line' : 'lf',
'indent_size' : '2',
])
}
}
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext.versions = [
'kotlin': '1.5.10',
'kotlin': '1.9.0',
]
ext.deps = [
'kotlinGradlePlugin': "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
Expand Down
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@ POM_DEVELOPER_NAME=CashApp
POM_DEVELOPER_URL=https://github.com/cashapp/

systemProp.org.gradle.internal.http.socketTimeout=120000

VERSION_NAME=1.0.0-SNAPSHOT
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0926de9

Please sign in to comment.