|
7 | 7 |
|
8 | 8 | import com.intellij.execution.process.ProcessOutputTypes; |
9 | 9 | import com.intellij.openapi.project.Project; |
| 10 | +import com.intellij.openapi.vfs.VfsUtil; |
10 | 11 | import com.intellij.util.PathUtil; |
11 | 12 | import com.microsoft.azure.toolkit.intellij.common.AzureArtifact; |
12 | 13 | import com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager; |
13 | 14 | import com.microsoft.azure.toolkit.intellij.common.RunProcessHandler; |
14 | 15 | import com.microsoft.azure.toolkit.intellij.connector.IJavaAgentSupported; |
| 16 | +import com.microsoft.azure.toolkit.intellij.connector.dotazure.AzureModule; |
15 | 17 | import com.microsoft.azure.toolkit.intellij.connector.dotazure.DotEnvBeforeRunTaskProvider; |
16 | 18 | import com.microsoft.azure.toolkit.intellij.legacy.common.AzureRunProfileState; |
17 | 19 | import com.microsoft.azure.toolkit.intellij.legacy.webapp.runner.Constants; |
|
20 | 22 | import com.microsoft.azure.toolkit.lib.appservice.model.AppServiceFile; |
21 | 23 | import com.microsoft.azure.toolkit.lib.appservice.model.DeployType; |
22 | 24 | import com.microsoft.azure.toolkit.lib.appservice.model.WebContainer; |
23 | | -import com.microsoft.azure.toolkit.lib.appservice.webapp.*; |
| 25 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.AzureWebApp; |
| 26 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.WebApp; |
| 27 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.WebAppBase; |
| 28 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.WebAppDeploymentSlot; |
| 29 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.WebAppDeploymentSlotDraft; |
| 30 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.WebAppDraft; |
| 31 | +import com.microsoft.azure.toolkit.lib.appservice.webapp.WebAppModule; |
24 | 32 | import com.microsoft.azure.toolkit.lib.common.bundle.AzureString; |
25 | 33 | import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException; |
26 | 34 | import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager; |
27 | 35 | import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation; |
28 | 36 | import com.microsoft.azure.toolkit.lib.common.operation.OperationContext; |
| 37 | +import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager; |
29 | 38 | import com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel; |
30 | 39 | import com.microsoft.azuretools.telemetry.TelemetryConstants; |
31 | 40 | import com.microsoft.azuretools.telemetrywrapper.Operation; |
|
47 | 56 | import java.net.URISyntaxException; |
48 | 57 | import java.net.URL; |
49 | 58 | import java.nio.file.Paths; |
50 | | -import java.util.*; |
| 59 | +import java.util.Collections; |
| 60 | +import java.util.HashMap; |
| 61 | +import java.util.Map; |
| 62 | +import java.util.Objects; |
| 63 | +import java.util.Optional; |
| 64 | +import java.util.Set; |
51 | 65 | import java.util.stream.Collectors; |
52 | 66 |
|
53 | 67 | import static com.microsoft.azure.toolkit.intellij.common.AzureBundle.message; |
@@ -82,6 +96,14 @@ public WebAppRunState(Project project, WebAppConfiguration webAppConfiguration) |
82 | 96 | throw new FileNotFoundException(message("webapp.deploy.error.noTargetFile", artifact.getAbsolutePath())); |
83 | 97 | } |
84 | 98 | final WebAppBase<?, ?, ?> deployTarget = getOrCreateDeployTargetFromAppSettingModel(processHandler); |
| 99 | + final AzureTaskManager tm = AzureTaskManager.getInstance(); |
| 100 | + tm.runOnPooledThread(()-> Optional.ofNullable(this.webAppConfiguration.getModule()).map(AzureModule::from) |
| 101 | + .or(() -> Optional.ofNullable(artifact) |
| 102 | + .map(f -> VfsUtil.findFileByIoFile(f, true)) |
| 103 | + .map(f -> AzureModule.from(f, this.project))) |
| 104 | + .ifPresent(module -> tm.runLater(() -> tm.write(() -> module |
| 105 | + .initializeWithDefaultProfileIfNot() |
| 106 | + .addApp(deployTarget).save())))); |
85 | 107 | applyResourceConnections(deployTarget); |
86 | 108 | updateApplicationSettings(deployTarget, processHandler); |
87 | 109 | AzureWebAppMvpModel.getInstance().deployArtifactsToWebApp(deployTarget, artifact, webAppSettingModel.isDeployToRoot(), processHandler); |
|
0 commit comments