Merge branch 'master' into gradle7

# Conflicts:
#	build.gradle
This commit is contained in:
Goooler 2021-07-01 11:12:17 +08:00
commit d65c88a447
12 changed files with 103 additions and 62 deletions

35
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Build
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: Build apktool.jar
steps:
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ matrix.java }}-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-${{ matrix.java }}-gradle-
- uses: actions/checkout@v2
- name: Set up JDK 10
uses: actions/setup-java@v1
with:
java-version: 10
- name: Build
run: ./gradlew build shadowJar proguard
- name: Upload
uses: actions/upload-artifact@v2
with:
name: apktool.jar
path: brut.apktool/apktool-cli/build/libs/apktool-*-small.jar

View File

@ -15,6 +15,7 @@ on:
jobs:
build-and-test-with-Java-8-and-later:
runs-on: ${{ matrix.os }}
name: Build/Test (JDK ${{ matrix.java }}, ${{ matrix.os }})
strategy:
fail-fast: false
@ -22,24 +23,27 @@ jobs:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
java: [8, 9, 10, 11, 12, 13, 14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
key: ${{ runner.os }}-gradle-${{ matrix.java }}-${{ hashFiles('**/*.gradle*') }}
restore-keys: ${{ runner.os }}-${{ matrix.java }}-gradle-
- uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build and test
run: ./gradlew.bat build shadowJar proguard
if: startsWith(matrix.os, 'windows') == true
run: ./gradlew.bat build shadowJar proguard
- name: Build and test
run: ./gradlew build shadowJar proguard
if: startsWith(matrix.os, 'windows') != true
run: ./gradlew build shadowJar proguard

View File

@ -11,7 +11,7 @@ It is NOT intended for piracy and other non-legal uses. It could be used for loc
#### Support
- [Project Page](https://ibotpeaches.github.io/Apktool/)
- [#apktool on freenode](http://webchat.freenode.net/?channels=apktool)
- [#apktool on libera.chat](https://web.libera.chat/)
#### Sponsored by
@ -32,7 +32,7 @@ If you discover a security vulnerability within Apktool, please send an e-mail t
- [Documentation](https://ibotpeaches.github.io/Apktool/documentation/)
- [Bug Reports](https://github.com/iBotPeaches/Apktool/issues)
- [Chat on Gitter](https://gitter.im/iBotPeaches/Apktool)
- [Changelog/Information](http://ibotpeaches.github.io/Apktool/changes/)
- [Changelog/Information](https://ibotpeaches.github.io/Apktool/changes/)
- [XDA Post](https://forum.xda-developers.com/t/util-dec-2-2020-apktool-tool-for-reverse-engineering-apk-files.1755243/)
- [Source (Github)](https://github.com/iBotPeaches/Apktool)
- [Source (Bitbucket)](https://bitbucket.org/iBotPeaches/apktool/)

View File

@ -33,9 +33,7 @@ processResources {
}
dependencies {
testImplementation("junit:junit:4.10") {
exclude(module: 'hamcrest-core')
}
testImplementation depends.junit
api project(':brut.j.dir'),
project(':brut.j.util'),

View File

@ -27,5 +27,10 @@ public class CantFindFrameworkResException extends AndrolibException {
return mPkgId;
}
@Override
public String getMessage() {
return String.format("Can't find framework resources for package of id: %d", this.getPkgId());
}
private final int mPkgId;
}

View File

@ -31,9 +31,8 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.*;
public class BaseTest {
@ -45,16 +44,16 @@ public class BaseTest {
Map<String, String> controlFiles = control.unknownFiles;
Map<String, String> testFiles = test.unknownFiles;
assertTrue(controlFiles.size() == testFiles.size());
assertEquals(controlFiles.size(), testFiles.size());
// Make sure that the compression methods are still the same
for (Map.Entry<String, String> controlEntry : controlFiles.entrySet()) {
assertTrue(controlEntry.getValue().equals(testFiles.get(controlEntry.getKey())));
assertEquals(controlEntry.getValue(), testFiles.get(controlEntry.getKey()));
}
}
protected void compareBinaryFolder(String path, boolean res) throws BrutException, IOException {
Boolean exists = true;
boolean exists = true;
String prefixPath = "";
if (res) {

View File

@ -495,7 +495,7 @@ public class BuildAndDecodeTest extends BaseTest {
MetaInfo metaInfo = new Androlib().readMetaFile(sTestNewDir);
for (String item : metaInfo.doNotCompress) {
assertFalse(item.equals("jpg"));
assertNotEquals("jpg", item);
}
}

View File

@ -29,6 +29,7 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class Empty9PatchTest extends BaseTest {
@ -58,6 +59,6 @@ public class Empty9PatchTest extends BaseTest {
File aPng = new File(sTestOrigDir,"res/drawable-xhdpi/empty.9.png");
assertTrue(aPng.isFile());
assertTrue(aPng.length() == 0);
assertEquals(0, aPng.length());
}
}

View File

@ -30,12 +30,11 @@ import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
public class ForceManifestDecodeNoResourcesTest extends BaseTest {
private byte[] xmlHeader = new byte[] {
private final byte[] xmlHeader = new byte[] {
0x3C, // <
0x3F, // ?
0x78, // x
@ -68,7 +67,7 @@ public class ForceManifestDecodeNoResourcesTest extends BaseTest {
// lets probe filetype of manifest, we should detect XML
File manifestFile = new File(output + File.separator + "AndroidManifest.xml");
byte[] magic = TestUtils.readHeaderOfFile(manifestFile, 6);
assertTrue(Arrays.equals(this.xmlHeader, magic));
assertArrayEquals(this.xmlHeader, magic);
// confirm resources.arsc still exists, as its raw
File resourcesArsc = new File(output + File.separator + "resources.arsc");
@ -87,7 +86,7 @@ public class ForceManifestDecodeNoResourcesTest extends BaseTest {
// lets probe filetype of manifest, we should detect XML
File manifestFile = new File(output + File.separator + "AndroidManifest.xml");
byte[] magic = TestUtils.readHeaderOfFile(manifestFile, 6);
assertTrue(Arrays.equals(this.xmlHeader, magic));
assertArrayEquals(this.xmlHeader, magic);
// confirm resources.arsc does not exist
File resourcesArsc = new File(output + File.separator + "resources.arsc");
@ -106,7 +105,7 @@ public class ForceManifestDecodeNoResourcesTest extends BaseTest {
// lets probe filetype of manifest, we should detect XML
File manifestFile = new File(output + File.separator + "AndroidManifest.xml");
byte[] magic = TestUtils.readHeaderOfFile(manifestFile, 6);
assertTrue(Arrays.equals(this.xmlHeader, magic));
assertArrayEquals(this.xmlHeader, magic);
// confirm resources.arsc does not exist
File resourcesArsc = new File(output + File.separator + "resources.arsc");

View File

@ -21,8 +21,8 @@ import brut.androlib.ApkDecoder;
import brut.androlib.BaseTest;
import brut.androlib.TestUtils;
import brut.androlib.meta.MetaInfo;
import brut.directory.ExtFile;
import brut.common.BrutException;
import brut.directory.ExtFile;
import brut.util.OS;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@ -31,7 +31,7 @@ import org.junit.Test;
import java.io.File;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class MissingVersionManifestTest extends BaseTest {
@ -58,6 +58,6 @@ public class MissingVersionManifestTest extends BaseTest {
apkDecoder.decode();
MetaInfo metaInfo = new Androlib().readMetaFile(decodedApk);
assertEquals(null, metaInfo.versionInfo.versionName);
assertNull(metaInfo.versionInfo.versionName);
}
}

View File

@ -16,12 +16,31 @@ import java.nio.charset.StandardCharsets
* limitations under the License.
*/
buildscript {
ext {
year = '2010'
brut = 'Ryszard Wiśniewski'
brutEmail = 'brut.alll@gmail.com'
ibot = 'Connor Tumbleson'
ibotEmail = 'connor.tumbleson@gmail.com'
depends = [
baksmali : 'org.smali:baksmali:2.5.2',
commons_cli : 'commons-cli:commons-cli:1.4',
commons_io : 'commons-io:commons-io:2.8.0',
commons_lang : 'org.apache.commons:commons-lang3:3.12.0',
guava : 'com.google.guava:guava:30.1.1-jre',
junit : 'junit:junit:4.13.2',
proguard_gradle: 'com.guardsquare:proguard-gradle:7.0.1',
snakeyaml : 'org.yaml:snakeyaml:1.28:android',
smali : 'org.smali:smali:2.5.2',
xmlpull : 'xpp3:xpp3:1.1.4c',
xmlunit : 'xmlunit:xmlunit:1.6',
]
}
repositories {
mavenCentral()
}
tasks.withType(JavaCompile) {
options.encoding = StandardCharsets.UTF_8.toString()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:6.1.0'
}
@ -53,21 +72,18 @@ allprojects {
java = 'SLASHSTAR_STYLE'
}
strictCheck true
ext.year = '2010'
ext.brut = 'Ryszard Wiśniewski'
ext.brutEmail = 'brut.alll@gmail.com'
ext.ibot = 'Connor Tumbleson'
ext.ibotEmail = 'connor.tumbleson@gmail.com'
}
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xlint:-options"]
}
// license plugin automatically fires these tasks, disable them and run them during releases
gradle.startParameter.excludedTaskNames += "licenseMain"
gradle.startParameter.excludedTaskNames += "licenseTest"
gradle.startParameter.excludedTaskNames += [
"licenseMain",
"licenseTest"
]
}
tasks.withType(JavaCompile).configureEach {
options.encoding = StandardCharsets.UTF_8.toString()
options.compilerArgs += ["-Xlint:-options"]
}
def mavenVersion = 'unspecified'
@ -82,7 +98,7 @@ if (!('release' in gradle.startParameter.taskNames)) {
project.ext.set("hash", hash)
project.ext.set("apktool_version", version + "-" + hash + "-SNAPSHOT")
mavenVersion = version + "-SNAPSHOT"
println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash
println "Building SNAPSHOT (${getCheckedOutBranch()}): $hash"
}
} else {
project.ext.set("hash", "")
@ -92,7 +108,7 @@ if (!('release' in gradle.startParameter.taskNames)) {
project.ext.set("apktool_version", version)
}
mavenVersion = version
println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version
println "Building RELEASE (${getCheckedOutBranch()}): $project.ext.apktool_version"
}
build.doFirst {
@ -119,22 +135,6 @@ task snapshot {
subprojects {
apply plugin: 'java'
ext {
depends = [
baksmali: 'org.smali:baksmali:2.5.2',
commons_cli: 'commons-cli:commons-cli:1.4',
commons_io: 'commons-io:commons-io:2.4',
commons_lang: 'org.apache.commons:commons-lang3:3.12.0',
guava: 'com.google.guava:guava:30.1.1-jre',
junit: 'junit:junit:4.13.2',
proguard_gradle: 'com.guardsquare:proguard-gradle:7.1.0-beta2',
snakeyaml: 'org.yaml:snakeyaml:1.28:android',
smali: 'org.smali:smali:2.5.2',
xmlpull: 'xpp3:xpp3:1.1.4c',
xmlunit: 'xmlunit:xmlunit:1.6',
]
}
repositories {
mavenCentral()
}