Merge pull request #2530 from iBotPeaches/maven-publish

Maven Publish
This commit is contained in:
Connor Tumbleson 2021-03-11 06:42:32 -05:00 committed by GitHub
commit bb2acaf3e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
98 changed files with 282 additions and 460 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Gradle # Gradle
.gradle/ .gradle/
bin/ bin/
gradle.properties
# Build # Build
**/build/ **/build/

View File

@ -42,6 +42,22 @@ For example for the `2.2.1` release.
git tag -a v2.2.1 -m "changed version to v2.2.1" git tag -a v2.2.1 -m "changed version to v2.2.1"
### Prepare for publishing.
New to Apktool is publishing releases to Maven, so plugin authors can directly integrate. You
need a `gradle.properties` file in root with the structure:
```
signing.keyId={gpgKeyId}
signing.password={gpgPassphrase}
signing.secretKeyRingFile={gpgSecretKingRingLocation}
ossrhUsername={sonatypeUsername}
ossrhPassword={sonatypePassword}
```
If `release` or `snapshot` is used publishing will be automatically attempted.
### Building the binary. ### Building the binary.
In order to maintain a clean slate. Run `gradlew clean` to start from a clean slate. Now lets build In order to maintain a clean slate. Run `gradlew clean` to start from a clean slate. Now lets build
@ -93,7 +109,7 @@ We upload the binaries into 3 places.
1. [Bitbucket Downloads](https://bitbucket.org/iBotPeaches/apktool/downloads) 1. [Bitbucket Downloads](https://bitbucket.org/iBotPeaches/apktool/downloads)
2. [Github Releases](https://github.com/iBotPeaches/Apktool/releases) - Since `2.2.1`. 2. [Github Releases](https://github.com/iBotPeaches/Apktool/releases) - Since `2.2.1`.
3. [Backup Mirror](http://connortumbleson.com/apktool/) 3. [Backup Mirror](https://connortumbleson.com/apktool/)
#### Bitbucket #### Bitbucket

View File

@ -30,10 +30,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.logging.*; import java.util.logging.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class Main { public class Main {
public static void main(String[] args) throws IOException, InterruptedException, BrutException { public static void main(String[] args) throws IOException, InterruptedException, BrutException {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2008 Android4ME * Copyright 2008 Android4ME / Dmitry Skiba
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,10 +15,6 @@
*/ */
package android.util; package android.util;
/**
* @author Dmitry Skiba
*
*/
public interface AttributeSet { public interface AttributeSet {
int getAttributeCount(); int getAttributeCount();

View File

@ -17,7 +17,7 @@ package android.util;
/** /**
* Container for a dynamically typed data value. Primarily used with * Container for a dynamically typed data value. Primarily used with
* {@link android.content.res.Resources} for holding resource values. * Resources for holding resource values.
*/ */
public class TypedValue { public class TypedValue {
/** The value contains no data. */ /** The value contains no data. */
@ -196,14 +196,13 @@ public class TypedValue {
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** /**
* If {@link #density} is equal to this value, then the density should be * If density is equal to this value, then the density should be
* treated as the system's default density value: * treated as the system's default density value:
* {@link DisplayMetrics#DENSITY_DEFAULT}.
*/ */
public static final int DENSITY_DEFAULT = 0; public static final int DENSITY_DEFAULT = 0;
/** /**
* If {@link #density} is equal to this value, then there is no density * If density is equal to this value, then there is no density
* associated with the resource and it should not be scaled. * associated with the resource and it should not be scaled.
*/ */
public static final int DENSITY_NONE = 0xffff; public static final int DENSITY_NONE = 0xffff;
@ -243,13 +242,11 @@ public class TypedValue {
private static final String[] FRACTION_UNIT_STRS = new String[] { "%", "%p" }; private static final String[] FRACTION_UNIT_STRS = new String[] { "%", "%p" };
/** /**
* Perform type conversion as per {@link #coerceToString()} on an explicitly * Perform type conversion as per coerceToString on an explicitly
* supplied type and data. * supplied type and data.
* *
* @param type * @param type The data type identifier.
* The data type identifier. * @param data The data value.
* @param data
* The data value.
* *
* @return String The coerced string value. If the value is null or the type * @return String The coerced string value. If the value is null or the type
* is not known, null is returned. * is not known, null is returned.

View File

@ -45,9 +45,6 @@ import java.util.zip.ZipOutputStream;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class Androlib { public class Androlib {
private final AndrolibResources mAndRes = new AndrolibResources(); private final AndrolibResources mAndRes = new AndrolibResources();
protected final ResUnknownFiles mResUnknownFiles = new ResUnknownFiles(); protected final ResUnknownFiles mResUnknownFiles = new ResUnknownFiles();

View File

@ -18,9 +18,6 @@ package brut.androlib;
import brut.common.BrutException; import brut.common.BrutException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class AndrolibException extends BrutException { public class AndrolibException extends BrutException {
public AndrolibException() { public AndrolibException() {
} }

View File

@ -38,9 +38,6 @@ import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ApkDecoder { public class ApkDecoder {
public ApkDecoder() { public ApkDecoder() {
this(new Androlib()); this(new Androlib());

View File

@ -21,9 +21,6 @@ import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ApktoolProperties { public class ApktoolProperties {
public static String get(String key) { public static String get(String key) {
return get().getProperty(key); return get().getProperty(key);

View File

@ -18,9 +18,6 @@ package brut.androlib.err;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class CantFind9PatchChunkException extends AndrolibException { public class CantFind9PatchChunkException extends AndrolibException {
public CantFind9PatchChunkException(String message, Throwable cause) { public CantFind9PatchChunkException(String message, Throwable cause) {
super(message, cause); super(message, cause);

View File

@ -18,9 +18,6 @@ package brut.androlib.err;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class CantFindFrameworkResException extends AndrolibException { public class CantFindFrameworkResException extends AndrolibException {
public CantFindFrameworkResException(int id) { public CantFindFrameworkResException(int id) {
mPkgId = id; mPkgId = id;

View File

@ -18,9 +18,6 @@ package brut.androlib.err;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class InFileNotFoundException extends AndrolibException { public class InFileNotFoundException extends AndrolibException {
public InFileNotFoundException() { public InFileNotFoundException() {
} }

View File

@ -18,9 +18,6 @@ package brut.androlib.err;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class OutDirExistsException extends AndrolibException { public class OutDirExistsException extends AndrolibException {
public OutDirExistsException() { public OutDirExistsException() {
} }

View File

@ -18,9 +18,6 @@ package brut.androlib.err;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class UndefinedResObjectException extends AndrolibException { public class UndefinedResObjectException extends AndrolibException {
public UndefinedResObjectException(String message) { public UndefinedResObjectException(String message) {
super(message); super(message);

View File

@ -16,19 +16,20 @@
*/ */
package brut.androlib.mod; package brut.androlib.mod;
import java.io.*; import org.antlr.runtime.CommonTokenStream;
import java.nio.charset.StandardCharsets; import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.Token;
import org.antlr.runtime.*;
import org.antlr.runtime.tree.CommonTree; import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.CommonTreeNodeStream; import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.jf.dexlib2.writer.builder.DexBuilder; import org.jf.dexlib2.writer.builder.DexBuilder;
import org.jf.smali.*; import org.jf.smali.smaliFlexLexer;
import org.jf.smali.smaliParser;
import org.jf.smali.smaliTreeWalker;
import java.io.*;
import java.nio.charset.StandardCharsets;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class SmaliMod { public class SmaliMod {
public static boolean assembleSmaliFile(String smali, DexBuilder dexBuilder, int apiLevel, boolean verboseErrors, public static boolean assembleSmaliFile(String smali, DexBuilder dexBuilder, int apiLevel, boolean verboseErrors,

View File

@ -44,9 +44,6 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
final public class AndrolibResources { final public class AndrolibResources {
public ResTable getResTable(ExtFile apkFile) throws AndrolibException { public ResTable getResTable(ExtFile apkFile) throws AndrolibException {
return getResTable(apkFile, true); return getResTable(apkFile, true);

View File

@ -18,9 +18,6 @@ package brut.androlib.res.data;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResConfigFlags { public class ResConfigFlags {
public final short mcc; public final short mcc;
public final short mnc; public final short mnc;

View File

@ -16,9 +16,6 @@
*/ */
package brut.androlib.res.data; package brut.androlib.res.data;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResID { public class ResID {
public final int package_; public final int package_;
public final int type; public final int type;

View File

@ -25,9 +25,6 @@ import brut.util.Duo;
import java.util.*; import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResPackage { public class ResPackage {
private final ResTable mResTable; private final ResTable mResTable;
private final int mId; private final int mId;

View File

@ -18,12 +18,13 @@ package brut.androlib.res.data;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.err.UndefinedResObjectException; import brut.androlib.err.UndefinedResObjectException;
import java.util.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
/** import java.util.LinkedHashMap;
* @author Ryszard Wiśniewski <brut.alll@gmail.com> import java.util.LinkedHashSet;
*/ import java.util.Map;
import java.util.Set;
public class ResResSpec { public class ResResSpec {
private final ResID mId; private final ResID mId;
private final String mName; private final String mName;

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.value.ResValue; import brut.androlib.res.data.value.ResValue;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResResource { public class ResResource {
private final ResType mConfig; private final ResType mConfig;
private final ResResSpec mResSpec; private final ResResSpec mResSpec;

View File

@ -23,9 +23,6 @@ import brut.androlib.res.AndrolibResources;
import brut.androlib.res.data.value.ResValue; import brut.androlib.res.data.value.ResValue;
import java.util.*; import java.util.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResTable { public class ResTable {
private final AndrolibResources mAndRes; private final AndrolibResources mAndRes;

View File

@ -20,9 +20,6 @@ import brut.androlib.AndrolibException;
import brut.androlib.err.UndefinedResObjectException; import brut.androlib.err.UndefinedResObjectException;
import java.util.*; import java.util.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResType { public class ResType {
private final ResConfigFlags mFlags; private final ResConfigFlags mFlags;
private final Map<ResResSpec, ResResource> mResources = new LinkedHashMap<ResResSpec, ResResource>(); private final Map<ResResSpec, ResResource> mResources = new LinkedHashMap<ResResSpec, ResResource>();

View File

@ -20,9 +20,6 @@ import brut.androlib.AndrolibException;
import brut.androlib.err.UndefinedResObjectException; import brut.androlib.err.UndefinedResObjectException;
import java.util.*; import java.util.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public final class ResTypeSpec { public final class ResTypeSpec {
public static final String RES_TYPE_NAME_ARRAY = "array"; public static final String RES_TYPE_NAME_ARRAY = "array";

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class ResUnknownFiles { public class ResUnknownFiles {
private final Map<String, String> mUnknownFiles = new LinkedHashMap<>(); private final Map<String, String> mUnknownFiles = new LinkedHashMap<>();

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResValuesFile { public class ResValuesFile {
private final ResPackage mPackage; private final ResPackage mPackage;
private final ResTypeSpec mType; private final ResTypeSpec mType;

View File

@ -20,14 +20,11 @@ import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import brut.util.Duo; import brut.util.Duo;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResArrayValue extends ResBagValue implements public class ResArrayValue extends ResBagValue implements
ResValuesXmlSerializable { ResValuesXmlSerializable {

View File

@ -21,12 +21,10 @@ import brut.androlib.res.data.ResPackage;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import brut.util.Duo; import brut.util.Duo;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResAttr extends ResBagValue implements ResValuesXmlSerializable { public class ResAttr extends ResBagValue implements ResValuesXmlSerializable {
ResAttr(ResReferenceValue parentVal, int type, Integer min, Integer max, ResAttr(ResReferenceValue parentVal, int type, Integer min, Integer max,
Boolean l10n) { Boolean l10n) {

View File

@ -20,12 +20,10 @@ import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import brut.util.Duo; import brut.util.Duo;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResBagValue extends ResValue implements ResValuesXmlSerializable { public class ResBagValue extends ResValue implements ResValuesXmlSerializable {
protected final ResReferenceValue mParent; protected final ResReferenceValue mParent;

View File

@ -16,9 +16,6 @@
*/ */
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResBoolValue extends ResScalarValue { public class ResBoolValue extends ResScalarValue {
private final boolean mValue; private final boolean mValue;

View File

@ -16,9 +16,6 @@
*/ */
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResColorValue extends ResIntValue { public class ResColorValue extends ResIntValue {
public ResColorValue(int value, String rawValue) { public ResColorValue(int value, String rawValue) {
super(value, rawValue, "color"); super(value, rawValue, "color");

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data.value;
import android.util.TypedValue; import android.util.TypedValue;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResDimenValue extends ResIntValue { public class ResDimenValue extends ResIntValue {
public ResDimenValue(int value, String rawValue) { public ResDimenValue(int value, String rawValue) {
super(value, rawValue, "dimen"); super(value, rawValue, "dimen");

View File

@ -20,14 +20,12 @@ import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResSpec; import brut.androlib.res.data.ResResSpec;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.util.Duo; import brut.util.Duo;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResEnumAttr extends ResAttr { public class ResEnumAttr extends ResAttr {
ResEnumAttr(ResReferenceValue parent, int type, Integer min, Integer max, ResEnumAttr(ResReferenceValue parent, int type, Integer min, Integer max,
Boolean l10n, Duo<ResReferenceValue, ResIntValue>[] items) { Boolean l10n, Duo<ResReferenceValue, ResIntValue>[] items) {

View File

@ -18,9 +18,6 @@ package brut.androlib.res.data.value;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResFileValue extends ResIntBasedValue { public class ResFileValue extends ResIntBasedValue {
private final String mPath; private final String mPath;

View File

@ -19,14 +19,12 @@ package brut.androlib.res.data.value;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.util.Duo; import brut.util.Duo;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResFlagsAttr extends ResAttr { public class ResFlagsAttr extends ResAttr {
ResFlagsAttr(ResReferenceValue parent, int type, Integer min, Integer max, ResFlagsAttr(ResReferenceValue parent, int type, Integer min, Integer max,
Boolean l10n, Duo<ResReferenceValue, ResIntValue>[] items) { Boolean l10n, Duo<ResReferenceValue, ResIntValue>[] items) {

View File

@ -16,9 +16,6 @@
*/ */
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResFloatValue extends ResScalarValue { public class ResFloatValue extends ResScalarValue {
private final float mValue; private final float mValue;

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data.value;
import android.util.TypedValue; import android.util.TypedValue;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResFractionValue extends ResIntValue { public class ResFractionValue extends ResIntValue {
public ResFractionValue(int value, String rawValue) { public ResFractionValue(int value, String rawValue) {
super(value, rawValue, "fraction"); super(value, rawValue, "fraction");

View File

@ -19,12 +19,10 @@ package brut.androlib.res.data.value;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResIdValue extends ResValue implements ResValuesXmlSerializable { public class ResIdValue extends ResValue implements ResValuesXmlSerializable {
@Override @Override
public void serializeToResValuesXml(XmlSerializer serializer, public void serializeToResValuesXml(XmlSerializer serializer,

View File

@ -16,9 +16,6 @@
*/ */
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
/**
* @author Matt Mastracci <matthew@mastracci.com>
*/
public class ResIntBasedValue extends ResValue { public class ResIntBasedValue extends ResValue {
private final int mRawIntValue; private final int mRawIntValue;

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data.value;
import android.util.TypedValue; import android.util.TypedValue;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResIntValue extends ResScalarValue { public class ResIntValue extends ResScalarValue {
protected final int mValue; protected final int mValue;
private int type; private int type;

View File

@ -21,12 +21,10 @@ import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import brut.androlib.res.xml.ResXmlEncoders; import brut.androlib.res.xml.ResXmlEncoders;
import brut.util.Duo; import brut.util.Duo;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResPluralsValue extends ResBagValue implements public class ResPluralsValue extends ResBagValue implements
ResValuesXmlSerializable { ResValuesXmlSerializable {
ResPluralsValue(ResReferenceValue parent, ResPluralsValue(ResReferenceValue parent,

View File

@ -21,9 +21,6 @@ import brut.androlib.err.UndefinedResObjectException;
import brut.androlib.res.data.ResPackage; import brut.androlib.res.data.ResPackage;
import brut.androlib.res.data.ResResSpec; import brut.androlib.res.data.ResResSpec;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResReferenceValue extends ResIntValue { public class ResReferenceValue extends ResIntValue {
private final ResPackage mPackage; private final ResPackage mPackage;
private final boolean mTheme; private final boolean mTheme;

View File

@ -21,12 +21,10 @@ import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import brut.androlib.res.xml.ResXmlEncodable; import brut.androlib.res.xml.ResXmlEncodable;
import brut.androlib.res.xml.ResXmlEncoders; import brut.androlib.res.xml.ResXmlEncoders;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public abstract class ResScalarValue extends ResIntBasedValue implements public abstract class ResScalarValue extends ResIntBasedValue implements
ResXmlEncodable, ResValuesXmlSerializable { ResXmlEncodable, ResValuesXmlSerializable {
protected final String mType; protected final String mType;

View File

@ -19,14 +19,11 @@ package brut.androlib.res.data.value;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResXmlEncoders; import brut.androlib.res.xml.ResXmlEncoders;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResStringValue extends ResScalarValue { public class ResStringValue extends ResScalarValue {
public ResStringValue(String value, int rawValue) { public ResStringValue(String value, int rawValue) {

View File

@ -21,13 +21,11 @@ import brut.androlib.res.data.ResResSpec;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResValuesXmlSerializable; import brut.androlib.res.xml.ResValuesXmlSerializable;
import brut.util.Duo; import brut.util.Duo;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResStyleValue extends ResBagValue implements public class ResStyleValue extends ResBagValue implements
ResValuesXmlSerializable { ResValuesXmlSerializable {
ResStyleValue(ResReferenceValue parent, ResStyleValue(ResReferenceValue parent,

View File

@ -16,9 +16,6 @@
*/ */
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResValue { public class ResValue {
} }

View File

@ -22,9 +22,6 @@ import brut.androlib.res.data.ResPackage;
import brut.androlib.res.data.ResTypeSpec; import brut.androlib.res.data.ResTypeSpec;
import brut.util.Duo; import brut.util.Duo;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResValueFactory { public class ResValueFactory {
private final ResPackage mPackage; private final ResPackage mPackage;

View File

@ -31,9 +31,6 @@ import java.util.*;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.apache.commons.io.input.CountingInputStream; import org.apache.commons.io.input.CountingInputStream;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ARSCDecoder { public class ARSCDecoder {
public static ARSCData decode(InputStream arscStream, boolean findFlagsOffsets, boolean keepBroken) public static ARSCData decode(InputStream arscStream, boolean findFlagsOffsets, boolean keepBroken)
throws AndrolibException { throws AndrolibException {

View File

@ -23,28 +23,24 @@ import brut.androlib.res.data.ResID;
import brut.androlib.res.xml.ResXmlEncoders; import brut.androlib.res.xml.ResXmlEncoders;
import brut.util.ExtDataInput; import brut.util.ExtDataInput;
import com.google.common.io.LittleEndianDataInputStream; import com.google.common.io.LittleEndianDataInputStream;
import org.xmlpull.v1.XmlPullParserException;
import java.io.DataInput; import java.io.DataInput;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.Reader; import java.io.Reader;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.xmlpull.v1.XmlPullParserException;
/** /**
* @author Ryszard Wiśniewski <brut.alll@gmail.com> * Binary xml files parser.
* @author Dmitry Skiba
* *
* Binary xml files parser. * Parser has only two states: (1) Operational state, which parser
* * obtains after first successful call to next() and retains until
* Parser has only two states: (1) Operational state, which parser * open(), close(), or failed call to next(). (2) Closed state, which
* obtains after first successful call to next() and retains until * parser obtains after open(), close(), or failed call to next(). In
* open(), close(), or failed call to next(). (2) Closed state, which * this state methods return invalid values or throw exceptions.
* parser obtains after open(), close(), or failed call to next(). In
* this state methods return invalid values or throw exceptions.
*
* TODO: * check all methods in closed state
* *
* TODO: * check all methods in closed state
*/ */
public class AXmlResourceParser implements XmlResourceParser { public class AXmlResourceParser implements XmlResourceParser {

View File

@ -19,17 +19,14 @@ package brut.androlib.res.decoder;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.err.CantFind9PatchChunkException; import brut.androlib.err.CantFind9PatchChunkException;
import brut.util.ExtDataInput; import brut.util.ExtDataInput;
import org.apache.commons.io.IOUtils;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.Raster; import java.awt.image.Raster;
import java.awt.image.WritableRaster; import java.awt.image.WritableRaster;
import java.io.*; import java.io.*;
import javax.imageio.ImageIO;
import org.apache.commons.io.IOUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class Res9patchStreamDecoder implements ResStreamDecoder { public class Res9patchStreamDecoder implements ResStreamDecoder {
@Override @Override
public void decode(InputStream in, OutputStream out) public void decode(InputStream in, OutputStream out)

View File

@ -23,9 +23,6 @@ import brut.androlib.res.data.ResResSpec;
import brut.androlib.res.data.value.ResAttr; import brut.androlib.res.data.value.ResAttr;
import brut.androlib.res.data.value.ResScalarValue; import brut.androlib.res.data.value.ResScalarValue;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResAttrDecoder { public class ResAttrDecoder {
public String decode(int type, int value, String rawValue, int attrResId) public String decode(int type, int value, String rawValue, int attrResId)
throws AndrolibException { throws AndrolibException {

View File

@ -30,9 +30,6 @@ import java.io.*;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResFileDecoder { public class ResFileDecoder {
private final ResStreamDecoderContainer mDecoders; private final ResStreamDecoderContainer mDecoders;

View File

@ -17,14 +17,12 @@
package brut.androlib.res.decoder; package brut.androlib.res.decoder;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import org.apache.commons.io.IOUtils;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import org.apache.commons.io.IOUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResRawStreamDecoder implements ResStreamDecoder { public class ResRawStreamDecoder implements ResStreamDecoder {
@Override @Override
public void decode(InputStream in, OutputStream out) public void decode(InputStream in, OutputStream out)

View File

@ -20,9 +20,6 @@ import brut.androlib.AndrolibException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public interface ResStreamDecoder { public interface ResStreamDecoder {
public void decode(InputStream in, OutputStream out) public void decode(InputStream in, OutputStream out)
throws AndrolibException; throws AndrolibException;

View File

@ -22,9 +22,6 @@ import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResStreamDecoderContainer { public class ResStreamDecoderContainer {
private final Map<String, ResStreamDecoder> mDecoders = new HashMap<String, ResStreamDecoder>(); private final Map<String, ResStreamDecoder> mDecoders = new HashMap<String, ResStreamDecoder>();

View File

@ -25,20 +25,15 @@ import java.nio.ByteBuffer;
import java.nio.charset.*; import java.nio.charset.*;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
* @author Dmitry Skiba
*
* Block of strings, used in binary xml and arsc.
*
* TODO: - implement get()
*
*/
public class StringBlock { public class StringBlock {
/** /**
* Reads whole (including chunk type) string block from stream. Stream must * Reads whole (including chunk type) string block from stream. Stream must
* be at the chunk type. * be at the chunk type.
* @param reader ExtDataInput
* @return StringBlock
*
* @throws IOException Parsing resources.arsc error
*/ */
public static StringBlock read(ExtDataInput reader) throws IOException { public static StringBlock read(ExtDataInput reader) throws IOException {
reader.skipCheckChunkTypeInt(CHUNK_STRINGPOOL_TYPE, CHUNK_NULL_TYPE); reader.skipCheckChunkTypeInt(CHUNK_STRINGPOOL_TYPE, CHUNK_NULL_TYPE);
@ -81,6 +76,7 @@ public class StringBlock {
/** /**
* Returns number of strings in block. * Returns number of strings in block.
* @return int
*/ */
public int getCount() { public int getCount() {
return m_stringOffsets != null ? m_stringOffsets.length : 0; return m_stringOffsets != null ? m_stringOffsets.length : 0;
@ -88,6 +84,8 @@ public class StringBlock {
/** /**
* Returns raw string (without any styling information) at specified index. * Returns raw string (without any styling information) at specified index.
* @param index int
* @return String
*/ */
public String getString(int index) { public String getString(int index) {
if (index < 0 || m_stringOffsets == null || index >= m_stringOffsets.length) { if (index < 0 || m_stringOffsets == null || index >= m_stringOffsets.length) {
@ -108,17 +106,10 @@ public class StringBlock {
return decodeString(offset, length); return decodeString(offset, length);
} }
/**
* Not yet implemented.
*
* Returns string with style information (if any).
*/
public CharSequence get(int index) {
return getString(index);
}
/** /**
* Returns string with style tags (html-like). * Returns string with style tags (html-like).
* @param index int
* @return String
*/ */
public String getHTML(int index) { public String getHTML(int index) {
String raw = getString(index); String raw = getString(index);
@ -228,6 +219,9 @@ public class StringBlock {
/** /**
* Finds index of the string. Returns -1 if the string was not found. * Finds index of the string. Returns -1 if the string was not found.
*
* @param string String to index location of
* @return int (Returns -1 if not found)
*/ */
public int find(String string) { public int find(String string) {
if (string == null) { if (string == null) {

View File

@ -16,12 +16,11 @@
*/ */
package brut.androlib.res.decoder; package brut.androlib.res.decoder;
import java.io.IOException; import brut.androlib.AndrolibException;
import java.io.InputStream;
import java.io.OutputStream;
import brut.androlib.err.AXmlDecodingException; import brut.androlib.err.AXmlDecodingException;
import brut.androlib.err.RawXmlEncounteredException; import brut.androlib.err.RawXmlEncounteredException;
import brut.androlib.res.data.ResTable;
import brut.androlib.res.util.ExtXmlSerializer;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.wrapper.XmlPullParserWrapper; import org.xmlpull.v1.wrapper.XmlPullParserWrapper;
@ -29,13 +28,10 @@ import org.xmlpull.v1.wrapper.XmlPullWrapperFactory;
import org.xmlpull.v1.wrapper.XmlSerializerWrapper; import org.xmlpull.v1.wrapper.XmlSerializerWrapper;
import org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper; import org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper;
import brut.androlib.AndrolibException; import java.io.IOException;
import brut.androlib.res.data.ResTable; import java.io.InputStream;
import brut.androlib.res.util.ExtXmlSerializer; import java.io.OutputStream;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class XmlPullStreamDecoder implements ResStreamDecoder { public class XmlPullStreamDecoder implements ResStreamDecoder {
public XmlPullStreamDecoder(XmlPullParser parser, public XmlPullStreamDecoder(XmlPullParser parser,
ExtXmlSerializer serializer) { ExtXmlSerializer serializer) {

View File

@ -16,12 +16,12 @@
*/ */
package brut.androlib.res.util; package brut.androlib.res.util;
import java.io.*;
import org.xmlpull.renamed.MXSerializer; import org.xmlpull.renamed.MXSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com> import java.io.OutputStream;
*/ import java.io.Writer;
public class ExtMXSerializer extends MXSerializer implements ExtXmlSerializer { public class ExtMXSerializer extends MXSerializer implements ExtXmlSerializer {
@Override @Override
public void startDocument(String encoding, Boolean standalone) public void startDocument(String encoding, Boolean standalone)

View File

@ -16,12 +16,10 @@
*/ */
package brut.androlib.res.util; package brut.androlib.res.util;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public interface ExtXmlSerializer extends XmlSerializer { public interface ExtXmlSerializer extends XmlSerializer {
public ExtXmlSerializer newLine() throws IOException; public ExtXmlSerializer newLine() throws IOException;

View File

@ -18,12 +18,10 @@ package brut.androlib.res.xml;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer; import org.xmlpull.v1.XmlSerializer;
/** import java.io.IOException;
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public interface ResValuesXmlSerializable { public interface ResValuesXmlSerializable {
public void serializeToResValuesXml(XmlSerializer serializer, public void serializeToResValuesXml(XmlSerializer serializer,
ResResource res) throws IOException, AndrolibException; ResResource res) throws IOException, AndrolibException;

View File

@ -18,9 +18,6 @@ package brut.androlib.res.xml;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public interface ResXmlEncodable { public interface ResXmlEncodable {
public String encodeAsResXmlAttr() throws AndrolibException; public String encodeAsResXmlAttr() throws AndrolibException;

View File

@ -17,16 +17,12 @@
package brut.androlib.res.xml; package brut.androlib.res.xml;
import brut.util.Duo; import brut.util.Duo;
import org.apache.commons.lang3.StringUtils;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.lang3.StringUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public final class ResXmlEncoders { public final class ResXmlEncoders {
public static String escapeXmlChars(String str) { public static String escapeXmlChars(String str) {

View File

@ -16,10 +16,12 @@
*/ */
package brut.androlib.res.xml; package brut.androlib.res.xml;
import java.io.File; import brut.androlib.AndrolibException;
import java.io.FileInputStream; import org.w3c.dom.Document;
import java.io.IOException; import org.w3c.dom.NamedNodeMap;
import java.util.logging.Logger; import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
@ -29,27 +31,19 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath; import javax.xml.xpath.*;
import javax.xml.xpath.XPathConstants; import java.io.File;
import javax.xml.xpath.XPathExpression; import java.io.FileInputStream;
import javax.xml.xpath.XPathExpressionException; import java.io.IOException;
import javax.xml.xpath.XPathFactory; import java.util.logging.Logger;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import brut.androlib.AndrolibException;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public final class ResXmlPatcher { public final class ResXmlPatcher {
/** /**
* Removes "debug" tag from file * Removes "debug" tag from file
* *
* @param file AndroidManifest file * @param file AndroidManifest file
* @throws AndrolibException * @throws AndrolibException Error reading Manifest file
*/ */
public static void removeApplicationDebugTag(File file) throws AndrolibException { public static void removeApplicationDebugTag(File file) throws AndrolibException {
if (file.exists()) { if (file.exists()) {
@ -77,9 +71,8 @@ public final class ResXmlPatcher {
* Sets "debug" tag in the file to true * Sets "debug" tag in the file to true
* *
* @param file AndroidManifest file * @param file AndroidManifest file
* @throws AndrolibException
*/ */
public static void setApplicationDebugTagTrue(File file) throws AndrolibException { public static void setApplicationDebugTagTrue(File file) {
if (file.exists()) { if (file.exists()) {
try { try {
Document doc = loadDocument(file); Document doc = loadDocument(file);
@ -105,18 +98,17 @@ public final class ResXmlPatcher {
} }
/** /**
* Any @string reference in a <provider> value in AndroidManifest.xml will break on * Any @string reference in a provider value in AndroidManifest.xml will break on
* build, thus preventing the application from installing. This is from a bug/error * build, thus preventing the application from installing. This is from a bug/error
* in AOSP where public resources cannot be part of an authorities attribute within * in AOSP where public resources cannot be part of an authorities attribute within
* a <provider> tag. * a provider tag.
* *
* This finds any reference and replaces it with the literal value found in the * This finds any reference and replaces it with the literal value found in the
* res/values/strings.xml file. * res/values/strings.xml file.
* *
* @param file File for AndroidManifest.xml * @param file File for AndroidManifest.xml
* @throws AndrolibException
*/ */
public static void fixingPublicAttrsInProviderAttributes(File file) throws AndrolibException { public static void fixingPublicAttrsInProviderAttributes(File file) {
boolean saved = false; boolean saved = false;
if (file.exists()) { if (file.exists()) {
try { try {
@ -177,9 +169,8 @@ public final class ResXmlPatcher {
* @param saved boolean on whether we need to save * @param saved boolean on whether we need to save
* @param provider Node we are attempting to replace * @param provider Node we are attempting to replace
* @return boolean * @return boolean
* @throws AndrolibException setting node value failed
*/ */
private static boolean isSaved(File file, boolean saved, Node provider) throws AndrolibException { private static boolean isSaved(File file, boolean saved, Node provider) {
String reference = provider.getNodeValue(); String reference = provider.getNodeValue();
String replacement = pullValueFromStrings(file.getParentFile(), reference); String replacement = pullValueFromStrings(file.getParentFile(), reference);
@ -196,9 +187,8 @@ public final class ResXmlPatcher {
* @param directory Root directory of apk * @param directory Root directory of apk
* @param key String reference (ie @string/foo) * @param key String reference (ie @string/foo)
* @return String|null * @return String|null
* @throws AndrolibException
*/ */
public static String pullValueFromStrings(File directory, String key) throws AndrolibException { public static String pullValueFromStrings(File directory, String key) {
if (key == null || ! key.contains("@")) { if (key == null || ! key.contains("@")) {
return null; return null;
} }
@ -231,9 +221,8 @@ public final class ResXmlPatcher {
* @param directory Root directory of apk * @param directory Root directory of apk
* @param key Integer reference (ie @integer/foo) * @param key Integer reference (ie @integer/foo)
* @return String|null * @return String|null
* @throws AndrolibException
*/ */
public static String pullValueFromIntegers(File directory, String key) throws AndrolibException { public static String pullValueFromIntegers(File directory, String key) {
if (key == null || ! key.contains("@")) { if (key == null || ! key.contains("@")) {
return null; return null;
} }
@ -264,9 +253,8 @@ public final class ResXmlPatcher {
* Removes attributes like "versionCode" and "versionName" from file. * Removes attributes like "versionCode" and "versionName" from file.
* *
* @param file File representing AndroidManifest.xml * @param file File representing AndroidManifest.xml
* @throws AndrolibException
*/ */
public static void removeManifestVersions(File file) throws AndrolibException { public static void removeManifestVersions(File file) {
if (file.exists()) { if (file.exists()) {
try { try {
Document doc = loadDocument(file); Document doc = loadDocument(file);
@ -293,9 +281,8 @@ public final class ResXmlPatcher {
* *
* @param file File for AndroidManifest.xml * @param file File for AndroidManifest.xml
* @param packageOriginal Package name to replace * @param packageOriginal Package name to replace
* @throws AndrolibException
*/ */
public static void renameManifestPackage(File file, String packageOriginal) throws AndrolibException { public static void renameManifestPackage(File file, String packageOriginal) {
try { try {
Document doc = loadDocument(file); Document doc = loadDocument(file);

View File

@ -18,19 +18,19 @@ package brut.androlib.src;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.mod.SmaliMod; import brut.androlib.mod.SmaliMod;
import brut.directory.ExtFile;
import brut.directory.DirectoryException; import brut.directory.DirectoryException;
import java.io.*; import brut.directory.ExtFile;
import java.util.logging.Logger;
import org.antlr.runtime.RecognitionException; import org.antlr.runtime.RecognitionException;
import org.jf.dexlib2.Opcodes; import org.jf.dexlib2.Opcodes;
import org.jf.dexlib2.writer.builder.DexBuilder; import org.jf.dexlib2.writer.builder.DexBuilder;
import org.jf.dexlib2.writer.io.FileDataStore; import org.jf.dexlib2.writer.io.FileDataStore;
/** import java.io.File;
* @author Ryszard Wiśniewski <brut.alll@gmail.com> import java.io.FileInputStream;
*/ import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Logger;
public class SmaliBuilder { public class SmaliBuilder {
public static void build(ExtFile smaliDir, File dexFile, int apiLevel) throws AndrolibException { public static void build(ExtFile smaliDir, File dexFile, int apiLevel) throws AndrolibException {
new SmaliBuilder(smaliDir, dexFile, apiLevel).build(); new SmaliBuilder(smaliDir, dexFile, apiLevel).build();

View File

@ -29,9 +29,6 @@ import org.jf.dexlib2.iface.MultiDexContainer;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class SmaliDecoder { public class SmaliDecoder {
public static void decode(File apkFile, File outDir, String dexName, boolean bakdeb, int api) public static void decode(File apkFile, File outDir, String dexName, boolean bakdeb, int api)

View File

@ -16,13 +16,13 @@
*/ */
package org.xmlpull.renamed; package org.xmlpull.renamed;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import org.xmlpull.v1.XmlSerializer;
/** /**
* Implementation of XmlSerializer interface from XmlPull V1 API. This * Implementation of XmlSerializer interface from XmlPull V1 API. This
* implementation is optimized for performance and low memory footprint. * implementation is optimized for performance and low memory footprint.
@ -1009,7 +1009,6 @@ public class MXSerializer implements XmlSerializer {
} }
} }
/** simple utility method -- good for debugging */
protected static final String printable(String s) { protected static final String printable(String s) {
if (s == null) { if (s == null) {
return "null"; return "null";

View File

@ -18,7 +18,16 @@ package brut.androlib;
import brut.androlib.res.AndrolibResources; import brut.androlib.res.AndrolibResources;
import brut.common.BrutException; import brut.common.BrutException;
import brut.directory.*; import brut.directory.DirUtil;
import brut.directory.Directory;
import brut.directory.FileDirectory;
import brut.util.OS;
import org.custommonkey.xmlunit.ElementQualifier;
import org.w3c.dom.Element;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.*; import java.io.*;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
@ -26,14 +35,6 @@ import java.nio.file.Files;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import brut.util.OS;
import org.custommonkey.xmlunit.ElementQualifier;
import org.w3c.dom.Element;
import org.xmlpull.v1.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public abstract class TestUtils { public abstract class TestUtils {
public static Map<String, String> parseStringsXml(File file) public static Map<String, String> parseStringsXml(File file)

View File

@ -28,9 +28,6 @@ import java.io.File;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class AndroidOreoNotSparseTest extends BaseTest { public class AndroidOreoNotSparseTest extends BaseTest {
@BeforeClass @BeforeClass
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception {

View File

@ -28,9 +28,6 @@ import java.io.File;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class AndroidOreoSparseTest extends BaseTest { public class AndroidOreoSparseTest extends BaseTest {
@BeforeClass @BeforeClass
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception {

View File

@ -31,9 +31,6 @@ import java.io.File;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class BuildAndDecodeJarTest extends BaseTest { public class BuildAndDecodeJarTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -21,25 +21,23 @@ import brut.androlib.ApkDecoder;
import brut.androlib.BaseTest; import brut.androlib.BaseTest;
import brut.androlib.TestUtils; import brut.androlib.TestUtils;
import brut.androlib.meta.MetaInfo; import brut.androlib.meta.MetaInfo;
import brut.directory.ExtFile;
import brut.common.BrutException; import brut.common.BrutException;
import brut.directory.ExtFile;
import brut.util.OS; import brut.util.OS;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Map;
import brut.util.OSDetection; import brut.util.OSDetection;
import org.junit.*; import org.junit.AfterClass;
import org.junit.BeforeClass;
import static org.junit.Assert.*; import org.junit.Test;
import static org.junit.Assume.*;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class BuildAndDecodeTest extends BaseTest { public class BuildAndDecodeTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -34,9 +34,6 @@ import java.nio.file.Paths;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebugTagRetainedTest extends BaseTest { public class DebugTagRetainedTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -32,9 +32,6 @@ import java.util.logging.Logger;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class EmptyResourcesArscTest { public class EmptyResourcesArscTest {
@BeforeClass @BeforeClass
public static void beforeClass() throws Exception { public static void beforeClass() throws Exception {

View File

@ -33,9 +33,6 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class ReferenceVersionCodeTest extends BaseTest { public class ReferenceVersionCodeTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -30,9 +30,6 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNotSame;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class UnknownCompressionTest extends BaseTest { public class UnknownCompressionTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -30,9 +30,6 @@ import java.io.IOException;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class BuildAndDecodeTest extends BaseTest { public class BuildAndDecodeTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -20,22 +20,20 @@ import brut.androlib.*;
import brut.common.BrutException; import brut.common.BrutException;
import brut.directory.ExtFile; import brut.directory.ExtFile;
import brut.util.OS; import brut.util.OS;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.custommonkey.xmlunit.XMLUnit; import org.custommonkey.xmlunit.XMLUnit;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebuggableFalseChangeToTrueTest extends BaseTest { public class DebuggableFalseChangeToTrueTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -20,22 +20,20 @@ import brut.androlib.*;
import brut.common.BrutException; import brut.common.BrutException;
import brut.directory.ExtFile; import brut.directory.ExtFile;
import brut.util.OS; import brut.util.OS;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.custommonkey.xmlunit.XMLUnit; import org.custommonkey.xmlunit.XMLUnit;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebuggableTrueAddedTest extends BaseTest { public class DebuggableTrueAddedTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -20,22 +20,20 @@ import brut.androlib.*;
import brut.common.BrutException; import brut.common.BrutException;
import brut.directory.ExtFile; import brut.directory.ExtFile;
import brut.util.OS; import brut.util.OS;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.custommonkey.xmlunit.XMLUnit; import org.custommonkey.xmlunit.XMLUnit;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebuggableTrueRetainedTest extends BaseTest { public class DebuggableTrueRetainedTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -16,6 +16,11 @@
*/ */
package brut.androlib.decode; package brut.androlib.decode;
import brut.androlib.*;
import brut.common.BrutException;
import brut.directory.DirectoryException;
import brut.directory.ExtFile;
import brut.util.OS;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -25,21 +30,8 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import brut.androlib.Androlib;
import brut.androlib.AndrolibException;
import brut.androlib.ApkDecoder;
import brut.androlib.BaseTest;
import brut.androlib.TestUtils;
import brut.common.BrutException;
import brut.directory.DirectoryException;
import brut.directory.ExtFile;
import brut.util.OS;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Adib Faramarzi <adibfara@gmail.com>
*/
public class DecodeKotlinCoroutinesTest extends BaseTest { public class DecodeKotlinCoroutinesTest extends BaseTest {
private static String apk = "test-kotlin-coroutines.apk"; private static String apk = "test-kotlin-coroutines.apk";

View File

@ -32,9 +32,6 @@ import java.io.IOException;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DecodeKotlinTest extends BaseTest { public class DecodeKotlinTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -34,9 +34,6 @@ import java.io.IOException;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DoubleExtensionUnknownFileTest extends BaseTest { public class DoubleExtensionUnknownFileTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -34,9 +34,6 @@ import java.nio.file.Paths;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class ExternalEntityTest extends BaseTest { public class ExternalEntityTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -33,9 +33,6 @@ import java.nio.file.Paths;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class MinifiedArscTest extends BaseTest { public class MinifiedArscTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -33,9 +33,6 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class MissingVersionManifestTest extends BaseTest { public class MissingVersionManifestTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -31,9 +31,6 @@ import java.io.File;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class OutsideOfDirectoryEntryTest extends BaseTest { public class OutsideOfDirectoryEntryTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -22,9 +22,6 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class PositionalEnumerationTest extends BaseTest { public class PositionalEnumerationTest extends BaseTest {
@Test @Test

View File

@ -35,9 +35,6 @@ import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class UnknownDirectoryTraversalTest extends BaseTest { public class UnknownDirectoryTraversalTest extends BaseTest {
@BeforeClass @BeforeClass

View File

@ -16,9 +16,6 @@
*/ */
package brut.common; package brut.common;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class BrutException extends Exception { public class BrutException extends Exception {
public BrutException(Throwable cause) { public BrutException(Throwable cause) {
super(cause); super(cause);

View File

@ -25,9 +25,6 @@ import brut.util.OS;
import java.io.*; import java.io.*;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class DirUtil { public class DirUtil {
private static final Logger LOGGER = Logger.getLogger(""); private static final Logger LOGGER = Logger.getLogger("");

View File

@ -20,9 +20,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ExtFile extends File { public class ExtFile extends File {
public ExtFile(File file) { public ExtFile(File file) {
super(file.getPath()); super(file.getPath());

View File

@ -16,21 +16,18 @@
*/ */
package brut.util; package brut.util;
import java.io.*;
import java.util.zip.CRC32;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import brut.common.BrutException; import brut.common.BrutException;
import brut.common.InvalidUnknownFileException; import brut.common.InvalidUnknownFileException;
import brut.common.RootUnknownFileException; import brut.common.RootUnknownFileException;
import brut.common.TraversalUnknownFileException; import brut.common.TraversalUnknownFileException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
/** import java.io.*;
* @author Ryszard Wiśniewski <brut.alll@gmail.com> import java.util.zip.CRC32;
*/ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
public class BrutIO { public class BrutIO {
public static void copyAndClose(InputStream in, OutputStream out) public static void copyAndClose(InputStream in, OutputStream out)
throws IOException { throws IOException {

View File

@ -19,9 +19,6 @@ package brut.util;
import java.io.DataInput; import java.io.DataInput;
import java.io.IOException; import java.io.IOException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
abstract public class DataInputDelegate implements DataInput { abstract public class DataInputDelegate implements DataInput {
protected final DataInput mDelegate; protected final DataInput mDelegate;

View File

@ -16,9 +16,6 @@
*/ */
package brut.util; package brut.util;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class Duo<T1, T2> { public class Duo<T1, T2> {
public final T1 m1; public final T1 m1;
public final T2 m2; public final T2 m2;

View File

@ -18,9 +18,6 @@ package brut.util;
import java.io.*; import java.io.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ExtDataInput extends DataInputDelegate { public class ExtDataInput extends DataInputDelegate {
public ExtDataInput(InputStream in) { public ExtDataInput(InputStream in) {
this((DataInput) new DataInputStream(in)); this((DataInput) new DataInputStream(in));

View File

@ -16,25 +16,16 @@
*/ */
package brut.util; package brut.util;
import brut.common.BrutException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import java.io.File; import java.io.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import brut.common.BrutException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
abstract public class Jar { abstract public class Jar {
private final static Set<String> mLoaded = new HashSet<String>(); private final static Set<String> mLoaded = new HashSet<String>();
private final static Map<String, File> mExtracted = new HashMap<String, File>(); private final static Map<String, File> mExtracted = new HashMap<String, File>();

View File

@ -17,6 +17,8 @@
package brut.util; package brut.util;
import brut.common.BrutException; import brut.common.BrutException;
import org.apache.commons.io.IOUtils;
import java.io.*; import java.io.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -24,11 +26,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.apache.commons.io.IOUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class OS { public class OS {
private static final Logger LOGGER = Logger.getLogger(""); private static final Logger LOGGER = Logger.getLogger("");

View File

@ -31,8 +31,8 @@ plugins {
apply from: 'gradle/functions.gradle' apply from: 'gradle/functions.gradle'
def apktoolversion_major = '2.5.1' version = '2.5.1'
def apktoolversion_minor = 'SNAPSHOT' def suffix = 'SNAPSHOT'
defaultTasks 'build', 'shadowJar', 'proguard' defaultTasks 'build', 'shadowJar', 'proguard'
@ -68,25 +68,28 @@ allprojects {
gradle.startParameter.excludedTaskNames += "licenseTest" gradle.startParameter.excludedTaskNames += "licenseTest"
} }
def mavenVersion = 'unspecified'
if (!('release' in gradle.startParameter.taskNames)) { if (!('release' in gradle.startParameter.taskNames)) {
def hash = getCheckedOutGitCommitHash() def hash = getCheckedOutGitCommitHash()
if (hash == null) { if (hash == null) {
project.ext.set("hash", "dirty") project.ext.set("hash", "dirty")
project.ext.set("apktool_version", apktoolversion_major + "-dirty") project.ext.set("apktool_version", version + "-dirty")
println "Building SNAPSHOT (no .git folder found)" println "Building SNAPSHOT (no .git folder found)"
} else { } else {
project.ext.set("hash", hash) project.ext.set("hash", hash)
project.ext.set("apktool_version", apktoolversion_major + "-" + hash + "-SNAPSHOT") project.ext.set("apktool_version", version + "-" + hash + "-SNAPSHOT")
mavenVersion = version + "-SNAPSHOT"
println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash println "Building SNAPSHOT (" + getCheckedOutBranch() + "): " + hash
} }
} else { } else {
project.ext.set("hash", "") project.ext.set("hash", "")
if (apktoolversion_minor.length() > 0) { if (suffix.length() > 0) {
project.ext.set("apktool_version", apktoolversion_major + "-" + apktoolversion_minor) project.ext.set("apktool_version", version + "-" + suffix)
} else { } else {
project.ext.set("apktool_version", apktoolversion_major) project.ext.set("apktool_version", version)
} }
mavenVersion = version
println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version
} }
@ -107,22 +110,26 @@ build.doFirst {
task release { task release {
} }
// used for publishing snapshot builds to maven.
task snapshot {
}
subprojects { subprojects {
apply plugin: 'java' apply plugin: 'java'
ext { ext {
depends = [ depends = [
baksmali: 'org.smali:baksmali:2.5.2', baksmali: 'org.smali:baksmali:2.5.2',
commons_cli: 'commons-cli:commons-cli:1.4', commons_cli: 'commons-cli:commons-cli:1.4',
commons_io: 'commons-io:commons-io:2.4', commons_io: 'commons-io:commons-io:2.4',
commons_lang: 'org.apache.commons:commons-lang3:3.1', commons_lang: 'org.apache.commons:commons-lang3:3.1',
guava: 'com.google.guava:guava:14.0', guava: 'com.google.guava:guava:14.0',
junit: 'junit:junit:4.12', junit: 'junit:junit:4.12',
proguard_gradle: 'com.guardsquare:proguard-gradle:7.0.0', proguard_gradle: 'com.guardsquare:proguard-gradle:7.0.0',
snakeyaml: 'org.yaml:snakeyaml:1.18:android', snakeyaml: 'org.yaml:snakeyaml:1.18:android',
smali: 'org.smali:smali:2.5.2', smali: 'org.smali:smali:2.5.2',
xmlpull: 'xpp3:xpp3:1.1.4c', xmlpull: 'xpp3:xpp3:1.1.4c',
xmlunit: 'xmlunit:xmlunit:1.6', xmlunit: 'xmlunit:xmlunit:1.6',
] ]
} }
@ -135,4 +142,81 @@ subprojects {
exceptionFormat = 'full' exceptionFormat = 'full'
} }
} }
def mavenProjects = ['apktool-lib', 'brut.j.common', 'brut.j.util', 'brut.j.dir']
if (project.name in mavenProjects) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
publishing {
publications {
maven(MavenPublication) {
from project.components.java
groupId = 'org.apktool'
artifactId = project.name
version = mavenVersion
pom {
name = 'Apktool'
description = 'A tool for reverse engineering Android apk files.'
url = 'https://apktool.org'
licenses {
license {
name = 'The Apache License 2.0'
url = 'https://opensource.org/licenses/Apache-2.0'
}
}
developers {
developer {
id = 'iBotPeaches'
name = 'Connor Tumbleson'
email = 'connor.tumbleson@gmail.com'
}
developer {
id = 'brutall'
name = 'Ryszard Wiśniewski'
email = 'brut.alll@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/iBotPeaches/Apktool.git'
developerConnection = 'scm:git:git@github.com:iBotPeaches/Apktool.git'
url = 'https://github.com/iBotPeaches/Apktool'
}
}
}
}
if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) {
repositories {
maven {
if (mavenVersion.endsWith('-SNAPSHOT')) {
url = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
} else {
url = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
}
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
}
signing {
required { gradle.taskGraph.hasTask('publish') }
sign(publishing.publications["maven"])
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.getByPath(':release').dependsOn(publish);
tasks.getByPath(':snapshot').dependsOn(publish);
}
} }