fix plugin version

This commit is contained in:
pengzhile 2021-10-18 21:25:27 +08:00
parent d28b716475
commit 494a42f673
5 changed files with 19 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# Reset Your IDE Eval Information # Reset Your IDE Eval Information
1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.3.1-6b4c51.zip). 1. Download and install plugin from [Download Link](https://plugins.zhile.io/files/ide-eval-resetter-2.3.2-10863c.zip).
* Alternative installation method: * Alternative installation method:
* Add "Custom Plugin Repository": `https://plugins.zhile.io` manually (`Settings/Preferences` -> `Plugins`) * Add "Custom Plugin Repository": `https://plugins.zhile.io` manually (`Settings/Preferences` -> `Plugins`)
* Search and install plugin: `IDE Eval Reset` * Search and install plugin: `IDE Eval Reset`

View File

@ -4,7 +4,7 @@ plugins {
} }
group 'io.zhile.research.intellij' group 'io.zhile.research.intellij'
version '2.3.1' version '2.3.2'
sourceCompatibility = 1.7 sourceCompatibility = 1.7
targetCompatibility = 1.7 targetCompatibility = 1.7
@ -29,6 +29,8 @@ intellij {
patchPluginXml { patchPluginXml {
changeNotes = """<pre> changeNotes = """<pre>
Release v2.3.2
1. fix plugin version
Release v2.3.1 Release v2.3.1
1. fix for some plugins 1. fix for some plugins
Release v2.3.0 Release v2.3.0

View File

@ -7,10 +7,7 @@ import com.intellij.ide.util.PropertiesComponent;
import com.intellij.ide.util.PropertiesComponentImpl; import com.intellij.ide.util.PropertiesComponentImpl;
import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.SystemInfo;
import io.zhile.research.intellij.ier.helper.AppHelper; import io.zhile.research.intellij.ier.helper.*;
import io.zhile.research.intellij.ier.helper.Constants;
import io.zhile.research.intellij.ier.helper.NotificationHelper;
import io.zhile.research.intellij.ier.helper.ReflectionHelper;
import io.zhile.research.intellij.ier.plugins.MyBatisCodeHelper; import io.zhile.research.intellij.ier.plugins.MyBatisCodeHelper;
import org.jdom.Attribute; import org.jdom.Attribute;
import org.jdom.Element; import org.jdom.Element;
@ -18,10 +15,7 @@ import org.jdom.Element;
import java.io.File; import java.io.File;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.prefs.BackingStoreException; import java.util.prefs.BackingStoreException;
import java.util.prefs.Preferences; import java.util.prefs.Preferences;
@ -34,7 +28,7 @@ public class Resetter {
private static final String AUTO_RESET_KEY = Constants.PLUGIN_PREFS_PREFIX + ".auto_reset." + Constants.IDE_NAME_LOWER + "." + Constants.IDE_HASH; private static final String AUTO_RESET_KEY = Constants.PLUGIN_PREFS_PREFIX + ".auto_reset." + Constants.IDE_NAME_LOWER + "." + Constants.IDE_HASH;
private static final Method METHOD_GET_PRODUCT_CODE = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getProductCode"); private static final Method METHOD_GET_PRODUCT_CODE = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getProductCode");
private static final Method METHOD_GET_RELEASE_VERSION = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getReleaseVersion"); private static final Method METHOD_GET_RELEASE_DATE = ReflectionHelper.getMethod(IdeaPluginDescriptor.class, "getReleaseDate");
private static final Set<String> LICENSE_FILES = new TreeSet<>(); private static final Set<String> LICENSE_FILES = new TreeSet<>();
public static List<EvalRecord> getEvalRecords() { public static List<EvalRecord> getEvalRecords() {
@ -163,7 +157,7 @@ public class Resetter {
public static void touchLicenses() { public static void touchLicenses() {
try { try {
if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_VERSION) { if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_DATE) {
return; return;
} }
@ -192,18 +186,18 @@ public class Resetter {
} }
public static void addPluginLicense(IdeaPluginDescriptor descriptor) { public static void addPluginLicense(IdeaPluginDescriptor descriptor) {
if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_VERSION) { if (null == METHOD_GET_PRODUCT_CODE || null == METHOD_GET_RELEASE_DATE) {
return; return;
} }
try { try {
String productCode = (String) METHOD_GET_PRODUCT_CODE.invoke(descriptor); String productCode = (String) METHOD_GET_PRODUCT_CODE.invoke(descriptor);
int releaseVersion = (int) METHOD_GET_RELEASE_VERSION.invoke(descriptor); Date releaseDate = (Date) METHOD_GET_RELEASE_DATE.invoke(descriptor);
if (null == productCode || productCode.isEmpty() || 0 == releaseVersion) { if (null == productCode || productCode.isEmpty() || null == releaseDate) {
return; return;
} }
LICENSE_FILES.add(String.format("plg_%s_%s.evaluation.key", productCode, releaseVersion)); LICENSE_FILES.add(String.format("plg_%s_%s.evaluation.key", productCode, DateTime.getPluginReleaseDateStr(releaseDate)));
} catch (Exception e) { } catch (Exception e) {
NotificationHelper.showError(null, "Add plugin eval license failed!"); NotificationHelper.showError(null, "Add plugin eval license failed!");
} }

View File

@ -3,13 +3,19 @@ package io.zhile.research.intellij.ier.helper;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale;
public class DateTime { public class DateTime {
public static final DateFormat DF_DATETIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static final DateFormat DF_DATETIME = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static final DateFormat DF_PLUGIN_DATE = new SimpleDateFormat("yyyyMMdd", Locale.US);
public static String getStringFromTimestamp(long timestamp) { public static String getStringFromTimestamp(long timestamp) {
Date date = new Date(timestamp); Date date = new Date(timestamp);
return DF_DATETIME.format(date); return DF_DATETIME.format(date);
} }
public static String getPluginReleaseDateStr(Date releaseDate) {
return DF_PLUGIN_DATE.format(releaseDate);
}
} }

View File

@ -121,6 +121,7 @@ public class MainForm {
private void reloadRecordItems() { private void reloadRecordItems() {
listModel.clear(); listModel.clear();
Resetter.touchLicenses();
List<EvalRecord> recordItemList = Resetter.getEvalRecords(); List<EvalRecord> recordItemList = Resetter.getEvalRecords();
for (EvalRecord record : recordItemList) { for (EvalRecord record : recordItemList) {
listModel.addElement(record.toString()); listModel.addElement(record.toString());