Skip to content
Merged
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
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,32 @@ jobs:
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Test
run: gradle clean test --info
verify_new:
name: Verify Plugin Against Latest Releases
runs-on: ubuntu-latest
strategy:
matrix:
release_type: [ release, eap ]
env:
RELEASE_TYPE: ${{ matrix.release_type }}
VERIFY_VERSIONS: new
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Plugin verification
run: gradle clean verifyPlugin
verify_old:
name: Verify Plugin Against Old Releases
runs-on: ubuntu-latest
env:
RELEASE_TYPE: release
VERIFY_VERSIONS: old
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Init Hermit
run: ./bin/hermit env -r >> $GITHUB_ENV
- name: Plugin verification
run: gradle clean runPluginVerifier
run: gradle clean verifyPlugin
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ build/
.gradle/
/gradle/
*.bak
.intellijPlatform
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/gradle
173 changes: 90 additions & 83 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,54 +1,32 @@
import org.jetbrains.intellij.tasks.RunPluginVerifierTask
import java.util.EnumSet
import org.jetbrains.intellij.platform.gradle.IntelliJPlatformType
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import kotlin.math.sin

group = "com.squareup.cash.hermit"
version = project.properties["version"] ?: "1.0-SNAPSHOT"

plugins {
id("idea")
id("java")
kotlin("kapt") version "1.8.10"
id("org.jetbrains.intellij") version "1.15.0"
id("org.jetbrains.kotlin.jvm") version "1.8.10"
kotlin("kapt") version "1.9.25"
id("org.jetbrains.intellij.platform") version "2.0.0"

id("org.jetbrains.kotlin.jvm") version "1.9.25"
id("org.jetbrains.kotlin.plugin.serialization") version "1.4.32"
}

// region Build, dependencies

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenCentral()
}

val kotlinVersion = "1.8.10"
val arrowVersion = "0.11.0"

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
implementation("io.arrow-kt:arrow-core:$arrowVersion")
implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
kapt("io.arrow-kt:arrow-meta:$arrowVersion")
}

tasks {
compileKotlin {
kotlinOptions.jvmTarget = "11"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
}

test {
systemProperty("idea.force.use.core.classloader", "true")
intellijPlatform {
defaultRepositories()
}
}
// endregion

// region IJ Plugin setup

data class Product(
val releaseType: String, // identifier for this product
Expand Down Expand Up @@ -77,73 +55,102 @@ val products = listOf(
)
val product = products.first { it.releaseType == (System.getenv("RELEASE_TYPE") ?: "release") }

intellij {
version.set(product.sdkVersion)
type.set("IU")
plugins.set(
listOf(
"gradle",
"java",
"terminal",
val verifyOldVersions = System.getenv("VERIFY_VERSIONS") == "old"

val kotlinVersion = "1.9.25"
val arrowVersion = "0.11.0"

dependencies {
intellijPlatform {
intellijIdeaUltimate(product.sdkVersion, useInstaller = false)
pluginVerifier("1.371")
plugins(
"org.jetbrains.plugins.go:${product.goPluginVersion}"
)
bundledPlugins(
"com.intellij.gradle",
"com.intellij.java",
"com.intellij.properties",
"org.jetbrains.plugins.go:${product.goPluginVersion}",
// Needed by Go plugin. See https://github.com/JetBrains/gradle-intellij-plugin/issues/1056
"org.intellij.intelliLang"
)
)
testFramework(TestFrameworkType.Bundled, product.sdkVersion)
}

implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0")
implementation("io.arrow-kt:arrow-core:$arrowVersion")
implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
kapt("io.arrow-kt:arrow-meta:$arrowVersion")

testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
}

tasks {
runIde {
// Uncomment this, and set your path accordingly, if you want to debug on GoLand
// ideDirectory "/Users/juho/Library/Application Support/JetBrains/Toolbox/apps/Goland/ch-0/203.6682.164/GoLand.app/Contents"
compileKotlin {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
}

test {
systemProperty("idea.force.use.core.classloader", "true")
}
}

intellijPlatform {
version = version
projectName = project.name

instrumentCode = false // We don't need to scan codebase for jetbrains annotations

//type.set("IU")

pluginVerification {
// These need to match the versions from
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIC,IIE,GO
if (verifyOldVersions) {
ides {
select {
types = listOf(IntelliJPlatformType.IntellijIdeaUltimate)
sinceBuild = project.properties["IIC.from.version"] as String
untilBuild = project.properties["IIC.from.version"] as String
}
select {
types = listOf(IntelliJPlatformType.GoLand)
sinceBuild = project.properties["GO.from.version"] as String
untilBuild = project.properties["GO.from.version"] as String
}
}
} else {
ides {
select {
types = listOf(IntelliJPlatformType.IntellijIdeaUltimate)
sinceBuild = product.intellijVersion
untilBuild = product.intellijVersion
}
select {
types = listOf(IntelliJPlatformType.GoLand)
sinceBuild = product.golandVersion
untilBuild = product.golandVersion
}
}
}
}
}

tasks {
patchPluginXml {
sinceBuild.set(project.properties["IIC.from.version"] as String)
val versionSuffix = when(product.releaseType) {
"release" -> ""
else -> "-${product.releaseType}"
}
version.set("${System.getenv("IJ_PLUGIN_VERSION")}${versionSuffix}") // IJ_PLUGIN_VERSION env var available in CI
}

runPluginVerifier {
// These need to match the versions from
// https://data.services.jetbrains.com/products?fields=code,name,releases.downloads,releases.version,releases.build,releases.type&code=IIC,IIE,GO
ideVersions.set(
listOf(
"IIC-${project.properties["IIC.from.version"] as String}",
"GO-${project.properties["GO.from.version"] as String}",
"IIC-${product.intellijVersion}",
"GO-${product.golandVersion}"
)
)
failureLevel.set(
EnumSet.complementOf(
EnumSet.of(
// skipping missing dependencies as com.intellij.java provided by IJ raises a false warning
RunPluginVerifierTask.FailureLevel.MISSING_DEPENDENCIES,
// skipping experimental API usage, as delaying Gradle execution relies on experimental GradleExecutionAware.
// if the API changes, we should be able to detect that in our tests when a new version comes out.
RunPluginVerifierTask.FailureLevel.EXPERIMENTAL_API_USAGES,
// we do not fail on deprecated API usages, as we want to support older versions where the API has
// not been deprecate yet, and the newer API not available
RunPluginVerifierTask.FailureLevel.DEPRECATED_API_USAGES,
// TODO: fix these
RunPluginVerifierTask.FailureLevel.SCHEDULED_FOR_REMOVAL_API_USAGES,
)
)
)
version = "${System.getenv("IJ_PLUGIN_VERSION")}${versionSuffix}" // IJ_PLUGIN_VERSION env var available in CI
}

publishPlugin {
token.set(System.getenv("JETBRAINS_TOKEN")) // JETBRAINS_TOKEN env var available in CI
}

// See https://youtrack.jetbrains.com/issue/KTIJ-782
buildSearchableOptions {
enabled = false
}
}

// endregion
}
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ kotlin.code.style=official

# The latest supported versions. Note, these are updated automatically from update-major-versions.sh
IIC.release.version=241.14494.240
IIC.eap.version=241.14494.17
IIC.eap.version=242.20224.91

IIC.release.go_plugin.version=241.14494.240
IIC.eap.go_plugin.version=241.14494.17
IIC.eap.go_plugin.version=242.20224.159
GO.release.version=241.14494.238
GO.eap.version=241.8102.131
GO.eap.version=242.20224.106
# The oldest supported versions.
IIC.from.version=222.4554.10
GO.from.version=222.4554.12
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ class HermitIdeaEnvProvider : RunConfigurationExtension() {
return Hermit(configuration.project).hasHermit()
}

override fun <T : RunConfigurationBase<*>?> updateJavaParameters(configuration: T, params: JavaParameters, settings: RunnerSettings?) {
val project = configuration?.getProject()
if (project != null) {
params.env = Hermit(project).environment().patch(params.env)
}
override fun <T : RunConfigurationBase<*>?> updateJavaParameters(
configuration: T & Any,
params: JavaParameters,
settings: RunnerSettings?
) {
val project = configuration.project
params.env = Hermit(project).environment().patch(params.env)
}
}
Loading