You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2026/07/26 20:33:31 UTC

(grails-intellij-plugin) 11/35: Add the Groovy convention plugins and convert hibernate as a pilot

This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/grails-intellij-plugin.git

commit cb817c4c141aa7179a690bd59f3822b511425276
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Sun Jul 26 11:08:08 2026 -0400

    Add the Groovy convention plugins and convert hibernate as a pilot
    
    Step 2 of the restructure: authors the convention plugins that the tiered
    projects will apply, and converts one module (hibernate) to prove the whole
    chain end to end. hibernate/build.gradle is now 27 lines of pure content,
    down from 68, and still produces intellij.groovy.grails.hibernate.jar.
    
    Plugins added under build-logic/src/main/groovy:
      base, java, java-legacy (+LegacyBytecodeExtension), kotlin, test,
      intellij-platform, intellij-plugin, intellij-module, lib, intellij-lib,
      rat, coverage-aggregation, and a transitional legacy-layout.
    
    Corrections to the plan, found by testing rather than reading:
    
    * archivesName does NOT name the shipped artifact for IPGP projects. hibernate
      ships intellij.groovy.grails.hibernate.jar (its composedJar pin) while
      hibernate-262.0.0-base.jar is a throwaway intermediate, and gradle-tooling
      ships "Grails IntelliJ Plugin.gradle-tooling.jar" rather than its
      archivesName. IPGP's ComposedJarTask applies its own archiveBaseName
      convention after the base plugin's, so composedJar.archiveBaseName is the
      only knob that decides what users get. Both are now set, with the pin
      carrying the comment explaining which one matters.
    
    * IPGP registers THREE extensions named intellijPlatform -- on the Project, on
      RepositoryHandler and on DependencyHandler. Groovy resolves closures
      owner-first, so a bare `intellijPlatform { }` nested inside `repositories { }`
      resolves to the PROJECT extension and dies with "Could not find method
      defaultRepositories()". Kotlin scopes by receiver type and has no such clash.
      Every nested closure now binds its target to an explicit parameter.
    
    * A convention plugin that configures the intellijPlatform extensions must
      apply org.jetbrains.intellij.platform.base itself. Relying on the consuming
      tier plugin to apply .module afterwards is too late: the script body runs
      first, when the extensions do not yet exist.
    
    * rat had outputs.upToDateWhen { false } but RatTask is @CacheableTask and
      org.gradle.caching=true, so a build-cache hit skipped the audit entirely.
      Added outputs.cacheIf { false }.
    
    * The rat convention plugin applies lifecycle-base. RatPlugin hooks rat into
      `check` only via plugins.withType(LifecycleBasePlugin), so once the root
      project stops applying java, `./gradlew check buildPlugin` in CI would have
      silently stopped auditing licences.
    
    * jacoco-report-aggregation only auto-registers <suite>CodeCoverageReport for
      projects applying jvm-test-suite. The root compiles nothing, so the report is
      registered explicitly -- this keeps the XML at the path coverage.yml uploads
      instead of moving it under plugin/.
    
    Also drops kotlin.jvm from i18n, which applies it with zero Kotlin sources.
---
 .../org.apache.grails.intellij.build.base.gradle   | 28 +++++++
 ...ails.intellij.build.coverage-aggregation.gradle | 46 ++++++++++
 ...pache.grails.intellij.build.intellij-lib.gradle | 42 ++++++++++
 ...he.grails.intellij.build.intellij-module.gradle | 50 +++++++++++
 ....grails.intellij.build.intellij-platform.gradle | 49 +++++++++++
 ...he.grails.intellij.build.intellij-plugin.gradle | 98 ++++++++++++++++++++++
 ...apache.grails.intellij.build.java-legacy.gradle | 39 +++++++++
 .../org.apache.grails.intellij.build.java.gradle   | 45 ++++++++++
 .../org.apache.grails.intellij.build.kotlin.gradle | 34 ++++++++
 ...ache.grails.intellij.build.legacy-layout.gradle | 40 +++++++++
 .../org.apache.grails.intellij.build.lib.gradle    | 28 +++++++
 .../org.apache.grails.intellij.build.rat.gradle    | 96 +++++++++++++++++++++
 .../org.apache.grails.intellij.build.test.gradle   | 31 +++++++
 hibernate/build.gradle                             | 27 ++++++
 hibernate/build.gradle.kts                         | 64 --------------
 i18n/build.gradle.kts                              |  8 --
 16 files changed, 653 insertions(+), 72 deletions(-)

diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.base.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.base.gradle
new file mode 100644
index 0000000..51fc71c
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.base.gradle
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Conventions shared by every project, including ones that compile nothing.
+
+plugins {
+    id 'org.apache.grails.intellij.build.reproducible'
+}
+
+repositories {
+    mavenCentral()
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.coverage-aggregation.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.coverage-aggregation.gradle
new file mode 100644
index 0000000..33998cc
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.coverage-aggregation.gradle
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.gradle.testing.jacoco.plugins.JacocoCoverageReport
+
+// Cross-project JaCoCo aggregation, applied to the root project so the report path that CI
+// uploads (build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml) is unchanged
+// by the restructure.
+//
+// jacoco-report-aggregation only auto-registers <suite>CodeCoverageReport for projects that
+// apply jvm-test-suite, and the root project compiles nothing. The report is therefore
+// registered explicitly here; without this the task simply would not exist and the coverage
+// workflow would fail with "task not found".
+//
+// Report formats are configured by org.apache.grails.intellij.build.jacoco where it is applied;
+// this project has no test suite of its own, so the formats are set on the aggregate directly.
+
+plugins {
+    id 'jacoco-report-aggregation'
+}
+
+reporting.reports.register('testCodeCoverageReport', JacocoCoverageReport) { report ->
+    report.testSuiteName = 'test'
+}
+
+tasks.named('testCodeCoverageReport') { task ->
+    task.reports.xml.required = true
+    task.reports.html.required = true
+    task.reports.csv.required = false
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-lib.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-lib.gradle
new file mode 100644
index 0000000..d6ce900
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-lib.gradle
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// A support library that compiles against the IntelliJ Platform. Same tier as
+// org.apache.grails.intellij.build.lib, but it applies the platform module plugin.
+//
+// The composed jar name is pinned rather than derived by IPGP, whose default is
+// "${rootProject.name}.${project.path with ':' replaced by '.'}". That default is why these
+// jars are currently called "Grails IntelliJ Plugin.jps-plugin.jar" -- it tracks both
+// rootProject.name and the project's depth in the tree, so nesting these projects or renaming
+// the root would silently rename them. plugin.xml's compileServer.plugin classpath names two
+// of these jars literally, so the name has to be stable and space-free.
+
+plugins {
+    id 'org.apache.grails.intellij.build.intellij-platform'
+    id 'org.jetbrains.intellij.platform.module'
+}
+
+def shortName = projectDir.name
+
+group = 'org.apache.grails.intellij.lib'
+base.archivesName = shortName
+
+tasks.named('composedJar') { task ->
+    task.archiveBaseName = "org.apache.grails.intellij.lib.$shortName"
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-module.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-module.gradle
new file mode 100644
index 0000000..a902eac
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-module.gradle
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// An IntelliJ *content module* (plugin.xml <content><module name="..."/></content>).
+//
+// NAMING IS A RUNTIME CONTRACT. The platform resolves a content module from
+// lib/modules/<module-name>.jar and reads its descriptor from <module-name>.xml at that jar's
+// root, so three things must agree exactly: the <module name> in plugin.xml, the descriptor
+// file name, and the composed jar's base name. Getting it wrong builds a valid ZIP that fails
+// to load the module at IDE runtime -- invisible to compilation, tests and verifyPlugin.
+//
+// The name is derived from the project DIRECTORY, not project.name: projects are named with
+// their subpath built in (pluginModules-hibernate), so project.name carries a prefix that must
+// not leak into the module name.
+//
+// archivesName only renames the throwaway -base/-instrumented intermediates; IPGP's
+// ComposedJarTask applies its own archiveBaseName convention afterwards, so the pin below is
+// what actually determines the shipped file name.
+
+plugins {
+    id 'org.apache.grails.intellij.build.intellij-platform'
+    id 'org.jetbrains.intellij.platform.module'
+}
+
+def shortName = projectDir.name
+
+group = 'org.apache.grails.intellij.module'
+base.archivesName = shortName
+
+// Prefix is changed to 'org.apache.grails.intellij.module.' in the content-module rename step;
+// deriving it here is what keeps the three coupled strings from drifting apart again.
+tasks.named('composedJar') { task ->
+    task.archiveBaseName = "intellij.groovy.grails.$shortName"
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-platform.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-platform.gradle
new file mode 100644
index 0000000..c660c33
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-platform.gradle
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Shared IntelliJ Platform wiring: the artifact repositories and the platform dependency.
+// The IPGP version comes from build-logic's classpath, so this is applied without a version.
+//
+// EVERY closure below binds its target to an explicit parameter, and that is load-bearing.
+// IPGP registers THREE extensions all named `intellijPlatform` -- one on the Project, one on
+// RepositoryHandler, one on DependencyHandler. Groovy closures resolve owner-first, so a bare
+// `intellijPlatform { }` nested inside `repositories { }` or `dependencies { }` resolves to the
+// PROJECT extension and fails with "Could not find method defaultRepositories() ... on extension
+// 'intellijPlatform'". Kotlin's DSL scopes by receiver type, so it has no such clash.
+
+plugins {
+    id 'org.apache.grails.intellij.build.java'
+    // Registers the intellijPlatform extensions used below. The consuming tier plugin adds
+    // the full plugin (.platform) or module (.module) variant on top; both re-apply this base
+    // idempotently. Without it, this script's body runs before any IPGP plugin is applied and
+    // the repository/dependency extensions do not exist yet.
+    id 'org.jetbrains.intellij.platform.base'
+}
+
+repositories { repositoryHandler ->
+    repositoryHandler.intellijPlatform { repos ->
+        repos.defaultRepositories()
+    }
+}
+
+dependencies { dependencyHandler ->
+    dependencyHandler.intellijPlatform { platform ->
+        platform.intellijIdea providers.gradleProperty('platformVersion')
+    }
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-plugin.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-plugin.gradle
new file mode 100644
index 0000000..247590c
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.intellij-plugin.gradle
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.jetbrains.intellij.platform.gradle.tasks.PrepareSandboxTask
+import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask
+
+// The IntelliJ plugin project itself. Everything here is plugin-wide configuration that has no
+// second consumer; it lives in a convention plugin so plugin/build.gradle carries only content
+// (the bundled-plugin list and project dependencies).
+
+plugins {
+    id 'org.apache.grails.intellij.build.intellij-platform'
+    id 'org.apache.grails.intellij.build.kotlin'
+    id 'org.jetbrains.intellij.platform'
+}
+
+group = 'org.apache.grails.intellij'
+
+intellijPlatform {
+    // Pinned explicitly. This drives the distribution ZIP name, the plugin directory inside it,
+    // and the sandbox directory; its convention is project.name, which would make all three
+    // 'plugin'. It is NOT the Marketplace display name -- that comes from <name> in plugin.xml.
+    projectName = 'apache-grails-intellij-plugin'
+
+    pluginConfiguration {
+        ideaVersion {
+            sinceBuild = providers.gradleProperty('pluginSinceBuild')
+        }
+        changeNotes = ''
+    }
+
+    pluginVerification {
+        // the legacy plugin id org.intellij.grails is grandfathered on Marketplace and
+        // permanent (see MIGRATION-PLAN.md decision 2); mute the new-plugin naming check
+        freeArgs = ['-mute', 'TemplateWordInPluginId']
+        // gate on real incompatibilities only; the inherited internal/deprecated API
+        // usages are a tracked cleanup item, not a release blocker
+        failureLevel = [
+                VerifyPluginTask.FailureLevel.COMPATIBILITY_PROBLEMS,
+                VerifyPluginTask.FailureLevel.MISSING_DEPENDENCIES,
+                VerifyPluginTask.FailureLevel.INVALID_PLUGIN,
+        ]
+        ides {
+            recommended()
+        }
+    }
+
+    // JetBrains Marketplace code signing / publishing; secrets provided by the release workflow.
+    // Providers are assigned rather than read, so absent secrets neither fail configuration nor
+    // land in the configuration cache.
+    signing {
+        certificateChain = providers.environmentVariable('CERTIFICATE_CHAIN')
+        privateKey = providers.environmentVariable('PRIVATE_KEY')
+        password = providers.environmentVariable('PRIVATE_KEY_PASSWORD')
+    }
+
+    publishing {
+        token = providers.environmentVariable('PUBLISH_TOKEN')
+    }
+}
+
+// The composed jar is what ships in lib/; its base name is conventioned from project.name and
+// ignores archivesName, so it is pinned for the same reason projectName is.
+tasks.named('composedJar') { task ->
+    task.archiveBaseName = 'apache-grails-intellij-plugin'
+}
+
+// ASF policy: ship LICENSE and NOTICE inside the plugin jar. They live at the repository root,
+// which is the settings directory rather than this project's directory.
+tasks.named('processResources') { task ->
+    task.from(layout.settingsDirectory.file('LICENSE')) { into 'META-INF' }
+    task.from(layout.settingsDirectory.file('NOTICE')) { into 'META-INF' }
+}
+
+// standardDsls/ is packaged as loose files under <plugin>/lib/standardDsls/ rather than as jar
+// resources, so it is excluded from the resource set and copied into the sandbox instead.
+// pluginName is a Property mapped lazily so it tracks projectName above.
+tasks.withType(PrepareSandboxTask).configureEach { task ->
+    task.from(layout.projectDirectory.dir('standardDsls')) {
+        into task.pluginName.map { "$it/lib/standardDsls/" }
+    }
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.java-legacy.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.java-legacy.gradle
new file mode 100644
index 0000000..8cc4b87
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.java-legacy.gradle
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.grails.intellij.build.LegacyBytecodeExtension
+
+// For projects whose output runs inside an end user's JVM (Grails builds, the JPS build
+// process) and therefore must emit older bytecode than the IntelliJ platform's Java level.
+//
+// Usage, in the consuming build file:
+//     legacyBytecode { release = 11 }
+
+plugins {
+    id 'org.apache.grails.intellij.build.java'
+}
+
+def legacyBytecode = extensions.create('legacyBytecode', LegacyBytecodeExtension)
+legacyBytecode.release.convention(8)
+
+// options.release wins over source/targetCompatibility, and is re-applied here because the
+// IntelliJ Platform Gradle Plugin force-sets it to the platform's Java version.
+tasks.withType(JavaCompile).configureEach { task ->
+    task.options.release.set(legacyBytecode.release)
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.java.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.java.gradle
new file mode 100644
index 0000000..08c62c2
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.java.gradle
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Java compilation conventions for every project that compiles code, plus the per-project
+// hygiene plugins so subproject build files do not have to list them.
+
+plugins {
+    id 'java'
+    id 'org.apache.grails.intellij.build.base'
+    id 'org.apache.grails.intellij.build.jacoco'
+    id 'org.apache.grails.intellij.build.vulnerability-scan'
+    id 'org.apache.grails.intellij.build.test'
+}
+
+def platformJavaVersion = providers.gradleProperty('platformJavaVersion')
+
+java.sourceCompatibility = platformJavaVersion.get()
+java.targetCompatibility = platformJavaVersion.get()
+
+// Checked-in generated sources (JFlex lexers) live in their own root so regenerating them
+// cannot clobber hand-written code. This is the only source-layout override that survives
+// the restructure.
+sourceSets.named('main') { main ->
+    main.java.srcDir 'src/main/gen'
+}
+
+tasks.withType(JavaCompile).configureEach { task ->
+    task.options.encoding = 'UTF-8'
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.kotlin.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.kotlin.gradle
new file mode 100644
index 0000000..7c3571b
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.kotlin.gradle
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+
+// Kotlin conventions. The version comes from build-logic's plugin classpath, so consuming
+// build files apply this without a version -- previously 'org.jetbrains.kotlin.jvm' was
+// declared with an explicit version in five separate places.
+
+plugins {
+    id 'org.jetbrains.kotlin.jvm'
+    id 'org.apache.grails.intellij.build.java'
+}
+
+def platformJavaVersion = providers.gradleProperty('platformJavaVersion')
+
+// No toolchain on purpose: the JDK is pinned via .sdkmanrc for reproducible builds.
+kotlin.compilerOptions.jvmTarget.set(JvmTarget.fromTarget(platformJavaVersion.get()))
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.legacy-layout.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.legacy-layout.gradle
new file mode 100644
index 0000000..663f4f0
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.legacy-layout.gradle
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// TRANSITIONAL. Declares the pre-restructure source layout inherited from the JetBrains JPS
+// monorepo (src/, gen/, resources/, compatibilityResources/, test/) so that the convention
+// plugins can be introduced before any files move.
+//
+// Every project applies this while the restructure is in flight; it is deleted once all three
+// tiers have been normalized to src/main/java, src/main/resources and src/test/java. Declaring
+// a srcDir that does not exist is harmless, so one shared block covers all projects even
+// though only the plugin project has gen/, compatibilityResources/ and test/.
+//
+// Do NOT add anything here that is not purely about the old layout.
+
+sourceSets.named('main') { main ->
+    main.java.srcDir 'src'
+    main.java.srcDir 'gen'
+    main.resources.srcDir 'resources'
+    main.resources.srcDir 'compatibilityResources'
+}
+
+sourceSets.named('test') { test ->
+    test.java.srcDir 'test'
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.lib.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.lib.gradle
new file mode 100644
index 0000000..86fe2ea
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.lib.gradle
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// A plain support library: compiled and bundled into the plugin's lib/ directory, but not an
+// IntelliJ content module and not published.
+
+plugins {
+    id 'org.apache.grails.intellij.build.java'
+}
+
+group = 'org.apache.grails.intellij.lib'
+base.archivesName = projectDir.name
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.rat.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.rat.gradle
new file mode 100644
index 0000000..883d127
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.rat.gradle
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Apache RAT license audit. Applied to the root project only: the exclude patterns below are
+// anchored at the audited directory, which is the project that owns the task.
+//
+// lifecycle-base is applied because RatPlugin hooks rat into `check` via
+// plugins.withType(LifecycleBasePlugin). Without it the root has no `check` task and
+// `./gradlew check buildPlugin` in CI would stop auditing licences -- a green build that
+// verifies nothing.
+
+plugins {
+    id 'lifecycle-base'
+    id 'org.nosphere.apache.rat'
+}
+
+// Every exclude must carry a justification; no blanket excludes to make the audit pass.
+tasks.named('rat') { task ->
+    task.excludes.addAll([
+            // planning documents, removed before the first release
+            'MIGRATION-PLAN.md',
+            'IMPROVEMENT-PLAN.md',
+            // documentation
+            '**/README.md',
+            // git configuration isn't code
+            '**/.gitignore',
+            '**/.gitattributes',
+            // gradle wrapper files, excluded from the source distro
+            'gradlew*',
+            'gradle/wrapper/**',
+            '**/.gradle/**',
+            // github/ASF infra configuration, not shipped in the source distro
+            '.github/**',
+            '.asf.yaml',
+            // IDE-generated files
+            '.idea/**',
+            '**/*.iml',
+            'out/**',
+            // IntelliJ Platform Gradle Plugin local cache (generated Ivy descriptors, git-ignored)
+            '.intellijPlatform/**',
+            // build-logic included build: generated output and local caches (sources are headered)
+            'build-logic/build/**',
+            'build-logic/.gradle/**',
+            // reproducible-build and release-verification output (git-ignored)
+            'etc/bin/results/**',
+            // generated code (JFlex lexers; headers are injected by the generator config)
+            'gen/**',
+            '**/src/main/gen/**',
+            // test fixtures: content *is* the test input (mock Grails projects/JARs);
+            // adding headers would break parser/position-sensitive tests
+            'testdata/**',
+            '**/testdata/**',
+            // file templates that materialize inside end-user projects
+            '**/resources/fileTemplates/**',
+            // intention/inspection description snippets and before/after templates
+            // rendered verbatim in the IDE settings UI
+            '**/intentionDescriptions/**',
+            '**/inspectionDescriptions/**',
+            // html files are IDE description snippets / template previews only
+            '**/*.html',
+            // GUI-designer .form files are machine-edited XML
+            '**/*.form',
+            // images
+            '**/*.png', '**/*.svg', '**/*.ico', '**/*.jpg', '**/*.gif',
+            // JAR manifest format has no comment syntax
+            '**/META-INF/MANIFEST.MF',
+            // build outputs are generated and never shipped in the source distro. Anchored to
+            // explicit depths rather than "**/build/**" so a source package named "build" would
+            // still be audited. Three levels are needed: the root, the tier directories, and the
+            // nested projects under pluginModules/ and libs/.
+            'build/**',
+            '*/build/**',
+            '*/*/build/**',
+    ])
+    // Never let a license audit be skipped. upToDateWhen alone is not enough: RatTask is
+    // @CacheableTask and org.gradle.caching=true, so a build-cache hit would skip the audit
+    // entirely even though it can never be considered up to date.
+    task.outputs.upToDateWhen { false }
+    task.outputs.cacheIf { false }
+}
diff --git a/build-logic/src/main/groovy/org.apache.grails.intellij.build.test.gradle b/build-logic/src/main/groovy/org.apache.grails.intellij.build.test.gradle
new file mode 100644
index 0000000..a56fd35
--- /dev/null
+++ b/build-logic/src/main/groovy/org.apache.grails.intellij.build.test.gradle
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Test conventions.
+
+def ideaHome = providers.gradleProperty('test.idea.home.path')
+
+tasks.withType(Test).configureEach { task ->
+    // Opt-in for the handful of tests that need IntelliJ sources on disk. Unset on CI, and
+    // ignored when it points somewhere that does not exist, so a stale value in a developer's
+    // gradle.properties cannot fail the build.
+    if (ideaHome.isPresent() && file(ideaHome.get()).exists()) {
+        task.systemProperty 'idea.home.path', ideaHome.get()
+    }
+}
diff --git a/hibernate/build.gradle b/hibernate/build.gradle
new file mode 100644
index 0000000..640e48c
--- /dev/null
+++ b/hibernate/build.gradle
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000-2026 JetBrains s.r.o. and contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+plugins {
+    id 'org.apache.grails.intellij.build.intellij-module'
+    id 'org.apache.grails.intellij.build.legacy-layout'
+}
+
+dependencies { deps ->
+    deps.intellijPlatform { platform ->
+        platform.bundledPlugin 'com.intellij.hibernate'
+    }
+
+    compileOnly project(':')
+}
diff --git a/hibernate/build.gradle.kts b/hibernate/build.gradle.kts
deleted file mode 100644
index ff36d98..0000000
--- a/hibernate/build.gradle.kts
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2000-2026 JetBrains s.r.o. and contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-fun properties(key: String) = project.findProperty(key).toString()
-
-plugins {
-    id("java")
-    id("org.apache.grails.intellij.build.reproducible")
-    id("org.apache.grails.intellij.build.jacoco")
-    id("org.apache.grails.intellij.build.vulnerability-scan")
-    id("org.jetbrains.intellij.platform.module")
-}
-
-group = "org.apache.grails.intellij.hibernate"
-
-repositories {
-    mavenCentral()
-    intellijPlatform {
-        defaultRepositories()
-    }
-}
-
-dependencies {
-    intellijPlatform {
-        intellijIdea(properties("platformVersion"))
-        bundledPlugin("com.intellij.hibernate")
-    }
-
-    compileOnly(project(":"))
-}
-
-java.sourceSets["main"].java {
-    srcDir("src")
-}
-
-java.sourceSets["main"].resources {
-    srcDir("resources")
-}
-
-tasks {
-        withType<JavaCompile> {
-        sourceCompatibility = properties("platformJavaVersion")
-        targetCompatibility = properties("platformJavaVersion")
-    }
-
-}
-
-// 2026.2 resolves content-module descriptors from lib/modules/<module-name>.jar,
-// so the composed jar must be named after the content module, not the project
-tasks.named<org.jetbrains.intellij.platform.gradle.tasks.ComposedJarTask>("composedJar") {
-    archiveBaseName = "intellij.groovy.grails.hibernate"
-}
diff --git a/i18n/build.gradle.kts b/i18n/build.gradle.kts
index efd45f1..c83209a 100644
--- a/i18n/build.gradle.kts
+++ b/i18n/build.gradle.kts
@@ -20,7 +20,6 @@ plugins {
     id("org.apache.grails.intellij.build.reproducible")
     id("org.apache.grails.intellij.build.jacoco")
     id("org.apache.grails.intellij.build.vulnerability-scan")
-    id("org.jetbrains.kotlin.jvm") version "2.3.0"
     id("org.jetbrains.intellij.platform.module")
 }
 
@@ -43,13 +42,6 @@ dependencies {
     compileOnly(project(":"))
 }
 
-kotlin {
-    // no toolchain on purpose: the JDK is pinned via .sdkmanrc for reproducible builds
-    compilerOptions {
-        jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.fromTarget(properties("platformJavaVersion"))
-    }
-}
-
 java.sourceSets["main"].java {
     srcDir("src")
 }