From fb2c45e2b7698a541594f915b3557772ca4183a3 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Sat, 12 Aug 2023 22:39:21 +0100 Subject: [PATCH] Fix deprecations, update build processes --- CHANGELOG.md | 52 ++++++++++++----- README.md | 2 +- build.gradle | 54 ------------------ build.gradle.kts | 57 +++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- .../templates/SilverstripeContextType.java | 2 +- .../SilverstripeHTMLContextType.java | 2 +- .../util/SilverstripeVersionUtil.java | 9 ++- src/main/resources/META-INF/plugin.xml | 4 +- 9 files changed, 106 insertions(+), 78 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts diff --git a/CHANGELOG.md b/CHANGELOG.md index 26f4539..03c5579 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] + ### Added ### Changed @@ -11,7 +12,16 @@ ### Fixed -## [1.0.3] +## 1.0.4 + +### Changed +- Updated Silverstripe icons with new open source icons + +### Fixed +- Fixed deprecated APIs, updated minimum supported version to 2022.3 + +## 1.0.3 + ### Changed - More flexible <% require %> syntax - Replaced usage of IntelliJ internal API @@ -21,33 +31,39 @@ ### Fixed - Issue with lookups annotations -## [1.0.2] +## 1.0.2 + ### Fixed - Fixed issue with parsing of float arguments in lookups (#21) -## [1.0.1] +## 1.0.1 + ### Changed - Improved `BraceMatcher` to highlight start / end of tags as well as braces/parentheses (#18) ### Fixed - Slightly more permissive lexing of translation entities (#20) -## [1.0.0] +## 1.0.0 Initial stable release -## [0.3.3] +## 0.3.3 + ### Changed - Block stack in parser shouldn’t be static (#16) -## [0.3.2] +## 0.3.2 + ### Fixed - Intermittent issues indexing projects (#14) -## [0.3.1] +## 0.3.1 + ### Fixed - Issues with numbers in translation keys (#12) -## [0.3.0] +## 0.3.0 + ### Added - Support for generic open & closed block statements (e.g. cacheinclude cache statements) @@ -61,21 +77,25 @@ Initial stable release ### Fixed - Issue with background indexing of templates (#3) -## [0.2.3] +## 0.2.3 + ### Fixed - Further issues with how $Variables without {} braces were handled -## [0.2.2] +## 0.2.2 + ### Fixed - Regression in how $Variables without {} braces were handled -## [0.2.1] +## 0.2.1 + ### Fixed - Issues with typing `$` or `>` in an empty template - Includes with numbers in file name were broken - Annotations for includes using double-backslash separators were broken -## [0.2.0] +## 0.2.0 + ### Added - Support for renaming/moving include files (auto-update references) @@ -83,16 +103,18 @@ Initial stable release - Broken click to navigate to include - Stale references to includes when include statement is changed -## [0.1.0] +## 0.1.0 + ### Added - Live templates for code completion/surrounding ### Fixed - Issues with include statements/references triggering exceptions -## [0.0.2] +## 0.0.2 + ### Fixed - Some include files wouldn’t be recognised as valid in SS4 projects -## [0.0.1] +## 0.0.1 - Initial release diff --git a/README.md b/README.md index c09cb07..d508bf4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This plugin adds Silverstripe template support to PHPStorm and other JetBrains I ## Platform requirements -This plugin requires PHPStorm (or other IDEA-based IDE) to be running version 2020.3 or greater. +This plugin requires PHPStorm (or other IDEA-based IDE) to be running version 2022.3 or greater. ## Installation diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 89fbfd7..0000000 --- a/build.gradle +++ /dev/null @@ -1,54 +0,0 @@ -plugins { - id 'java' - id 'org.jetbrains.intellij' version '0.6.5' - id 'org.jetbrains.changelog' version '1.1.1' -} - -group 'com.kinglozzer' -version '1.0.3' - -sourceSets { - main.java.srcDirs = ['src/main/java', 'src/main/gen'] -} - -repositories { - mavenCentral() -} - -apply plugin: 'java' -apply plugin: 'idea' -apply plugin: 'org.jetbrains.intellij' -apply plugin: 'org.jetbrains.changelog' - -intellij { - version 'IC-2020.3' - - patchPluginXml { - version = project.version - untilBuild = null - changeNotes({ changelog.get(project.version).toHTML() }) - } -} - -test { - testLogging { - exceptionFormat = 'full' - } -} - -tasks { - buildSearchableOptions { - // Disabled as temporary workaround for https://youtrack.jetbrains.com/issue/KTIJ-699 - enabled(false) - } -} - -changelog { - version = project.version - path = "${project.projectDir}/CHANGELOG.md" - header = { "[$version]" } - itemPrefix = "-" - keepUnreleasedSection = true - unreleasedTerm = "[Unreleased]" - groups = ["Added", "Changed", "Deprecated", "Removed", "Fixed"] -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..dbb7370 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,57 @@ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.jetbrains.changelog.Changelog + +plugins { + id("java") + id("org.jetbrains.intellij") version "1.15.0" + id("org.jetbrains.changelog") version "2.1.2" +} + +group = "com.kinglozzer" +version = "1.0.4" + +sourceSets { + main { + java.srcDirs("src/main/java", "src/main/gen") + } +} + +repositories { + mavenCentral() +} + +intellij { + version.set("2022.3") +} + +tasks { + test { + testLogging { + exceptionFormat = TestExceptionFormat.FULL + } + } + + patchPluginXml { + untilBuild.set("") + + changeNotes.set(provider { + changelog.renderItem( + changelog + .getLatest() + .withHeader(false) + .withEmptySections(false), + Changelog.OutputType.HTML + ) + }) + } +} + +changelog { + version.set("1.0.4") + path.set(file("CHANGELOG.md").canonicalPath) + header.set(provider { "${version.get()}" }) + itemPrefix.set("-") + keepUnreleasedSection.set(true) + unreleasedTerm.set("[Unreleased]") + groups.set(listOf("Added", "Changed", "Deprecated", "Removed", "Fixed")) +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index be52383..070cb70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeContextType.java b/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeContextType.java index 9d6ed58..bffb8d2 100644 --- a/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeContextType.java +++ b/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeContextType.java @@ -10,7 +10,7 @@ public class SilverstripeContextType extends TemplateContextType { protected SilverstripeContextType() { - super("Silverstripe", "Silverstripe"); + super("Silverstripe"); } @Override diff --git a/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeHTMLContextType.java b/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeHTMLContextType.java index e7f2c10..afe6259 100644 --- a/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeHTMLContextType.java +++ b/src/main/java/com/kinglozzer/silverstripe/ide/templates/SilverstripeHTMLContextType.java @@ -13,7 +13,7 @@ public class SilverstripeHTMLContextType extends TemplateContextType { protected SilverstripeHTMLContextType() { - super("Silverstripe HTML", "Silverstripe"); + super("Silverstripe"); } @Override diff --git a/src/main/java/com/kinglozzer/silverstripe/util/SilverstripeVersionUtil.java b/src/main/java/com/kinglozzer/silverstripe/util/SilverstripeVersionUtil.java index ca06944..b4aca97 100644 --- a/src/main/java/com/kinglozzer/silverstripe/util/SilverstripeVersionUtil.java +++ b/src/main/java/com/kinglozzer/silverstripe/util/SilverstripeVersionUtil.java @@ -2,6 +2,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectRootManager; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFileSystemItem; import com.intellij.psi.search.FilenameIndex; import com.intellij.psi.util.CachedValueProvider; @@ -9,6 +10,8 @@ import com.intellij.util.text.VersionComparatorUtil; import org.jetbrains.annotations.NotNull; +import java.util.Collection; + import static com.intellij.psi.search.GlobalSearchScope.allScope; public final class SilverstripeVersionUtil { @@ -33,13 +36,13 @@ public static boolean isSilverstripe4OrMore(@NotNull Project project) { private static String computeSilverstripeVersion(@NotNull Project project) { String version = "3"; - PsiFileSystemItem[] candidates = FilenameIndex.getFilesByName(project, "framework", allScope(project), true); - for (PsiFileSystemItem candidate : candidates) { + Collection candidates = FilenameIndex.getVirtualFilesByName("framework", allScope(project)); + for (VirtualFile candidate : candidates) { if (!candidate.isDirectory()) { continue; } - PsiFileSystemItem parent = candidate.getParent(); + VirtualFile parent = candidate.getParent(); if (parent != null && parent.isDirectory() && parent.getName().equals("silverstripe")) { parent = parent.getParent(); if (parent != null && parent.isDirectory() && parent.getName().equals("vendor")) { diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 6e18811..a945854 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -87,8 +87,8 @@ - - + +