From b33d42aa41a29d01f69fe01d6d21ebad5cd56096 Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Tue, 23 Jan 2024 15:19:56 +0800 Subject: [PATCH 1/8] check build plugin to maven Signed-off-by: wangzeyu --- hapsigntool/hap_sign_tool/build.gradle | 60 --------- hapsigntool/hap_sign_tool/pom.xml | 116 ++++++++++++++++++ hapsigntool/hap_sign_tool_lib/build.gradle | 39 ------ hapsigntool/hap_sign_tool_lib/pom.xml | 40 ++++++ .../hapsigntool/keystore/KeyStoreHelper.java | 7 +- hapsigntool/pom.xml | 57 +++++++++ hapsigntool/settings.gradle | 19 --- 7 files changed, 214 insertions(+), 124 deletions(-) delete mode 100644 hapsigntool/hap_sign_tool/build.gradle create mode 100644 hapsigntool/hap_sign_tool/pom.xml delete mode 100644 hapsigntool/hap_sign_tool_lib/build.gradle create mode 100644 hapsigntool/hap_sign_tool_lib/pom.xml create mode 100644 hapsigntool/pom.xml delete mode 100644 hapsigntool/settings.gradle diff --git a/hapsigntool/hap_sign_tool/build.gradle b/hapsigntool/hap_sign_tool/build.gradle deleted file mode 100644 index 4f7b67b6..00000000 --- a/hapsigntool/hap_sign_tool/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id 'java' - id 'application' -} - -group 'com.ohos' - - -repositories { - maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } -} - -dependencies { - implementation 'org.bouncycastle:bcpkix-jdk18on:1.76' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' - implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.18.0' - implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.18.0' - implementation 'com.google.code.gson:gson:2.9.0' - implementation project(':hap_sign_tool_lib') -} - -test { - useJUnitPlatform() -} - -jar { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - - from sourceSets.main.output - - dependsOn configurations.runtimeClasspath - from { - configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) } - } - exclude 'META-INF/*.DF' - exclude 'META-INF/*.DSA' - - manifest { - attributes 'Main-Class': 'com.ohos.hapsigntool.HapSignTool' - } - - archiveBaseName = "hap-sign-tool" - -} \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool/pom.xml b/hapsigntool/hap_sign_tool/pom.xml new file mode 100644 index 00000000..2cbdc56b --- /dev/null +++ b/hapsigntool/hap_sign_tool/pom.xml @@ -0,0 +1,116 @@ + + + + + com.ohos + hapsigntool + 1.0-SNAPSHOT + + 4.0.0 + hap_sign_tool + + + + com.ohos + hap_sign_tool_lib + 1.0-SNAPSHOT + + + com.google.code.gson + gson + + + org.bouncycastle + bcpkix-jdk18on + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-api + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 1.8 + 1.8 + UTF-8 + true + + -Xlint:all + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + UTF-8 + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + + + hap-sign-tool + + + com.ohos.hapsigntool.HapSignTool + + + + + *:* + + + + + *:* + + **/module-info.class + module-info.class + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + META-INF/DEPENDENCIES + META-INF/LICENSE + META-INF/NOTICE + META-INF/LICENSE.txt + META-INF/NOTICE.txt + META-INF/MANIFEST.MF + + + + + + + + \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool_lib/build.gradle b/hapsigntool/hap_sign_tool_lib/build.gradle deleted file mode 100644 index cbe1ca83..00000000 --- a/hapsigntool/hap_sign_tool_lib/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -plugins { - id 'java' -} - -group 'com.ohos' -version '1.0-SNAPSHOT' - - -repositories { - maven { url 'https://mirrors.huaweicloud.com/repository/maven/' } -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' - implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.18.0' - implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.18.0' - implementation 'org.bouncycastle:bcpkix-jdk18on:1.76' - implementation 'com.google.code.gson:gson:2.9.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool_lib/pom.xml b/hapsigntool/hap_sign_tool_lib/pom.xml new file mode 100644 index 00000000..cbc914fd --- /dev/null +++ b/hapsigntool/hap_sign_tool_lib/pom.xml @@ -0,0 +1,40 @@ + + + + + com.ohos + hapsigntool + 1.0-SNAPSHOT + + 4.0.0 + hap_sign_tool_lib + + + + com.google.code.gson + gson + + + org.bouncycastle + bcpkix-jdk18on + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + org.junit.jupiter + junit-jupiter-engine + + + org.junit.jupiter + junit-jupiter-api + + + \ No newline at end of file diff --git a/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java b/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java index 65ce9435..f8d15f0a 100644 --- a/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java +++ b/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java @@ -223,12 +223,7 @@ public class KeyStoreHelper { return; } X509Certificate cert = (X509Certificate) certificate; - try { - cert.checkValidity(); - certificates.add(cert); - } catch (CertificateExpiredException | CertificateNotYetValidException exception) { - logger.debug(exception.getMessage(), exception); - } + certificates.add(cert); } /** diff --git a/hapsigntool/pom.xml b/hapsigntool/pom.xml new file mode 100644 index 00000000..60561682 --- /dev/null +++ b/hapsigntool/pom.xml @@ -0,0 +1,57 @@ + + + 4.0.0 + + com.ohos + hapsigntool + 1.0-SNAPSHOT + pom + + + 8 + 8 + UTF-8 + + + + hap_sign_tool + hap_sign_tool_lib + + + + + + com.google.code.gson + gson + 2.9.0 + + + org.bouncycastle + bcpkix-jdk18on + 1.76 + + + org.apache.logging.log4j + log4j-core + 2.18.0 + + + org.apache.logging.log4j + log4j-api + 2.18.0 + + + org.junit.jupiter + junit-jupiter-engine + 5.9.2 + + + org.junit.jupiter + junit-jupiter-api + 5.9.2 + + + + \ No newline at end of file diff --git a/hapsigntool/settings.gradle b/hapsigntool/settings.gradle deleted file mode 100644 index 26ea2ad2..00000000 --- a/hapsigntool/settings.gradle +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -rootProject.name = 'hapsigntool' -include 'hap_sign_tool_lib' -include 'hap_sign_tool' - -- Gitee From 6c1a134421506a66aad82aad818fb9b6b501e880 Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Tue, 23 Jan 2024 17:29:38 +0800 Subject: [PATCH 2/8] check build plugin to maven Signed-off-by: wangzeyu --- README.md | 8 ++++---- README_ZH.md | 8 ++++---- hapsigntool/hap_sign_tool/pom.xml | 9 +++++++-- hapsigntool/hap_sign_tool_lib/pom.xml | 25 ++++++++++++++++++++++++- hapsigntool/pom.xml | 3 ++- 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0cea090f..0b977a41 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,15 @@ Code signing is enabled by default for hapsigner. If you do not need the mandato ## Build - 1. Check that Gradle 7.1 has been installed. + 1. Check that Maven 3 has been installed. - gradle -v + mvn -version 2. Download the code, open the directory **developtools_hapsigner/hapsigntool**, and run the following command to build the code: - gradle build or gradle jar + mvn package - 3. Check that **hap-sign-tool.jar** (binary files) is generated in the **./hap_sign_tool/build/libs** directory. + 3. Check that **hap-sign-tool.jar** (binary files) is generated in the **./hap_sign_tool/target** directory. ## Usage diff --git a/README_ZH.md b/README_ZH.md index f6f1cbb5..84194d86 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -35,15 +35,15 @@ - 一键签名等脚本文件基于Python语言开发,使用需配置环境python3.5及以上。 #### 编译构建 - 1. 该工具基于Gradle 7.1编译构建,请确认环境已安装配置Gradle环境,并且版本正确 + 1. 该工具基于Maven3编译构建,请确认环境已安装配置Maven3环境,并且版本正确 - gradle -v + mvn -version 2. 下载代码,命令行打开文件目录至developtools_hapsigner/hapsigntool,执行命令进行编译打包 - gradle build 或者 gradle jar + mvn package - 3. 编译后得到二进制文件,目录为: ./hap_sign_tool/build/libs/hap-sign-tool.jar + 3. 编译后得到二进制文件,目录为: ./hap_sign_tool/target **** #### 说明 diff --git a/hapsigntool/hap_sign_tool/pom.xml b/hapsigntool/hap_sign_tool/pom.xml index 2cbdc56b..42f5be75 100644 --- a/hapsigntool/hap_sign_tool/pom.xml +++ b/hapsigntool/hap_sign_tool/pom.xml @@ -6,7 +6,7 @@ com.ohos hapsigntool - 1.0-SNAPSHOT + ${version} 4.0.0 hap_sign_tool @@ -15,7 +15,7 @@ com.ohos hap_sign_tool_lib - 1.0-SNAPSHOT + ${version} com.google.code.gson @@ -59,6 +59,11 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + org.apache.maven.plugins maven-resources-plugin diff --git a/hapsigntool/hap_sign_tool_lib/pom.xml b/hapsigntool/hap_sign_tool_lib/pom.xml index cbc914fd..45e45e0a 100644 --- a/hapsigntool/hap_sign_tool_lib/pom.xml +++ b/hapsigntool/hap_sign_tool_lib/pom.xml @@ -6,7 +6,7 @@ com.ohos hapsigntool - 1.0-SNAPSHOT + ${version} 4.0.0 hap_sign_tool_lib @@ -37,4 +37,27 @@ junit-jupiter-api + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 1.8 + 1.8 + UTF-8 + true + + -Xlint:all + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + + \ No newline at end of file diff --git a/hapsigntool/pom.xml b/hapsigntool/pom.xml index 60561682..d6d9f264 100644 --- a/hapsigntool/pom.xml +++ b/hapsigntool/pom.xml @@ -6,13 +6,14 @@ com.ohos hapsigntool - 1.0-SNAPSHOT + ${version} pom 8 8 UTF-8 + 4.0 -- Gitee From a0064d3a12f8b8ae1a6a740db0ecc1392c4478af Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Wed, 24 Jan 2024 11:39:06 +0800 Subject: [PATCH 3/8] check build plugin to maven Signed-off-by: wangzeyu --- hapsigntool/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hapsigntool/pom.xml b/hapsigntool/pom.xml index d6d9f264..b4df20c9 100644 --- a/hapsigntool/pom.xml +++ b/hapsigntool/pom.xml @@ -47,11 +47,13 @@ org.junit.jupiter junit-jupiter-engine 5.9.2 + test org.junit.jupiter junit-jupiter-api 5.9.2 + test -- Gitee From e94ab31dc1f2ef3b141c0834f1102bdca8215be0 Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Wed, 24 Jan 2024 14:36:51 +0800 Subject: [PATCH 4/8] check build plugin to maven Signed-off-by: wangzeyu --- OAT.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OAT.xml b/OAT.xml index 0f0759c0..93a542ff 100644 --- a/OAT.xml +++ b/OAT.xml @@ -34,6 +34,7 @@ + @@ -43,6 +44,7 @@ + -- Gitee From bf4a9b147d2074f310041dd3edaa1ea196a2ce14 Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Wed, 24 Jan 2024 15:02:41 +0800 Subject: [PATCH 5/8] check build plugin to maven Signed-off-by: wangzeyu --- OAT.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OAT.xml b/OAT.xml index 93a542ff..094d8dc7 100644 --- a/OAT.xml +++ b/OAT.xml @@ -25,6 +25,7 @@ + -- Gitee From 10f859b1f65eb9e41b8346109df11e0d0c92a95f Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Thu, 25 Jan 2024 11:37:32 +0800 Subject: [PATCH 6/8] check build plugin to maven Signed-off-by: wangzeyu --- hapsigntool/hap_sign_tool/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/hapsigntool/hap_sign_tool/pom.xml b/hapsigntool/hap_sign_tool/pom.xml index 42f5be75..394098a9 100644 --- a/hapsigntool/hap_sign_tool/pom.xml +++ b/hapsigntool/hap_sign_tool/pom.xml @@ -86,6 +86,7 @@ hap-sign-tool + ../hap_sign_tool/build/libs com.ohos.hapsigntool.HapSignTool -- Gitee From 4bb744d63e3551d213679139ff5dad47891dacc6 Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Thu, 25 Jan 2024 15:28:28 +0800 Subject: [PATCH 7/8] check build plugin to maven Signed-off-by: wangzeyu --- .../java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java b/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java index f8d15f0a..e8594f1d 100644 --- a/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java +++ b/hapsigntool/hap_sign_tool_lib/src/main/java/com/ohos/hapsigntool/keystore/KeyStoreHelper.java @@ -223,6 +223,11 @@ public class KeyStoreHelper { return; } X509Certificate cert = (X509Certificate) certificate; + try { + cert.checkValidity(); + } catch (CertificateExpiredException | CertificateNotYetValidException exception) { + logger.info("p12's certificates is not valid"); + } certificates.add(cert); } -- Gitee From e3b965e6259cbbee3e3736e7539b3991b80e6077 Mon Sep 17 00:00:00 2001 From: wangzeyu Date: Thu, 25 Jan 2024 15:54:21 +0800 Subject: [PATCH 8/8] check build plugin to maven Signed-off-by: wangzeyu --- hapsigntool/settings.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 hapsigntool/settings.xml diff --git a/hapsigntool/settings.xml b/hapsigntool/settings.xml new file mode 100644 index 00000000..0ffa83ab --- /dev/null +++ b/hapsigntool/settings.xml @@ -0,0 +1,13 @@ + + + + + huawei cloud + * + Huawei Cloud Maven + https://mirrors.huaweicloud.com/repository/maven/ + + + \ No newline at end of file -- Gitee