Skip to content

Commit

Permalink
[smali] update to 2.0 final
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Oct 11, 2013
1 parent 5fa3c2d commit 03fc77c
Show file tree
Hide file tree
Showing 168 changed files with 69 additions and 28,897 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ private Set<String> writeDirectMethods(IndentingWriter writer) throws IOExceptio

MethodImplementation methodImpl = method.getImplementation();
if (methodImpl == null) {
MethodDefinition.writeEmptyMethodTo(methodWriter, method);
MethodDefinition.writeEmptyMethodTo(methodWriter, method, options);
} else {
MethodDefinition methodDefinition = new MethodDefinition(this, method, methodImpl);
methodDefinition.writeTo(methodWriter);
Expand Down Expand Up @@ -308,7 +308,7 @@ private void writeVirtualMethods(IndentingWriter writer, Set<String> directMetho

MethodImplementation methodImpl = method.getImplementation();
if (methodImpl == null) {
MethodDefinition.writeEmptyMethodTo(methodWriter, method);
MethodDefinition.writeEmptyMethodTo(methodWriter, method, options);
} else {
MethodDefinition methodDefinition = new MethodDefinition(this, method, methodImpl);
methodDefinition.writeTo(methodWriter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.google.common.collect.ImmutableList;
import org.jf.baksmali.Adaptors.Debug.DebugMethodItem;
import org.jf.baksmali.Adaptors.Format.InstructionMethodItemFactory;
import org.jf.baksmali.baksmaliOptions;
import org.jf.dexlib2.AccessFlags;
import org.jf.dexlib2.Format;
import org.jf.dexlib2.Opcode;
Expand Down Expand Up @@ -113,7 +114,8 @@ public MethodDefinition(@Nonnull ClassDefinition classDef, @Nonnull Method metho
}
}

public static void writeEmptyMethodTo(IndentingWriter writer, Method method) throws IOException {
public static void writeEmptyMethodTo(IndentingWriter writer, Method method,
baksmaliOptions options) throws IOException {
writer.write(".method ");
writeAccessFlags(writer, method.getAccessFlags());
writer.write(method.getName());
Expand All @@ -127,7 +129,7 @@ public static void writeEmptyMethodTo(IndentingWriter writer, Method method) thr
writer.write('\n');

writer.indent(4);
writeParameters(writer, method, methodParameters);
writeParameters(writer, method, methodParameters, options);
AnnotationFormatter.writeTo(writer, method.getAnnotations());
writer.deindent(4);
writer.write(".end method\n");
Expand Down Expand Up @@ -164,7 +166,7 @@ public void writeTo(IndentingWriter writer) throws IOException {
writer.printSignedIntAsDec(methodImpl.getRegisterCount());
}
writer.write('\n');
writeParameters(writer, method, methodParameters);
writeParameters(writer, method, methodParameters, classDef.options);

if (registerFormatter == null) {
registerFormatter = new RegisterFormatter(classDef.options, methodImpl.getRegisterCount(),
Expand Down Expand Up @@ -218,7 +220,8 @@ private static void writeAccessFlags(IndentingWriter writer, int accessFlags)
}

private static void writeParameters(IndentingWriter writer, Method method,
List<? extends MethodParameter> parameters) throws IOException {
List<? extends MethodParameter> parameters,
baksmaliOptions options) throws IOException {
boolean isStatic = AccessFlags.STATIC.isSet(method.getAccessFlags());
int registerNumber = isStatic?0:1;
for (MethodParameter parameter: parameters) {
Expand All @@ -229,7 +232,7 @@ private static void writeParameters(IndentingWriter writer, Method method,
writer.write(".param p");
writer.printSignedIntAsDec(registerNumber);

if (parameterName != null) {
if (parameterName != null && options.outputDebugInfo) {
writer.write(", ");
ReferenceFormatter.writeStringReference(writer, parameterName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static void main(String[] args) throws IOException {
options.addCodeOffsets = true;
break;
case 'r':
String[] values = commandLine.getOptionValues("r");
String[] values = commandLine.getOptionValues('r');
int registerInfo = 0;

if (values == null || values.length == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void runTest(String test, boolean registerInfo) throws IOException, URISy
className.substring(1, className.length() - 1));
String smaliContents = readResource(smaliPath);

Assert.assertEquals(smaliContents, stringWriter.toString().replace("\r\n", "\n"));
Assert.assertEquals(smaliContents.replace("\r\n", "\n"), stringWriter.toString().replace("\r\n", "\n"));
}
}

Expand Down
6 changes: 5 additions & 1 deletion brut.apktool.smali/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

apply plugin: 'idea'

version = '2.0b5'
version = '2.0'

def jarVersion = version

Expand Down Expand Up @@ -98,4 +98,8 @@ buildscript {
dependencies {
classpath 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r'
}
}

task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
36 changes: 0 additions & 36 deletions brut.apktool.smali/dexlib/build.gradle

This file was deleted.

Loading

0 comments on commit 03fc77c

Please sign in to comment.