Skip to content

Commit be434b6

Browse files
authored
Merge pull request #259 from ndtp/ISSUE-256-k2_support
256: Add K2 support to Intellij Platform Plugin
2 parents 2977c0d + 6a9559f commit be434b6

22 files changed

+380
-238
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Plugins/Gradle/.idea/
1414
Plugins/Gradle/gradle/wrapper/
1515
Plugins/Gradle/gradlew
1616
Plugins/Gradle/gradlew.bat
17+
.intellijPlatform/

Plugins/IntelliJ/CHANGELOG.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
1+
<!-- Keep a Changelog guide -> https://keepachangelog.com -->
2+
13
# Android Testify - IntelliJ Platform Plugin - Change Log
24

5+
## [3.0.0]
6+
7+
- Added support for Support Android Studio Narwhal | 2025.1.1 Canary 9 | 251.+
8+
- Raised minimum supported Android Studio version to Ladybug 2024.2.1 | 242.+
9+
- K2 supported
10+
311
## [2.5.0]
412

5-
- Added support for Support Android Studio Meerkat | 2024.3.1 Canary 7 | 243.+
13+
- Added support for Support Android Studio Meerkat | 2024.3.1 Canary 7 | 243.+
614

715
## [2.4.0]
816

9-
- Added support for Android Studio Ladybug | 2024.2.1 Canary 9 | 242.+
17+
- Added support for Android Studio Ladybug | 2024.2.1 Canary 9 | 242.+
1018

1119
## [2.3.0]
1220

13-
- Added a 'Go To Source' popup menu item to baseline image asset files. This action will navigate you from the PNG baseline image to the test source code.
14-
- Added a 'Baseline Image' destination in the `Go To` popup menu when right-clicking on the test source code. This action will navigate you to the baseline image for the current test.
21+
- Added a 'Go To Source' popup menu item to baseline image asset files. This action will navigate you from the PNG baseline image to the test source code.
22+
- Added a 'Baseline Image' destination in the `Go To` popup menu when right-clicking on the test source code. This action will navigate you to the baseline image for the current test.
1523

1624
## [2.2.0]
1725

18-
- Added support for Android Studio Koala | 2024.1.1 Canary 6 | 241.+
26+
- Added support for Android Studio Koala | 2024.1.1 Canary 6 | 241.+
1927

2028
## [2.1.0]
2129

22-
- Added support for Android Studio Jellyfish | 2023.3.1 Canary 10 | 233.+
23-
- Replaced deprecated API calls.
24-
30+
- Added support for Android Studio Jellyfish | 2023.3.1 Canary 10 | 233.+
31+
- Replaced deprecated API calls.
32+
2533
- Dropped support for Android Studio versions 221.* and earlier (Electric Eel, Dolphin, Chipmunk, Bumblebee)
2634

2735
## [2.0.0]
@@ -53,7 +61,7 @@
5361
- Added support for IntelliJ platform 213+ (Dolphin)
5462
- Added support for IntelliJ platform 212.+ (Chipmunk)
5563
- Added support for Android Studio Bumblebee | 2021.1.1 Canary 9 | 211.+
56-
64+
5765
## [1.2.0-alpha01]
5866

5967
- Unified version scheme with the core Testify library.

Plugins/IntelliJ/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ This plugin will enhance the developer experience by adding fully integrated IDE
1616
- Reveal the baseline image in Android Studio
1717
- Delete the baseline image from your project
1818

19+
Learn more at <a href="https://testify.dev/">testify.dev</a>
20+
21+
Copyright (c) 2023-2025 ndtp
22+
1923
<!-- Plugin description end -->
2024

2125
---
@@ -38,5 +42,5 @@ This plugin will enhance the developer experience by adding fully integrated IDE
3842

3943
### License
4044

41-
[MIT License -- Modified work copyright (c) 2022-2024 ndtp](LICENSE)<br/>
45+
[MIT License -- Modified work copyright (c) 2022-2025 ndtp](LICENSE)<br/>
4246
[MIT License -- Original work copyright (c) 2020 Shopify](LICENSE)

Plugins/IntelliJ/build.gradle.kts

Lines changed: 130 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,157 @@
1-
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
1+
import org.jetbrains.changelog.Changelog
2+
import org.jetbrains.changelog.markdownToHTML
3+
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
24

35
plugins {
4-
id("org.jetbrains.kotlin.jvm") version "1.6.10"
5-
id("org.jetbrains.intellij") version "1.12.0"
6-
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
6+
id("java") // Java support
7+
alias(libs.plugins.kotlin) // Kotlin support
8+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
9+
alias(libs.plugins.changelog) // Gradle Changelog Plugin
10+
alias(libs.plugins.qodana) // Gradle Qodana Plugin
11+
alias(libs.plugins.kover) // Gradle Kover Plugin
712
}
813

9-
fun properties(key: String) = project.findProperty(key).toString()
14+
group = providers.gradleProperty("pluginGroup").get()
15+
version = providers.gradleProperty("pluginVersion").get()
1016

11-
group = project.property("pluginGroup") as String
12-
version = properties("version")
17+
// Set the JVM language level used to build the project.
18+
kotlin {
19+
jvmToolchain(21)
20+
}
1321

22+
// Configure project's dependencies
1423
repositories {
1524
mavenCentral()
25+
26+
// IntelliJ Platform Gradle Plugin Repositories Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-repositories-extension.html
27+
intellijPlatform {
28+
defaultRepositories()
29+
}
1630
}
1731

32+
// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
1833
dependencies {
19-
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
20-
}
34+
testImplementation(libs.junit)
35+
testImplementation(libs.opentest4j)
2136

22-
java {
23-
sourceCompatibility = JavaVersion.VERSION_17
24-
}
37+
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
38+
intellijPlatform {
39+
androidStudio(providers.gradleProperty("platformVersion"), useInstaller = true)
40+
41+
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
42+
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
43+
44+
// Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file for plugin from JetBrains Marketplace.
45+
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
2546

26-
// See https://github.com/JetBrains/gradle-intellij-plugin/
27-
intellij {
28-
version.set(properties("InstrumentCodeVersion"))
29-
type.set(properties("platformType"))
30-
31-
plugins.set(
32-
listOf(
33-
"Kotlin",
34-
"gradle",
35-
"android",
36-
"java"
37-
)
38-
)
47+
testFramework(TestFrameworkType.Platform)
48+
}
3949
}
4050

41-
tasks {
42-
buildSearchableOptions {
43-
enabled = false
51+
// Configure IntelliJ Platform Gradle Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
52+
intellijPlatform {
53+
pluginConfiguration {
54+
name = providers.gradleProperty("pluginName")
55+
version = providers.gradleProperty("pluginVersion")
56+
57+
// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
58+
description = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
59+
val start = "<!-- Plugin description -->"
60+
val end = "<!-- Plugin description end -->"
61+
62+
with(it.lines()) {
63+
if (!containsAll(listOf(start, end))) {
64+
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
65+
}
66+
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
67+
}
68+
}
69+
70+
val changelog = project.changelog // local variable for configuration cache compatibility
71+
// Get the latest available change notes from the changelog file
72+
changeNotes = providers.gradleProperty("pluginVersion").map { pluginVersion ->
73+
with(changelog) {
74+
renderItem(
75+
(getOrNull(pluginVersion) ?: getUnreleased())
76+
.withHeader(false)
77+
.withEmptySections(false),
78+
Changelog.OutputType.HTML,
79+
)
80+
}
81+
}
82+
83+
ideaVersion {
84+
sinceBuild = providers.gradleProperty("pluginSinceBuild")
85+
untilBuild = providers.gradleProperty("pluginUntilBuild")
86+
}
4487
}
4588

46-
patchPluginXml {
47-
version.set("${project.version}")
48-
sinceBuild.set(properties("pluginSinceBuild"))
49-
untilBuild.set(properties("pluginUntilBuild"))
89+
signing {
90+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
91+
privateKey = providers.environmentVariable("PRIVATE_KEY")
92+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
5093
}
94+
95+
publishing {
96+
token = providers.environmentVariable("PUBLISH_TOKEN")
97+
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
98+
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
99+
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
100+
channels = providers.gradleProperty("pluginVersion")
101+
.map { listOf(it.substringAfter('-', "").substringBefore('.').ifEmpty { "default" }) }
102+
}
103+
104+
pluginVerification {
105+
ides {
106+
recommended()
107+
}
108+
}
109+
}
110+
111+
// Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin
112+
changelog {
113+
groups.empty()
114+
repositoryUrl = providers.gradleProperty("pluginRepositoryUrl")
51115
}
52116

53-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
54-
kotlinOptions {
55-
jvmTarget = "17"
117+
// Configure Gradle Kover Plugin - read more: https://github.com/Kotlin/kotlinx-kover#configuration
118+
kover {
119+
reports {
120+
total {
121+
xml {
122+
onCheck = true
123+
}
124+
}
56125
}
57126
}
58127

59128
tasks {
129+
wrapper {
130+
gradleVersion = providers.gradleProperty("gradleVersion").get()
131+
}
132+
133+
publishPlugin {
134+
dependsOn(patchChangelog)
135+
}
136+
}
137+
138+
intellijPlatformTesting {
60139
runIde {
61-
// Absolute path to installed target 3.5 Android Studio to use as
62-
// IDE Development Instance (the "Contents" directory is macOS specific):
63-
ideDir.set(file("/Applications/Android Studio Preview.app/Contents"))
140+
register("runIdeForUiTests") {
141+
task {
142+
jvmArgumentProviders += CommandLineArgumentProvider {
143+
listOf(
144+
"-Drobot-server.port=8082",
145+
"-Dide.mac.message.dialogs.as.sheets=false",
146+
"-Djb.privacy.policy.text=<!--999.999-->",
147+
"-Djb.consents.confirmation.enabled=false",
148+
)
149+
}
150+
}
151+
152+
plugins {
153+
robotServerPlugin()
154+
}
155+
}
64156
}
65157
}

Plugins/IntelliJ/gradle.properties

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1-
# IntelliJ Platform Artifacts Repositories
2-
# -> https://www.jetbrains.org/intellij/sdk/docs/reference_guide/intellij_artifacts.html
1+
# IntelliJ Platform Artifacts Repositories -> https://plugins.jetbrains.com/docs/intellij/intellij-artifacts.html
32

43
pluginGroup = dev.testify
5-
version = 2.5.0
4+
pluginName = Android Testify - Screenshot Instrumentation Tests
5+
pluginRepositoryUrl = https://github.com/ndtp/android-testify/tree/main/Plugins/IntelliJ
6+
# SemVer format -> https://semver.org
7+
pluginVersion = 3.0.0
68

7-
# https://plugins.jetbrains.com/docs/intellij/android-studio.html#android-studio-releases-listing
8-
pluginSinceBuild = 223
9-
pluginUntilBuild = 243.*
9+
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10+
pluginSinceBuild = 242
11+
pluginUntilBuild = 252.*
1012

11-
platformType = IC
12-
platformDownloadSources = true
13+
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
14+
platformType = AI
1315

14-
# Set the explicit compiler version
15-
InstrumentCodeVersion=223.7571.182
16+
# Narwhal 2025.1.1 Canary 9
17+
platformVersion = 2025.1.1.9
1618

17-
kotlin.code.style=official
19+
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
20+
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
21+
platformPlugins =
22+
# Example: platformBundledPlugins = com.intellij.java
23+
platformBundledPlugins = org.jetbrains.kotlin, com.intellij.gradle, org.jetbrains.android
24+
25+
# Gradle Releases -> https://github.com/gradle/gradle/releases
26+
gradleVersion = 8.13
27+
28+
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
1829
kotlin.stdlib.default.dependency = false
30+
31+
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html
32+
org.gradle.configuration-cache = true
33+
34+
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
35+
org.gradle.caching = true

Plugins/IntelliJ/gradle/libs.versions.toml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

Plugins/IntelliJ/gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)