Skip to content

Commit

Permalink
feat: 5.0.8 预发发布
Browse files Browse the repository at this point in the history
feat: 准备下一个版本迭代
  • Loading branch information
[email protected] committed Aug 20, 2023
1 parent 24028df commit 1e94d7f
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 352 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ IDEA --> Setting --> Plugins --> 搜索 MyBatis Log EasyPlus
</td>
</table>

#### <kbd>2023.08.20</kbd> -> <kbd> 最后一个支持《IDEA 2021.1》的版本,感谢各位社区伙伴的测试反馈,现已修复若干个已知问题,装备下一个版本大迭代</kbd>

#### <kbd>2023.05.28</kbd> -> <kbd>对额外的扩展插件进行支持</kbd>

#### <kbd>2023.05.22</kbd> -> <kbd>《IDEA 2021.1 以上》感谢各位社区伙伴的测试反馈,现已修复若干个已知问题</kbd>
Expand Down
6 changes: 3 additions & 3 deletions mybatis-idea-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ allprojects {
}

group 'com.plugins.mybaitslog.idea.plugin'
version '5.0.8.1'
version '5.0.8.2'

dependencies {
implementation project(path: ':mybatis-plugin')
Expand All @@ -50,8 +50,8 @@ dependencies {

/*测试关闭*/
java {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
sourceCompatibility = "8"
targetCompatibility = "8"
}

/*https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html#intellij-platform-based-products-of-recent-ide-versions*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.runners.JavaProgramPatcher;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.diagnostic.Logger;
import com.plugins.mybaitslog.rmi.RmiServer;
import org.jetbrains.annotations.NotNull;
import com.plugins.mybaitslog.unix.UnixServer;

import java.util.*;

Expand Down Expand Up @@ -44,7 +38,7 @@ public void patchJavaParameters(Executor executor, RunProfile configuration, Jav
String id = null;
if (configuration instanceof RunConfiguration) {
final RunConfiguration runConfiguration = (RunConfiguration) configuration;
id = RmiServer.getId(runConfiguration.getProject());
id = UnixServer.getId(runConfiguration.getProject());
}
//
Sdk jdk = javaParameters.getJdk();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.intellij.ui.content.ContentFactory;
import com.plugins.mybaitslog.VersionControl;
import com.plugins.mybaitslog.icons.Icons;
import com.plugins.mybaitslog.rmi.RmiServer;
import com.plugins.mybaitslog.unix.UnixServer;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
Expand All @@ -24,7 +24,7 @@ public class MyBatisLogToolWindow implements ToolWindowFactory {

@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
RmiServer.boot(project);
UnixServer.boot(project);
ConsolePanel consolePanel = new ConsolePanel();
final JComponent jComponent = consolePanel.getConsolePanel(project);
final ContentFactory contentFactory = VersionControl.getContentFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="RMIServer"/>
<text value="UnixServer"/>
</properties>
</component>
<component id="9ec2b" class="javax.swing.JCheckBox" binding="checkBox_rmi">
Expand All @@ -360,7 +360,7 @@
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="RMI输出"/>
<text value="已废弃"/>
</properties>
</component>
</children>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.plugins.mybaitslog.unix;

import com.intellij.openapi.project.Project;
import com.plugins.mybaitslog.Config;
import com.plugins.mybaitslog.console.PrintlnUtil;
import org.jetbrains.annotations.NotNull;

import java.net.StandardProtocolFamily;
import java.net.UnixDomainSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;

/**
* A <code>RmiServer</code> Class
*
* @author lk
* @version 1.0
* <p><b>date: 2023/5/12 19:20</b></p>
*/
public class UnixServer {

public static Map<Project, String> RMISERVERID = new ConcurrentHashMap<Project, String>();

public static String getId(@NotNull Project project) {
return RMISERVERID.get(project);
}

public static void boot(@NotNull Project project) {
String id = UUID.randomUUID().toString().replace("-", "");
RMISERVERID.put(project, id);
//无法支持到1.8后续再想办法
/*
final boolean runRmi = Config.Idea.getRunRmi();
if (runRmi) {
new Thread(new Runnable() {
@Override
public void run() {
try {
String id = UUID.randomUUID().toString().replace("-", "");
RMISERVERID.put(project, id);
Path socketPath = Path
.of(System.getProperty("java.io.tmpdir"))
.resolve(id + ".socket");
Files.deleteIfExists(socketPath);
ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(StandardProtocolFamily.UNIX);
UnixDomainSocketAddress of = UnixDomainSocketAddress.of(socketPath);
serverSocketChannel.bind(of);
while (true) {
SocketChannel socketChannel = serverSocketChannel.accept();
ByteBuffer buf = ByteBuffer.allocate(1024);
int bytesRead = socketChannel.read(buf);
while (bytesRead > 0) {
buf.flip();
StringBuffer stringBuffer = new StringBuffer();
while (buf.hasRemaining()) {
stringBuffer.append((char) buf.get());
}
buf.clear();
PrintlnUtil.prints(project, stringBuffer.toString());
bytesRead = socketChannel.read(buf);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}*/
}
}
2 changes: 1 addition & 1 deletion mybatis-idea-plugin/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<vendor email="[email protected]" url="https://github.com/Link-Kou/intellij-mybaitslog">linkkou</vendor>

<!-- 插件版本 -->
<version>5.0.8.1</version>
<version>5.0.8.2</version>
<!-- please see https://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
<idea-version since-build="201"/>
<!-- 插件的描述 -->
Expand Down
6 changes: 3 additions & 3 deletions mybatis-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ allprojects {
}

group 'com.plugins.mybatislog.plugin'
version '1.0.9'
version '1.0.10'

java {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
sourceCompatibility = "8"
targetCompatibility = "8"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.javatuples.Pair;

import java.lang.reflect.Field;
import java.text.DateFormat;
import java.util.*;
import java.util.regex.Matcher;

Expand Down Expand Up @@ -82,7 +81,7 @@ public Object intercept(Invocation invocation) throws Throwable {
.setParameter(gson.toJson(completeSql.getValue1()))
.setOriginalSql(originalSql);
final String json = gson.toJson(sqlVO);
RmiLog.log("==> SQLStructure: " + json, this.id);
PrintlnLog.log("==> SQLStructure: " + json, this.id);
}
} catch (Exception e) {
e.printStackTrace();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.linkkou.mybatis.log;

import com.google.gson.internal.JavaVersion;

import java.net.StandardProtocolFamily;
import java.net.UnixDomainSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.file.Path;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
* A <code>RmiLog</code> Class
*
* @author lk
* @version 1.0
* <p><b>date: 2023/5/12 19:28</b></p>
*/
public class PrintlnLog {

private static SocketChannel socketChannel;
private static boolean connect = false;

private static SocketChannel client(String id) {
return null;
//目前无法支持到1.8
/*if (null == id) {
return null;
}
if (socketChannel != null && connect) {
return socketChannel;
}
Lock lock = new ReentrantLock(); //注意这个地方
lock.lock();
try {
Path socketPath = Path.of(System.getProperty("java.io.tmpdir")).resolve(id + ".socket");
socketChannel = SocketChannel.open(StandardProtocolFamily.UNIX);
UnixDomainSocketAddress of = UnixDomainSocketAddress.of(socketPath);
connect = socketChannel.connect(of);
} catch (Exception e) {
e.printStackTrace();
} finally {
lock.unlock();
}
return socketChannel;*/
}

public static void log(String log, String id) {
final SocketChannel client = client(id);
if (!connect) {
System.out.println(log);
} else {
try {
ByteBuffer buf = ByteBuffer.allocate(log.length());
buf.clear();
buf.put(log.getBytes());
buf.flip();
while (buf.hasRemaining()) {
client.write(buf);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Loading

0 comments on commit 1e94d7f

Please sign in to comment.