diff --git a/buildSrc/src/main/kotlin/Version.kt b/buildSrc/src/main/kotlin/Version.kt index f2558fe080..f91fcf6550 100644 --- a/buildSrc/src/main/kotlin/Version.kt +++ b/buildSrc/src/main/kotlin/Version.kt @@ -3,8 +3,9 @@ import io.github.rhdunn.intellij.IntelliJVersion import org.gradle.api.GradleException +@Suppress("ConstPropertyName") object Version { - /** + /** * The version of the Kotlin compiler and runtime. * * `SPDX-License-Identifier: Apache-2.0` @@ -27,4 +28,37 @@ object Version { intellij.buildVersion >= 223 -> 17 else -> throw GradleException("Unsupported version of IntelliJ: $intellij") } + + /** + * Versions of the various libraries used by the project. + */ + object Dependency { + /** + * The version of the `junit` test library. + * + * `SPDX-License-Identifier: EPL-2.0` + */ + const val JUnit5 = "5.9.1" + + /** + * The version of the `junit` test library. + * + * `SPDX-License-Identifier: EPL-2.0` + */ + const val JUnitPlatform = "1.9.1" + + /** + * The version of the `jsoup` package. + * + * `SPDX-License-Identifier: MIT` + */ + const val JSoup = "1.15.4" + + /** + * The version of the `saxon` XQuery and XSLT HE processor. + * + * `SPDX-License-Identifier: MPL-2.0` + */ + const val Saxon = "9.9.1-7" + } } diff --git a/src/intellij-compat/build.gradle b/src/intellij-compat/build.gradle deleted file mode 100644 index f0fa6bb22f..0000000000 --- a/src/intellij-compat/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ -ext.intellij_version = project.property("idea_since_build") -ext.intellij_type = project.property("idea_type") - -version = ext.intellij_version - -if (ext.intellij_version >= 231) { - sourceSets.main.java.srcDirs += "src/231/native" -} else { - sourceSets.main.java.srcDirs += "src/231/compat" -} - -if (ext.intellij_version >= 232) { - sourceSets.main.java.srcDirs += "src/232/native" -} else { - sourceSets.main.java.srcDirs += "src/232/compat" -} - -if (ext.intellij_version >= 233) { - sourceSets.main.java.srcDirs += "src/233/native" -} else { - sourceSets.main.java.srcDirs += "src/233/compat" -} - -if (ext.intellij_version >= 242) { - sourceSets.main.java.srcDirs += "src/242/native" -} else { - sourceSets.main.java.srcDirs += "src/242/compat" -} - -if (ext.intellij_version >= 242) { - sourceSets.main.java.srcDirs += "src/233-242/native" -} else if (ext.intellij_version >= 233) { - sourceSets.main.java.srcDirs += "src/233-242/233" -} else { - sourceSets.main.java.srcDirs += "src/233-242/232" -} - -if (ext.intellij_version >= 243) { - sourceSets.main.java.srcDirs += "src/243/native" -} else { - sourceSets.main.java.srcDirs += "src/243/compat" -} - -// Microservices - -if (ext.intellij_type == "IU") { - if (ext.intellij_version >= 231) { - sourceSets.main.java.srcDirs += "src/microservices/IU-231" - } else { - sourceSets.main.java.srcDirs += "src/microservices/IU-203" - } -} else { - sourceSets.main.java.srcDirs += "src/microservices/IC-203" -} diff --git a/src/intellij-compat/build.gradle.kts b/src/intellij-compat/build.gradle.kts new file mode 100644 index 0000000000..5fb2990bdb --- /dev/null +++ b/src/intellij-compat/build.gradle.kts @@ -0,0 +1,57 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + +val platformVersion = BuildConfiguration.getPlatformVersion(project) +val platformType = BuildConfiguration.getPlatformType(project) + +version = platformVersion.buildVersion + +// IntelliJ 2022.3 to IntelliJ 2024.3 compatibility APIs +kotlin.sourceSets.main { + val srcDirs = mutableListOf() + + // IntelliJ 2023.1 + srcDirs += when { + platformVersion.buildVersion >= 231 -> "src/231/native" + else -> "src/231/compat" + } + + // IntelliJ 2023.2 + srcDirs += when { + platformVersion.buildVersion >= 232 -> "src/232/native" + else -> "src/232/compat" + } + + // IntelliJ 2023.3 + srcDirs += when { + platformVersion.buildVersion >= 233 -> "src/233/native" + else -> "src/233/compat" + } + + // IntelliJ 2024.2 + srcDirs += when { + platformVersion.buildVersion >= 242 -> "src/242/native" + else -> "src/242/compat" + } + srcDirs += when { + platformVersion.buildVersion >= 242 -> "src/233-242/native" + platformVersion.buildVersion >= 233 -> "src/233-242/233" + else -> "src/233-242/232" + } + + // IntelliJ 2024.3 + srcDirs += when { + platformVersion.buildVersion >= 243 -> "src/243/native" + else -> "src/24/3/compat" + } + + // Microservices + srcDirs += when (platformType) { + "IU" -> when { + platformVersion.buildVersion >= 231 -> "src/microservices/IU-231" + else -> "src/microservices/IU-203" + } + else -> "src/microservices/IC-203" + } + + kotlin.srcDirs(srcDirs) +} diff --git a/src/intellij-test/build.gradle b/src/intellij-test/build.gradle.kts similarity index 83% rename from src/intellij-test/build.gradle rename to src/intellij-test/build.gradle.kts index 454b0d9252..f6ca744fd0 100644 --- a/src/intellij-test/build.gradle +++ b/src/intellij-test/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") } @@ -15,7 +17,7 @@ dependencies { } // Include the testFramework dependency in the main build dependencies. -configurations.getByName("intellijPlatformTestDependencies").dependencies.each { dependency -> +configurations.getByName("intellijPlatformTestDependencies").dependencies.forEach { dependency -> dependencies { implementation("${dependency.group}:${dependency.name}:${dependency.version}") } diff --git a/src/kotlin-intellij/build.gradle b/src/kotlin-intellij/build.gradle.kts similarity index 74% rename from src/kotlin-intellij/build.gradle rename to src/kotlin-intellij/build.gradle.kts index a229643ffb..2cc97e4d47 100644 --- a/src/kotlin-intellij/build.gradle +++ b/src/kotlin-intellij/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") } diff --git a/src/lang-core/build.gradle b/src/lang-core/build.gradle.kts similarity index 77% rename from src/lang-core/build.gradle rename to src/lang-core/build.gradle.kts index b118ba8a72..a54d37c1ae 100644 --- a/src/lang-core/build.gradle +++ b/src/lang-core/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/lang-java/build.gradle b/src/lang-java/build.gradle.kts similarity index 86% rename from src/lang-java/build.gradle rename to src/lang-java/build.gradle.kts index 8024a426f2..fd34d6667a 100644 --- a/src/lang-java/build.gradle +++ b/src/lang-java/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/lang-xdm/build.gradle b/src/lang-xdm/build.gradle.kts similarity index 88% rename from src/lang-xdm/build.gradle rename to src/lang-xdm/build.gradle.kts index 9a2ee2f816..d7665601dc 100644 --- a/src/lang-xdm/build.gradle +++ b/src/lang-xdm/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/lang-xpath/build.gradle b/src/lang-xpath/build.gradle.kts similarity index 82% rename from src/lang-xpath/build.gradle rename to src/lang-xpath/build.gradle.kts index b642f2790a..3ac1d02840 100644 --- a/src/lang-xpath/build.gradle +++ b/src/lang-xpath/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -8,9 +10,9 @@ kotlin.sourceSets.test { resources.srcDirs("test/resources") } -processResources { - from ("main") { - include "**/*.dic" +tasks.processResources { + from("main") { + include("**/*.dic") } } diff --git a/src/lang-xpm/build.gradle b/src/lang-xpm/build.gradle.kts similarity index 84% rename from src/lang-xpm/build.gradle rename to src/lang-xpm/build.gradle.kts index b89bdf6cdc..5dcbc6e561 100644 --- a/src/lang-xpm/build.gradle +++ b/src/lang-xpm/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/lang-xproc/build.gradle b/src/lang-xproc/build.gradle.kts similarity index 86% rename from src/lang-xproc/build.gradle rename to src/lang-xproc/build.gradle.kts index d5cf9baf1e..0907bdf312 100644 --- a/src/lang-xproc/build.gradle +++ b/src/lang-xproc/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/lang-xqdoc/build.gradle b/src/lang-xqdoc/build.gradle.kts similarity index 84% rename from src/lang-xqdoc/build.gradle rename to src/lang-xqdoc/build.gradle.kts index 97e3f25ee1..595d126074 100644 --- a/src/lang-xqdoc/build.gradle +++ b/src/lang-xqdoc/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/lang-xquery/build.gradle b/src/lang-xquery/build.gradle.kts similarity index 86% rename from src/lang-xquery/build.gradle rename to src/lang-xquery/build.gradle.kts index c9b4b9b297..9b5ef61aab 100644 --- a/src/lang-xquery/build.gradle +++ b/src/lang-xquery/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -8,9 +10,9 @@ kotlin.sourceSets.test { resources.srcDirs("test/resources") } -processResources { - from ("main") { - include "**/*.dic" +tasks.processResources { + from("main") { + include("**/*.dic") } } diff --git a/src/lang-xslt/build.gradle b/src/lang-xslt/build.gradle.kts similarity index 80% rename from src/lang-xslt/build.gradle rename to src/lang-xslt/build.gradle.kts index cc0dfaf7c3..c34c27171b 100644 --- a/src/lang-xslt/build.gradle +++ b/src/lang-xslt/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -8,9 +10,9 @@ kotlin.sourceSets.test { resources.srcDirs("test/resources") } -processResources { - from ("main") { - include "**/*.dic" +tasks.processResources { + from("main") { + include("**/*.dic") } } diff --git a/src/plugin-api/build.gradle b/src/plugin-api/build.gradle.kts similarity index 87% rename from src/plugin-api/build.gradle rename to src/plugin-api/build.gradle.kts index 4a1e3d981d..2f0056a85b 100644 --- a/src/plugin-api/build.gradle +++ b/src/plugin-api/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/plugin-saxon/build.gradle b/src/plugin-basex/build.gradle.kts similarity index 88% rename from src/plugin-saxon/build.gradle rename to src/plugin-basex/build.gradle.kts index bdf6524bc3..0f7e338604 100644 --- a/src/plugin-saxon/build.gradle +++ b/src/plugin-basex/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -10,11 +12,11 @@ kotlin.sourceSets.test { dependencies { implementation(project(":src:kotlin-intellij")) implementation(project(":src:lang-core")) - implementation(project(":src:lang-xpath")) implementation(project(":src:lang-xquery")) implementation(project(":src:lang-xslt")) implementation(project(":src:lang-xdm")) implementation(project(":src:lang-xpm")) + implementation(project(":src:lang-xpath")) implementation(project(":src:plugin-api")) testImplementation(project(":src:intellij-test")) diff --git a/src/plugin-existdb/build.gradle b/src/plugin-existdb/build.gradle.kts similarity index 79% rename from src/plugin-existdb/build.gradle rename to src/plugin-existdb/build.gradle.kts index a65c1007f9..29c165da46 100644 --- a/src/plugin-existdb/build.gradle +++ b/src/plugin-existdb/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -18,6 +20,5 @@ dependencies { testImplementation(project(":src:intellij-test")) - // JSoup - implementation("org.jsoup:jsoup:$jsoup_version") + implementation("org.jsoup:jsoup:${Version.Dependency.JSoup}") } diff --git a/src/plugin-expath/build.gradle b/src/plugin-expath/build.gradle.kts similarity index 85% rename from src/plugin-expath/build.gradle rename to src/plugin-expath/build.gradle.kts index c2e0fcbfe7..e36e6d4866 100644 --- a/src/plugin-expath/build.gradle +++ b/src/plugin-expath/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/plugin-exquery/build.gradle b/src/plugin-exquery/build.gradle.kts similarity index 82% rename from src/plugin-exquery/build.gradle rename to src/plugin-exquery/build.gradle.kts index c8f6f2b59e..657d32cf29 100644 --- a/src/plugin-exquery/build.gradle +++ b/src/plugin-exquery/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") diff --git a/src/plugin-marklogic/build.gradle b/src/plugin-marklogic/build.gradle.kts similarity index 72% rename from src/plugin-marklogic/build.gradle rename to src/plugin-marklogic/build.gradle.kts index e9f176b9b2..84b358959c 100644 --- a/src/plugin-marklogic/build.gradle +++ b/src/plugin-marklogic/build.gradle.kts @@ -1,3 +1,7 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + +val platformVersion = BuildConfiguration.getPlatformVersion(project) + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -11,7 +15,7 @@ kotlin.sourceSets.test { dependencies { intellijPlatform { bundledPlugin("com.intellij.properties") - if (idea_since_build >= 243) { + if (platformVersion.buildVersion >= 243) { bundledPlugin("com.intellij.modules.json") } } @@ -29,9 +33,7 @@ dependencies { testImplementation(project(":src:intellij-test")) - // Saxon HE - runtimeOnly("net.sf.saxon:Saxon-HE:$saxon_version") + runtimeOnly("net.sf.saxon:Saxon-HE:${Version.Dependency.Saxon}") - // JSoup - implementation("org.jsoup:jsoup:$jsoup_version") + implementation("org.jsoup:jsoup:${Version.Dependency.JSoup}") } diff --git a/src/plugin-basex/build.gradle b/src/plugin-saxon/build.gradle.kts similarity index 88% rename from src/plugin-basex/build.gradle rename to src/plugin-saxon/build.gradle.kts index d58bb63847..83b9041b37 100644 --- a/src/plugin-basex/build.gradle +++ b/src/plugin-saxon/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -10,11 +12,11 @@ kotlin.sourceSets.test { dependencies { implementation(project(":src:kotlin-intellij")) implementation(project(":src:lang-core")) + implementation(project(":src:lang-xpath")) implementation(project(":src:lang-xquery")) implementation(project(":src:lang-xslt")) implementation(project(":src:lang-xdm")) implementation(project(":src:lang-xpm")) - implementation(project(":src:lang-xpath")) implementation(project(":src:plugin-api")) testImplementation(project(":src:intellij-test")) diff --git a/src/plugin-w3/build.gradle b/src/plugin-w3/build.gradle.kts similarity index 82% rename from src/plugin-w3/build.gradle rename to src/plugin-w3/build.gradle.kts index 618debadcf..d313da4e3b 100644 --- a/src/plugin-w3/build.gradle +++ b/src/plugin-w3/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources") @@ -20,6 +22,5 @@ dependencies { testImplementation(project(":src:intellij-test")) - // JSoup - implementation("org.jsoup:jsoup:$jsoup_version") + implementation("org.jsoup:jsoup:${Version.Dependency.JSoup}") } diff --git a/src/plugin-xijp/build.gradle b/src/plugin-xijp/build.gradle.kts similarity index 87% rename from src/plugin-xijp/build.gradle rename to src/plugin-xijp/build.gradle.kts index 3eb159a193..44fdf88bee 100644 --- a/src/plugin-xijp/build.gradle +++ b/src/plugin-xijp/build.gradle.kts @@ -1,3 +1,5 @@ +// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 + kotlin.sourceSets.main { kotlin.srcDirs("main") resources.srcDirs("main/resources")