update
This commit is contained in:
parent
d24ba2e3e4
commit
bddb4d1243
@ -146,6 +146,8 @@ public class AppMain extends JFrame {
|
||||
new File(path).renameTo(new File(savePath));
|
||||
}
|
||||
});
|
||||
}else if(model.equals("sdk")){
|
||||
new AutoPackageSDK(path -> new File(path).renameTo(new File(savePath)), version, packageName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public class AutoPackageSDK {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
System.out.println("准备打包");
|
||||
File gdtPath = new File("input" + File.separator + "gdtSDK" + File.separator);
|
||||
File unplayPath = new File("input" + File.separator + "uniplaySDK" + File.separator);
|
||||
File qysdkPath = new File("input" + File.separator + "qySDK" + File.separator);
|
||||
@ -102,10 +103,11 @@ public class AutoPackageSDK {
|
||||
sdk.mkdirs();
|
||||
}
|
||||
|
||||
|
||||
System.out.println("复制资源文件");
|
||||
outAssetsQY(0, "0");
|
||||
outAssetsQY(1, "4");
|
||||
outRes();
|
||||
System.out.println("开始打包");
|
||||
new AutoRandomAdSDK(array, new SmaliApkToolsPath() {
|
||||
@Override
|
||||
public void smaliPath(String path) {
|
||||
|
@ -53,15 +53,18 @@ public class AutoPackageSDKMust {
|
||||
Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "settings.gradle", sdk_src.getAbsolutePath() + File.separator, true);
|
||||
Tools.copyFile(sdkPath.getAbsolutePath() + File.separator + "local.properties", sdk_src.getAbsolutePath() + File.separator, true);
|
||||
try {
|
||||
Runtime.getRuntime().exec("chmod 777 "+sdk_src.getAbsolutePath() + File.separator+"gradlew");
|
||||
BufferedReader reader;
|
||||
Process process = Runtime.getRuntime().exec("xcopy " + sdkPath.getAbsolutePath() + File.separator + "gradle " + sdk_src.getAbsolutePath() + File.separator + "gradle /E /I /Y");
|
||||
Tools.copy_dir(sdkPath.getAbsolutePath()+File.separator+"gradle",sdk_src.getAbsolutePath()+File.separator+"gradle");
|
||||
/*Process process = Runtime.getRuntime().exec("xcopy " + sdkPath.getAbsolutePath() + File.separator + "gradle " + sdk_src.getAbsolutePath() + File.separator + "gradle /E /I /Y");
|
||||
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
while (reader.readLine() != null) ;
|
||||
reader.close();
|
||||
process = Runtime.getRuntime().exec("xcopy " + sdkPath.getAbsolutePath() + File.separator + "sdk " + sdk_src.getAbsolutePath() + File.separator + "sdk /E /I /Y");
|
||||
reader.close();*/
|
||||
Tools.copy_dir(sdkPath.getAbsolutePath()+File.separator+"sdk",sdk_src.getAbsolutePath()+File.separator+File.separator+"sdk");
|
||||
/* process = Runtime.getRuntime().exec("xcopy " + sdkPath.getAbsolutePath() + File.separator + "sdk " + sdk_src.getAbsolutePath() + File.separator + "sdk /E /I /Y");
|
||||
reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
while (reader.readLine() != null) ;
|
||||
reader.close();
|
||||
reader.close();*/
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -185,14 +188,18 @@ public class AutoPackageSDKMust {
|
||||
private String packageSDK() {
|
||||
File sdk_src = new File("sdk_src");
|
||||
try {
|
||||
Process process = Runtime.getRuntime().exec(sdk_src.getAbsolutePath() + File.separator + "gradlew.bat assembleRelease -p " + sdk_src.getAbsolutePath() + File.separator + "sdk");//打包sdk
|
||||
String gradlew=Tools.isWindowsRuntime()?"gradlew.bat":"gradlew";
|
||||
String exec=sdk_src.getAbsolutePath() + File.separator + gradlew +" assembleRelease -p " + sdk_src.getAbsolutePath() + File.separator + "sdk";
|
||||
System.out.println("exec="+exec);
|
||||
Process process = Runtime.getRuntime().exec(exec);//打包sdk
|
||||
Tools.outError(process.getErrorStream());
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String tmp;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
System.out.println(tmp);
|
||||
}
|
||||
process.waitFor();
|
||||
reader.close();
|
||||
System.out.println("over");
|
||||
return sdk_src.getAbsolutePath() + File.separator + "sdk" + File.separator + "build" + File.separator
|
||||
+ "intermediates" + File.separator + "aar_main_jar" + File.separator + "release" + File.separator + "classes.jar";
|
||||
} catch (Exception e) {
|
||||
@ -201,6 +208,7 @@ public class AutoPackageSDKMust {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
start("eZMpiVponpIUV5VO", new SmaliApkToolsPath() {
|
||||
@Override
|
||||
|
@ -69,7 +69,7 @@ public class Tools {
|
||||
// 目标文件所在目录不存在
|
||||
if (!destFile.mkdirs()) {
|
||||
// 复制文件失败:创建目标文件所在目录失败
|
||||
System.err.println("创建文件夹失败");
|
||||
System.err.println("创建文件夹失败:"+destFile.getAbsolutePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -122,6 +122,22 @@ public class Tools {
|
||||
return copyFileToName(srcFileName, destFileName, null, overlay);
|
||||
}
|
||||
}
|
||||
public static void copy_dir(String src,String desc){
|
||||
try {
|
||||
File dirSrc=new File(src);
|
||||
for (File file : dirSrc.listFiles()) {
|
||||
if(file.isDirectory()){
|
||||
new File(desc+File.separator+file.getName()).mkdirs();
|
||||
copy_dir(file.getAbsolutePath(),desc+File.separator+file.getName());
|
||||
}else{
|
||||
copyFile(file.getAbsolutePath(),desc,true);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
private static boolean copyDir(String dir,String dest){
|
||||
try{
|
||||
//System.out.println("复制文件"+dir+"到"+dest);
|
||||
@ -312,4 +328,20 @@ public class Tools {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static void outError(InputStream inputStream){
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String tmp;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
System.out.println(tmp);
|
||||
}
|
||||
reader.close();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static boolean isWindowsRuntime(){
|
||||
System.out.println(System.getProperties().getProperty("os.name"));
|
||||
return System.getProperties().getProperty("os.name").toLowerCase().contains("windows");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user