Skip to content

Commit

Permalink
Added support for Android Studio 2024.1, fixed api calls, increased o…
Browse files Browse the repository at this point in the history
…perations timeouts, increased default java version
  • Loading branch information
LuigiVampa92 committed May 31, 2024
1 parent 7471484 commit 719d60f
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 18 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ plugins {
}

group 'com.luigivampa92.remoteandroidbuilds'
version '0.4.0'
version '0.4.1'

sourceCompatibility = 1.8
sourceCompatibility = 1.8 // todo fix to 11 ?
targetCompatibility = 1.8

repositories {
Expand All @@ -30,13 +30,14 @@ intellij {
pluginName = 'SkyForge'
type = 'AI'
version = 'AI-213.7172.25.2113.9014738'
// version = 'AI-241.14494.158.2411.11648550'
plugins = ['android']
}

patchPluginXml {
version = rootProject.version
sinceBuild = "213"
untilBuild = "223.*"
untilBuild = "241.*"
pluginDescription = file("extra/pluginDescription.html").text
changeNotes = file("extra/pluginChangeNotes.html").text
}
Expand Down
8 changes: 8 additions & 0 deletions extra/pluginChangeNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
<li>Initial plugin release for Android Studio >= 2021.3</li>
</ul>
</li>
<li>0.4.1
<ul>
<li>Bumped plugin release for Android Studio >= 2024.1</li>
<li>Fixed api calls to the ones compatible with all the new versions</li>
<li>Increased operations timeouts</li>
<li>Increased default java version to 17</li>
</ul>
</li>
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void run(@NotNull ProgressIndicator progressIndicator) {
String pushScriptToServerCommandTemplate = "scp %s %s:~/%s";
String osAwarePath = FileManager.fixFilePathForWindowsCygwin(scriptLocalPath);
String pushScriptToServer = String.format(pushScriptToServerCommandTemplate, osAwarePath, configuration.getSshAlias(), scriptFileNameOnServer);
ShellExecutionResult pushResult = shellExecutor.execute(pushScriptToServer, 6000);
ShellExecutionResult pushResult = shellExecutor.execute(pushScriptToServer, 15000);
if (pushResult.getExitCode() != 0) {
throw new RuntimeException("Failed to push setup script to the server");
}
Expand All @@ -78,7 +78,7 @@ public void run(@NotNull ProgressIndicator progressIndicator) {

String chmodCommandTemplate = "ssh %s chmod +x ~/%s";
String chmodCommand = String.format(chmodCommandTemplate, configuration.getSshAlias(), scriptFileNameOnServer);
ShellExecutionResult chmodResult = shellExecutor.execute(chmodCommand, 4500);
ShellExecutionResult chmodResult = shellExecutor.execute(chmodCommand, 15000);
if (chmodResult.getExitCode() != 0) {
throw new RuntimeException("Failed to set file parameters to the script on the server");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private String getUserDirValue(RemoteBuildsConfiguration configuration) {
}

private String getJdkDepValue() {
return "openjdk-11-jdk"; // todo ?
return "openjdk-17-jdk"; // todo take the actual version !
}

public final void write(File targetFile, RemoteBuildsConfiguration configuration, Collection<String> serverSdkManagerDependencies) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ private boolean isGradleAndroidStudioProject(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project != null) {
boolean ideIsAndroidStudio = getIdeInfo().isAndroidStudio();
boolean projectIsBuiltWithGradle = GradleProjectInfo.getInstance(project).isBuildWithGradle();
// boolean projectIsBuiltWithGradle = GradleProjectInfo.getInstance(project).isBuildWithGradle();
boolean projectIsBuiltWithGradle = true;
return ideIsAndroidStudio && projectIsBuiltWithGradle;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ private boolean isGradleAndroidStudioProject(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project != null) {
boolean ideIsAndroidStudio = getIdeInfo().isAndroidStudio();
boolean projectIsBuiltWithGradle = GradleProjectInfo.getInstance(project).isBuildWithGradle();
// boolean projectIsBuiltWithGradle = GradleProjectInfo.getInstance(project).isBuildWithGradle();
boolean projectIsBuiltWithGradle = true;
return ideIsAndroidStudio && projectIsBuiltWithGradle;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected void doPerform(@NotNull AnActionEvent e, @NotNull Project project) {
}

private void openPluginSettings(Project project) {
RemoteBuildsConfigurationSettings settings = new RemoteBuildsConfigurationSettings();
RemoteBuildsConfigurationSettings settings = new RemoteBuildsConfigurationSettings(project);
ShowSettingsUtil.getInstance().editConfigurable(project, settings);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public final class RcOnlyShellExecutor {

private final int PROCESS_AWAITING_TIMEOUT_MS = 3000;
private final int PROCESS_AWAITING_TIMEOUT_MS = 15000;

public synchronized ShellExecutionResult execute(String command) {
return execute(command, PROCESS_AWAITING_TIMEOUT_MS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ public boolean uploadDebugKeystoreToServer(String sshAlias, String user) {
} else {
commandPrepareAndroidDebugKeystoreFolder = String.format(CMD_TEMPLATE_SSH_PREPARE_DEBUG_KEYSTORE_FOLDER_USER_NORMAL, getSshExecutableValueForPlatform(), sshAlias, user);
}
ShellExecutionResult prepareAndroidDebugKeystoreFolderResult = shellExecutor.execute(commandPrepareAndroidDebugKeystoreFolder, 4500);
ShellExecutionResult prepareAndroidDebugKeystoreFolderResult = shellExecutor.execute(commandPrepareAndroidDebugKeystoreFolder, 15000);
if (prepareAndroidDebugKeystoreFolderResult.getExitCode() != 0) {
return false;
}
String osAwareAndroidDebugKeystoreFile = FileManager.fixFilePathForWindowsCygwin(androidDebugKeystoreFile);
String commandTransferAndroidKeystore = String.format(CMD_TEMPLATE_SCP_UPLOAD_DEBUG_KEYSTORE, getScpExecutableValueForPlatform(), osAwareAndroidDebugKeystoreFile, sshAlias);
ShellExecutionResult result = shellExecutor.execute(commandTransferAndroidKeystore, 6000);
ShellExecutionResult result = shellExecutor.execute(commandTransferAndroidKeystore, 15000);
return result.getExitCode() == 0;
} else {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public final class SshShellExecutor {

private final long PROCESS_AWAITING_TIMEOUT_MS = 5500L;
private final long PROCESS_AWAITING_TIMEOUT_MS = 15000L;

public ShellExecutionResult execute(String command, String lineDelimiter) {
Process process = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsContexts;
import com.luigivampa92.remoteandroidbuilds.ideplugin.ServiceLocator;
import com.luigivampa92.remoteandroidbuilds.ideplugin.services.RemoteBuildConfigurationService;
Expand All @@ -12,13 +13,20 @@

public final class RemoteBuildsConfigurationSettings implements Configurable {

private Project project;
private RemoteBuildConfigurationService configurationService = ServiceLocator.getInstance().getRemoteBuildConfigurationService();
private RemoteBuildsConfigurationSettingsForm configurationForm;
private RemoteBuildsConfiguration initialConfiguration;

public RemoteBuildsConfigurationSettings() {}

public RemoteBuildsConfigurationSettings(Project project) {
this.project = project;
}

@Override
public @Nullable JComponent createComponent() {
configurationForm = new RemoteBuildsConfigurationSettingsForm();
configurationForm = new RemoteBuildsConfigurationSettingsForm(project);
return configurationForm.createCenterPanel();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.luigivampa92.remoteandroidbuilds.ideplugin.settings;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.luigivampa92.remoteandroidbuilds.ideplugin.services.RemoteBuildsConfiguration;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -28,8 +29,8 @@ public final class RemoteBuildsConfigurationSettingsForm extends DialogWrapper {
private JLabel sdkDependenciesDescriptionLabel;
private JCheckBox extraDependenciesRequiredCheckBox;

public RemoteBuildsConfigurationSettingsForm() {
super(null);
public RemoteBuildsConfigurationSettingsForm(Project project) {
super(project);
init();
proxyRequiredCheckBox.addItemListener(e -> {
if (e.getStateChange() == ItemEvent.SELECTED) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<applicationService
serviceInterface="com.luigivampa92.remoteandroidbuilds.ideplugin.services.RemoteBuildConfigurationService"
serviceImplementation="com.luigivampa92.remoteandroidbuilds.ideplugin.services.RemoteBuildConfigurationServicePersistentStateImpl" />
<applicationConfigurable parentId="build" instance="com.luigivampa92.remoteandroidbuilds.ideplugin.settings.RemoteBuildsConfigurationSettings" />
<applicationConfigurable
id="com.luigivampa92.remoteandroidbuilds.ideplugin.settings.RemoteBuildsConfigurationSettings"
instance="com.luigivampa92.remoteandroidbuilds.ideplugin.settings.RemoteBuildsConfigurationSettings"
parentId="build"
displayName="Remote Builds" />
</extensions>

<actions>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/serverPrepare_Ubuntu_20.template
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ echoLog 'Variables are not yet set. Setting up.'
cat <<EOF >> $DIR_USER/$FILE_ENV_VARS
#!/bin/bash
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
ANDROID_HOME="$DIR_USER/$DIR_ANDROID_SDK"
ANDROID_SDK_ROOT="$DIR_USER/$DIR_ANDROID_SDK"
Expand Down

0 comments on commit 719d60f

Please sign in to comment.