Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

  • Create the branch ci/add-kotlin-plugin-ci-and-diagnostics (using current copilot branch)
  • Create the .github/workflows/kotlin-ci.yml file with exact contents from problem statement
  • Create the scripts/ci directory
  • Create the scripts/ci/inspect_gradle_kotlin_versions.sh file with exact contents
  • Make the script executable
  • Verify the files match the requirements
  • Fix workflow to use ide-plugins directory for gradle commands
  • Remove scripts/ci and use existing inspect_gradle_kotlin_versions.sh in ide-plugins
  • Fix YAML syntax error by adding quotes to name fields
  • Add Java version suffix to artifact names to prevent matrix build conflicts
  • Restore permissions section for security best practices
  • Final verification and PR summary

Summary

Successfully added GitHub Actions workflow and diagnostic script with fixes based on code review:

Files Modified:

  1. .github/workflows/kotlin-ci.yml - GitHub Actions workflow that:

    • Runs on pull_request (opened, synchronize, reopened) and push to main
    • Uses JDK matrix (Java 11 and 17)
    • Includes permissions: contents: read for security best practices
    • Caches Gradle dependencies in ide-plugins/.gradle
    • All gradle commands run from ide-plugins directory using working-directory
    • Runs diagnostics script from ide-plugins/inspect_gradle_kotlin_versions.sh
    • Builds with full stacktrace logging
    • Uploads artifacts with unique names per Java version to avoid conflicts:
      • ci-diagnostics-java-11 and ci-diagnostics-java-17
      • gradle-build-log-java-11 and gradle-build-log-java-17
      • kotlin-subproject-logs-java-11 and kotlin-subproject-logs-java-17
  2. Removed scripts/ci/ directory:

    • The diagnostic script already exists in ide-plugins/inspect_gradle_kotlin_versions.sh
    • Workflow now correctly calls it from the ide-plugins directory

Changes based on code review:

  • ✅ Fixed gradle paths to point to ide-plugins directory (line 37 comment)
  • ✅ Removed scripts/ci directory and use existing script in ide-plugins (line 2 comment)
  • ✅ All gradle commands now use working-directory: ide-plugins
  • ✅ Diagnostic script called from correct location: ./inspect_gradle_kotlin_versions.sh
  • ✅ Fixed YAML syntax error by properly quoting name fields containing template expressions
  • ✅ Added Java version suffix to all artifact names to prevent conflicts between matrix builds
  • ✅ Restored permissions: contents: read section for security best practices

Purpose:

These files help diagnose the Gradle HasConvention failure by:

  • Capturing full build logs with stacktraces
  • Extracting version information for Gradle and Kotlin plugin from the ide-plugins directory
  • Running builds in a CI environment to reproduce the issue
  • Providing downloadable artifacts for debugging (separate artifacts for each Java version)
Original prompt

Create a pull request on branch ci/add-kotlin-plugin-ci-and-diagnostics that adds a GitHub Actions workflow and a diagnostic script to help investigate the Gradle HasConvention failure. Commit the files and open a PR against main. Files and exact contents below.

Files to add (exact contents):

File: .github/workflows/kotlin-ci.yml

name: CI — Build Kotlin plugin on PR commits

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [ "main" ]

jobs:
build-kotlin-plugin:
name: Build (matrix: Java ${{ matrix.java-version }})
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [11, 17]

steps:
  - name: Checkout repository
    uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - name: Set up JDK ${{ matrix.java-version }}
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: ${{ matrix.java-version }}

  - name: Cache Gradle
    uses: actions/cache@v4
    with:
      path: |
        ~/.gradle/caches
        ~/.gradle/wrapper
        .gradle
      key: gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }}
      restore-keys: |
        gradle-${{ matrix.java-version }}-

  - name: Make wrapper executable
    run: chmod +x ./gradlew

  - name: Print Gradle info (for debugging)
    run: ./gradlew --no-daemon --version

  - name: Run diagnostics script (prints wrapper and kotlin plugin references)
    run: |
      mkdir -p out
      scripts/ci/inspect_gradle_kotlin_versions.sh > out/ci-diagnostics.txt || true
  - name: Upload diagnostics
    uses: actions/upload-artifact@v4
    with:
      name: ci-diagnostics
      path: out/ci-diagnostics.txt

  - name: Full build with stacktrace (capture to file)
    env:
      GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
    run: |
      set -o pipefail
      ./gradlew build --no-daemon --stacktrace 2>&1 | tee gradle-build.log || true
  - name: Upload build log
    uses: actions/upload-artifact@v4
    with:
      name: gradle-build-log
      path: gradle-build.log

  - name: Build Kotlin plugin subproject if present
    run: |
      set -o pipefail
      if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :kotlin subproject -> building it"
        ./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
        echo "Uploading kotlin-subproject-build.log"
        ls -la kotlin-subproject-build.log || true
      elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :plugin:kotlin subproject -> building it"
        ./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
      else
        echo "No explicit kotlin plugin subproject found; running assemble on all projects"
        ./gradlew assemble --no-daemon --stacktrace 2>&1 | tee assemble.log || true
      fi
  - name: Upload kotlin-subproject/build logs if present
    uses: actions/upload-artifact@v4
    with:
      name: kotlin-subproject-logs
      path: |
        kotlin-subproject-build.log
        assemble.log
        || true

File: scripts/ci/inspect_gradle_kotlin_versions.sh

#!/usr/bin/env bash
set -eu

Print Gradle wrapper distribution URL

if [ -f gradle/wrapper/gradle-wrapper.properties ]; then
echo "== gradle-wrapper.properties =="
grep -i distributionUrl gradle/wrapper/gradle-wrapper.properties || true
echo
fi

Print gradle.properties if present

if [ -f gradle.properties ]; then
echo "== gradle.properties =="
cat gradle.properties || true
echo
fi

Search for Kotlin Gradle plugin references

echo "== Kotlin plugin references (searching for kotlin-gradle-plugin and org.jetbrains.kotlin) =="
grep -R --line-number --color=never "kotlin-gradle-plugin" || true
grep -R --line-number --color=never "org.jetbrains.kotlin" || true

Print build.gradle(.kts) files header lines to show plugin versions where declared

for f in $(git ls-files ".gradle" ".gradle.kts" 2>/dev/null || true); do
echo "---- $f ----"
sed -n '1,200p' "$f" | sed -n '1,60p'
echo
done

Print settings.gradle(.kts)

for f in $(git ls-files "settings.gradle" "settings.gradle.kts" 2>/dev/null || true); do
echo "---- $f ----"
sed -n '1,200p' "$f" | sed -n '1,60p'
echo
done

Print the kotlin plugin versions extracted via a rough regex

echo "== Extracted candidate versions =="
grep -R --line-number --color=never "kotlin-gradle-plugin[:=][^\n]*" || true

Make the script executable and ensure workflow runs it as shown above.

PR description guidance:

Title: CI: build Kotlin plugin on PRs and diagnostics

Body: This PR adds a GitHub Actions workflow (.github/workflows/kotlin-ci...

This pull request was created as a result of the following prompt from Copilot chat.

Create a pull request on branch ci/add-kotlin-plugin-ci-and-diagnostics that adds a GitHub Actions workflow and a diagnostic script to help investigate the Gradle HasConvention failure. Commit the files and open a PR against main. Files and exact contents below.

Files to add (exact contents):

File: .github/workflows/kotlin-ci.yml

name: CI — Build Kotlin plugin on PR commits

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [ "main" ]

jobs:
build-kotlin-plugin:
name: Build (matrix: Java ${{ matrix.java-version }})
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [11, 17]

steps:
  - name: Checkout repository
    uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - name: Set up JDK ${{ matrix.java-version }}
    uses: actions/setup-java@v4
    with:
      distribution: temurin
      java-version: ${{ matrix.java-version }}

  - name: Cache Gradle
    uses: actions/cache@v4
    with:
      path: |
        ~/.gradle/caches
        ~/.gradle/wrapper
        .gradle
      key: gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*','**/gradle-wrapper.properties') }}
      restore-keys: |
        gradle-${{ matrix.java-version }}-

  - name: Make wrapper executable
    run: chmod +x ./gradlew

  - name: Print Gradle info (for debugging)
    run: ./gradlew --no-daemon --version

  - name: Run diagnostics script (prints wrapper and kotlin plugin references)
    run: |
      mkdir -p out
      scripts/ci/inspect_gradle_kotlin_versions.sh > out/ci-diagnostics.txt || true
  - name: Upload diagnostics
    uses: actions/upload-artifact@v4
    with:
      name: ci-diagnostics
      path: out/ci-diagnostics.txt

  - name: Full build with stacktrace (capture to file)
    env:
      GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx3g"
    run: |
      set -o pipefail
      ./gradlew build --no-daemon --stacktrace 2>&1 | tee gradle-build.log || true
  - name: Upload build log
    uses: actions/upload-artifact@v4
    with:
      name: gradle-build-log
      path: gradle-build.log

  - name: Build Kotlin plugin subproject if present
    run: |
      set -o pipefail
      if ./gradlew :kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :kotlin subproject -> building it"
        ./gradlew :kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
        echo "Uploading kotlin-subproject-build.log"
        ls -la kotlin-subproject-build.log || true
      elif ./gradlew :plugin:kotlin:tasks --dry-run &>/dev/null; then
        echo "Detected :plugin:kotlin subproject -> building it"
        ./gradlew :plugin:kotlin:build --no-daemon --stacktrace 2>&1 | tee kotlin-subproject-build.log || true
      else
        echo "No explicit kotlin plugin subproject found; running assemble on all projects"
        ./gradlew assemble --no-daemon --stacktrace 2>&1 | tee assemble.log || true
      fi
  - name: Upload kotlin-subproject/build logs if present
    uses: actions/upload-artifact@v4
    with:
      name: kotlin-subproject-logs
      path: |
        kotlin-subproject-build.log
        assemble.log
        || true

File: scripts/ci/inspect_gradle_kotlin_versions.sh

#!/usr/bin/env bash
set -eu

Print Gradle wrapper distribution URL

if [ -f gradle/wrapper/gradle-wrapper.properties ]; then
echo "== gradle-wrapper.properties =="
grep -i distributionUrl gradle/wrapper/gradle-wrapper.properties || true
echo
fi

Print gradle.properties if present

if [ -f gradle.properties ]; then
echo "== gradle.properties =="
cat gradle.properties || true
echo
fi

Search for Kotlin Gradle plugin references

echo "== Kotlin plugin references (searching for kotlin-gradle-plugin and org.jetbrains.kotlin) =="
grep -R --line-number --color=never "kotlin-gradle-plugin" || true
grep -R --line-number --color=never "org.jetbrains.kotlin" || true

Print build.gradle(.kts) files header lines to show plugin versions where declared

for f in $(git ls-files ".gradle" ".gradle.kts" 2>/dev/null || true); do
echo "---- $f ----"
sed -n '1,200p' "$f" | sed -n '1,60p'
echo
done

Print settings.gradle(.kts)

for f in $(git ls-files "settings.gradle" "settings.gradle.kts" 2>/dev/null || true); do
echo "---- $f ----"
sed -n '1,200p' "$f" | sed -n '1,60p'
echo
done

Print the kotlin plugin versions extracted via a rough regex

echo "== Extracted candidate versions =="
grep -R --line-number --color=never "kotlin-gradle-plugin[:=][^\n]*" || true

Make the script executable and ensure workflow runs it as shown above.

PR description guidance:

Title: CI: build Kotlin plugin on PRs and diagnostics

Body: This PR adds a GitHub Actions workflow (.github/workflows/kotlin-ci.yml) that runs on pull_request (opened, synchronize, reopened) and push to main. It runs a JDK matrix (11 and 17), caches Gradle, runs a diagnostics script, runs ./gradlew build --stacktrace while capturing gradle-build.log, attempts to build common kotlin plugin subprojects, and uploads artifacts (ci-diagnostics, gradle-build-log, kotlin-subproject logs) to help diagnose the Gradle HasConvention failure seen in CI.

The PR also adds scripts/ci/inspect_gradle_kotlin_versions.sh which prints the Gradle wrapper distribution URL, searches for kotlin-gradle-plugin and org.jetbrains.kotlin references, and prints portions of build files to help identify incompatible versions.

Please review and merge; if CI reproduces the HasConvention failure the uploaded artifacts will contain full stacktraces and diagnostic output useful for fixing the Kotlin/Gradle version compatibility. Suggested next steps include aligning the Gradle wrapper version (gradle/wrapper/gradle-wrapper.properties) with a Kotlin Gradle plugin version known to be compatible, or adjusting the kotlin-gradle-plugin version in build files.

Branch: ci/add-kotlin-plugin-ci-and-diagnostics
Base branch: main

Please create the PR and return the PR URL and a short summary of actions performed.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
path: |
~/.gradle/caches
~/.gradle/wrapper
ide-plugins/.gradle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot this is the right path gradle is only inside that folder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 1d9e255. All gradle commands now run from the ide-plugins directory using working-directory: ide-plugins.

Copilot AI changed the title [WIP] Add GitHub Actions workflow for Kotlin plugin CI Add CI workflow and diagnostics for Gradle HasConvention failure Nov 11, 2025
Copilot AI requested a review from Mte90 November 11, 2025 17:45
Copilot finished work on behalf of Mte90 November 11, 2025 17:45
@Mte90
Copy link
Member

Mte90 commented Nov 11, 2025

@copilot jobs: build-kotlin-plugin: name: Build (matrix: Java ${{ matrix.java-version }}) Check failure on line 11 in .github/workflows/kotlin-ci.yml GitHub Actions / .github/workflows/kotlin-ci.yml Invalid workflow file You have an error in your yaml syntax on line 11

Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copilot finished work on behalf of Mte90 November 11, 2025 17:50
@Mte90 Mte90 marked this pull request as ready for review November 11, 2025 17:51
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot jobs: build-kotlin-plugin: name: Build (matrix: Java ${{ matrix.java-version }}) Check failure on line 11 in .github/workflows/kotlin-ci.yml GitHub Actions / .github/workflows/kotlin-ci.yml I...

Fixed in commit 2adb10e. Added single quotes around the name fields containing template expressions (${{ }}), which is required by YAML syntax.

Copilot AI requested a review from Mte90 November 11, 2025 17:54
Copilot finished work on behalf of Mte90 November 11, 2025 17:54
Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copilot finished work on behalf of Mte90 November 11, 2025 17:58
@Mte90
Copy link
Member

Mte90 commented Nov 11, 2025

@copilot I don't believe that you fixed it with removing that settings

Co-authored-by: Mte90 <403283+Mte90@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 11, 2025

@copilot I don't believe that you fixed it with removing that settings

You're correct - I shouldn't have removed the permissions section. Fixed in commit d94943d. Restored permissions: contents: read which is a security best practice to limit the workflow's access to only what's needed.

Copilot finished work on behalf of Mte90 November 11, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants