Skip to content

Commit

Permalink
Convert the subproject build.gradle files to kotlin.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhdunn committed Nov 20, 2024
1 parent 418c7e7 commit 340cb65
Show file tree
Hide file tree
Showing 23 changed files with 151 additions and 76 deletions.
36 changes: 35 additions & 1 deletion buildSrc/src/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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"
}
}
54 changes: 0 additions & 54 deletions src/intellij-compat/build.gradle

This file was deleted.

57 changes: 57 additions & 0 deletions src/intellij-compat/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<String>()

// 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)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0

kotlin.sourceSets.main {
kotlin.srcDirs("main")
}
Expand All @@ -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}")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0

kotlin.sourceSets.main {
kotlin.srcDirs("main")
}
Expand Down
2 changes: 2 additions & 0 deletions src/lang-core/build.gradle → src/lang-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 2 additions & 0 deletions src/lang-java/build.gradle → src/lang-java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 2 additions & 0 deletions src/lang-xdm/build.gradle → src/lang-xdm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -8,9 +10,9 @@ kotlin.sourceSets.test {
resources.srcDirs("test/resources")
}

processResources {
from ("main") {
include "**/*.dic"
tasks.processResources {
from("main") {
include("**/*.dic")
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/lang-xpm/build.gradle → src/lang-xpm/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -8,9 +10,9 @@ kotlin.sourceSets.test {
resources.srcDirs("test/resources")
}

processResources {
from ("main") {
include "**/*.dic"
tasks.processResources {
from("main") {
include("**/*.dic")
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/lang-xslt/build.gradle → src/lang-xslt/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -8,9 +10,9 @@ kotlin.sourceSets.test {
resources.srcDirs("test/resources")
}

processResources {
from ("main") {
include "**/*.dic"
tasks.processResources {
from("main") {
include("**/*.dic")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -18,6 +20,5 @@ dependencies {

testImplementation(project(":src:intellij-test"))

// JSoup
implementation("org.jsoup:jsoup:$jsoup_version")
implementation("org.jsoup:jsoup:${Version.Dependency.JSoup}")
}
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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")
}
}
Expand All @@ -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}")
}
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -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"))
Expand Down
5 changes: 3 additions & 2 deletions src/plugin-w3/build.gradle → src/plugin-w3/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -20,6 +22,5 @@ dependencies {

testImplementation(project(":src:intellij-test"))

// JSoup
implementation("org.jsoup:jsoup:$jsoup_version")
implementation("org.jsoup:jsoup:${Version.Dependency.JSoup}")
}
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit 340cb65

Please sign in to comment.