backport: 17.2.0

This commit is contained in:
FalsePattern 2024-09-20 10:19:48 +02:00
parent a23812536d
commit 0596c5cafb
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
10 changed files with 128 additions and 32 deletions

45
.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]
## [17.2.0]
### Added
- IDEA 2024.3 support
### Fixed
- Project
- Safer standard library path resolution
## [17.1.0]
### 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.utils.extensionProvider
fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)
fun properties(key: String) = providers.gradleProperty(key) as Provider<String>
fun environment(key: String) = providers.environmentVariable(key) as Provider<String>
plugins {
java
`maven-publish`
`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.grammarkit") version("2022.3.2.2")
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
@ -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 lsp4jVersion = "0.21.1"
val lsp4ijVersion = "0.3.0"
val lsp4ijVersion = "0.5.0"
val lsp4ijNightly = lsp4ijVersion.contains("-")
val lsp4ijDepString = "${if (lsp4ijNightly) "nightly." else ""}com.jetbrains.plugins:com.redhat.devtools.lsp4ij:$lsp4ijVersion"
@ -86,13 +86,20 @@ allprojects {
includeGroup("nightly.com.jetbrains.plugins")
}
}
snapshots {
releases {
content {
includeModule("com.jetbrains.intellij.clion", "clion")
includeModule("com.jetbrains.intellij.idea", "ideaIC")
includeModule("com.jetbrains.intellij.idea", "ideaIU")
}
}
jetbrainsIdeInstallers {
content {
includeModule("cpp", "CLion")
includeModule("idea", "ideaIC")
includeModule("idea", "ideaIU")
}
}
}
}
dependencies {
@ -173,7 +180,7 @@ allprojects {
withType<PatchPluginXmlTask> {
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")
untilBuild = properties("pluginUntilBuild").flatMap {provider { it.ifBlank { null } }}
}
}
intellijPlatform {
@ -317,7 +324,7 @@ project(":plugin") {
privateKeyFile = rootProject.file("secrets/private.pem")
password = environment("PRIVATE_KEY_PASSWORD")
}
verifyPlugin {
pluginVerification {
ides {
ide(IntelliJPlatformType.IntellijIdeaCommunity, ideaVersion)
ide(IntelliJPlatformType.IntellijIdeaUltimate, ideaVersion)

View file

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

View file

@ -11,10 +11,10 @@ baseIDE=clion
ideaVersion=2024.2.2
clionVersion=2024.2.2
pluginVersion=17.1.1-dev
pluginVersion=17.2.0
# 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
# TODO grammarkit breaks with this

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
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
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

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

View file

@ -25,6 +25,7 @@ import com.intellij.openapi.application.ApplicationManager;
import lombok.val;
import org.jetbrains.annotations.Nullable;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
@ -32,7 +33,7 @@ import java.util.concurrent.ExecutionException;
public class ZigCompilerTool extends AbstractZigTool{
public static final String TOOL_NAME = "zig";
private final Lazy<Optional<String>> version;
private final Lazy<Optional<String>> stdPath;
private final Lazy<Optional<Path>> stdPath;
public ZigCompilerTool(AbstractZigToolchain toolchain) {
super(toolchain, TOOL_NAME);
@ -47,7 +48,22 @@ public class ZigCompilerTool extends AbstractZigTool{
});
stdPath = new Lazy<>(() -> {
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) {
return Optional.empty();
}
@ -61,7 +77,7 @@ public class ZigCompilerTool extends AbstractZigTool{
}
public Optional<String> getStdPath() {
public Optional<Path> getStdPath() {
return stdPath.get();
}