Update dependencies for Android box tests
This commit is contained in:
@@ -34,8 +34,8 @@ public class PathManager {
|
||||
return getAndroidSdkRoot() + "/platforms";
|
||||
}
|
||||
|
||||
public String getAndroidEmulatorRoot() {
|
||||
String androidEmulatorRoot = getAndroidSdkRoot() + "/emulator";
|
||||
public String getAndroidAvdRoot() {
|
||||
String androidEmulatorRoot = getAndroidSdkRoot() + "/emulatoravd";
|
||||
new File(androidEmulatorRoot).mkdirs();
|
||||
return androidEmulatorRoot;
|
||||
}
|
||||
@@ -48,6 +48,10 @@ public class PathManager {
|
||||
return getAndroidSdkRoot() + "/tools";
|
||||
}
|
||||
|
||||
public String getEmulatorFolderInAndroidSdk() {
|
||||
return getAndroidSdkRoot() + "/emulator";
|
||||
}
|
||||
|
||||
public String getBuildToolsFolderInAndroidSdk() {
|
||||
return getAndroidSdkRoot() + "/build-tools";
|
||||
}
|
||||
|
||||
+31
-7
@@ -35,14 +35,16 @@ public class SDKDownloader {
|
||||
private final String skdToolsZipPath;
|
||||
private final String buildToolsZipPath;
|
||||
private final String gradleZipPath;
|
||||
private final String emulatorZipPath;
|
||||
|
||||
private final PathManager pathManager;
|
||||
|
||||
private static final String PLATFORM_TOOLS = "28.0.1";
|
||||
private static final String SDK_TOOLS = "25.2.5";
|
||||
private static final String SDK_TOOLS = "4333796"; //"26.1.1";
|
||||
public static final String BUILD_TOOLS = "28.0.3";
|
||||
private static final int ANDROID_VERSION = 19;
|
||||
public static final String GRADLE_VERSION = "4.6";
|
||||
public static final String EMULATOR_TOOLS_VERSION = "5264690"; //"28.0.23";
|
||||
|
||||
|
||||
public SDKDownloader(PathManager pathManager) {
|
||||
@@ -51,9 +53,10 @@ public class SDKDownloader {
|
||||
armImage = pathManager.getRootForDownload() + "/arm-image.zip";
|
||||
x86Image = pathManager.getRootForDownload() + "/x86-image.zip";
|
||||
platformToolsZipPath = pathManager.getRootForDownload() + "/platform-tools" + PLATFORM_TOOLS + ".zip";
|
||||
skdToolsZipPath = pathManager.getRootForDownload() + "/tools" + SDK_TOOLS + ".zip";
|
||||
skdToolsZipPath = pathManager.getRootForDownload() + "/sdk-tools" + SDK_TOOLS + ".zip";
|
||||
buildToolsZipPath = pathManager.getRootForDownload() + "/build-tools" + BUILD_TOOLS + ".zip";
|
||||
gradleZipPath = pathManager.getRootForDownload() + "/gradle" + GRADLE_VERSION + ".zip";
|
||||
emulatorZipPath = pathManager.getRootForDownload() + "/emulator" + EMULATOR_TOOLS_VERSION + ".zip";
|
||||
}
|
||||
|
||||
public void downloadPlatform() {
|
||||
@@ -70,12 +73,17 @@ public class SDKDownloader {
|
||||
}
|
||||
|
||||
public void downloadSdkTools() {
|
||||
download(getDownloadUrl("https://dl.google.com/android/repository/tools_r" + SDK_TOOLS), skdToolsZipPath);
|
||||
download("https://dl.google.com/android/repository/sdk-tools-" + getPlatformName() + "-" + SDK_TOOLS + ".zip",
|
||||
skdToolsZipPath);
|
||||
}
|
||||
|
||||
public void downloadBuildTools() {
|
||||
download(getDownloadUrl("https://dl.google.com/android/repository/build-tools_r" + BUILD_TOOLS), buildToolsZipPath);
|
||||
}
|
||||
public void downloadEmulator() {
|
||||
download("https://dl.google.com/android/repository/emulator-" + getPlatformName() + "-" + EMULATOR_TOOLS_VERSION + ".zip",
|
||||
emulatorZipPath);
|
||||
}
|
||||
|
||||
public void downloadGradle() {
|
||||
download("https://services.gradle.org/distributions/gradle-" + GRADLE_VERSION + "-bin.zip", gradleZipPath);
|
||||
@@ -93,11 +101,27 @@ public class SDKDownloader {
|
||||
suffix = "-linux.zip";
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Your operating system doesn't supported yet.");
|
||||
throw new IllegalStateException("Your operating system isn't supported yet.");
|
||||
}
|
||||
return prefix + suffix;
|
||||
}
|
||||
|
||||
|
||||
private static String getPlatformName() {
|
||||
if (SystemInfo.isWindows) {
|
||||
return "windows";
|
||||
}
|
||||
else if (SystemInfo.isMac) {
|
||||
return "darwin";
|
||||
}
|
||||
else if (SystemInfo.isUnix) {
|
||||
return "linux";
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Your operating system isn't supported yet.");
|
||||
}
|
||||
}
|
||||
|
||||
public void downloadAll() {
|
||||
downloadSdkTools();
|
||||
downloadAbi();
|
||||
@@ -105,6 +129,7 @@ public class SDKDownloader {
|
||||
downloadPlatformTools();
|
||||
downloadBuildTools();
|
||||
downloadGradle();
|
||||
downloadEmulator();
|
||||
}
|
||||
|
||||
|
||||
@@ -123,10 +148,9 @@ public class SDKDownloader {
|
||||
|
||||
//BUILD TOOLS
|
||||
String buildTools = androidSdkRoot + "/build-tools/";
|
||||
String buildToolsFolder = buildTools + BUILD_TOOLS + "/";
|
||||
new File(buildToolsFolder).delete();
|
||||
unzip(buildToolsZipPath, buildTools);
|
||||
new File(buildTools + "/android-9").renameTo(new File(buildToolsFolder));
|
||||
|
||||
unzip(emulatorZipPath, androidSdkRoot);
|
||||
}
|
||||
|
||||
public void deleteAll() {
|
||||
|
||||
+15
-23
@@ -34,11 +34,12 @@ public class Emulator {
|
||||
|
||||
public static final String ARM = "arm";
|
||||
public static final String X86 = "x86";
|
||||
private static final String AVD_NAME = "kotlin_box_test_avd";
|
||||
|
||||
private final static Pattern EMULATOR_PATTERN = Pattern.compile("emulator-([0-9])*");
|
||||
|
||||
private final PathManager pathManager;
|
||||
private String platform;
|
||||
private final String platform;
|
||||
|
||||
public Emulator(PathManager pathManager, String platform) {
|
||||
this.pathManager = pathManager;
|
||||
@@ -53,27 +54,23 @@ public class Emulator {
|
||||
commandLine.addParameter("avd");
|
||||
commandLine.addParameter("--force");
|
||||
commandLine.addParameter("-n");
|
||||
commandLine.addParameter("my_avd");
|
||||
commandLine.addParameter(AVD_NAME);
|
||||
commandLine.addParameter("-p");
|
||||
commandLine.addParameter(pathManager.getAndroidEmulatorRoot());
|
||||
commandLine.addParameter("-t");
|
||||
commandLine.addParameter("1");
|
||||
|
||||
commandLine.addParameter("-b");
|
||||
commandLine.addParameter(getEmulatorAbi());
|
||||
commandLine.addParameter(pathManager.getAndroidAvdRoot());
|
||||
commandLine.addParameter("-k");
|
||||
if (platform == X86) {
|
||||
commandLine.addParameter("system-images;android-19;default;x86");
|
||||
} else {
|
||||
commandLine.addParameter("system-images;android-19;default;armeabi-v7a");
|
||||
}
|
||||
return commandLine;
|
||||
}
|
||||
|
||||
private String getEmulatorAbi(){
|
||||
return platform == X86 ? "x86" : "armeabi-v7a";
|
||||
}
|
||||
|
||||
private GeneralCommandLine getStartCommand() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
String emulatorCmdName = SystemInfo.isWindows ? "emulator.exe" : "emulator";
|
||||
commandLine.setExePath(pathManager.getToolsFolderInAndroidSdk() + "/" + emulatorCmdName);
|
||||
commandLine.setExePath(pathManager.getEmulatorFolderInAndroidSdk() + "/" + "emulator");
|
||||
commandLine.addParameter("-avd");
|
||||
commandLine.addParameter("my_avd");
|
||||
commandLine.addParameter(AVD_NAME);
|
||||
if (platform != X86) {
|
||||
//problem with qemu options
|
||||
commandLine.addParameter("-no-audio");
|
||||
@@ -83,17 +80,13 @@ public class Emulator {
|
||||
}
|
||||
|
||||
private GeneralCommandLine getWaitCommand() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
||||
GeneralCommandLine commandLine = createAdbCommand();
|
||||
commandLine.addParameter("wait-for-device");
|
||||
return commandLine;
|
||||
}
|
||||
|
||||
private GeneralCommandLine getStopCommandForAdb() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
||||
GeneralCommandLine commandLine = createAdbCommand();
|
||||
commandLine.addParameter("kill-server");
|
||||
return commandLine;
|
||||
}
|
||||
@@ -118,8 +111,7 @@ public class Emulator {
|
||||
|
||||
private GeneralCommandLine createAdbCommand() {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
String adbCmdName = SystemInfo.isWindows ? "adb.exe" : "adb";
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + adbCmdName);
|
||||
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/" + "adb");
|
||||
return commandLine;
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -30,10 +30,15 @@ public class PermissionManager {
|
||||
public static void setPermissions(PathManager pathManager) {
|
||||
if (!SystemInfo.isWindows) {
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getToolsFolderInAndroidSdk()));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getToolsFolderInAndroidSdk() + "/bin64"));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getBuildToolsFolderInAndroidSdk() + "/" + SDKDownloader.BUILD_TOOLS));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getPlatformToolsFolderInAndroidSdk()));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getToolsFolderInAndroidSdk() +"/qemu/linux-x86_64"));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getToolsFolderInAndroidSdk() +"/bin"));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getEmulatorFolderInAndroidSdk()));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getEmulatorFolderInAndroidSdk() +"/bin"));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getEmulatorFolderInAndroidSdk() +"/bin64"));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getEmulatorFolderInAndroidSdk() +"/qemu/linux-x86_64"));
|
||||
setExecPermissionForSimpleNamedFiles(new File(pathManager.getAndroidSdkRoot() + "/system-images/android-19/default/armeabi-v7a/"));
|
||||
|
||||
RunUtils.execute(generateChmodCmd(pathManager.getGradleBinFolder() + "/gradle"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user