Skip to content

Commit

Permalink
Update to versions catalog and newer dependencies (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmook committed May 9, 2024
1 parent 8952453 commit cff154a
Show file tree
Hide file tree
Showing 387 changed files with 8,467 additions and 10,040 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trim_trailing_whitespace = true
[*.gradle]
ij_continuation_indent_size = 8

[{*.kt, *.kts}]
[{*.kt,*.kts}]
ij_continuation_indent_size = 8
ij_kotlin_assignment_wrap = normal
ij_kotlin_call_parameters_new_line_after_left_paren = true
Expand Down
73 changes: 16 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,23 @@ on:
- main

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1

create_staging_repository:
runs-on: ubuntu-latest
needs: [ validation ]
name: Create staging repository
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
if: startsWith(github.ref, 'refs/tags/')
uses: nexus-actions/create-nexus-staging-repo@v1.1
with:
username: appmattus
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}

build:
needs: [ create_staging_repository ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macOS-latest, ubuntu-latest, windows-latest ]
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: konan cache
uses: actions/cache@v3
with:
path: ~/.konan
key: ${{ runner.os }}-konan

- name: Check
run: ./gradlew check
Expand All @@ -54,42 +36,19 @@ jobs:
run: ./gradlew build -x check -x lintVitalRelease

- name: Prepare tag properties (*nix)
if: runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/')
run: |
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > $HOME/.gradle/sonatype-appmattus-keys.gpg.b64
base64 -d $HOME/.gradle/sonatype-appmattus-keys.gpg.b64 > $HOME/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > $HOME/.gradle/gradle.properties
if: runner.os != 'Windows' && startsWith(github.ref, 'refs/tags/')
- name: Prepare tag properties (windows)
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
run: |
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > $HOME/.gradle/sonatype-appmattus-keys.gpg.b64
certutil -decode $HOME/.gradle/sonatype-appmattus-keys.gpg.b64 $HOME/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > $HOME/.gradle/gradle.properties
if: runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/')
- name: Upload tag
if: startsWith(github.ref, 'refs/tags/')
env:
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
run: ./gradlew publish -P"signing.secretKeyRingFile=$(echo $HOME/.gradle/sonatype-appmattus-keys.gpg)"

close:
if: startsWith(github.ref, 'refs/tags/')
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'

- name: Prepare tag properties (*nix)
run: |
mkdir -p $HOME/.gradle
echo "${{secrets.GPG_SIGNING_SECRET_KEY_RING_FILE_BASE64}}" > $HOME/.gradle/sonatype-appmattus-keys.gpg.b64
base64 -d $HOME/.gradle/sonatype-appmattus-keys.gpg.b64 > $HOME/.gradle/sonatype-appmattus-keys.gpg
echo "${{secrets.GPG_GRADLE_PROPERTIES}}" > $HOME/.gradle/gradle.properties
- name: Close and release tag
run: ./gradlew closeAndReleaseRepository
run: ./gradlew publishAllPublicationsToMavenCentral -P"signing.secretKeyRingFile=$(echo $HOME/.gradle/sonatype-appmattus-keys.gpg)"
19 changes: 19 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Validate Gradle Wrapper"

on:
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- main

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
85 changes: 40 additions & 45 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Appmattus Limited
* Copyright 2021-2024 Appmattus Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,58 +14,59 @@
* limitations under the License.
*/

import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost.DEFAULT
import io.gitlab.arturbosch.detekt.Detekt

plugins {
id("io.gitlab.arturbosch.detekt") version Versions.detektGradlePlugin
id("com.appmattus.markdown") version Versions.markdownlintGradlePlugin
id("com.vanniktech.maven.publish") version Versions.gradleMavenPublishPlugin apply false
id("org.jetbrains.dokka") version Versions.dokkaPlugin
}
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

buildscript {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
classpath("com.android.tools.build:gradle:${Versions.androidGradlePlugin}")
classpath("com.google.dagger:hilt-android-gradle-plugin:${Versions.Google.dagger}")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.AndroidX.navigation}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${libs.versions.kotlin.get()}")
classpath("com.google.dagger:hilt-android-gradle-plugin:${libs.versions.google.dagger.get()}")
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${libs.versions.androidX.navigation.get()}")
}
}

apply(from = "$rootDir/gradle/scripts/dependencyUpdates.gradle.kts")
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.markdownlintGradlePlugin)
alias(libs.plugins.gradleMavenPublishPlugin) apply false
alias(libs.plugins.dokkaPlugin)
alias(libs.plugins.gradleVersionsPlugin)
}

allprojects {
repositories {
gradlePluginPortal()
//noinspection JcenterRepositoryObsolete Just needed for Groupie
@Suppress("DEPRECATION")
jcenter()
google()
mavenCentral()
maven(url = "https://kotlin.bintray.com/kotlinx/")
}
}

dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:${Versions.detektGradlePlugin}")
}

tasks.withType<Detekt> {
jvmTarget = "1.8"
}

detekt {
input = files(subprojects.map { File(it.projectDir, "src") })

buildUponDefaultConfig = true

autoCorrect = true

config = files("detekt-config.yml")
apply(from = "gradle/scripts/detekt.gradle.kts")

tasks.withType<DependencyUpdatesTask> {
resolutionStrategy {
componentSelection {
all {
fun isNonStable(version: String) = listOf(
"alpha",
"beta",
"rc",
"cr",
"m",
"preview",
"b",
"ea"
).any { qualifier ->
version.matches(Regex("(?i).*[.-]$qualifier[.\\d-+]*"))
}
if (isNonStable(candidate.version) && !isNonStable(currentVersion)) {
reject("Release candidate")
}
}
}
}
}

tasks.maybeCreate("check").dependsOn(tasks.named("detekt"))
Expand All @@ -92,10 +93,4 @@ allprojects {
}
}
}

plugins.withId("com.vanniktech.maven.publish.base") {
configure<MavenPublishBaseExtension> {
publishToMavenCentral(DEFAULT, System.getenv("SONATYPE_REPOSITORY_ID"))
}
}
}
50 changes: 0 additions & 50 deletions buildSrc/src/main/kotlin/Versions.kt

This file was deleted.

Loading

0 comments on commit cff154a

Please sign in to comment.