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