Skip to content

Commit

Permalink
chore(update): Update gradle, intellij and dependencies
Browse files Browse the repository at this point in the history
Update required java version to 17 (requires updating intellij since 2022.2)

Update gradle to 8.5
Update intellij gradle plugin and test dependencies to latest versions
Add changelog for next release
Bump version to 0.8.0 for release

Signed-off-by: jchrist <[email protected]>
  • Loading branch information
JChrist committed Dec 14, 2023
1 parent bacbad0 commit 3fd2648
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 95 deletions.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
26 changes: 21 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,30 @@ jobs:
citest:
runs-on: ubuntu-latest
steps:
# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
- name: checkout
uses: actions/checkout@v1
- name: setup_jdk
uses: actions/setup-java@v1
uses: actions/checkout@v4
# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 11
distribution: corretto
java-version: 17
- name: build
run: ./gradlew check --stacktrace --info
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Collect Tests Result
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: tests-result
path: ${{ github.workspace }}/build/reports/tests
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
---------


## 0.8.0 (2023-12-14)
* Fix no display name for configurable. Closes [#70](https://github.com/JChrist/gitextender/issues/70)

## 0.7.0 (2021-06-04)
* Workaround issue with wrong thread creating the update tree, by disabling showing update tree

Expand Down
47 changes: 27 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
buildscript {
repositories {
mavenCentral()
jcenter()
}
plugins {
id "java"
id "org.jetbrains.intellij" version "1.16.1"
id "jacoco"
}

plugins {
id "org.jetbrains.intellij" version "1.8.1"
repositories {
mavenCentral()
maven {
url = uri("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
}

intellij {
type = 'IC'
version = "2021.1"
// version = "LATEST-EAP-SNAPSHOT"
// version = "2022.2"
version = "LATEST-EAP-SNAPSHOT"
updateSinceUntilBuild = false
downloadSources = true
//comma separated list of plugins to depend on
plugins = ['git4idea']
plugins = ['Git4Idea']
pluginName = 'gitextender'
}

Expand All @@ -28,31 +30,36 @@ intellij {
}*/

group 'gr.jchrist'
version '0.7.0'
version '0.8.0'

apply plugin: 'java'
sourceCompatibility = '11'
targetCompatibility = '11'
sourceCompatibility = '17'
targetCompatibility = '17'

repositories {
mavenCentral()
}

dependencies {
testImplementation 'org.mockito:mockito-core:4.+'
testImplementation 'org.mockito:mockito-core:5.8.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.23.1'
testImplementation 'org.assertj:assertj-core:3.24.2'
}

buildSearchableOptions.enabled=false

apply plugin: 'jacoco'
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = false
xml.required = true
html.required = false
csv.required = false
}
}

//specify here that jacoco test report should execute after test
test { finalizedBy jacocoTestReport }
test {
finalizedBy jacocoTestReport
jacoco {
includeNoLocationClasses = true
excludes = ["jdk.internal.*"]
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3 changes: 2 additions & 1 deletion src/main/java/gr/jchrist/gitextender/RepositoryUpdater.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gr.jchrist.gitextender;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
Expand Down Expand Up @@ -67,7 +68,7 @@ public void updateRepository() {
final Project project = repo.getProject();

//find git service
final Git git = ServiceManager.getService(Git.class);
final Git git = ApplicationManager.getApplication().getService(Git.class);

Check warning on line 71 in src/main/java/gr/jchrist/gitextender/RepositoryUpdater.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/RepositoryUpdater.java#L71

Added line #L71 was not covered by tests

final String currBranch = repo.getCurrentBranchName();
if (currBranch == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@ public ProjectSettingsHandler(@NotNull Project project) {

@NotNull
public List<String> loadSelectedModules() {
List<String> modules = new ArrayList<>();

String[] selectedModules = properties.getValues(SELECTED_MODULES_KEY);
if (selectedModules == null || selectedModules.length == 0) {
return modules;
List<String> selectedModules = properties.getList(SELECTED_MODULES_KEY);

Check warning on line 25 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L25

Added line #L25 was not covered by tests
if (selectedModules == null) {
return new ArrayList<>();

Check warning on line 27 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L27

Added line #L27 was not covered by tests
}

modules.addAll(Arrays.asList(selectedModules));
return modules;
return new ArrayList<>(selectedModules);

Check warning on line 30 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L30

Added line #L30 was not covered by tests
}

public void addSelectedModule(@NotNull String module) {
List<String> modules = loadSelectedModules();
if (!modules.contains(module)) {
modules.add(module);
properties.setValues(SELECTED_MODULES_KEY, modules.toArray(new String[modules.size()]));
properties.setList(SELECTED_MODULES_KEY, modules);

Check warning on line 37 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L37

Added line #L37 was not covered by tests
}
}

Expand All @@ -48,16 +45,17 @@ public void removeSelectedModule(@NotNull String module) {
if (modules.isEmpty()) {
clearSelectedModules();
} else {
properties.setValues(SELECTED_MODULES_KEY, modules.toArray(new String[modules.size()]));
properties.setList(SELECTED_MODULES_KEY, modules);

Check warning on line 48 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L48

Added line #L48 was not covered by tests
}
}
}

public void setSelectedModules(@NotNull List<String> modules) {
properties.setValues(SELECTED_MODULES_KEY, modules.toArray(new String[modules.size()]));
properties.setList(SELECTED_MODULES_KEY, new ArrayList<>(modules));

Check warning on line 54 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L54

Added line #L54 was not covered by tests
}

public void clearSelectedModules() {
properties.setList(SELECTED_MODULES_KEY, new ArrayList<>());

Check warning on line 58 in src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/configuration/ProjectSettingsHandler.java#L58

Added line #L58 was not covered by tests
properties.unsetValue(SELECTED_MODULES_KEY);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.intellij.history.Label;
import com.intellij.history.LocalHistory;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.vcs.changes.VcsAnnotationRefresher;
Expand Down Expand Up @@ -104,6 +105,6 @@ public UpdateInfoTree generateUpdateInfoTree() {

protected void showUpdateTree(final UpdateInfoTree tree) {
if (!mergeState.getProject().isOpen() || mergeState.getProject().isDisposed() || tree == null) return;
GuiUtils.invokeLaterIfNeeded(() -> ViewUpdateInfoNotification.focusUpdateInfoTree(mergeState.getProject(), tree), ModalityState.defaultModalityState());
ApplicationManager.getApplication().invokeLater(() -> ViewUpdateInfoNotification.focusUpdateInfoTree(mergeState.getProject(), tree), ModalityState.defaultModalityState());

Check warning on line 108 in src/main/java/gr/jchrist/gitextender/handlers/AfterSuccessfulMergeHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/gr/jchrist/gitextender/handlers/AfterSuccessfulMergeHandler.java#L108

Added line #L108 was not covered by tests
}
}
7 changes: 5 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>gr.jchrist.gitextender</id>
<name>Git Extender</name>
<version>0.7.0</version>
<version>0.8.0</version>
<vendor email="[email protected]" url="https://github.com/JChrist/gitextender">JChrist</vendor>

<description><![CDATA[
Expand All @@ -26,6 +26,9 @@

<change-notes><![CDATA[
<ul>
<li>
0.8.0: Fix no display name for configurable. Closes [#70](https://github.com/JChrist/gitextender/issues/70)
</li>
<li>
0.7.0: Workaround issue with wrong thread creating the update tree, by disabling showing update tree
</li>
Expand Down Expand Up @@ -78,7 +81,7 @@
</change-notes>

<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
<idea-version since-build="203"/>
<idea-version since-build="222"/>

<depends>com.intellij.modules.lang</depends>
<depends>com.intellij.modules.vcs</depends>
Expand Down
55 changes: 42 additions & 13 deletions src/test/java/gr/jchrist/gitextender/AbstractIT.java
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
package gr.jchrist.gitextender;

import com.intellij.ide.highlighter.ProjectFileType;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.VcsShowConfirmationOption;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.ChangeListManagerImpl;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.testFramework.EdtTestUtil;
import com.intellij.testFramework.HeavyPlatformTestCase;
import com.intellij.testFramework.PlatformTestCase;
import com.intellij.testFramework.TestLoggerFactory;
import com.intellij.util.ArrayUtil;
import git4idea.DialogManager;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.commands.Git;
import git4idea.config.GitVcsSettings;
import git4idea.repo.GitRepository;
import git4idea.repo.GitRepositoryManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public abstract class AbstractIT extends HeavyPlatformTestCase {
private static final Logger logger = Logger.getInstance(GitTestUtil.class);

protected File myTestRoot;
protected VirtualFile myTestRootFile;
protected VirtualFile myProjectRoot;
Expand All @@ -52,14 +58,10 @@ public abstract class AbstractIT extends HeavyPlatformTestCase {
@Rule
public TestName testName = new TestName();

private boolean inited = false;
private boolean stopped = false;

@Before
public final void abstractSetUp() throws Exception {
//if (inited) return;
//inited = true;
//EdtTestUtil.runInEdtAndWait(() -> super.setUp());
myTestRoot = new File(FileUtil.getTempDirectory(), "testRoot");
checkTestRootIsEmpty(myTestRoot);

Expand All @@ -75,11 +77,11 @@ public final void abstractSetUp() throws Exception {
myGitSettings = GitVcsSettings.getInstance(myProject);
myGitSettings.getAppSettings().setPathToGit(GitExecutor.PathHolder.getGitExecutable());

myDialogManager = ServiceManager.getService(DialogManager.class);
myVcsNotifier = ServiceManager.getService(myProject, VcsNotifier.class);
myDialogManager = ApplicationManager.getApplication().getService(DialogManager.class);
myVcsNotifier = myProject.getService(VcsNotifier.class);

myGitRepositoryManager = GitUtil.getRepositoryManager(myProject);
myGit = ServiceManager.getService(Git.class);
myGit = ApplicationManager.getApplication().getService(Git.class);
myVcs = GitVcs.getInstance(myProject);
myVcs.doActivate();

Expand Down Expand Up @@ -154,6 +156,20 @@ protected void refresh() {
VfsUtil.markDirtyAndRefresh(false, true, false, myTestRootFile);
}

public void updateRepos() {
updateRepos(null);
}

public void updateRepos(GitRepository repository) {
var grm = getGitRepositoryManager();
runOutOfEdt(() -> {
if (repository != null) {
repository.update();
}
grm.updateAllRepositories();
});
}

private void checkTestRootIsEmpty(File testRoot) {
File[] files = testRoot.listFiles();
if (files != null && files.length > 0) {
Expand Down Expand Up @@ -244,4 +260,17 @@ public DialogManager getDialogManager() {
public VcsNotifier getVcsNotifier() {
return myVcsNotifier;
}

public static void runOutOfEdt(Runnable r) {
final var latch = new CountDownLatch(1);
ApplicationManager.getApplication().executeOnPooledThread(() -> {
r.run();
latch.countDown();
});
try {
latch.await(10, TimeUnit.SECONDS);
} catch (Exception e) {
logger.warn("error waiting", e);
}
}
}
Loading

0 comments on commit 3fd2648

Please sign in to comment.