Skip to content

Commit

Permalink
remove common io dependencies, it cause crash because using new api
Browse files Browse the repository at this point in the history
  • Loading branch information
tranleduy2000 committed Jun 15, 2018
1 parent 5b5ad96 commit b7aea3e
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 789 deletions.
9 changes: 6 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled true
versionCode 44
versionName "1.4.4"
versionCode 45
versionName "1.4.5"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -113,7 +113,10 @@ dependencies {
api 'com.yqritc:recyclerview-flexibledivider:1.2.9'
api 'com.sothree.slidinguppanel:library:3.4.0'
//noinspection GradleDependency newer version cause crash
// api 'commons-io:commons-io:2.2'
api ('commons-io:commons-io:2.3'){
transitive = true
}

api 'com.simplecityapps:recyclerview-fastscroll:1.0.18'
api 'org.apache.commons:commons-lang3:3.7'
api 'com.google.guava:guava:25.1-android'
Expand Down
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":43,"versionName":"1.4.3","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":45,"versionName":"1.4.5","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
import com.duy.android.compiler.library.LibraryCache;
import com.duy.android.compiler.project.AndroidAppProject;
import com.duy.android.compiler.project.AndroidProjectManager;
import com.duy.android.compiler.repo.maven.ArtifactDownloader;
import com.duy.android.compiler.repo.maven.MojoExecutionException;
import com.duy.android.compiler.repo.maven.MojoFailureException;
import com.duy.common.io.IOUtils;

import org.apache.commons.io.IOUtils;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.project.MavenProject;
Expand Down Expand Up @@ -90,7 +87,7 @@ public void testReadPom() throws IOException {
}

@Test
public void testDownload() throws IOException, MojoFailureException, MojoExecutionException {
public void testDownload() throws IOException {
Context context = InstrumentationRegistry.getTargetContext();

File pomFile = new File(Environment.getSdkAppDir(), "appcompat-v7-27.1.1.pom");
Expand All @@ -109,8 +106,5 @@ public void testDownload() throws IOException, MojoFailureException, MojoExecuti
}
MavenProject mavenProject = new MavenProject(model);
System.out.println("mavenProject = " + mavenProject);

ArtifactDownloader artifactDownloader = new ArtifactDownloader(context, mavenProject);
artifactDownloader.execute();
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/duy/common/purchase/Premium.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class Premium {
* @param context - Android context
*/
public static boolean isPremiumUser(Context context) {
return IS_PREMIUM || PremiumFileUtil.licenseCached(context) || true;
return IS_PREMIUM || PremiumFileUtil.licenseCached(context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;


import org.apache.commons.io.IOUtils;
import com.duy.common.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/duy/ide/javaide/JavaIdeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.duy.android.compiler.project.JavaProjectManager;
import com.duy.android.compiler.utils.ProjectUtils;
import com.duy.common.purchase.InAppPurchaseHelper;
import com.duy.common.purchase.Premium;
import com.duy.ide.R;
import com.duy.ide.code.api.CodeFormatProvider;
import com.duy.ide.code.api.SuggestionProvider;
Expand Down Expand Up @@ -171,6 +172,9 @@ public boolean onCreateOptionsMenu(Menu container) {
@Override
protected void onCreateNavigationMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_nav_javaide, menu);
if (Premium.isPremiumUser(this)) {
menu.findItem(R.id.action_premium).setVisible(false);
}
super.onCreateNavigationMenu(menu);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.duy.android.compiler.project.JavaProject;
import com.duy.common.data.Pair;
import com.duy.common.interfaces.Filter;
import com.duy.common.io.IOUtils;
import com.duy.ide.javaide.editor.autocomplete.model.ClassDescription;
import com.duy.ide.javaide.utils.DLog;
import com.sun.tools.javac.tree.JCTree;
Expand Down Expand Up @@ -106,7 +107,7 @@ public void loadFromProject(JavaProject project) {
true);
for (File javaFile : javaFiles) {
if (DLog.DEBUG) DLog.d(TAG, "loadFromProject: parsing class " + javaFile);
String content = com.duy.android.compiler.utils.IOUtils.toString(javaFile);
String content = IOUtils.toString(javaFile);
JCTree.JCCompilationUnit ast = parser.parse(content);
List<IClass> parseClasses = parser.parseClasses(ast);
for (IClass aClass : parseClasses) {
Expand Down
4 changes: 1 addition & 3 deletions lib-android-compiler/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ android {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/plexus/components.xml'
exclude 'META-INF/INDEX.LIST'
}
}
Expand All @@ -54,9 +53,8 @@ dependencies {

api 'com.google.guava:guava:25.1-android'
//noinspection GradleDependency newer version cause crash
//api 'commons-io:commons-io:2.2'
api 'commons-io:commons-io:2.3'
api 'commons-codec:commons-codec:1.10'
api 'org.apache.maven:maven-project:2.2.1'
api 'org.codehaus.plexus:plexus-archiver:3.6.0'
api 'com.google.code.gson:gson:2.8.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.content.res.AssetManager;
import android.util.Log;

import org.apache.commons.io.IOUtils;
import com.duy.common.io.IOUtils;

import java.io.File;
import java.io.FileOutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void writeToLibraryFile() throws JSONException, IOException {
array.put(item);
}
String str = jsonObject.toString(1);
org.apache.commons.io.IOUtils.write(str, new FileOutputStream(file), "UTF-8");
IOUtils.write(str, new FileOutputStream(file), "UTF-8");
}

public String getPackageForR() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,15 @@ private void copyAssets(String assetsPath, File outFile) throws IOException {
outFile.getParentFile().mkdirs();
FileOutputStream output = new FileOutputStream(outFile);
InputStream input = context.getAssets().open(assetsPath);
org.apache.commons.io.IOUtils.copy(input, output);
IOUtils.copy(input, output);
input.close();
output.close();
}

private void saveFile(File file, String content) throws IOException {
file.getParentFile().mkdirs();
FileOutputStream output = new FileOutputStream(file);
org.apache.commons.io.IOUtils.write(content, output);
IOUtils.write(content, output);
output.close();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.duy.android.compiler.project;

import com.duy.common.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
import java.util.regex.Pattern;
Expand All @@ -24,7 +26,7 @@ public class ClassUtil {
*/
public static boolean hasMainFunction(File file) {
try {
String s = org.apache.commons.io.IOUtils.toString(new FileInputStream(file));
String s = IOUtils.toString(new FileInputStream(file));
return hasMainFunction(s);
} catch (Exception e) {
e.printStackTrace();
Expand Down
Loading

0 comments on commit b7aea3e

Please sign in to comment.