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
47 changes: 8 additions & 39 deletions .github/workflows/preMerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ name: Build
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
push:
branches: [main]
branches: [master]
# Trigger the workflow on any pull request
pull_request:

Expand All @@ -31,11 +31,6 @@ jobs:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v4.1.2

# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v2.1.2

# Run verifyPlugin and test Gradle tasks
test:
name: Test
Expand All @@ -47,53 +42,27 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v4.1.2

# Setup Java 17 environment for the next steps
# Setup Java 21 environment for the next steps
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
java-version: 21
cache: gradle

- name: Grant execute permission for scripts
run: chmod +x getMasterThemes.sh
- name: Pull down the Master Themes
run: ./getMasterThemes.sh

# Set environment variables
- name: Export Properties
id: properties
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
IDE_VERSIONS="$(echo "$PROPERTIES" | grep "^pluginVerifierIdeVersions:" | base64)"

echo "::set-output name=ideVersions::$IDE_VERSIONS"
echo "::set-output name=pluginVerifierHomeDir::~/.pluginVerifier"

# Cache Plugin Verifier IDEs
- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v4.0.2
with:
path: ${{ steps.properties.outputs.pluginVerifierHomeDir }}/ides
key: ${{ runner.os }}-plugin-verifier-${{ steps.properties.outputs.ideVersions }}

# Run Qodana inspections
# - name: Qodana - Code Inspection
# uses: JetBrains/qodana-action@v2.1-eap

# Run tests
- name: Run Tests
run: ./gradlew test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew check

# Run verifyPlugin Gradle task
- name: Verify Plugin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew verifyPlugin

# Run IntelliJ Plugin Verifier action using GitHub Action
- name: Run Plugin Verifier
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}


2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
run: ./getMasterThemes.sh
- uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: 'zulu'
- run: ./ciScripts/buildPlugin.sh
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ masterThemes/
masterThemes
_masterThemes/
.qodana/
.intellijPlatform/
196 changes: 108 additions & 88 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,39 +1,53 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

fun properties(key: String) = project.findProperty(key).toString()
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {
// Custom plugin for building all the themes
id("doki-theme-plugin")
// Kotlin support
kotlin("jvm") version "2.0.0"
// gradle-intellij-plugin - read more: https://github.com/JetBrains/gradle-intellij-plugin
id("org.jetbrains.intellij") version "1.16.1"
// detekt linter - read more: https://detekt.github.io/detekt/gradle.html
id("io.gitlab.arturbosch.detekt") version "1.23.6"
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
id("org.jlleitschuh.gradle.ktlint") version "12.0.3"
id("org.jetbrains.qodana") version "0.1.13"
id("java") // Java support
alias(libs.plugins.kotlin) // Kotlin support
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
}

group = properties("pluginGroup")
version = properties("pluginVersion")
group = providers.gradleProperty("pluginGroup").get()
version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(21)
}

// Configure project's dependencies
repositories {
mavenCentral()
mavenLocal()
gradlePluginPortal()

// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
intellijPlatform {
defaultRepositories()
}
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.23.1")
implementation("commons-io:commons-io:2.15.1")
implementation("org.javassist:javassist:3.29.2-GA")
implementation("io.sentry:sentry:6.28.0")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("io.mockk:mockk:1.13.8")
testImplementation(libs.junit)
testImplementation(libs.opentest4j)

// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
intellijPlatform {
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"))

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })

testFramework(TestFrameworkType.Platform)
}
}

configurations {
Expand All @@ -44,89 +58,95 @@ configurations {
}
}

// Configure gradle-intellij-plugin plugin.
// Read more: https://github.com/JetBrains/gradle-intellij-plugin
intellij {
version.set(properties("platformVersion"))
type.set(properties("platformType"))
downloadSources.set(properties("platformDownloadSources").toBoolean())
updateSinceUntilBuild.set(true)

// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file.
plugins.set(
properties("platformPlugins").split(',')
.map(String::trim)
.filter(String::isNotEmpty),
)
}

// Configure detekt plugin.
// Read more: https://detekt.github.io/detekt/kotlindsl.html
detekt {
config = files("./detekt-config.yml")
buildUponDefaultConfig = true
autoCorrect = true

reports {
html.enabled = false
xml.enabled = false
txt.enabled = false
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
pluginConfiguration {
name = providers.gradleProperty("pluginName")
version = providers.gradleProperty("pluginVersion")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
// description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
// val start = "<!-- Plugin description -->"
// val end = "<!-- Plugin description end -->"
//
// with(it.lines()) {
// if (!containsAll(listOf(start, end))) {
// throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
// }
// subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
// }
// }

// val changelog = project.changelog // local variable for configuration cache compatibility
// // Get the latest available change notes from the changelog file
// changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
// with(changelog) {
// renderItem(
// (getOrNull(pluginVersion) ?: getUnreleased())
// .withHeader(false)
// .withEmptySections(false),
// Changelog.OutputType.HTML,
// )
// }
// }

ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}
}

qodana {
cachePath.set(projectDir.resolve(".qodana").canonicalPath)
reportPath.set(projectDir.resolve("build/reports/inspections").canonicalPath)
saveReport.set(true)
showReport.set(System.getenv("QODANA_SHOW_REPORT").toBoolean())
}

tasks {
// Set the JVM compatibility versions
properties("javaVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = it
}
signing {
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
privateKey = providers.environmentVariable("PRIVATE_KEY")
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
}

withType<Detekt> {
jvmTarget = "17"
publishing {
token = providers.environmentVariable("PUBLISH_TOKEN")
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = providers.gradleProperty("pluginVersion").map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
}

runIde {
maxHeapSize = "2g"
enabled = environment.getOrDefault("SHOULD_DOKI_THEME_RUN", "true") == "true"
val idePath = properties("idePath")
if (idePath.isNotEmpty()) {
ideDir.set(file(idePath))
systemProperty("idea.platform.prefix", properties("idePrefix"))
pluginVerification {
ides {
recommended()
}
}
}

runPluginVerifier {
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
tasks {
wrapper {
gradleVersion = providers.gradleProperty("gradleVersion").get()
}

patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))

val releaseNotes = file("$projectDir/build/html/RELEASE-NOTES.html")
if (releaseNotes.exists()) {
changeNotes.set(releaseNotes.readText())
}

dependsOn("buildThemes")
}
// publishPlugin {
// dependsOn(patchChangelog)
// }
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
intellijPlatformTesting {
runIde {
register("runIdeForUiTests") {
task {
jvmArgumentProviders += CommandLineArgumentProvider {
listOf(
"-Drobot-server.port=8082",
"-Dide.mac.message.dialogs.as.sheets=false",
"-Djb.privacy.policy.text=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
}
}

plugins {
robotServerPlugin()
}
}
}
}
}
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ repositories {

dependencies {
implementation("org.jsoup:jsoup:1.17.2")
implementation("com.google.code.gson:gson:2.10.1")
implementation("io.unthrottled.doki.build.jvm:doki-build-source-jvm:88.0.6")
}
10 changes: 6 additions & 4 deletions buildSrc/src/main/kotlin/BuildThemes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ open class BuildThemes : DefaultTask() {

private fun getThemeSchema(): ThemeDefinitionSchema =
newInputStream(get(getResourcesDirectory().toString(), "theme-schema", "master.theme.schema.json")).use {
gson.fromJson(
InputStreamReader(it, StandardCharsets.UTF_8),
val inputStreamReader: InputStreamReader = InputStreamReader(it, StandardCharsets.UTF_8)
val fromJson: ThemeDefinitionSchema = gson.fromJson(
inputStreamReader,
ThemeDefinitionSchema::class.java
)
fromJson
}

@TaskAction
fun run() {
val buildSourceAssetDirectory = getBuildSourceAssetDirectory()
val masterThemesDirectory = get(project.rootDir.absolutePath, "masterThemes")
val masterThemesDirectory = get(project.projectDir.toString(), "masterThemes")
val constructableAssetSupplier =
ConstructableAssetSupplierFactory.createCommonAssetsTemplate(
buildSourceAssetDirectory,
Expand Down Expand Up @@ -459,7 +461,7 @@ open class BuildThemes : DefaultTask() {
)

private fun getResourcesDirectory(): Path = get(
project.rootDir.absolutePath,
project.getRootDir().toString(),
"src",
"main",
"resources"
Expand Down
5 changes: 5 additions & 0 deletions changelog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Changelog
---
# 88.5-1.16.0 [2025.1 Build Support]

- Lowest supported version is now 2025.1
- Compiles to the 2025.1 build

# 88.5-1.15.0 [2024.3 Build Support]

- Lowest supported version is now 2024.3
Expand Down
Loading