diff --git a/build.gradle b/build.gradle index 489ec64..d39f556 100644 --- a/build.gradle +++ b/build.gradle @@ -1,41 +1,132 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -allprojects { - apply plugin: 'maven' - apply plugin: 'idea' - apply plugin: 'eclipse' - version = '1.0.2' +plugins { + // Apply the java-library plugin for API and implementation separation. + id 'java-library' + id 'maven-publish' } -defaultTasks('clean','distZip') +// Set version of programm +def version = "1.1.0" -subprojects { - apply plugin: 'java' - apply plugin: 'maven' - sourceCompatibility = 1.8 - targetCompatibility = 1.8 +group = "com.wind.meditor.ManifestEditorMain" - repositories { - mavenCentral() +sourceCompatibility = 11 +targetCompatibility = 11 + +// Set correct encoding +compileJava.options.encoding = 'UTF-8' +tasks.withType(Javadoc) { + options.encoding = 'UTF-8' +} + +// create a single .jar with all dependencies // +task fatJar(type: Jar) { + + archiveClassifier = '' + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + manifest { + attributes( 'Main-Class': 'com.wind.meditor.ManifestEditorMain', + 'Implementation-Version': version ) } - - [compileJava, compileTestJava]*.options.collect {options ->options.encoding = 'UTF-8'} - - dependencies { - compile fileTree(dir: 'libs', include: '*.jar') + + manifest { + attributes( 'Implementation-Title': 'ManifestEditor', + 'Implementation-Version': version, + 'Implementation-Group': project.group, ) } + + archivesBaseName = "ManifestEditor" + from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } + { + exclude "META-INF/*.SF" + exclude "META-INF/*.DSA" + exclude "META-INF/*.RSA" + } + with jar + destinationDirectory.set(layout.buildDirectory.dir("dist")) +} - jar { - manifest { - attributes("Implementation-Title": project.name, - "Implementation-Version": project.version, - "Build-Time": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - "Build-Number": System.env.BUILD_NUMBER?System.env.BUILD_NUMBER:"-1", - ) - } - from (project.parent.projectDir) { - include 'NOTICE.txt' - include 'LICENSE.txt' - into('META-INF') +task sourcesJar(type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' + from sourceSets.main.allSource + destinationDirectory.set(layout.buildDirectory.dir("dist")) +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + manifest { + attributes( 'Implementation-Title': 'ManifestEditor', + 'Implementation-Version': version, + 'Implementation-Group': project.group, ) + } + archiveClassifier = 'javadoc' + from javadoc.destinationDir + destinationDirectory.set(layout.buildDirectory.dir("dist")) +} + +artifacts { + archives sourcesJar + archives javadocJar + archives fatJar +} + +// publish to local maven repo // + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'ManifestEditor' + from components.java + pom { + name = 'Manifest Editor' + description = 'A manifest editor for android' + url = 'https://git.rpjosh.de/RPJosh/RPdb' + licenses { + license { + name = 'The GNU AFFERO GENERAL PUBLIC LICENSE, Version 3' + url = 'https://www.gnu.org/licenses/agpl-3.0.html' + } + } + developers { + developer { + id = 'RPJosh' + name = 'RPJosh' + email = 'RPjosh@rpjosh.de' + } + } + } } } } + + + +repositories { + mavenCentral() +} + +dependencies { + + // Logging library + implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.3.0-alpha16' + + // Rest service + implementation group: 'com.squareup.retrofit2', name: 'retrofit', version: '2.9.0' + implementation group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.9.0' + + // Configuration file (.ini) + implementation group: 'org.ini4j', name: 'ini4j', version: '0.5.4' + +} + +tasks.named('jar') { + manifest { + attributes( 'Implementation-Title': 'ManifestEditor', + 'Implementation-Version': version, + 'Implementation-Group': 'com.wind.meditor.ManifestEditorMain', ) + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8cf710f..7bc5fea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-rc-1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip diff --git a/lib/.gitignore b/lib/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/lib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/lib/build.gradle b/lib/build.gradle deleted file mode 100644 index 45b030d..0000000 --- a/lib/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -apply plugin: 'java-library' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) -} - -jar{ - baseName = "ManifestEditor" - manifest { - attributes 'Main-Class': 'com.wind.meditor.ManifestEditorMain' - } - //添加将引用的jar的源码打入最终的jar - from { - (configurations.runtime).collect { - it.isDirectory() ? it : zipTree(it) - } - } - - from fileTree(dir:'src/main', includes: ['assets/**']) - - //排除引用的jar中的签名信息 - exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF' -} - -//添加源码中引入的非代码文件,例如资源等 -sourceSets.main.resources { - srcDirs = [ - "src/main/java", - ]; - include "**/*.*" -} diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..662153e --- /dev/null +++ b/run.sh @@ -0,0 +1,5 @@ +# Build app +./gradlew build + +# Run the app (add your options here) +java -jar build/dist/ManifestEditor.jar --help \ No newline at end of file diff --git a/lib/src/main/assets/new_keystore b/src/main/assets/new_keystore similarity index 100% rename from lib/src/main/assets/new_keystore rename to src/main/assets/new_keystore diff --git a/lib/src/main/assets/public.xml b/src/main/assets/public.xml similarity index 100% rename from lib/src/main/assets/public.xml rename to src/main/assets/public.xml diff --git a/lib/src/main/java/com/wind/meditor/ManifestEditorMain.java b/src/main/java/com/wind/meditor/ManifestEditorMain.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/ManifestEditorMain.java rename to src/main/java/com/wind/meditor/ManifestEditorMain.java diff --git a/lib/src/main/java/com/wind/meditor/base/BaseCommand.java b/src/main/java/com/wind/meditor/base/BaseCommand.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/base/BaseCommand.java rename to src/main/java/com/wind/meditor/base/BaseCommand.java diff --git a/lib/src/main/java/com/wind/meditor/core/ApkSigner.java b/src/main/java/com/wind/meditor/core/ApkSigner.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/core/ApkSigner.java rename to src/main/java/com/wind/meditor/core/ApkSigner.java diff --git a/lib/src/main/java/com/wind/meditor/core/FileProcesser.java b/src/main/java/com/wind/meditor/core/FileProcesser.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/core/FileProcesser.java rename to src/main/java/com/wind/meditor/core/FileProcesser.java diff --git a/lib/src/main/java/com/wind/meditor/core/ManifestEditor.java b/src/main/java/com/wind/meditor/core/ManifestEditor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/core/ManifestEditor.java rename to src/main/java/com/wind/meditor/core/ManifestEditor.java diff --git a/lib/src/main/java/com/wind/meditor/property/AttributeItem.java b/src/main/java/com/wind/meditor/property/AttributeItem.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/property/AttributeItem.java rename to src/main/java/com/wind/meditor/property/AttributeItem.java diff --git a/lib/src/main/java/com/wind/meditor/property/ModificationProperty.java b/src/main/java/com/wind/meditor/property/ModificationProperty.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/property/ModificationProperty.java rename to src/main/java/com/wind/meditor/property/ModificationProperty.java diff --git a/lib/src/main/java/com/wind/meditor/utils/FileTypeUtils.java b/src/main/java/com/wind/meditor/utils/FileTypeUtils.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/utils/FileTypeUtils.java rename to src/main/java/com/wind/meditor/utils/FileTypeUtils.java diff --git a/lib/src/main/java/com/wind/meditor/utils/Log.java b/src/main/java/com/wind/meditor/utils/Log.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/utils/Log.java rename to src/main/java/com/wind/meditor/utils/Log.java diff --git a/lib/src/main/java/com/wind/meditor/utils/NodeValue.java b/src/main/java/com/wind/meditor/utils/NodeValue.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/utils/NodeValue.java rename to src/main/java/com/wind/meditor/utils/NodeValue.java diff --git a/lib/src/main/java/com/wind/meditor/utils/ShellCmdUtil.java b/src/main/java/com/wind/meditor/utils/ShellCmdUtil.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/utils/ShellCmdUtil.java rename to src/main/java/com/wind/meditor/utils/ShellCmdUtil.java diff --git a/lib/src/main/java/com/wind/meditor/utils/TypedValue.java b/src/main/java/com/wind/meditor/utils/TypedValue.java similarity index 97% rename from lib/src/main/java/com/wind/meditor/utils/TypedValue.java rename to src/main/java/com/wind/meditor/utils/TypedValue.java index 1cc19ff..068cf8b 100644 --- a/lib/src/main/java/com/wind/meditor/utils/TypedValue.java +++ b/src/main/java/com/wind/meditor/utils/TypedValue.java @@ -18,7 +18,7 @@ package com.wind.meditor.utils; /** * Container for a dynamically typed data value. Primarily used with - * {@link1 android.content.res.Resources} for holding resource values. + * "android.content.res.Resources" for holding resource values. */ public class TypedValue { /** The value contains no data. */ @@ -151,7 +151,7 @@ public class TypedValue { /** * If {@link #density} is equal to this value, then the density should be - * treated as the system's default density value: {@link1 DisplayMetrics#DENSITY_DEFAULT}. + * treated as the system's default density value: unknown. */ public static final int DENSITY_DEFAULT = 0; @@ -186,7 +186,7 @@ public class TypedValue { * which its contents can change. * *
For example, if a resource has a value defined for the -land resource qualifier, - * this field will have the {@link1 android.content.pm.ActivityInfo#CONFIG_ORIENTATION} bit set. + * this field will have the {@link android.content.pm.ActivityInfo#CONFIG_ORIENTATION} bit set. *
* */ @@ -279,7 +279,7 @@ public class TypedValue { /** * Converts a complex data value holding a dimension to its final value * as an integer pixel size. This is the same as - * {@link1 #complexToDimension}, except the raw floating point value is + * {@link #complexToDimension}, except the raw floating point value is * converted to an integer (pixel) value for use as a size. A size * conversion involves rounding the base value, and ensuring that a * non-zero base value is at least one pixel in size. @@ -310,7 +310,7 @@ public class TypedValue { // } /** - * @hide Was accidentally exposed in API level 1 for debugging purposes. + * Was accidentally exposed in API level 1 for debugging purposes. * Kept for compatibility just in case although the debugging code has been removed. */ @Deprecated diff --git a/lib/src/main/java/com/wind/meditor/utils/Utils.java b/src/main/java/com/wind/meditor/utils/Utils.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/utils/Utils.java rename to src/main/java/com/wind/meditor/utils/Utils.java diff --git a/lib/src/main/java/com/wind/meditor/visitor/ApplicationTagVisitor.java b/src/main/java/com/wind/meditor/visitor/ApplicationTagVisitor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/visitor/ApplicationTagVisitor.java rename to src/main/java/com/wind/meditor/visitor/ApplicationTagVisitor.java diff --git a/lib/src/main/java/com/wind/meditor/visitor/DeleteMetaDataVisitor.java b/src/main/java/com/wind/meditor/visitor/DeleteMetaDataVisitor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/visitor/DeleteMetaDataVisitor.java rename to src/main/java/com/wind/meditor/visitor/DeleteMetaDataVisitor.java diff --git a/lib/src/main/java/com/wind/meditor/visitor/ManifestTagVisitor.java b/src/main/java/com/wind/meditor/visitor/ManifestTagVisitor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/visitor/ManifestTagVisitor.java rename to src/main/java/com/wind/meditor/visitor/ManifestTagVisitor.java diff --git a/lib/src/main/java/com/wind/meditor/visitor/MetaDataVisitor.java b/src/main/java/com/wind/meditor/visitor/MetaDataVisitor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/visitor/MetaDataVisitor.java rename to src/main/java/com/wind/meditor/visitor/MetaDataVisitor.java diff --git a/lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java b/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java rename to src/main/java/com/wind/meditor/visitor/ModifyAttributeVisitor.java diff --git a/lib/src/main/java/com/wind/meditor/visitor/UserPermissionTagVisitor.java b/src/main/java/com/wind/meditor/visitor/UserPermissionTagVisitor.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/visitor/UserPermissionTagVisitor.java rename to src/main/java/com/wind/meditor/visitor/UserPermissionTagVisitor.java diff --git a/lib/src/main/java/com/wind/meditor/xml/ResourceIdXmlReader.java b/src/main/java/com/wind/meditor/xml/ResourceIdXmlReader.java similarity index 100% rename from lib/src/main/java/com/wind/meditor/xml/ResourceIdXmlReader.java rename to src/main/java/com/wind/meditor/xml/ResourceIdXmlReader.java diff --git a/lib/src/main/java/pxb/android/ResConst.java b/src/main/java/pxb/android/ResConst.java similarity index 100% rename from lib/src/main/java/pxb/android/ResConst.java rename to src/main/java/pxb/android/ResConst.java diff --git a/lib/src/main/java/pxb/android/StringItem.java b/src/main/java/pxb/android/StringItem.java similarity index 100% rename from lib/src/main/java/pxb/android/StringItem.java rename to src/main/java/pxb/android/StringItem.java diff --git a/lib/src/main/java/pxb/android/StringItems.java b/src/main/java/pxb/android/StringItems.java similarity index 100% rename from lib/src/main/java/pxb/android/StringItems.java rename to src/main/java/pxb/android/StringItems.java diff --git a/lib/src/main/java/pxb/android/axml/Axml.java b/src/main/java/pxb/android/axml/Axml.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/Axml.java rename to src/main/java/pxb/android/axml/Axml.java diff --git a/lib/src/main/java/pxb/android/axml/AxmlParser.java b/src/main/java/pxb/android/axml/AxmlParser.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/AxmlParser.java rename to src/main/java/pxb/android/axml/AxmlParser.java diff --git a/lib/src/main/java/pxb/android/axml/AxmlReader.java b/src/main/java/pxb/android/axml/AxmlReader.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/AxmlReader.java rename to src/main/java/pxb/android/axml/AxmlReader.java diff --git a/lib/src/main/java/pxb/android/axml/AxmlVisitor.java b/src/main/java/pxb/android/axml/AxmlVisitor.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/AxmlVisitor.java rename to src/main/java/pxb/android/axml/AxmlVisitor.java diff --git a/lib/src/main/java/pxb/android/axml/AxmlWriter.java b/src/main/java/pxb/android/axml/AxmlWriter.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/AxmlWriter.java rename to src/main/java/pxb/android/axml/AxmlWriter.java diff --git a/lib/src/main/java/pxb/android/axml/DumpAdapter.java b/src/main/java/pxb/android/axml/DumpAdapter.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/DumpAdapter.java rename to src/main/java/pxb/android/axml/DumpAdapter.java diff --git a/lib/src/main/java/pxb/android/axml/NodeVisitor.java b/src/main/java/pxb/android/axml/NodeVisitor.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/NodeVisitor.java rename to src/main/java/pxb/android/axml/NodeVisitor.java diff --git a/lib/src/main/java/pxb/android/axml/Util.java b/src/main/java/pxb/android/axml/Util.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/Util.java rename to src/main/java/pxb/android/axml/Util.java diff --git a/lib/src/main/java/pxb/android/axml/ValueWrapper.java b/src/main/java/pxb/android/axml/ValueWrapper.java similarity index 100% rename from lib/src/main/java/pxb/android/axml/ValueWrapper.java rename to src/main/java/pxb/android/axml/ValueWrapper.java