Skip to content

Commit 3ecd949

Browse files
committed
Update sample plugin for toolbox 2.6.0
1 parent 01170bd commit 3ecd949

16 files changed

+309
-126
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Gradle
22
.gradle
33
build
4+
jvm/
45

56
# IntelliJ IDEA
67
.idea

build.gradle.kts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import com.github.jk1.license.filter.ExcludeTransitiveDependenciesFilter
22
import com.github.jk1.license.render.JsonReportRenderer
33
import org.jetbrains.intellij.pluginRepository.PluginRepositoryFactory
44
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfoRt
5+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
56
import java.nio.file.Path
67
import kotlin.io.path.div
78

@@ -10,6 +11,7 @@ plugins {
1011
alias(libs.plugins.serialization)
1112
`java-library`
1213
alias(libs.plugins.dependency.license.report)
14+
alias(libs.plugins.gradle.wrapper)
1315
}
1416

1517
buildscript {
@@ -20,15 +22,24 @@ buildscript {
2022

2123
repositories {
2224
mavenCentral()
23-
maven("https://packages.jetbrains.team/maven/p/tbx/gateway")
25+
maven("https://packages.jetbrains.team/maven/p/tbx/toolbox-api")
26+
}
27+
28+
jvmWrapper {
29+
unixJvmInstallDir = "jvm"
30+
winJvmInstallDir = "jvm"
31+
linuxAarch64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-aarch64-b631.28.tar.gz"
32+
linuxX64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-x64-b631.28.tar.gz"
33+
macAarch64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-aarch64-b631.28.tar.gz"
34+
macX64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-x64-b631.28.tar.gz"
35+
windowsX64JvmUrl = "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-windows-x64-b631.28.tar.gz"
2436
}
2537

2638
dependencies {
27-
implementation(libs.gateway.api)
39+
compileOnly(libs.bundles.toolbox.plugin.api)
2840
implementation(libs.slf4j)
2941
implementation(libs.bundles.serialization)
3042
implementation(libs.coroutines.core)
31-
implementation(libs.okhttp)
3243
}
3344

3445
licenseReport {
@@ -39,9 +50,7 @@ licenseReport {
3950
}
4051

4152
tasks.compileKotlin {
42-
kotlinOptions.freeCompilerArgs += listOf(
43-
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi",
44-
)
53+
compilerOptions.jvmTarget.set(JvmTarget.JVM_21)
4554
}
4655

4756
val pluginId = "dev.kropp.toolbox.sample"
@@ -62,7 +71,7 @@ val copyPlugin by tasks.creating(Sync::class.java) {
6271
SystemInfoRt.isLinux -> System.getenv("XDG_DATA_HOME")?.let { Path.of(it) } ?: (userHome / ".local" / "share")
6372
SystemInfoRt.isMac -> userHome / "Library" / "Caches"
6473
else -> error("Unknown os")
65-
} / "JetBrains" / "Toolbox"
74+
} / "JetBrains" / "Toolbox-Dev"
6675

6776
val pluginsDir = when {
6877
SystemInfoRt.isWindows -> toolboxCachesDir / "cache"
@@ -81,6 +90,7 @@ val copyPlugin by tasks.creating(Sync::class.java) {
8190
}
8291

8392
into(targetDir)
93+
8494
}
8595

8696
val pluginZip by tasks.creating(Zip::class) {

gradle/libs.versions.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
[versions]
2-
gateway = "2.3.0.19968"
3-
kotlin = "1.9.0"
2+
toolbox-plugin-api = "0.2"
3+
kotlin = "2.0.10"
44
coroutines = "1.7.3"
55
serialization = "1.5.0"
66
okhttp = "4.10.0"
77
slf4j = "2.0.3"
88
dependency-license-report = "2.5"
99
marketplace-client = "2.0.38"
10+
gradle-wrapper = "0.14.0"
11+
1012

1113
[libraries]
1214
kotlin-stdlib = { module = "com.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
13-
gateway-api = { module = "com.jetbrains.toolbox.gateway:gateway-api", version.ref = "gateway" }
15+
toolbox-core-api = { module = "com.jetbrains.toolbox:core-api", version.ref = "toolbox-plugin-api" }
16+
toolbox-ui-api = { module = "com.jetbrains.toolbox:ui-api", version.ref = "toolbox-plugin-api" }
17+
toolbox-remote-dev-api = { module = "com.jetbrains.toolbox:remote-dev-api", version.ref = "toolbox-plugin-api" }
1418
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
1519
serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "serialization" }
1620
serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }
17-
serialization-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "serialization" }
1821
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
1922
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
2023

2124
marketplace-client = { module = "org.jetbrains.intellij:plugin-repository-rest-client", version.ref = "marketplace-client" }
2225

2326
[bundles]
24-
serialization = [ "serialization-core", "serialization-json", "serialization-json-okio" ]
27+
serialization = [ "serialization-core", "serialization-json" ]
28+
toolbox-plugin-api = [ "toolbox-core-api", "toolbox-ui-api", "toolbox-remote-dev-api" ]
2529

2630
[plugins]
2731
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
2832
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
2933
dependency-license-report = { id = "com.github.jk1.dependency-license-report", version.ref = "dependency-license-report" }
34+
gradle-wrapper = { id = "me.filippov.gradle.jvm.wrapper", version.ref = "gradle-wrapper" }

gradle/wrapper/gradle-wrapper.jar

-18.2 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 105 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,7 +83,8 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
8788

8889
# Use the maximum available, or set MAX_FD != -1 to use that value.
8990
MAX_FD=maximum
@@ -114,6 +115,97 @@ esac
114115
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
115116

116117

118+
# GRADLE JVM WRAPPER START MARKER
119+
BUILD_DIR="jvm"
120+
JVM_ARCH=$(uname -m)
121+
JVM_TEMP_FILE=$BUILD_DIR/gradle-jvm-temp.tar.gz
122+
if [ "$darwin" = "true" ]; then
123+
case $JVM_ARCH in
124+
x86_64)
125+
JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-x64-b631.28.tar.gz
126+
JVM_TARGET_DIR=$BUILD_DIR/jbr_jcef-21.0.5-osx-x64-b631.28-be8dc8
127+
;;
128+
arm64)
129+
JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-osx-aarch64-b631.28.tar.gz
130+
JVM_TARGET_DIR=$BUILD_DIR/jbr_jcef-21.0.5-osx-aarch64-b631.28-f458b6
131+
;;
132+
*)
133+
die "Unknown architecture $JVM_ARCH"
134+
;;
135+
esac
136+
elif [ "$cygwin" = "true" ] || [ "$msys" = "true" ]; then
137+
JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-windows-x64-b631.28.tar.gz
138+
JVM_TARGET_DIR=$BUILD_DIR/jbr_jcef-21.0.5-windows-x64-b631.28-eedcdf
139+
else
140+
JVM_ARCH=$(linux$(getconf LONG_BIT) uname -m)
141+
case $JVM_ARCH in
142+
x86_64)
143+
JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-x64-b631.28.tar.gz
144+
JVM_TARGET_DIR=$BUILD_DIR/jbr_jcef-21.0.5-linux-x64-b631.28-322c17
145+
;;
146+
aarch64)
147+
JVM_URL=https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.5-linux-aarch64-b631.28.tar.gz
148+
JVM_TARGET_DIR=$BUILD_DIR/jbr_jcef-21.0.5-linux-aarch64-b631.28-3ac5ea
149+
;;
150+
*)
151+
die "Unknown architecture $JVM_ARCH"
152+
;;
153+
esac
154+
fi
155+
156+
set -e
157+
158+
if [ -e "$JVM_TARGET_DIR/.flag" ] && [ -n "$(ls "$JVM_TARGET_DIR")" ] && [ "x$(cat "$JVM_TARGET_DIR/.flag")" = "x${JVM_URL}" ]; then
159+
# Everything is up-to-date in $JVM_TARGET_DIR, do nothing
160+
true
161+
else
162+
echo "Downloading $JVM_URL to $JVM_TEMP_FILE"
163+
164+
rm -f "$JVM_TEMP_FILE"
165+
mkdir -p "$BUILD_DIR"
166+
if command -v curl >/dev/null 2>&1; then
167+
if [ -t 1 ]; then CURL_PROGRESS="--progress-bar"; else CURL_PROGRESS="--silent --show-error"; fi
168+
# shellcheck disable=SC2086
169+
curl $CURL_PROGRESS -L --output "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1
170+
elif command -v wget >/dev/null 2>&1; then
171+
if [ -t 1 ]; then WGET_PROGRESS=""; else WGET_PROGRESS="-nv"; fi
172+
wget $WGET_PROGRESS -O "${JVM_TEMP_FILE}" "$JVM_URL" 2>&1
173+
else
174+
die "ERROR: Please install wget or curl"
175+
fi
176+
177+
echo "Extracting $JVM_TEMP_FILE to $JVM_TARGET_DIR"
178+
rm -rf "$JVM_TARGET_DIR"
179+
mkdir -p "$JVM_TARGET_DIR"
180+
181+
case "$JVM_URL" in
182+
*".zip") unzip "$JVM_TEMP_FILE" -d "$JVM_TARGET_DIR" ;;
183+
*) tar -x -f "$JVM_TEMP_FILE" -C "$JVM_TARGET_DIR" ;;
184+
esac
185+
186+
rm -f "$JVM_TEMP_FILE"
187+
188+
echo "$JVM_URL" >"$JVM_TARGET_DIR/.flag"
189+
fi
190+
191+
JAVA_HOME=
192+
for d in "$JVM_TARGET_DIR" "$JVM_TARGET_DIR"/* "$JVM_TARGET_DIR"/Contents/Home "$JVM_TARGET_DIR"/*/Contents/Home; do
193+
if [ -e "$d/bin/java" ]; then
194+
JAVA_HOME="$d"
195+
fi
196+
done
197+
198+
if [ '!' -e "$JAVA_HOME/bin/java" ]; then
199+
die "Unable to find bin/java under $JVM_TARGET_DIR"
200+
fi
201+
202+
# Make it available for child processes
203+
export JAVA_HOME
204+
205+
set +e
206+
207+
# GRADLE JVM WRAPPER END MARKER
208+
117209
# Determine the Java command to use to start the JVM.
118210
if [ -n "$JAVA_HOME" ] ; then
119211
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -130,26 +222,29 @@ location of your Java installation."
130222
fi
131223
else
132224
JAVACMD=java
133-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
225+
if ! command -v java >/dev/null 2>&1
226+
then
227+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134228
135229
Please set the JAVA_HOME variable in your environment to match the
136230
location of your Java installation."
231+
fi
137232
fi
138233

139234
# Increase the maximum file descriptors if we can.
140235
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
141236
case $MAX_FD in #(
142237
max*)
143238
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
144-
# shellcheck disable=SC3045
239+
# shellcheck disable=SC2039,SC3045
145240
MAX_FD=$( ulimit -H -n ) ||
146241
warn "Could not query maximum file descriptor limit"
147242
esac
148243
case $MAX_FD in #(
149244
'' | soft) :;; #(
150245
*)
151246
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
152-
# shellcheck disable=SC3045
247+
# shellcheck disable=SC2039,SC3045
153248
ulimit -n "$MAX_FD" ||
154249
warn "Could not set maximum file descriptor limit to $MAX_FD"
155250
esac
@@ -198,11 +293,11 @@ fi
198293
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
199294
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
200295

201-
# Collect all arguments for the java command;
202-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
203-
# shell script including quotes and variable substitutions, so put them in
204-
# double quotes to make sure that they get re-expanded; and
205-
# * put everything else in single quotes, so that it's not re-expanded.
296+
# Collect all arguments for the java command:
297+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
298+
# and any embedded shellness will be escaped.
299+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
300+
# treated as '${Hostname}' itself on the command line.
206301

207302
set -- \
208303
"-Dorg.gradle.appname=$APP_BASE_NAME" \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy