Skip to content

Commit

Permalink
Fix bug in toGDrive introduced by Gradle 8.10
Browse files Browse the repository at this point in the history
* after many hours of debugging, the cause was the dubious usage of `Provider.map {}` in task configuration
* previously (Gradle 8.9) it seems this method was evaluated eager, during task configuration
* now it seems either the map is not evaluated at all (which it probably shouldn't), or this type of code is disallowed
* the latter was indicated by certain build errors claiming something like "actions with Java lambdas are not allowed"
  • Loading branch information
itsnotoger committed Oct 13, 2024
1 parent efc23e0 commit 056f94a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "com.github.itsnotoger"
version = "0.0.1-SNAPSHOT"
version = "2.0.0-SNAPSHOT"
val githubProjectName = "gradle-plugin"

kotlin {
Expand Down Expand Up @@ -46,7 +46,7 @@ dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.0")

val groovyMajor = 3
testImplementation("org.codehaus.groovy:groovy-all:${groovyMajor}.0.21") {
testImplementation("org.codehaus.groovy:groovy-all:${groovyMajor}.0.22") {
because("java-gradle-plugin requires 3.x")
}
testImplementation("org.spockframework:spock-core:2.3-groovy-${groovyMajor}.0")
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/oger/util/java/GDriveExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ enum class Type {
LIBRARY,
JARLIBRARY,
MAVENLIBRARY -> true

L4JAPPLICATION,
FATJARAPPLICATION -> false
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/oger/util/java/OgerPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class OgerPlugin : Plugin<Project> {
it.dependsOn("build")

@Suppress("DEPRECATION") // we want to support deprecated fields
gdrive.type.map { type ->
gdrive.type.get().let { type ->
when (type) {
Type.INLINELIBRARY -> {
it.enabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import org.gradlex.javamodule.moduleinfo.ExtraJavaModuleInfoPluginExtension

object ConfigureExtraJavaModule {

var DEBUG = false

fun apply(project: Project) {
val extraJavaModuleInfo = project.extensions.getByType(ExtraJavaModuleInfoPluginExtension::class.java)
extraJavaModuleInfo.apply {
Expand Down Expand Up @@ -125,13 +123,9 @@ object ConfigureExtraJavaModule {
}

fun disableTestClasspath(project: Project) {
if (DEBUG) println("configure test classpath for $project")
project.plugins.withType(JavaPlugin::class.java) {
if (DEBUG) println("configure test classpath for java $project")
listOf("testCompileClasspath", "testRuntimeClasspath").forEach { configName ->
if (DEBUG) println("configure $configName for java $project")
project.configurations.named(configName).configure {
if (DEBUG) println("configure $configName for java $project attribute set")
it.attributes.attribute(Attribute.of("javaModule", Boolean::class.javaObjectType), false)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/oger/util/java/plugins/ConfigureL4j.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ object ConfigureL4j {
"""-Dold.user.dir="%OLDPWD%""""
)
val gdrive = project.extensions.getByType(GDriveExtension::class.java)
if (gdrive.mainClass.isPresent) mainClassName.set(gdrive.mainClass.get())

mainClassName.convention(gdrive.mainClass)

project.plugins.findPlugin("org.openjfx.javafxplugin")?.let {
jvmOptions.addAll(ConfigureJfx.getJvmOptions(libraryDir))
Expand Down
1 change: 0 additions & 1 deletion src/test/groovy/oger.util.java/ToGDriveSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class ToGDriveSpec extends Specification {
id 'com.github.itsnotoger.gradle-plugin'
}
gdrive {
debug = true
type = oger.util.java.Type.JARLIBRARY
GDriveJars = "/syncme/gradle_jars"
GDriveApps = "/gradle_apps"
Expand Down

0 comments on commit 056f94a

Please sign in to comment.