Skip to content

Commit

Permalink
Merge branch 'main' into favors-binds
Browse files Browse the repository at this point in the history
  • Loading branch information
WhosNickDoglio committed Nov 4, 2023
2 parents 6c24a85 + 5bc5e8b commit 47035d7
Show file tree
Hide file tree
Showing 60 changed files with 1,125 additions and 478 deletions.
8 changes: 4 additions & 4 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ description: 'Setup stuff'
runs:
using: "composite"
steps:
- name: set up JDK 19
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
- name: set up JDK 20
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
distribution: 'zulu'
java-version: '19'
java-version: '20'
- name: Setup Gradle
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
26 changes: 14 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
name: CI

on:
pull_request:
branches:
- main
merge_group:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- main
- renovate/**
- 'main'
- "renovate/**"
tags-ignore:
- '**'

jobs:
Validate-Gradle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b # v1.0.6
uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0
Build:
runs-on: ubuntu-latest
needs: [ Validate-Gradle ]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup
- name: Build
run: ./gradlew assemble
Expand All @@ -30,22 +32,22 @@ jobs:
needs: [ Build ]
strategy:
matrix:
command: [ detekt, spotlessCheck, lint ]
command: [ detektMain, detektTest, spotlessCheck, lint, checkSortDependencies ]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup
- name: Lint
run: ./gradlew ${{ matrix.command }}
Tests:
runs-on: ubuntu-latest
needs: [ Build ]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup
- name: Run Unit Tests
run: ./gradlew kover-aggregate:koverXmlReport --no-build-cache
- name: Codecov
uses: codecov/codecov-action@894ff025c7b54547a9a2a1e9f228beae737ad3c2 # v3.1.3
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
files: ./kover-aggregate/build/reports/kover/report.xml
token: ${{ secrets.CODE_COV_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: 3.x
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
key: ${{ github.ref }}
path: .cache
Expand Down
2 changes: 2 additions & 0 deletions .idea/detekt.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 2 additions & 8 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,15 @@
* SPDX-License-Identifier: MIT
*/

import com.diffplug.spotless.LineEnding

plugins {
`kotlin-dsl`
alias(libs.plugins.spotless)
alias(libs.plugins.detekt)
}

kotlin { jvmToolchain(19) }
kotlin { jvmToolchain(20) }

configure<com.diffplug.gradle.spotless.SpotlessExtension> {

// https://github.com/diffplug/spotless/issues/1527
// https://github.com/diffplug/spotless/issues/1644
lineEndings = LineEnding.PLATFORM_NATIVE

format("misc") {
target("*.md", ".gitignore")
trimTrailingWhitespace()
Expand All @@ -43,4 +36,5 @@ dependencies {
implementation(libs.detekt.gradle)
implementation(libs.android.gradle)
implementation(libs.kover.gradle)
implementation(libs.sortDependencies.gradle)
}
17 changes: 3 additions & 14 deletions build-logic/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,10 @@
# Copyright (C) 2023 Nicholas Doglio
# SPDX-License-Identifier: MIT
#

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -XX:+UseParallelGC
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.jvmargs=-Xmx3g -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=4g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true
# Kotlin code style for this project: "official" or "obsolete":
org.gradle.kotlin.dsl.allWarningsAsErrors=true
kotlin.code.style=official
4 changes: 2 additions & 2 deletions build-logic/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright (C) 2023 Nicholas Doglio
# SPDX-License-Identifier: MIT
#

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
15 changes: 10 additions & 5 deletions build-logic/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +198,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
4 changes: 4 additions & 0 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ dependencyResolutionManagement {

versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
23 changes: 23 additions & 0 deletions build-logic/src/main/kotlin/lint.shared.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2023 Nicholas Doglio
* SPDX-License-Identifier: MIT
*/

import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.dependencies

plugins {
id("rules.shared")
}

val catalog =
extensions.findByType(VersionCatalogsExtension::class.java) ?: error("No Catalog found!")

val libs = catalog.named("libs")


dependencies {
"compileOnly"(libs.findBundle("lintApi").get())
"testImplementation"(libs.findBundle("test").get())
"testImplementation"(libs.findBundle("lintTest").get())
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* SPDX-License-Identifier: MIT
*/

import com.android.build.api.dsl.Lint
import com.diffplug.gradle.spotless.SpotlessExtension
import com.diffplug.spotless.LineEnding
import io.gitlab.arturbosch.detekt.Detekt
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
Expand All @@ -18,14 +17,15 @@ plugins {
id("com.diffplug.spotless")
id("com.android.lint")
id("org.jetbrains.kotlinx.kover")
id("com.squareup.sort-dependencies")
}

val catalog =
extensions.findByType(VersionCatalogsExtension::class.java) ?: error("No Catalog found!")

val libs = catalog.named("libs")

lint {
configure<Lint> {
htmlReport = false
xmlReport = false
textReport = true
Expand All @@ -36,11 +36,6 @@ lint {
}

configure<SpotlessExtension> {

// https://github.com/diffplug/spotless/issues/1527
// https://github.com/diffplug/spotless/issues/1644
lineEndings = LineEnding.PLATFORM_NATIVE

format("misc") {
target("*.md", ".gitignore")
trimTrailingWhitespace()
Expand All @@ -64,9 +59,7 @@ configure<SpotlessExtension> {
}
}

configure<KotlinJvmProjectExtension> { jvmToolchain(19) }

tasks.withType<Detekt>().configureEach { jvmTarget = "11" }
configure<KotlinJvmProjectExtension> { jvmToolchain(20) }

tasks.withType<JavaCompile>().configureEach { options.release.set(11) }

Expand Down Expand Up @@ -95,7 +88,4 @@ tasks.withType<KotlinCompile>().configureEach {

dependencies {
"compileOnly"(platform(libs.findLibrary("kotlin-bom").get()))
"compileOnly"(libs.findBundle("lintApi").get())
"testImplementation"(libs.findBundle("test").get())
"testImplementation"(libs.findBundle("lintTest").get())
}
18 changes: 0 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,9 @@
* SPDX-License-Identifier: MIT
*/

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import java.util.*

plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.lint) apply false
alias(libs.plugins.kover) apply false
alias(libs.plugins.doctor)
alias(libs.plugins.dependencyAnalysis)
alias(libs.plugins.gradleVersions)
}

fun isNonStable(version: String): Boolean {
val unstableKeywords =
listOf("ALPHA", "RC", "BETA", "DEV", "-M").any { version.uppercase(Locale.getDefault()).contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
return unstableKeywords && !regex.matches(version)
}

tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {
rejectVersionIf {
isNonStable(candidate.version)
}
}
Loading

0 comments on commit 47035d7

Please sign in to comment.