Skip to content

Commit

Permalink
fix for IC 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
chuntungho committed Apr 29, 2024
1 parent fac1e01 commit b211fd7
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 34 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0

- name: Build with Gradle Wrapper
run: ./gradlew buildPlugin

- name: Upload image file
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: plugin-file
path: build/distributions/*.zip

dependency-submission:

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
59 changes: 33 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
plugins {
id "java"
id "org.jetbrains.intellij" version "0.4.15"
buildscript {
repositories {
mavenCentral()
jcenter()
}
}

intellij {
version ideaVersion
pluginName "MyBatisBuilder"
// plugins = ['java'] only for 201
sameSinceUntilBuild Boolean.valueOf(isEAP)
patchPluginXml{
untilBuild customUtilBuild
changeNotes "${new File('changeNotes.txt').getText('UTF-8')}"
}
plugins {
id 'org.jetbrains.intellij' version '1.10.2'
}

group 'com.chuntung.plugin'
version "${version}"
sourceCompatibility = JavaVersion.VERSION_1_8

publishPlugin {
username System.properties['plugin.publish.username']
password System.properties['plugin.publish.password']
channels "${pluginChannels}"
}
//sourceCompatibility = JavaVersion.VERSION_1_8
[compileJava,compileTestJava,javadoc]*.options*.encoding = 'UTF-8'

repositories {
jcenter()
Expand All @@ -31,6 +21,23 @@ repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}

intellij {
pluginName = "MyBatis Builder"
version = ideaVersion
plugins = ["java"]
sameSinceUntilBuild = Boolean.valueOf(isEAP)
patchPluginXml {
untilBuild = customUtilBuild
changeNotes = "${new File('changeNotes.txt').getText('UTF-8')}"
}
}

//publishPlugin {
// username = System.properties['plugin.publish.username']
// password = System.properties['plugin.publish.password']
// channels = "${pluginChannels}"
//}

sourceSets {
test {
java {
Expand All @@ -46,16 +53,16 @@ sourceSets {
}

dependencies {
compile ( group: 'org.mybatis.generator', name: 'mybatis-generator-core', version: '1.4.2') {
implementation( group: 'org.mybatis.generator', name: 'mybatis-generator-core', version: '1.4.2') {
exclude group: 'org.junit.jupiter'
exclude group: 'org.junit.platform'
exclude group: 'org.assertj'
}
compile group: 'com.github.javaparser', name: 'javaparser-core', version: '3.19.0'
compile group: 'org.postgresql', name: 'postgresql', version: '9.4.1212'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.47'
implementation group: 'com.github.javaparser', name: 'javaparser-core', version: '3.19.0'
implementation group: 'org.postgresql', name: 'postgresql', version: '9.4.1212'
implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.47'

testCompile('com.h2database:h2:1.4.200')
testCompile('org.mybatis:mybatis:3.5.9')
testCompile("org.mybatis.dynamic-sql:mybatis-dynamic-sql:1.5.0")
testImplementation('com.h2database:h2:1.4.200')
testImplementation('org.mybatis:mybatis:3.5.9')
testImplementation("org.mybatis.dynamic-sql:mybatis-dynamic-sql:1.5.0")
}
2 changes: 1 addition & 1 deletion changeNotes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<ul>
<li>Upgrade mybatis generator to 1.4.2.</li>
<li>Fix for IC 2024</li>
</ul>
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = 1.2.5
ideaVersion = IC-2018.1
version = 1.3.0
ideaVersion = IC-2023.1
customUtilBuild = 299.*
isEAP = false
pluginChannels = nightly
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Dec 03 16:52:50 CST 2019
distributionUrl=https\://downloads.gradle-dn.com/distributions/gradle-6.8.3-bin.zip
#Mon Apr 29 10:48:50 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.chuntung.plugin.mybatis.builder.view.MybatisBuilderParametersDialog;
import com.chuntung.plugin.mybatis.builder.view.MybatisBuilderToolWindowPanel;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
Expand Down Expand Up @@ -54,6 +55,10 @@ public static AnAction getInstance(Project project) {
return ActionManager.getInstance().getAction(ACTION_ID);
}

public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import com.chuntung.plugin.mybatis.builder.model.ConnectionInfo;
import com.chuntung.plugin.mybatis.builder.model.DatabaseItem;
import com.chuntung.plugin.mybatis.builder.util.ViewUtil;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
Expand All @@ -25,6 +27,10 @@ public ConnectionAction(ConnectionInfo connectionInfo, JTree objectTree) {
this.objectTree = objectTree;
}

public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(AnActionEvent e) {
DefaultMutableTreeNode root = (DefaultMutableTreeNode) objectTree.getModel().getRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.chuntung.plugin.mybatis.builder.util.StringUtil;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Editor;
Expand All @@ -31,6 +32,10 @@ public class CopyAsExecutableSQLAction extends DumbAwareAction {
private static final String PARAMETERS = "Parameters: ";
private static final Set<String> QUOTE_TYPES = new HashSet<>(Arrays.asList("(String)", "(Date)", "(Time)", "(Timestamp)", "(DateTime)", "(LocalDateTime)"));

public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
Editor editor = event.getData(CommonDataKeys.EDITOR);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.chuntung.plugin.mybatis.builder.view.MybatisBuilderSettingsDialog;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
Expand All @@ -20,6 +21,10 @@ public static AnAction getInstance() {
return ActionManager.getInstance().getAction(ACTION_ID);
}

public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
DialogWrapper dialog = new MybatisBuilderSettingsDialog(anActionEvent.getProject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.chuntung.plugin.mybatis.builder.model.ConnectionInfo;
import com.chuntung.plugin.mybatis.builder.MybatisBuilderService;
import com.chuntung.plugin.mybatis.builder.util.ViewUtil;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
Expand All @@ -30,6 +31,10 @@ public PopupAction(JTree objectTree) {
this.objectTree = objectTree;
}

public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
DefaultActionGroup actionGroup = new DefaultActionGroup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.chuntung.plugin.mybatis.builder.generator.GeneratorToolWrapper;
import com.chuntung.plugin.mybatis.builder.generator.callback.IndicatorProcessCallback;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
Expand All @@ -30,6 +31,10 @@
* @author Tony Ho
*/
public class RunMyBatisGeneratorAction extends AnAction {
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
}

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
PsiFile psiFile = (PsiFile) event.getData(CommonDataKeys.PSI_FILE);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<li>"Copy as Executable SQL" from MyBatis log.</li>
<li>"Run MyBatis Generator" with official configuration file.</li>
</ul>
<a href="https://mybatis.chuntung.com">Getting Started</a> | <a href="https://chuntung.com/donate">Donate</a>
<a href="https://mybatis.chuntung.com">Getting Started</a>
]]></description>

<change-notes><![CDATA[
Expand All @@ -31,7 +31,7 @@
</change-notes>

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="191.0"/>
<!-- <idea-version since-build="191.0"/>-->

<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
Expand Down

0 comments on commit b211fd7

Please sign in to comment.