backport: 17.2.0

This commit is contained in:
FalsePattern 2024-09-20 10:19:48 +02:00
parent afdd04ae3c
commit 4288722909
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
10 changed files with 127 additions and 31 deletions

43
.gitattributes vendored
View file

@ -1 +1,44 @@
* text=auto eol=lf * text=auto eol=lf
*.[jJ][aA][rR] binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.[pP][aA][tT][cC][hH] -text
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary

View file

@ -17,6 +17,17 @@ Changelog structure reference:
## [Unreleased] ## [Unreleased]
## [17.2.0]
### Added
- IDEA 2024.3 support
### Fixed
- Project
- Safer standard library path resolution
## [17.1.0] ## [17.1.0]
### Fixed ### Fixed

View file

@ -7,20 +7,20 @@ import org.jetbrains.intellij.platform.gradle.tasks.PatchPluginXmlTask
import org.jetbrains.intellij.platform.gradle.tasks.PublishPluginTask import org.jetbrains.intellij.platform.gradle.tasks.PublishPluginTask
import org.jetbrains.intellij.platform.gradle.utils.extensionProvider import org.jetbrains.intellij.platform.gradle.utils.extensionProvider
fun properties(key: String) = providers.gradleProperty(key) fun properties(key: String) = providers.gradleProperty(key) as Provider<String>
fun environment(key: String) = providers.environmentVariable(key) fun environment(key: String) = providers.environmentVariable(key) as Provider<String>
plugins { plugins {
java java
`maven-publish` `maven-publish`
`java-library` `java-library`
id("org.jetbrains.intellij.platform") version("2.0.0") id("org.jetbrains.intellij.platform") version("2.0.1")
id("org.jetbrains.changelog") version("2.2.1") id("org.jetbrains.changelog") version("2.2.1")
id("org.jetbrains.grammarkit") version("2022.3.2.2") id("org.jetbrains.grammarkit") version("2022.3.2.2")
id("de.undercouch.download") version("5.6.0") id("de.undercouch.download") version("5.6.0")
} }
val publishVersions = listOf("232", "233", "241", "242") val publishVersions = listOf("232", "233", "241", "242", "243")
val gitVersion: groovy.lang.Closure<String> by extra val gitVersion: groovy.lang.Closure<String> by extra
@ -40,7 +40,7 @@ val clionVersion = properties("clionVersion").get()
val clionPlugins = listOf("com.intellij.clion", "com.intellij.cidr.lang", "com.intellij.cidr.base", "com.intellij.nativeDebug") val clionPlugins = listOf("com.intellij.clion", "com.intellij.cidr.lang", "com.intellij.cidr.base", "com.intellij.nativeDebug")
val lsp4jVersion = "0.21.1" val lsp4jVersion = "0.21.1"
val lsp4ijVersion = "0.3.0" val lsp4ijVersion = "0.5.0"
val lsp4ijNightly = lsp4ijVersion.contains("-") val lsp4ijNightly = lsp4ijVersion.contains("-")
val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion" val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion"
@ -93,6 +93,13 @@ allprojects {
includeModule("com.jetbrains.intellij.idea", "ideaIU") includeModule("com.jetbrains.intellij.idea", "ideaIU")
} }
} }
jetbrainsIdeInstallers {
content {
includeModule("cpp", "CLion")
includeModule("idea", "ideaIC")
includeModule("idea", "ideaIU")
}
}
} }
} }
dependencies { dependencies {
@ -173,7 +180,7 @@ allprojects {
withType<PatchPluginXmlTask> { withType<PatchPluginXmlTask> {
sinceBuild = properties("pluginSinceBuild") sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild") untilBuild = properties("pluginUntilBuild").flatMap {provider { it.ifBlank { null } }}
} }
} }
intellijPlatform { intellijPlatform {
@ -317,7 +324,7 @@ project(":plugin") {
privateKeyFile = rootProject.file("secrets/private.pem") privateKeyFile = rootProject.file("secrets/private.pem")
password = environment("PRIVATE_KEY_PASSWORD") password = environment("PRIVATE_KEY_PASSWORD")
} }
verifyPlugin { pluginVerification {
ides { ides {
ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion) ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
ide(IntelliJPlatformType.IntellijIdeaUltimate, ideaVersion) ide(IntelliJPlatformType.IntellijIdeaUltimate, ideaVersion)

View file

@ -17,7 +17,7 @@
set -e set -e
declare -a branches=("master" "241" "233" "232") declare -a branches=("master" "242" "241" "233" "232")
DEFAULT_BRANCH="${branches[0]}" DEFAULT_BRANCH="${branches[0]}"

View file

@ -11,10 +11,10 @@ baseIDE=clion
ideaVersion=2024.1.6 ideaVersion=2024.1.6
clionVersion=2024.1.5 clionVersion=2024.1.5
pluginVersion=17.1.1-dev pluginVersion=17.2.0
# Gradle Releases -> https://github.com/gradle/gradle/releases # Gradle Releases -> https://github.com/gradle/gradle/releases
gradleVersion=8.9 gradleVersion=8.10.1
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
# TODO grammarkit breaks with this # TODO grammarkit breaks with this

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

View file

@ -147,7 +147,7 @@ public class ZigProjectSettingsPanel implements MyDisposable {
toolchainVersion.setForeground(JBColor.foreground()); toolchainVersion.setForeground(JBColor.foreground());
if (!stdFieldOverride.isSelected()) if (!stdFieldOverride.isSelected())
pathToStdField.setText(StringUtil.orEmpty(stdPath)); pathToStdField.setText(StringUtil.orEmpty(stdPath.toString()));
}); });
} }
} }

View file

@ -33,6 +33,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -49,11 +51,30 @@ public class ZigSyntheticLibrary extends SyntheticLibrary implements ItemPresent
val service = ZigProjectSettingsService.getInstance(project); val service = ZigProjectSettingsService.getInstance(project);
val state = service.getState(); val state = service.getState();
this.roots = ApplicationManager.getApplication().executeOnPooledThread(() -> { this.roots = ApplicationManager.getApplication().executeOnPooledThread(() -> {
var roots = pathToVFS(state.getExplicitPathToStd());
if (roots != null) {
return roots;
}
val toolchain = state.getToolchain(); val toolchain = state.getToolchain();
blk: try {
val ePathStr = state.getExplicitPathToStd();
if (ePathStr == null) {
break blk;
}
val ePath = Path.of(ePathStr);
if (ePath.isAbsolute()) {
var roots = pathToVFS(ePath);
if (roots != null) {
return roots;
}
} else if (toolchain != null) {
val stdPath = toolchain.getLocation().resolve(ePath);
if (stdPath.isAbsolute()) {
var roots = pathToVFS(stdPath);
if (roots != null) {
return roots;
}
}
}
} catch (InvalidPathException ignored) {
}
if (toolchain != null) { if (toolchain != null) {
val stdPath = val stdPath =
toolchain.zig().getStdPath().orElse(null); toolchain.zig().getStdPath().orElse(null);
@ -69,16 +90,13 @@ public class ZigSyntheticLibrary extends SyntheticLibrary implements ItemPresent
.orElse("Zig")); .orElse("Zig"));
} }
private static @Nullable Collection<VirtualFile> pathToVFS(String path) { private static @Nullable Collection<VirtualFile> pathToVFS(Path path) {
if (path != null && !path.isEmpty()) { if (path != null) {
val thePath = PathUtil.pathFromString(path); val file = VfsUtil.findFile(path, true);
if (thePath != null) { if (file != null) {
val file = VfsUtil.findFile(thePath, true); val children = file.getChildren();
if (file != null) { if (children != null && children.length > 0)
val children = file.getChildren(); return Arrays.asList(children);
if (children != null && children.length > 0)
return Arrays.asList(children);
}
} }
} }
return null; return null;
@ -86,7 +104,8 @@ public class ZigSyntheticLibrary extends SyntheticLibrary implements ItemPresent
@Override @Override
public @NotNull Collection<VirtualFile> getSourceRoots() { public @NotNull Collection<VirtualFile> getSourceRoots() {
try { try {
return roots.get(); val rootsRaw = roots.get();
return rootsRaw == null ? Collections.emptySet() : rootsRaw;
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
e.printStackTrace(); e.printStackTrace();
return Collections.emptySet(); return Collections.emptySet();

View file

@ -25,6 +25,7 @@ import com.intellij.openapi.application.ApplicationManager;
import lombok.val; import lombok.val;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.nio.file.InvalidPathException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -32,7 +33,7 @@ import java.util.concurrent.ExecutionException;
public class ZigCompilerTool extends AbstractZigTool{ public class ZigCompilerTool extends AbstractZigTool{
public static final String TOOL_NAME = "zig"; public static final String TOOL_NAME = "zig";
private final Lazy<Optional<String>> version; private final Lazy<Optional<String>> version;
private final Lazy<Optional<String>> stdPath; private final Lazy<Optional<Path>> stdPath;
public ZigCompilerTool(AbstractZigToolchain toolchain) { public ZigCompilerTool(AbstractZigToolchain toolchain) {
super(toolchain, TOOL_NAME); super(toolchain, TOOL_NAME);
@ -47,7 +48,22 @@ public class ZigCompilerTool extends AbstractZigTool{
}); });
stdPath = new Lazy<>(() -> { stdPath = new Lazy<>(() -> {
try { try {
return baseFuture.get().map(ZigToolchainEnvironmentSerializable::stdDirectory); return baseFuture.get().map(ZigToolchainEnvironmentSerializable::stdDirectory)
.map(pathStr -> {
try {
val path = Path.of(pathStr);
if (path.isAbsolute()) {
return path;
}
val resolvedPath = toolchain.getLocation().resolve(path);
if (resolvedPath.isAbsolute()) {
return resolvedPath;
}
return null;
} catch (InvalidPathException e) {
return null;
}
});
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
return Optional.empty(); return Optional.empty();
} }
@ -61,7 +77,7 @@ public class ZigCompilerTool extends AbstractZigTool{
} }
public Optional<String> getStdPath() { public Optional<Path> getStdPath() {
return stdPath.get(); return stdPath.get();
} }