com.faker.android.DexPakerTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle Show documentation
Show all versions of gradle Show documentation
fakeradnroid gradle builder
package com.faker.android;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class DexPakerTask extends DefaultTask {
private File javaSrc;
private File smalis;
private File apktoolYaml;
private File dexBuildTmpDir;
private File target;
private String applicationId;
private File outApk;
public File getOutApk() {
return outApk;
}
public void setOutApk(File outApk) {
this.outApk = outApk;
}
public String getApplicationId() {
return applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public File getJavaSrc() {
return javaSrc;
}
public void setJavaSrc(File javaSrc) {
this.javaSrc = javaSrc;
}
@InputDirectory
public File getSmalis() {
return smalis;
}
public void setSmalis(File smalis) {
this.smalis = smalis;
}
public File getApktoolYaml() {
return apktoolYaml;
}
public void setApktoolYaml(File apktoolYaml) {
this.apktoolYaml = apktoolYaml;
}
@OutputDirectory
public File getDexBuildTmpDir() {
return dexBuildTmpDir;
}
public void setDexBuildTmpDir(File dexBuildTmpDir) {
this.dexBuildTmpDir = dexBuildTmpDir;
}
@OutputFile
public File getTarget() {
return target;
}
public void setTarget(File target) {
this.target = target;
}
@TaskAction
public void writeObject() {
if(outApk.exists()){
System.out.println("im exist now");
}else {
System.out.println("im not exist now");
}
if(!dexBuildTmpDir.exists()){
dexBuildTmpDir.mkdirs();
}
try {
System.out.println("assemble samli files to dex pack...");
TargetDexPacker.packDex(smalis,dexBuildTmpDir,javaSrc,apktoolYaml,applicationId,target);
} catch (Exception e) {
e.printStackTrace();
}
}
}