Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropping Kotlin 1.7 support and adding min Gradle version check #145

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@ import org.gradle.kotlin.dsl.domainObjectContainer
import org.gradle.kotlin.dsl.newInstance
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.withType
import org.gradle.util.GradleVersion

class BuildConfigPlugin : Plugin<Project> {

companion object {
const val MIN_GRADLE_VERSION = "7.0"
}

override fun apply(project: Project) = with(project) {
check(GradleVersion.current() >= GradleVersion.version(MIN_GRADLE_VERSION)) {
"Gradle version must be at least $MIN_GRADLE_VERSION"
}

val sourceSets = objects.domainObjectContainer(DefaultBuildConfigSourceSet::class)

val defaultSS = sourceSets.create(SourceSet.MAIN_SOURCE_SET_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,18 @@ import java.util.stream.Stream
class BuildConfigPluginTest {

fun testBuild(): Stream<Args> {
val gradleMin = "7.0"
val gradleLatest = "8.5"
val gradleMin = BuildConfigPlugin.MIN_GRADLE_VERSION
val gradleLatest = GradleVersion.current().baseVersion.version

val kotlin6 = "1.6.+"
val kotlin7 = "1.7.+"
val kotlin8 = "1.8.+"
val kotlin9 = "1.9.+"

return Stream.of(
Args(gradleMin, null),
Args(gradleMin, kotlin6),
Args(gradleMin, kotlin7),
Args(gradleMin, kotlin8),
Args(gradleMin, kotlin9),

Args(gradleLatest, null),
Args(gradleLatest, kotlin6),
Args(gradleLatest, kotlin7),
Args(gradleLatest, kotlin8),
Args(gradleLatest, kotlin9),
).flatMap { Stream.of(it.copy(withPackage = true), it.copy(withPackage = false)) }
Expand Down