Skip to content

Commit

Permalink
Replace dx.jar with its sources
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita36078 committed Feb 23, 2018
1 parent a38db25 commit 70d940c
Show file tree
Hide file tree
Showing 391 changed files with 82,998 additions and 210 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "ru.playsoftware.j2meloader"
minSdkVersion 14
targetSdkVersion 27
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 27
versionName "1.2.7.5"
setProperty("archivesBaseName", "J2ME_Loader-$versionName")
Expand Down Expand Up @@ -63,5 +63,5 @@ dependencies {
implementation 'com.github.yukuku:ambilwarna:2.0.1'
implementation 'org.ow2.asm:asm-tree:5.2'
implementation 'org.sufficientlysecure:donations:2.5'
implementation fileTree(include: ['*.jar', '*.so'], dir: 'libs')
implementation project(':dexlib')
}
197 changes: 0 additions & 197 deletions app/libs/NOTICE.txt

This file was deleted.

Binary file removed app/libs/dx.jar
Binary file not shown.
Expand Up @@ -22,14 +22,11 @@
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;

import com.android.dx.command.Main;

import com.android.dx.command.dexer.Main;
import org.acra.ACRA;
import org.microemu.android.asm.AndroidProducer;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.zip.ZipException;

Expand Down Expand Up @@ -81,6 +78,7 @@ protected Boolean doInBackground(String... p1) {
try {
ZipUtils.unzip(fixedJar, dirTmp);
} catch (IOException e) {
e.printStackTrace();
err = "Brocken jar";
deleteTemp();
return false;
Expand All @@ -97,9 +95,16 @@ protected Boolean doInBackground(String... p1) {
FileUtils.deleteDirectory(appConverted);
appConverted.mkdirs();
Log.d(TAG, "appConverted=" + appConverted.getPath());
Main.main(new String[]{
"--dex", "--no-optimize", "--output=" + appConverted.getPath()
+ ConfigActivity.MIDLET_DEX_FILE, fixedJar.getAbsolutePath()});
try {
Main.main(new String[]{
"--no-optimize", "--output=" + appConverted.getPath()
+ ConfigActivity.MIDLET_DEX_FILE, fixedJar.getAbsolutePath()});
} catch (IOException e) {
e.printStackTrace();
err = "Can't convert";
deleteTemp();
return false;
}
File conf = new File(dirTmp, "/META-INF/MANIFEST.MF");
try {
FileUtils.copyFileUsingChannel(conf, new File(appConverted, ConfigActivity.MIDLET_CONF_FILE));
Expand Down
8 changes: 8 additions & 0 deletions build.gradle
Expand Up @@ -16,4 +16,12 @@ allprojects {
jcenter()
google()
}
}

ext {
buildToolsVersion = '27.0.3'
compileSdkVersion = 27

minSdkVersion = 14
targetSdkVersion = 27
}
25 changes: 25 additions & 0 deletions dexlib/build.gradle
@@ -0,0 +1,25 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.13"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
21 changes: 21 additions & 0 deletions dexlib/proguard-rules.pro
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
1 change: 1 addition & 0 deletions dexlib/src/main/AndroidManifest.xml
@@ -0,0 +1 @@
<manifest package="com.android.dx" />
63 changes: 63 additions & 0 deletions dexlib/src/main/java/com/android/dex/Annotation.java
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.android.dex;

import static com.android.dex.EncodedValueReader.ENCODED_ANNOTATION;

/**
* An annotation.
*/
public final class Annotation implements Comparable<Annotation> {
private final Dex dex;
private final byte visibility;
private final EncodedValue encodedAnnotation;

public Annotation(Dex dex, byte visibility, EncodedValue encodedAnnotation) {
this.dex = dex;
this.visibility = visibility;
this.encodedAnnotation = encodedAnnotation;
}

public byte getVisibility() {
return visibility;
}

public EncodedValueReader getReader() {
return new EncodedValueReader(encodedAnnotation, ENCODED_ANNOTATION);
}

public int getTypeIndex() {
EncodedValueReader reader = getReader();
reader.readAnnotation();
return reader.getAnnotationType();
}

public void writeTo(Dex.Section out) {
out.writeByte(visibility);
encodedAnnotation.writeTo(out);
}

@Override public int compareTo(Annotation other) {
return encodedAnnotation.compareTo(other.encodedAnnotation);
}

@Override public String toString() {
return dex == null
? visibility + " " + getTypeIndex()
: visibility + " " + dex.typeNames().get(getTypeIndex());
}
}

0 comments on commit 70d940c

Please sign in to comment.