Skip to content

Commit

Permalink
Merge pull request #85 from AniTrend/develop
Browse files Browse the repository at this point in the history
Develop ➡️ Master
  • Loading branch information
wax911 authored Nov 16, 2022
2 parents ed69960 + 7358c24 commit ff1a0c3
Show file tree
Hide file tree
Showing 26 changed files with 353 additions and 338 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android-dependency-updates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- name: Gradle check for updates
run: ./gradlew dependencyUpdates --stacktrace
- name: Upload dependency updates report
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: dependency-report
path: build/dependencyUpdates/report.json
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/android-spotless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle-dokka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
Expand All @@ -23,7 +23,7 @@ jobs:
run: ./gradlew dokkaHtmlMultiModule

- name: Deploy 🚀
uses: JamesIves/[email protected].5
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: docs # The branch the action should deploy to.
folder: dokka-docs # The folder the action should deploy.
2 changes: 1 addition & 1 deletion .github/workflows/release-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Fetch tags
run: git fetch --tags --force
- uses: ericcornelissen/git-tag-annotation-action@v2
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath(co.anitrend.arch.buildSrc.Libraries.Android.Tools.buildGradle)
classpath(co.anitrend.arch.buildSrc.Libraries.JetBrains.Kotlin.Gradle.plugin)
classpath(libs.android.gradle.plugin)
classpath(libs.jetbrains.kotlin.gradle)
}
}

Expand Down
21 changes: 11 additions & 10 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile
plugins {
`kotlin-dsl`
`maven-publish`
`version-catalog`
}

repositories {
Expand All @@ -27,27 +28,27 @@ tasks.withType(KotlinJvmCompile::class) {
}
}

val buildToolsVersion = "7.2.1"
val kotlinVersion = "1.7.20"
val dokkaVersion = "1.6.21"
val manesVersion = "0.42.0"
val spotlessVersion = "6.11.0"
fun Project.library(alias: String) =
extensions.getByType<VersionCatalogsExtension>()
.named("libs")
.findLibrary(alias)
.get()

dependencies {
/* Depend on the android gradle plugin, since we want to access it in our plugin */
implementation("com.android.tools.build:gradle:$buildToolsVersion")
implementation(library("android-gradle-plugin"))

/* Depend on the kotlin plugin, since we want to access it in our plugin */
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation(library("jetbrains-kotlin-gradle"))

/* Depend on the dokka plugin, since we want to access it in our plugin */
implementation("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
implementation(library("jetbrains-dokka-gradle"))

/** Dependency management */
implementation("com.github.ben-manes:gradle-versions-plugin:$manesVersion")
implementation(library("gradle-versions"))

/** Spotless */
implementation("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion")
implementation(library("spotless-gradle"))

/* Depend on the default Gradle API's since we want to build a custom plugin */
implementation(gradleApi())
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@file:Suppress("UnstableApiUsage")

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
137 changes: 0 additions & 137 deletions buildSrc/src/main/java/co/anitrend/arch/buildSrc/Libraries.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ object Configuration {

private const val channel = "alpha"

const val compileSdk = 32
const val targetSdk = 32
const val compileSdk = 33
const val targetSdk = 33
const val minSdk = 21

/**
Expand All @@ -34,4 +34,4 @@ object Configuration {
"$major.$minor.$patch-$channel$${revision.toVersion()}"
else
"$major.$minor.$patch"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import co.anitrend.arch.buildSrc.plugin.extensions.baseExtension
import co.anitrend.arch.buildSrc.plugin.extensions.libraryExtension
import co.anitrend.arch.buildSrc.plugin.extensions.isDomainModule
import co.anitrend.arch.buildSrc.plugin.extensions.isThemeModule
import co.anitrend.arch.buildSrc.plugin.extensions.version
import co.anitrend.arch.buildSrc.common.Configuration
import co.anitrend.arch.buildSrc.common.Versions
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
Expand All @@ -30,7 +30,7 @@ internal fun Project.configureSpotless(): Unit = spotlessExtension().run {
"**/test/**/*.kt",
"bin/**/*.kt"
)
ktlint(Versions.ktlint).userData(
ktlint(version("ktlint").toString()).userData(
mapOf("android" to "true")
)
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ import com.android.build.gradle.BaseExtension
import com.android.build.gradle.LibraryExtension
import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.Project
import org.gradle.api.artifacts.MinimalExternalModuleDependency
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.artifacts.VersionConstraint
import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet
import org.gradle.api.plugins.BasePlugin
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.provider.Provider
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.reporting.ReportingExtension
import org.gradle.api.tasks.SourceSetContainer
Expand Down Expand Up @@ -45,6 +50,20 @@ fun Project.isThemeModule() =
fun Project.isUiModule() =
name == Modules.Support.Ui.id

fun Project.versionCatalog(): VersionCatalog =
versionCatalogExtension()
.named("libs")

fun Project.library(alias: String): Provider<MinimalExternalModuleDependency> =
versionCatalog()
.findLibrary(alias)
.get()

fun Project.version(alias: String): VersionConstraint =
versionCatalog()
.findVersion(alias)
.get()

internal fun Project.baseExtension() =
extensions.getByType<BaseExtension>()

Expand Down Expand Up @@ -81,6 +100,9 @@ internal fun Project.publishingExtension() =
internal fun Project.spotlessExtension() =
extensions.getByType<SpotlessExtension>()

internal fun Project.versionCatalogExtension() =
extensions.getByType<VersionCatalogsExtension>()

internal fun Project.containsBasePlugin(): Boolean {
return project.plugins.toList().any { plugin ->
plugin is BasePlugin
Expand Down
Loading

0 comments on commit ff1a0c3

Please sign in to comment.