Skip to content

How to tackle lifecycle issues? #19

Description

@OliverO2

Description

I'm using this function to configure build-logic plugins which build upon each other. Not ideal, but it works.

I tried to change this to make Compat-Patrouille check dependencies:

fun Project.configureWithCompatPatrouille() {
    configureJavaCompatibility(versionFromCatalog("jdk").toInt())
    configureKotlinCompatibility(versionFromCatalog("org.jetbrains.kotlin"))

    extensions.configure<CompatPatrouilleExtension>("compatPatrouille") {
        // The next line is for debugging only
        project.configurations.forEach { println("$project: configuration '$it'") }
        checkApiDependencies(Severity.ERROR)
        checkRuntimeDependencies(Severity.ERROR)
    }
}

Now I'm getting

FAILURE: Build failed with an exception.

* Where:
Build file '/home/oliver/Repositories/open-source/infix/testBalloon/experiments/build.gradle.kts' line: 3

* What went wrong:
An exception occurred applying plugin request [id: 'buildLogic.multiplatform']
> Failed to apply plugin 'buildLogic.multiplatform'.
   > Configuration with name 'jvmApiElements' not found.

Apparently, the experiments project configuration is incomplete at the time checkApiDependencies() runs. What would be the ideal way to avoid such lifecycle issues?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions