diff --git a/CHANGE-NOTES.md b/CHANGE-NOTES.md index 2c2348b07..69096bc70 100644 --- a/CHANGE-NOTES.md +++ b/CHANGE-NOTES.md @@ -1,6 +1,12 @@ # Changelog +## v5.0.1 + +- Improved: performance of loading repositories with long git histories and a lot of red-edge branches +- Fixed: `Class initialization must not depend on services` error on IntelliJ 2024.2 EAP (reported by @fan-tom) + ## v5.0.0 +- Added support for IntelliJ 2024.2. - Dropped support for IntelliJ 2022.2. Note that the versions of this plugin published so far will remain available for download in IntelliJ 2022.2 indefinitely. The change in the range of supported IntelliJ versions will only affect the new plugin releases, starting from this one. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7eb979515..6696dc4dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -72,7 +72,6 @@ ln -s ../../scripts/run-pre-build-checks .git/hooks/pre-commit #### Windows **The hooks do not work on Windows** (however, their execution seems to be possible theoretically). -This is because one may not be emulating bash environment in any way or doing it in some specific way. #### macOS Some hooks use `grep`. The macOS version of `grep` (FreeBSD) differs from GNU `grep`. diff --git a/build.gradle.kts b/build.gradle.kts index 0a158b337..e3ddc1107 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -442,9 +442,3 @@ vavr("test") tasks.withType { jvmArgs(getFlagsForAddExports("jdk.internal.reflect", module = "java.base")) } - -// TODO (JetBrains/intellij-platform-gradle-plugin#1675): workaround to prevent race condition on .../.intellijPlatform/coroutines-javaagent.jar -tasks.withType { - dependsOn(":frontend:graph:initializeIntellijPlatformPlugin") - dependsOn(":frontend:ui:initializeIntellijPlatformPlugin") -} diff --git a/buildSrc/gradle/libs.versions.toml b/buildSrc/gradle/libs.versions.toml index bf0ddf560..4619e5502 100644 --- a/buildSrc/gradle/libs.versions.toml +++ b/buildSrc/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [libraries] -jsoup = "org.jsoup:jsoup:1.17.2" +jsoup = "org.jsoup:jsoup:1.18.1" junit-api = "org.junit.jupiter:junit-jupiter-api:5.10.3" # Plugin packages # This way of applying the plugins was needed for the build-related code in buildSrc/src/main/, diff --git a/frontend/ui/impl/build.gradle.kts b/frontend/ui/impl/build.gradle.kts index e50c353c7..25acbde7a 100644 --- a/frontend/ui/impl/build.gradle.kts +++ b/frontend/ui/impl/build.gradle.kts @@ -10,16 +10,6 @@ dependencies { implementation(project(":frontend:ui:api")) } -// TODO (JetBrains/intellij-platform-gradle-plugin#1675): workaround to prevent race condition on .../.intellijPlatform/coroutines-javaagent.jar -tasks.withType { - dependsOn(":initializeIntellijPlatformPlugin") - dependsOn(":frontend:actions:initializeIntellijPlatformPlugin") - dependsOn(":frontend:graph:initializeIntellijPlatformPlugin") - dependsOn(":frontend:graph:impl:initializeIntellijPlatformPlugin") - dependsOn(":frontend:ui:initializeIntellijPlatformPlugin") - dependsOn(":frontend:ui:impl:initializeIntellijPlatformPlugin") -} - apacheCommonsText() junit() junitPlatformLauncher() diff --git a/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/cell/BranchOrCommitCellRendererComponent.java b/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/cell/BranchOrCommitCellRendererComponent.java index 50e16a324..cfdeba346 100644 --- a/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/cell/BranchOrCommitCellRendererComponent.java +++ b/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/cell/BranchOrCommitCellRendererComponent.java @@ -68,9 +68,6 @@ public final class BranchOrCommitCellRendererComponent extends SimpleColoredRend private static final String CELL_TEXT_FRAGMENTS_SPACING = " "; private static final String HEAVY_WIDE_HEADED_RIGHTWARDS_ARROW = "\u2794"; - private static final IGraphCellPainterFactory graphCellPainterFactoryInstance = ApplicationManager.getApplication() - .getService(IGraphCellPainterFactory.class); - private final JTable graphTable; private final BufferedImage graphImage; private final MyTableCellRenderer myTableCellRenderer; @@ -104,7 +101,7 @@ public BranchOrCommitCellRendererComponent( } this.graphImage = getGraphImage(graphTable, maxGraphNodePositionInRow); Graphics2D g2 = graphImage.createGraphics(); - val graphCellPainter = graphCellPainterFactoryInstance.create(table); + val graphCellPainter = ApplicationManager.getApplication().getService(IGraphCellPainterFactory.class).create(table); graphCellPainter.draw(g2, renderParts); this.myTableCellRenderer = new MyTableCellRenderer(); diff --git a/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotification.java b/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotification.java new file mode 100644 index 000000000..b6690304e --- /dev/null +++ b/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotification.java @@ -0,0 +1,25 @@ +package com.virtuslab.gitmachete.frontend.ui.impl.table; + +import static com.virtuslab.gitmachete.frontend.resourcebundles.GitMacheteBundle.getString; + +import com.intellij.notification.Notification; +import com.intellij.notification.NotificationType; +import com.intellij.openapi.vcs.VcsNotifier; +import lombok.Getter; +import lombok.experimental.ExtensionMethod; + +import com.virtuslab.gitmachete.frontend.resourcebundles.GitMacheteBundle; + +@ExtensionMethod(GitMacheteBundle.class) +public class UnmanagedBranchNotification extends Notification { + + @Getter + private final String branchName; + + UnmanagedBranchNotification(String branchName) { + super(VcsNotifier.STANDARD_NOTIFICATION.getDisplayId(), + getString("action.GitMachete.EnhancedGraphTable.unmanaged-branch-notification.text").fmt(branchName), + NotificationType.INFORMATION); + this.branchName = branchName; + } +} diff --git a/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotificationFactory.java b/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotificationFactory.java index a569b1847..763410d3b 100644 --- a/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotificationFactory.java +++ b/frontend/ui/impl/src/main/java/com/virtuslab/gitmachete/frontend/ui/impl/table/UnmanagedBranchNotificationFactory.java @@ -12,15 +12,12 @@ import com.intellij.ide.util.PropertiesComponent; import com.intellij.notification.Notification; import com.intellij.notification.NotificationAction; -import com.intellij.notification.NotificationType; import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.project.Project; -import com.intellij.openapi.vcs.VcsNotifier; -import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.experimental.ExtensionMethod; import lombok.val; @@ -132,19 +129,4 @@ private NotificationAction getOpenMacheteFileAction() { ActionManager.getInstance().getAction(OPEN_MACHETE_FILE).actionPerformed(actionEvent); }); } - -} - -@ExtensionMethod(GitMacheteBundle.class) -class UnmanagedBranchNotification extends Notification { - - @Getter - private final String branchName; - - UnmanagedBranchNotification(String branchName) { - super(VcsNotifier.STANDARD_NOTIFICATION.getDisplayId(), - getString("action.GitMachete.EnhancedGraphTable.unmanaged-branch-notification.text").fmt(branchName), - NotificationType.INFORMATION); - this.branchName = branchName; - } } diff --git a/gitCore/jGit/src/main/java/com/virtuslab/gitcore/impl/jgit/GitCoreRepository.java b/gitCore/jGit/src/main/java/com/virtuslab/gitcore/impl/jgit/GitCoreRepository.java index f6148cd4c..8393d5609 100644 --- a/gitCore/jGit/src/main/java/com/virtuslab/gitcore/impl/jgit/GitCoreRepository.java +++ b/gitCore/jGit/src/main/java/com/virtuslab/gitcore/impl/jgit/GitCoreRepository.java @@ -53,6 +53,12 @@ @CustomLog @ToString(onlyExplicitlyIncluded = true) public final class GitCoreRepository implements IGitCoreRepository { + /** + * Let's avoid loading too many commits when trying to find fork point. + * It's unlikely that anyone will have that many unique commits on a branch. + */ + private static final int MAX_ANCESTOR_COMMIT_COUNT = 100; + @Getter @ToString.Include private final Path rootDirectoryPath; @@ -643,6 +649,6 @@ public Stream ancestorsOf(IGitCoreCommit commitInclusive) throws throw new GitCoreException(e); } - return Stream.ofAll(walk).map(GitCoreCommit::new); + return Stream.ofAll(walk).take(MAX_ANCESTOR_COMMIT_COUNT).map(GitCoreCommit::new); } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8401ad2f8..a452f06a6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,7 +28,7 @@ vavr = "io.vavr:vavr:0.10.4" # where they aren't really `apply`-ed as plugins, but rather added to classpath as plugin packages; # see https://docs.gradle.org/current/samples/sample_convention_plugins.html#things_to_note. [plugins] -jetbrains-changelog = "org.jetbrains.changelog:2.2.0" +jetbrains-changelog = "org.jetbrains.changelog:2.2.1" jetbrains-grammarkit = "org.jetbrains.grammarkit:2022.3.2.2" -jetbrains-intellij = "org.jetbrains.intellij.platform:2.0.0-beta8" +jetbrains-intellij = "org.jetbrains.intellij.platform:2.0.0-RC1" taskTree = "com.dorongold.task-tree:4.0.0" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e6441136f..2c3521197 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138c..09523c0e5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index b740cf133..f5feea6d6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum diff --git a/intellij-versions.properties b/intellij-versions.properties index 4e9648ef8..16e97316c 100644 --- a/intellij-versions.properties +++ b/intellij-versions.properties @@ -1,4 +1,4 @@ -eapOfLatestSupportedMajor=242.19533.56-EAP-SNAPSHOT +eapOfLatestSupportedMajor=242.20224.91-EAP-SNAPSHOT earliestSupportedMajor=2022.3 earliestSupportedMajorKotlinVersion=1.7 latestMinorsOfOldSupportedMajors=2022.3.3,2023.1.7,2023.2.7,2023.3.7 diff --git a/src/test/java/com/virtuslab/archunit/ForbiddenMethodsTestSuite.java b/src/test/java/com/virtuslab/archunit/ForbiddenMethodsTestSuite.java index bac74e59b..e51382b5b 100644 --- a/src/test/java/com/virtuslab/archunit/ForbiddenMethodsTestSuite.java +++ b/src/test/java/com/virtuslab/archunit/ForbiddenMethodsTestSuite.java @@ -7,6 +7,9 @@ import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.methods; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; +import com.tngtech.archunit.base.DescribedPredicate; +import com.tngtech.archunit.core.domain.JavaMethodCall; +import lombok.val; import org.junit.jupiter.api.Test; import com.virtuslab.gitmachete.backend.impl.GitMacheteRepositorySnapshot; @@ -25,6 +28,24 @@ public void no_classes_should_call_AnActionEvent_getRequiredData() { .check(productionClasses); } + @Test + public void no_classes_should_call_Application_getService_from_static_initializer() { + noClasses() + .should() + .callMethodWhere(new DescribedPredicate("Application#getService is called from static initializer") { + @Override + public boolean test(JavaMethodCall javaMethodCall) { + val target = javaMethodCall.getTarget(); + val origin = javaMethodCall.getOrigin(); + return target.getOwner().isEquivalentTo(com.intellij.openapi.application.Application.class) + && target.getName().equals("getService") + && origin.getName().equals(""); + } + }) + .because("class initialization must not depend on services since IntelliJ 2024.2") + .check(productionClasses); + } + @Test public void no_classes_should_call_Collections_nCopies() { noClasses() diff --git a/version.gradle.kts b/version.gradle.kts index ec5dc7ba6..8bd2a525e 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -1 +1 @@ -val prospectiveReleaseVersion by extra("5.0.0") +val prospectiveReleaseVersion by extra("5.0.1")