From 16d59148a41346d4ad63031579bf010be113e5cb Mon Sep 17 00:00:00 2001 From: Caoxy Date: Fri, 30 Sep 2022 10:55:23 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=A0=E9=99=A4=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=86=99=E6=96=87=E4=BB=B6=E6=93=8D=E4=BD=9C=202=E3=80=81?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=9B=B8=E5=85=B3=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 - README_cn.md | 2 - pom.xml | 10 +++- .../com/pgyer/app/upload/PgyerAppUpload.java | 18 +----- .../com/pgyer/app/upload/bean/ParamsBean.java | 18 ------ .../pgyer/app/upload/helper/PgyerHelper.java | 2 - .../com/pgyer/app/upload/net/PgyerUpload.java | 60 ------------------- .../app/upload/PgyerAppUpload/config.jelly | 8 --- .../PgyerAppUpload/help-envVarsPath.html | 4 -- .../PgyerAppUpload/help-qrcodePath.html | 5 -- 10 files changed, 9 insertions(+), 120 deletions(-) delete mode 100644 src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-envVarsPath.html delete mode 100644 src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-qrcodePath.html diff --git a/README.md b/README.md index 31987cb..46af683 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,6 @@ installType|`(Optional)` Application installation, the value is (1,2,3).
1: password|(Optional) Set the App installation password, if you do not want to set the password, please pass empty string, or not pass. updateDescription|`(Optional)` Version update description, please pass empty string, or not pass. channelShortcut|`(Optional)` The download short link of the specified channel that needs to be updated, only one channel can be specified, string type, such as: abcd. -qrcodePath|`(Optional)` If you need to download the qrcode, please enter the save path of the qrcode!otherwise, not download! -envVarsPath|`(Optional)` if you need to save info, please enter save file path! otherwise, not save! ### Running log ![](./images/pgyer-app-upload-running-log.png) diff --git a/README_cn.md b/README_cn.md index 13668a5..36dd041 100644 --- a/README_cn.md +++ b/README_cn.md @@ -20,8 +20,6 @@ installType|`(选填)` 应用安装方式,值为(1,2,3)。
1:公开,2 password|`(选填)` 设置App安装密码,如果不想设置密码,请传空字符串,或不传。 updateDescription|`(选填)` 版本更新描述,请传空字符串,或不传。 channelShortcut|`(选填)` 所需更新的指定渠道的下载短链接,只可指定一个渠道,字符串型,如:abcd -qrcodePath|`(选填)` 如果你需要下载蒲公英返回的二维码,那么这里填写二维码的存储路径,
如果你不需要下载,那么你不需要在这里填写任何内容。 -envVarsPath |`(选填)` 如果你想存储蒲公英返回的上传信息,那么这里填写保存信息的文件路径,
如果你不需要保存,那么你不需要在这里填写任何内容。 ### 运行截图 ![](./images/pgyer-app-upload-running-log.png) diff --git a/pom.xml b/pom.xml index a90c3ea..887cad9 100644 --- a/pom.xml +++ b/pom.xml @@ -63,13 +63,19 @@ com.google.code.gson gson - 2.8.6 + 2.9.0 com.squareup.okhttp3 okhttp-urlconnection - 3.14.9 + 4.10.0 + + + org.jetbrains.kotlin + kotlin-stdlib-common + + diff --git a/src/main/java/com/pgyer/app/upload/PgyerAppUpload.java b/src/main/java/com/pgyer/app/upload/PgyerAppUpload.java index 06ddd3f..2bc59b9 100644 --- a/src/main/java/com/pgyer/app/upload/PgyerAppUpload.java +++ b/src/main/java/com/pgyer/app/upload/PgyerAppUpload.java @@ -29,11 +29,8 @@ public class PgyerAppUpload extends Recorder { private final String buildName; private final String buildChannelShortcut; - private final String qrcodePath; - private final String envVarsPath; - @DataBoundConstructor - public PgyerAppUpload(Secret apiKey, String scanDir, String wildcard, String buildInstallType, Secret buildPassword, String buildUpdateDescription, String buildName, String buildChannelShortcut, String qrcodePath, String envVarsPath) { + public PgyerAppUpload(Secret apiKey, String scanDir, String wildcard, String buildInstallType, Secret buildPassword, String buildUpdateDescription, String buildName, String buildChannelShortcut) { this.apiKey = Secret.fromString(String.valueOf(apiKey)); this.scanDir = scanDir; this.wildcard = wildcard; @@ -42,8 +39,6 @@ public PgyerAppUpload(Secret apiKey, String scanDir, String wildcard, String bui this.buildUpdateDescription = buildUpdateDescription; this.buildName = buildName; this.buildChannelShortcut = buildChannelShortcut; - this.qrcodePath = qrcodePath; - this.envVarsPath = envVarsPath; } public Secret getApiKey() { @@ -78,14 +73,6 @@ public String getBuildChannelShortcut() { return buildChannelShortcut; } - public String getQrcodePath() { - return qrcodePath; - } - - public String getEnvVarsPath() { - return envVarsPath; - } - @Override public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { ParamsBean paramsBean = new ParamsBean(); @@ -97,10 +84,7 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListen paramsBean.setBuildName(buildName); paramsBean.setBuildUpdateDescription(buildUpdateDescription); paramsBean.setBuildChannelShortcut(buildChannelShortcut); - paramsBean.setQrcodePath(qrcodePath); - paramsBean.setEnvVarsPath(envVarsPath); return PgyerHelper.upload(build, listener, paramsBean); -// return super.perform(build, launcher, listener); } @Override diff --git a/src/main/java/com/pgyer/app/upload/bean/ParamsBean.java b/src/main/java/com/pgyer/app/upload/bean/ParamsBean.java index d2db2de..99c8a94 100644 --- a/src/main/java/com/pgyer/app/upload/bean/ParamsBean.java +++ b/src/main/java/com/pgyer/app/upload/bean/ParamsBean.java @@ -13,9 +13,6 @@ public class ParamsBean { private String buildName; private String buildChannelShortcut; - private String qrcodePath; - private String envVarsPath; - public String getApiKey() { return apiKey; } @@ -88,19 +85,4 @@ public void setBuildChannelShortcut(String buildChannelShortcut) { this.buildChannelShortcut = buildChannelShortcut; } - public String getQrcodePath() { - return qrcodePath; - } - - public void setQrcodePath(String qrcodePath) { - this.qrcodePath = qrcodePath; - } - - public String getEnvVarsPath() { - return envVarsPath; - } - - public void setEnvVarsPath(String envVarsPath) { - this.envVarsPath = envVarsPath; - } } diff --git a/src/main/java/com/pgyer/app/upload/helper/PgyerHelper.java b/src/main/java/com/pgyer/app/upload/helper/PgyerHelper.java index 96aab01..8b3755d 100644 --- a/src/main/java/com/pgyer/app/upload/helper/PgyerHelper.java +++ b/src/main/java/com/pgyer/app/upload/helper/PgyerHelper.java @@ -47,8 +47,6 @@ public void message(boolean needTag, String mesage) { paramsBean.setBuildUpdateDescription(build.getEnvironment(listener).expand(paramsBean.getBuildUpdateDescription())); paramsBean.setBuildName(build.getEnvironment(listener).expand(paramsBean.getBuildName())); paramsBean.setBuildChannelShortcut(build.getEnvironment(listener).expand(paramsBean.getBuildChannelShortcut())); - paramsBean.setQrcodePath(build.getEnvironment(listener).expand(paramsBean.getQrcodePath())); - paramsBean.setEnvVarsPath(build.getEnvironment(listener).expand(paramsBean.getEnvVarsPath())); // upload PgyerBean pgyerBean = PgyerUpload.upload2Pgyer(build.getEnvironment(listener), true, paramsBean, message); diff --git a/src/main/java/com/pgyer/app/upload/net/PgyerUpload.java b/src/main/java/com/pgyer/app/upload/net/PgyerUpload.java index a410397..9e87304 100644 --- a/src/main/java/com/pgyer/app/upload/net/PgyerUpload.java +++ b/src/main/java/com/pgyer/app/upload/net/PgyerUpload.java @@ -82,8 +82,6 @@ private static ParamsBean parseArgs(String[] args, Message listener) { paramsBean.setScandir(maps.get("-scanDir")); paramsBean.setWildcard(maps.get("-wildcard")); paramsBean.setBuildName(maps.containsKey("-buildName") ? maps.get("-buildName") : ""); - paramsBean.setQrcodePath(maps.containsKey("-qrcodePath") ? maps.get("-qrcodePath") : null); - paramsBean.setEnvVarsPath(maps.containsKey("-envVarsPath") ? maps.get("-envVarsPath") : null); paramsBean.setBuildPassword(maps.containsKey("-buildPassword") ? maps.get("-buildPassword") : ""); paramsBean.setBuildInstallType(maps.containsKey("-buildInstallType") ? maps.get("-buildInstallType") : "1"); paramsBean.setBuildUpdateDescription(maps.containsKey("-buildUpdateDescription") ? maps.get("-buildUpdateDescription") : ""); @@ -352,8 +350,6 @@ public void actionPerformed(ActionEvent e) { CommonUtil.printMessage(listener, true, "uploaded successfully!\n"); printResultInfo(pgyerBean, listener); - writeEnvVars(paramsBean, pgyerBean, listener); - downloadQrcode(paramsBean, pgyerBean, listener); return pgyerBean; } catch (IOException e) { e.printStackTrace(); @@ -363,62 +359,6 @@ public void actionPerformed(ActionEvent e) { } } - /** - * Download the qr code - * - * @param paramsBean paramsBeanV2 - * @param pgyerBean pgyerBeanV2 - * @param listener listener - */ - private static void downloadQrcode(ParamsBean paramsBean, PgyerBean pgyerBean, Message listener) { - if (paramsBean.getQrcodePath() == null) { - return; - } - if (CommonUtil.replaceBlank(paramsBean.getQrcodePath()).length() == 0) { - return; - } - CommonUtil.printMessage(listener, true, "Downloading the qr code……"); - File qrcode = new File(paramsBean.getQrcodePath()); - if (!qrcode.getParentFile().exists() && !qrcode.getParentFile().mkdirs()) { - CommonUtil.printMessage(listener, true, "Oh, my god, download the qr code failed……" + "\n"); - return; - } - File file = CommonUtil.download(pgyerBean.getData().getBuildQRCodeURL(), qrcode.getParentFile().getAbsolutePath(), qrcode.getName()); - if (file != null) { - CommonUtil.printMessage(listener, true, "Download the qr code successfully! " + file + "\n"); - } else { - CommonUtil.printMessage(listener, true, "Oh, my god, download the qr code failed……" + "\n"); - } - } - - /** - * Writing the environment variable to the file. - * - * @param paramsBean paramsBeanV2 - * @param pgyerBean pgyerBeanV2 - * @param listener listener - */ - private static void writeEnvVars(ParamsBean paramsBean, PgyerBean pgyerBean, Message listener) { - if (paramsBean.getEnvVarsPath() == null) { - return; - } - if (CommonUtil.replaceBlank(paramsBean.getEnvVarsPath()).length() == 0) { - return; - } - CommonUtil.printMessage(listener, true, "Writing the environment variable to the file……"); - File envVars = new File(paramsBean.getEnvVarsPath()); - if (!envVars.getParentFile().exists() && !envVars.getParentFile().mkdirs()) { - CommonUtil.printMessage(listener, true, "Oh my god, the environment variable writes failed……" + "\n"); - return; - } - File file = CommonUtil.write(envVars.getAbsolutePath(), getEnvVarsInfo(pgyerBean), "utf-8"); - if (file != null) { - CommonUtil.printMessage(listener, true, "The environment variable is written successfully! " + file + "\n"); - } else { - CommonUtil.printMessage(listener, true, "Oh my god, the environment variable writes failed……" + "\n"); - } - } - /** * Print return log * diff --git a/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/config.jelly b/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/config.jelly index 4054daa..f53396a 100644 --- a/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/config.jelly +++ b/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/config.jelly @@ -36,14 +36,6 @@ - - - - - - - - diff --git a/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-envVarsPath.html b/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-envVarsPath.html deleted file mode 100644 index f979915..0000000 --- a/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-envVarsPath.html +++ /dev/null @@ -1,4 +0,0 @@ -
- (Optional) if you need to save info, please enter save file path!
- otherwise, not save! -
diff --git a/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-qrcodePath.html b/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-qrcodePath.html deleted file mode 100644 index 74961ff..0000000 --- a/src/main/resources/com/pgyer/app/upload/PgyerAppUpload/help-qrcodePath.html +++ /dev/null @@ -1,5 +0,0 @@ -
- (Optional) If you need to download the qrcode,
- please enter the save path of the qrcode!
- otherwise, not download! -