Skip to content

Commit

Permalink
Upgrade to Gradle 8
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangl committed Nov 7, 2023
1 parent cdaa124 commit 835b5d5
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 31 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
- No security issues fixed!

## [4.0.0] - 2023-11-07
### Changed
- BREAKING CHANGE: Bump Gradle version to 8 and AGP version to 8.1.2.
- Update dependencies.

## [3.4.2] - 2023-08-28
### Fixed
- Fix tags not being sent as String JSON array. _Thanks to [@bogdanzurac](https://github.com/bogdanzurac) for the contribution!_
Expand Down Expand Up @@ -478,7 +483,8 @@ res_dir_path -> resDirPath
### Added
- Initial release.

[Unreleased]: https://github.com/hyperdevs-team/poeditor-android-gradle-plugin/compare/3.4.2...HEAD
[Unreleased]: https://github.com/hyperdevs-team/poeditor-android-gradle-plugin/compare/4.0.0...HEAD
[4.0.0]: https://github.com/hyperdevs-team/poeditor-android-gradle-plugin/compare/3.4.2...4.0.0
[3.4.2]: https://github.com/hyperdevs-team/poeditor-android-gradle-plugin/compare/3.4.1...3.4.2
[3.4.1]: https://github.com/hyperdevs-team/poeditor-android-gradle-plugin/compare/3.4.0...3.4.1
[3.4.0]: https://github.com/hyperdevs-team/poeditor-android-gradle-plugin/compare/3.3.0...3.4.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This plug-in super-charges your Android project by providing tasks to download y
It also provides a built-in syntax to handle placeholders to enhance the already awesome Android support from PoEditor.

## Minimum requirements
* Android Gradle Plug-in 7.0 or above
* Android Gradle Plug-in 8.0 or above

## Setting Up
In your main `build.gradle`, add [jitpack.io](https://jitpack.io/) repository in the `buildscript` block and include the plug-in as a dependency:
Expand Down
33 changes: 16 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.toVersion(libs.versions.java.sdk.get())
targetCompatibility = JavaVersion.toVersion(libs.versions.java.sdk.get())

withJavadocJar()
withSourcesJar()
Expand All @@ -79,7 +79,7 @@ tasks.javadoc {

detekt {
toolVersion = libs.versions.detekt.get()
config = files("${project.rootDir}/config/detekt.yml")
config.setFrom(files("${project.rootDir}/config/detekt.yml"))
autoCorrect = true
}

Expand All @@ -94,9 +94,10 @@ tasks {
maxHeapSize = "1G"
}

withType<io.gitlab.arturbosch.detekt.Detekt> {
// Target version of the generated JVM bytecode. It is used for type resolution.
this.jvmTarget = "1.8"
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = libs.versions.java.sdk.get()
}
}

val installGitHooks by registering(Copy::class) {
Expand Down Expand Up @@ -169,18 +170,16 @@ publishing {
}
}
}

// https://github.com/ben-manes/gradle-versions-plugin
// Disallow release candidates as upgradable versions from stable versions
fun String.isNonStable(): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(this)
return isStable.not()
}

// Get only stable versions when running dependencyUpdates
tasks.withType<DependencyUpdatesTask> {
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}

rejectVersionIf {
candidate.version.isNonStable() && !currentVersion.isNonStable()
isNonStable(this.candidate.version) && !isNonStable(this.currentVersion)
}
}
14 changes: 8 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
[versions]
kotlin = "1.8.20-RC"
detekt = "1.22.0"
moshi = "1.14.0"
java-sdk = "17"

kotlin = "1.9.10"
detekt = "1.23.3"
moshi = "1.15.0"
retrofit = "2.9.0"
okhttp = "4.10.0"
okhttp = "4.12.0"

[libraries]
android-buildTools = "com.android.tools.build:gradle:7.3.0"
android-buildTools = "com.android.tools.build:gradle:8.1.2"

kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
Expand All @@ -30,7 +32,7 @@ detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-form
[plugins]
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
gitVersionGradle = { id = "com.gladed.androidgitversion", version = "0.4.14"}
versionsUpdate = { id = "com.github.ben-manes.versions", version = "0.46.0" }
versionsUpdate = { id = "com.github.ben-manes.versions", version = "0.49.0" }

[bundles]
moshi = ["moshi", "moshi-kotlin", "moshi-adapters"]
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 0 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@
* limitations under the License.
*/

enableFeaturePreview("VERSION_CATALOGS")

rootProject.name = "poeditor-android-gradle-plugin"
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.hyperdevs.poeditor.gradle

import com.hyperdevs.poeditor.gradle.adapters.PoEditorDateJsonAdapter
import com.hyperdevs.poeditor.gradle.ktx.downloadUrlToString
import com.hyperdevs.poeditor.gradle.network.PoEditorApiControllerImpl
import com.hyperdevs.poeditor.gradle.network.api.ExportType
Expand All @@ -30,7 +31,6 @@ import com.hyperdevs.poeditor.gradle.utils.logger
import com.hyperdevs.poeditor.gradle.xml.AndroidXmlWriter
import com.hyperdevs.poeditor.gradle.xml.XmlPostProcessor
import com.squareup.moshi.Moshi
import com.squareup.moshi.adapters.PoEditorDateJsonAdapter
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
Expand Down
Loading

0 comments on commit 835b5d5

Please sign in to comment.