Visitar URL original
Command-line Isolated Projects flags are not reflected in KSP source wiring · Issue #3188 · google/ksp · GitHub
Skip to content

Command-line Isolated Projects flags are not reflected in KSP source wiring #3188

Closed

Description

@gregjotau

KSP's enableProjectIsolationCompatibleCodepath() reads Gradle/system properties directly, so it misses Gradle's --isolated-projects command-line flag. It also reports isolation enabled when org.gradle.isolated-projects=true is overridden by --no-isolated-projects.

This is present in KSP 2.3.11 and current main. The compatible source-registration path is selected by this function in both KspSubplugin and KspAATask.

A small Groovy build demonstrates the detection error:

import com.google.devtools.ksp.gradle.utils.KgpUtilsKt

plugins {
    id 'org.jetbrains.kotlin.jvm' version '2.3.20' apply false
    id 'com.google.devtools.ksp' version '2.3.11' apply false
}

def isolated = KgpUtilsKt.enableProjectIsolationCompatibleCodepath(project)
tasks.register('checkIsolation') {
    inputs.property('isolated', isolated)
    doLast { println('KSP isolation: ' + inputs.properties.isolated) }
}

With Gradle 9.7.1:

  • ./gradlew checkIsolation --isolated-projects prints Gradle's isolation banner, but KSP isolation: false.
  • Put org.gradle.isolated-projects=true in gradle.properties; ./gradlew checkIsolation --no-isolated-projects prints KSP isolation: true.
  • Explicit ksp.project.isolation.enabled=true remains a useful opt-in/workaround and should continue to work with Gradle isolation disabled.

I have reproduced both failures in focused TestKit tests against current main. BuildFeatures.isolatedProjects.active supplies Gradle's effective feature state, including CLI precedence. It is available since Gradle 8.5, so a version-gated injected helper can use it while retaining the existing property fallback on older Gradle versions.

I am preparing that small fix with CLI/cache-reuse, explicit opt-in, older-Gradle, and actual generated-source compilation coverage. This investigation and the tests are substantially AI-assisted with Codex.

Activity

  1. added
    P2affects usability but not blocks users
    GradleIssues with KSP Gradle Plugin, AGP or Gradle.
    on Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GradleIssues with KSP Gradle Plugin, AGP or Gradle.P2affects usability but not blocks users

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions