Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try new gradle plugin #302

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,8 @@ jobs:

strategy:
matrix:
product: [ "IC-211", "IC-212", "IC-213", "IC-221", "IC-222", "IC-223", "IC-231", "IC-232", "IC-233", "IC-241", "IC-242" ]
product: [ "IC-223", "IC-231", "IC-232", "IC-233", "IC-241" ]
include:
- product: "IC-211"
java: "11"
distribution: "adopt"
- product: "IC-212"
java: "11"
distribution: "adopt"
- product: "IC-213"
java: "11"
distribution: "adopt"
- product: "IC-221"
java: "11"
distribution: "adopt"
- product: "IC-222"
java: "11"
distribution: "adopt"
- product: "IC-223"
java: "17"
distribution: "temurin"
Expand All @@ -46,9 +31,9 @@ jobs:
- product: "IC-241"
java: "17"
distribution: "temurin"
- product: "IC-242"
java: "17"
distribution: "temurin"
# - product: "IC-242"
# java: "17"
# distribution: "temurin"
max-parallel: 10
fail-fast: false

Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,8 @@ jobs:

strategy:
matrix:
product: [ "IC-211", "IC-212", "IC-213", "IC-221", "IC-222", "IC-223", "IC-231", "IC-232", "IC-233", "IC-241", "IC-242" ]
product: [ "IC-223", "IC-231", "IC-232", "IC-233", "IC-241" ]
include:
- product: "IC-211"
java: "11"
distribution: "adopt"
- product: "IC-212"
java: "11"
distribution: "adopt"
- product: "IC-213"
java: "11"
distribution: "adopt"
- product: "IC-221"
java: "11"
distribution: "adopt"
- product: "IC-222"
java: "11"
distribution: "adopt"
- product: "IC-223"
java: "17"
distribution: "temurin"
Expand All @@ -44,9 +29,9 @@ jobs:
- product: "IC-241"
java: "17"
distribution: "temurin"
- product: "IC-242"
java: "17"
distribution: "temurin"
# - product: "IC-242"
# java: "17"
# distribution: "temurin"
max-parallel: 10
fail-fast: false

Expand Down
23 changes: 4 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,8 @@ jobs:

strategy:
matrix:
product: [ "IC-211", "IC-212", "IC-213", "IC-221", "IC-222", "IC-223", "IC-231", "IC-232", "IC-233", "IC-241", "IC-242" ]
product: [ "IC-223", "IC-231", "IC-232", "IC-233", "IC-241" ]
include:
- product: "IC-211"
java: "11"
distribution: "adopt"
- product: "IC-212"
java: "11"
distribution: "adopt"
- product: "IC-213"
java: "11"
distribution: "adopt"
- product: "IC-221"
java: "11"
distribution: "adopt"
- product: "IC-222"
java: "11"
distribution: "adopt"
- product: "IC-223"
java: "17"
distribution: "temurin"
Expand All @@ -40,9 +25,9 @@ jobs:
- product: "IC-241"
java: "17"
distribution: "temurin"
- product: "IC-242"
java: "17"
distribution: "temurin"
# - product: "IC-242"
# java: "17"
# distribution: "temurin"
max-parallel: 1

runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ system-test/
/system/

.DS_Store
.intellijPlatform
178 changes: 75 additions & 103 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
buildscript {
repositories {
mavenCentral()
}
}

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
java
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.intellij)
}

repositories {
mavenCentral()
mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://www.jetbrains.com/intellij-repository/snapshots")
kotlin("jvm").version("1.9.23")
id("org.jetbrains.intellij.platform")
}


data class PluginDescriptor(
val since: String, // earliest version string this is compatible with
val until: String, // latest version string this is compatible with, can be wildcard like 202.*
// https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
val sdkVersion: String, // the version string passed to the intellij sdk gradle plugin
val intellijVersion: String, // the version string passed to the intellijIdeaCommunity dependency
val sourceFolder: String, // used as the source root for specifics of this build
val deps: List<String> // dependent plugins of this plugin
)

// https://jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html
Expand All @@ -37,6 +21,8 @@ data class PluginDescriptor(
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIU
// when releasing for an EAP, look at snapshots and see the column called build number
// https://www.jetbrains.com/intellij-repository/snapshots
// more versions here:
// https://data.services.jetbrains.com/products?code=IC

// for the sdk version we can use IC-2021.1 if the product is released
// or IC-213-EAP-SNAPSHOT if not
Expand All @@ -45,115 +31,71 @@ data class PluginDescriptor(
// and 'until' we can use a wildcard eg 213.*

val plugins = listOf(
PluginDescriptor(
since = "211.6693.111", // this version is 2021.1
until = "211.*",
sdkVersion = "IC-2021.1",
sourceFolder = "IC-211",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "212.3116.43", // this version is 2021.2
until = "212.*",
sdkVersion = "IC-2021.2.3",
sourceFolder = "IC-212",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "213.3714", // this version is 2021.3
until = "213.*",
sdkVersion = "IC-2021.3",
sourceFolder = "IC-213",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin:213-1.6.10-release-923-IJ5744.223")
),
PluginDescriptor(
since = "221.3427.89", // this version is 2022.1
until = "221.*",
sdkVersion = "IC-2022.1",
sourceFolder = "IC-221",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "222.2270.16", // this version is 2022.2
until = "222.*",
sdkVersion = "IC-2022.2",
sourceFolder = "IC-222",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "223.4884.69", // this version is 2022.3
until = "223.*",
sdkVersion = "IC-2022.3",
intellijVersion = "2022.3",
sourceFolder = "IC-223",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "231.8109.163", // this version is 2023.1 release
until = "231.*",
sdkVersion = "IC-2023.1",
intellijVersion = "2023.1",
sourceFolder = "IC-231",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "232.5150.116", // this version is 2023.2
until = "232.*",
sdkVersion = "IC-2023.2",
intellijVersion = "2023.2",
sourceFolder = "IC-232",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "233.9802.16", // this version is 2023.3
until = "233.*",
sdkVersion = "IC-2023.3",
intellijVersion = "2023.3",
sourceFolder = "IC-233",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "241.15989.150", // this version is 2024.1
until = "241.*",
sdkVersion = "IC-2024.1.1",
sourceFolder = "IC-241",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
),
PluginDescriptor(
since = "241.17011.108", // this version is 2024.2
until = "242.*",
sdkVersion = "241.17011-EAP-CANDIDATE-SNAPSHOT",
sourceFolder = "IC-242",
deps = listOf("java", "org.jetbrains.plugins.gradle", "org.jetbrains.kotlin")
intellijVersion = "2024.1.1",
sourceFolder = "IC-241",
),
// this is broken until the next release of the gradle plugin
// PluginDescriptor(
// since = "242.12881.66", // this version is 2024.2
// until = "243.*",
// intellijVersion = "242.12881.66",
// sourceFolder = "IC-242",
// ),
)

val productName = System.getenv("PRODUCT_NAME") ?: "IC-242"
val jvmTarget = System.getenv("JVM_TARGET") ?: "11"
val descriptor = plugins.first { it.sourceFolder == productName }
val productName = System.getenv("PRODUCT_NAME") ?: "IC-241"
val jvmTargetVersion = System.getenv("JVM_TARGET") ?: "11"
val descriptor = plugins.firstOrNull { it.sourceFolder == productName } ?: error("SDK not found $productName")

val jetbrainsToken: String by project

version = "1.3." + (System.getenv("GITHUB_RUN_NUMBER") ?: "0-SNAPSHOT")

intellij {
sandboxDir.set(project.property("sandbox").toString())
// sandboxDir.set("./sandbox")
version.set(descriptor.sdkVersion)
pluginName.set("kotest-plugin-intellij")
plugins.addAll(*descriptor.deps.toTypedArray())
downloadSources.set(true)
type.set("IC")
updateSinceUntilBuild.set(false)
}
version = "1.4." + (System.getenv("GITHUB_RUN_NUMBER") ?: "0-SNAPSHOT")

dependencies {

implementation(libs.jaxb.api)
implementation(libs.javax.activation)

intellijPlatform {
intellijIdeaCommunity(descriptor.intellijVersion)
bundledPlugin("com.intellij.java")
bundledPlugin("org.jetbrains.kotlin")
}

// we bundle this for 4.1 support
// in kotest 4.2.0 the launcher has moved to a stand alone module
// in kotest 4.2.0 the launcher has moved to a standalone module
implementation(libs.runtime.kotest.legacy.launcher)

// this is needed to use the launcher in 4.2.0, in 4.2.1+ the launcher is built
// into the engine dep which should already be on the classpath
implementation(libs.runtime.kotest.framework.launcher)
implementation(libs.kotest.framework.launcher)

// needed for the resource files which are loaded into java light tests
testImplementation(libs.test.kotest.framework.api)
Expand All @@ -172,37 +114,67 @@ sourceSets {
}
}

intellijPlatform {
buildSearchableOptions = true
instrumentCode = false
projectName = "Kotest Plugin"
sandboxContainer.set(project.projectDir)
pluginConfiguration {
name.set("kotest-plugin-intellij")
description.set("Plugin for Kotest for Intellij")
version.set("${project.version}-${descriptor.intellijVersion}")
ideaVersion {
sinceBuild = descriptor.since
untilBuild = descriptor.until
}
}

publishing {
token.set(System.getenv("JETBRAINS_TOKEN") ?: jetbrainsToken)
}

verifyPlugin {
}
}

tasks {

compileKotlin {
kotlinOptions {
jvmTarget = jvmTarget
jvmTarget = jvmTargetVersion
}
}

withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = jvmTarget
jvmTarget = jvmTargetVersion
}
}

buildPlugin {
archiveClassifier.set(descriptor.sdkVersion)
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

publishPlugin {
token.set(System.getenv("JETBRAINS_TOKEN") ?: jetbrainsToken)
}

patchPluginXml {
version.set("${project.version}-${descriptor.sdkVersion}")
sinceBuild.set(descriptor.since)
untilBuild.set(descriptor.until)
}
// tasks {
// printProductsReleases {
// channels = listOf(ProductRelease.Channel.EAP)
// types = listOf(IntelliJPlatformType.IntellijIdeaCommunity)
// untilBuild = provider { null }
//
// doLast {
// val latestEap = productsReleases.get().max()
// }
// }
// }

// buildPlugin {
// archiveClassifier.set(descriptor.sdkVersion)
// }

test {
isScanForTestClasses = false
// Only run tests from classes that end with "Test"
// Only run tests from classes that end with "Test"
include("**/*Test.class")
include("**/*Tests.class")
}
Expand Down
Loading