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/
bin/
gradle.properties
# 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"
### 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.
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)
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

View File

@ -30,10 +30,6 @@ import java.io.File;
import java.io.IOException;
import java.util.logging.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class Main {
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");
* you may not use this file except in compliance with the License.
@ -15,10 +15,6 @@
*/
package android.util;
/**
* @author Dmitry Skiba
*
*/
public interface AttributeSet {
int getAttributeCount();

View File

@ -17,7 +17,7 @@ package android.util;
/**
* 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 {
/** 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:
* {@link DisplayMetrics#DENSITY_DEFAULT}.
*/
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.
*/
public static final int DENSITY_NONE = 0xffff;
@ -243,13 +242,11 @@ public class TypedValue {
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.
*
* @param type
* The data type identifier.
* @param data
* The data value.
* @param type The data type identifier.
* @param data The data value.
*
* @return String The coerced string value. If the value is null or the type
* 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.FilenameUtils;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class Androlib {
private final AndrolibResources mAndRes = new AndrolibResources();
protected final ResUnknownFiles mResUnknownFiles = new ResUnknownFiles();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,19 +16,20 @@
*/
package brut.androlib.mod;
import java.io.*;
import java.nio.charset.StandardCharsets;
import org.antlr.runtime.*;
import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.CommonTreeNodeStream;
import org.apache.commons.io.IOUtils;
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 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.ZipOutputStream;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
final public class AndrolibResources {
public ResTable getResTable(ExtFile apkFile) throws AndrolibException {
return getResTable(apkFile, true);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,9 +20,6 @@ import brut.androlib.AndrolibException;
import brut.androlib.err.UndefinedResObjectException;
import java.util.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResType {
private final ResConfigFlags mFlags;
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 java.util.*;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public final class ResTypeSpec {
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.Map;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class ResUnknownFiles {
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.Set;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResValuesFile {
private final ResPackage mPackage;
private final ResTypeSpec mType;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data.value;
import android.util.TypedValue;
import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResDimenValue extends ResIntValue {
public ResDimenValue(int value, String rawValue) {
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.ResResource;
import brut.util.Duo;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResEnumAttr extends ResAttr {
ResEnumAttr(ResReferenceValue parent, int type, Integer min, Integer max,
Boolean l10n, Duo<ResReferenceValue, ResIntValue>[] items) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,9 +19,6 @@ package brut.androlib.res.data.value;
import android.util.TypedValue;
import brut.androlib.AndrolibException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResIntValue extends ResScalarValue {
protected final int mValue;
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.ResXmlEncoders;
import brut.util.Duo;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
import java.io.IOException;
public class ResPluralsValue extends ResBagValue implements
ResValuesXmlSerializable {
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.ResResSpec;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResReferenceValue extends ResIntValue {
private final ResPackage mPackage;
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.ResXmlEncodable;
import brut.androlib.res.xml.ResXmlEncoders;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
import java.io.IOException;
public abstract class ResScalarValue extends ResIntBasedValue implements
ResXmlEncodable, ResValuesXmlSerializable {
protected final String mType;

View File

@ -19,14 +19,11 @@ package brut.androlib.res.data.value;
import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResResource;
import brut.androlib.res.xml.ResXmlEncoders;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.util.regex.Pattern;
import org.xmlpull.v1.XmlSerializer;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResStringValue extends ResScalarValue {
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.xml.ResValuesXmlSerializable;
import brut.util.Duo;
import java.io.IOException;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.util.logging.Logger;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResStyleValue extends ResBagValue implements
ResValuesXmlSerializable {
ResStyleValue(ResReferenceValue parent,

View File

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

View File

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

View File

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

View File

@ -23,18 +23,15 @@ import brut.androlib.res.data.ResID;
import brut.androlib.res.xml.ResXmlEncoders;
import brut.util.ExtDataInput;
import com.google.common.io.LittleEndianDataInputStream;
import org.xmlpull.v1.XmlPullParserException;
import java.io.DataInput;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xmlpull.v1.XmlPullParserException;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
* @author Dmitry Skiba
*
* Binary xml files parser.
*
* Parser has only two states: (1) Operational state, which parser
@ -44,7 +41,6 @@ import org.xmlpull.v1.XmlPullParserException;
* this state methods return invalid values or throw exceptions.
*
* TODO: * check all methods in closed state
*
*/
public class AXmlResourceParser implements XmlResourceParser {

View File

@ -19,17 +19,14 @@ package brut.androlib.res.decoder;
import brut.androlib.AndrolibException;
import brut.androlib.err.CantFind9PatchChunkException;
import brut.util.ExtDataInput;
import org.apache.commons.io.IOUtils;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
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 {
@Override
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.ResScalarValue;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResAttrDecoder {
public String decode(int type, int value, String rawValue, int attrResId)
throws AndrolibException {

View File

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

View File

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

View File

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

View File

@ -22,9 +22,6 @@ import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class ResStreamDecoderContainer {
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.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 {
/**
* Reads whole (including chunk type) string block from stream. Stream must
* be at the chunk type.
* @param reader ExtDataInput
* @return StringBlock
*
* @throws IOException Parsing resources.arsc error
*/
public static StringBlock read(ExtDataInput reader) throws IOException {
reader.skipCheckChunkTypeInt(CHUNK_STRINGPOOL_TYPE, CHUNK_NULL_TYPE);
@ -81,6 +76,7 @@ public class StringBlock {
/**
* Returns number of strings in block.
* @return int
*/
public int getCount() {
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.
* @param index int
* @return String
*/
public String getString(int index) {
if (index < 0 || m_stringOffsets == null || index >= m_stringOffsets.length) {
@ -108,17 +106,10 @@ public class StringBlock {
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).
* @param index int
* @return String
*/
public String getHTML(int 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.
*
* @param string String to index location of
* @return int (Returns -1 if not found)
*/
public int find(String string) {
if (string == null) {

View File

@ -16,12 +16,11 @@
*/
package brut.androlib.res.decoder;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import brut.androlib.AndrolibException;
import brut.androlib.err.AXmlDecodingException;
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.XmlPullParserException;
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.classic.StaticXmlSerializerWrapper;
import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResTable;
import brut.androlib.res.util.ExtXmlSerializer;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
*/
public class XmlPullStreamDecoder implements ResStreamDecoder {
public XmlPullStreamDecoder(XmlPullParser parser,
ExtXmlSerializer serializer) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,10 +16,12 @@
*/
package brut.androlib.res.xml;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Logger;
import brut.androlib.AndrolibException;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -29,27 +31,19 @@ import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
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 {
/**
* Removes "debug" tag from file
*
* @param file AndroidManifest file
* @throws AndrolibException
* @throws AndrolibException Error reading Manifest file
*/
public static void removeApplicationDebugTag(File file) throws AndrolibException {
if (file.exists()) {
@ -77,9 +71,8 @@ public final class ResXmlPatcher {
* Sets "debug" tag in the file to true
*
* @param file AndroidManifest file
* @throws AndrolibException
*/
public static void setApplicationDebugTagTrue(File file) throws AndrolibException {
public static void setApplicationDebugTagTrue(File file) {
if (file.exists()) {
try {
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
* 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
* res/values/strings.xml file.
*
* @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;
if (file.exists()) {
try {
@ -177,9 +169,8 @@ public final class ResXmlPatcher {
* @param saved boolean on whether we need to save
* @param provider Node we are attempting to replace
* @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 replacement = pullValueFromStrings(file.getParentFile(), reference);
@ -196,9 +187,8 @@ public final class ResXmlPatcher {
* @param directory Root directory of apk
* @param key String reference (ie @string/foo)
* @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("@")) {
return null;
}
@ -231,9 +221,8 @@ public final class ResXmlPatcher {
* @param directory Root directory of apk
* @param key Integer reference (ie @integer/foo)
* @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("@")) {
return null;
}
@ -264,9 +253,8 @@ public final class ResXmlPatcher {
* Removes attributes like "versionCode" and "versionName" from file.
*
* @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()) {
try {
Document doc = loadDocument(file);
@ -293,9 +281,8 @@ public final class ResXmlPatcher {
*
* @param file File for AndroidManifest.xml
* @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 {
Document doc = loadDocument(file);

View File

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

View File

@ -16,13 +16,13 @@
*/
package org.xmlpull.renamed;
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.xmlpull.v1.XmlSerializer;
/**
* Implementation of XmlSerializer interface from XmlPull V1 API. This
* 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) {
if (s == null) {
return "null";

View File

@ -18,7 +18,16 @@ package brut.androlib;
import brut.androlib.res.AndrolibResources;
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.net.URL;
import java.net.URLDecoder;
@ -26,14 +35,6 @@ import java.nio.file.Files;
import java.util.HashMap;
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 static Map<String, String> parseStringsXml(File file)

View File

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

View File

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

View File

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

View File

@ -21,25 +21,23 @@ 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 java.awt.image.BufferedImage;
import java.io.*;
import java.util.Map;
import brut.util.OSDetection;
import org.junit.*;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
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 {
@BeforeClass

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -20,22 +20,20 @@ import brut.androlib.*;
import brut.common.BrutException;
import brut.directory.ExtFile;
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.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
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.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebuggableFalseChangeToTrueTest extends BaseTest {
@BeforeClass

View File

@ -20,22 +20,20 @@ import brut.androlib.*;
import brut.common.BrutException;
import brut.directory.ExtFile;
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.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
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.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebuggableTrueAddedTest extends BaseTest {
@BeforeClass

View File

@ -20,22 +20,20 @@ import brut.androlib.*;
import brut.common.BrutException;
import brut.directory.ExtFile;
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.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
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.junit.Assert.assertTrue;
/**
* @author Connor Tumbleson <connor.tumbleson@gmail.com>
*/
public class DebuggableTrueRetainedTest extends BaseTest {
@BeforeClass

View File

@ -16,6 +16,11 @@
*/
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.BeforeClass;
import org.junit.Test;
@ -25,21 +30,8 @@ import java.io.IOException;
import java.nio.file.Files;
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;
/**
* @author Adib Faramarzi <adibfara@gmail.com>
*/
public class DecodeKotlinCoroutinesTest extends BaseTest {
private static String apk = "test-kotlin-coroutines.apk";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,8 +31,8 @@ plugins {
apply from: 'gradle/functions.gradle'
def apktoolversion_major = '2.5.1'
def apktoolversion_minor = 'SNAPSHOT'
version = '2.5.1'
def suffix = 'SNAPSHOT'
defaultTasks 'build', 'shadowJar', 'proguard'
@ -68,25 +68,28 @@ allprojects {
gradle.startParameter.excludedTaskNames += "licenseTest"
}
def mavenVersion = 'unspecified'
if (!('release' in gradle.startParameter.taskNames)) {
def hash = getCheckedOutGitCommitHash()
if (hash == null) {
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)"
} else {
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
}
} else {
project.ext.set("hash", "")
if (apktoolversion_minor.length() > 0) {
project.ext.set("apktool_version", apktoolversion_major + "-" + apktoolversion_minor)
if (suffix.length() > 0) {
project.ext.set("apktool_version", version + "-" + suffix)
} else {
project.ext.set("apktool_version", apktoolversion_major)
project.ext.set("apktool_version", version)
}
mavenVersion = version
println "Building RELEASE (" + getCheckedOutBranch() + "): " + project.ext.apktool_version
}
@ -107,6 +110,10 @@ build.doFirst {
task release {
}
// used for publishing snapshot builds to maven.
task snapshot {
}
subprojects {
apply plugin: 'java'
@ -135,4 +142,81 @@ subprojects {
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);
}
}