Skip to content

Commit

Permalink
Build for 241 (#4110)
Browse files Browse the repository at this point in the history
  • Loading branch information
rli authored Feb 5, 2024
1 parent 6abf638 commit 221a731
Show file tree
Hide file tree
Showing 54 changed files with 344 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun Project.kotlinTarget(): Provider<String> = withCurrentProfileName {
when (it) {
"2022.3" -> KotlinVersionEnum.KOTLIN_1_7
"2023.1", "2023.2" -> KotlinVersionEnum.KOTLIN_1_8
"2023.3" -> KotlinVersionEnum.KOTLIN_1_9
"2023.3", "2024.1" -> KotlinVersionEnum.KOTLIN_1_9
else -> error("not set")
}.version
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,51 @@ object IdeVersions {
nugetVersion = "2023.3.0"
)
),
Profile(
name = "2024.1",
gateway = ProductProfile(
sdkFlavor = IdeFlavor.GW,
sdkVersion = "241.9959-EAP-CANDIDATE-SNAPSHOT",
plugins = arrayOf("org.jetbrains.plugins.terminal")
),
community = ProductProfile(
sdkFlavor = IdeFlavor.IC,
sdkVersion = "241.9959-EAP-CANDIDATE-SNAPSHOT",
plugins = commonPlugins + listOf(
"java",
"com.intellij.gradle",
"org.jetbrains.idea.maven",
"PythonCore:241.9959.31",
"Docker:241.9959.32"
)
),
ultimate = ProductProfile(
sdkFlavor = IdeFlavor.IU,
sdkVersion = "241.9959-EAP-CANDIDATE-SNAPSHOT",
plugins = commonPlugins + listOf(
"JavaScript",
// Transitive dependency needed for javascript
// Can remove when https://github.com/JetBrains/gradle-intellij-plugin/issues/608 is fixed
"com.intellij.css",
"JavaScriptDebugger",
"com.intellij.database",
"com.jetbrains.codeWithMe",
"Pythonid:241.9959.31",
"org.jetbrains.plugins.go:241.9959.31",
// https://github.com/JetBrains/gradle-intellij-plugin/issues/1056
"org.intellij.intelliLang"
)
),
rider = RiderProfile(
sdkVersion = "2024.1-EAP2-SNAPSHOT",
plugins = commonPlugins + listOf(
"rider-plugins-appender" // Workaround for https://youtrack.jetbrains.com/issue/IDEA-179607
),
netFrameworkTarget = "net472",
rdGenVersion = "2024.1.0-pre1",
nugetVersion = "2024.1.0-eap02"
)
),

).associateBy { it.name }

Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ junit5 = "5.10.1"
kotlin = "1.9.21"
# set in <root>/settings.gradle.kts
kotlinCoroutines = "1.7.3"
mockito = "4.6.1"
mockitoKotlin = "4.0.0"
mockito = "5.10.0"
mockitoKotlin = "5.2.1"
mockk = "1.13.8"
node-gradle = "7.0.1"
telemetryGenerator = "1.0.182"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.StartupActivity
import com.intellij.openapi.util.SystemInfo
import com.intellij.util.io.lastModified
import software.aws.toolkits.core.utils.exists
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.lastModified
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.jetbrains.core.executables.ExecutableInstance.ExecutableWithPath
import software.aws.toolkits.jetbrains.services.lambda.sam.SamExecutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import com.intellij.openapi.util.io.FileUtil
import com.intellij.serviceContainer.NonInjectable
import com.intellij.util.ExceptionUtil
import com.intellij.util.io.delete
import com.intellij.util.io.readText
import com.intellij.util.io.write
import org.jetbrains.annotations.VisibleForTesting
import software.aws.toolkits.core.utils.debug
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.readText
import software.aws.toolkits.core.utils.warn
import software.aws.toolkits.jetbrains.core.tools.ToolManager.Companion.MANAGED_TOOL_INSTALL_ROOT
import software.aws.toolkits.jetbrains.utils.assertIsNonDispatchThread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package software.aws.toolkits.jetbrains.services

import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.io.isFile
import com.intellij.xdebugger.XSourcePosition
import com.jetbrains.python.debugger.PyLocalPositionConverter
import com.jetbrains.python.debugger.PySourcePosition
Expand All @@ -15,6 +14,7 @@ import software.aws.toolkits.jetbrains.services.PathMapper.Companion.normalizeLo
import java.nio.file.Files
import java.nio.file.Paths
import java.util.Objects
import kotlin.io.path.isRegularFile

/**
* Maps a local path to a remote path. The order of the list indicates the order of priority where first possible
Expand Down Expand Up @@ -90,7 +90,7 @@ class PathMapper(private val mappings: List<PathMapping>) {

class PathMapping(localPath: String, remoteDirectory: String) {
private val directory = Paths.get(localPath).let {
if (it.isFile()) {
if (it.isRegularFile()) {
it.parent.toString()
} else {
localPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.intellij.openapi.util.io.FileUtil.createTempDirectory
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.util.io.isDirectory
import software.aws.toolkits.core.utils.error
import software.aws.toolkits.core.utils.exists
import software.aws.toolkits.core.utils.getLogger
Expand All @@ -17,6 +16,7 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.TransformationSum
import software.aws.toolkits.jetbrains.services.codemodernizer.unzipFile
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.Path
import kotlin.io.path.isDirectory
import kotlin.io.path.walk

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import software.aws.toolkits.resources.message
import java.awt.event.MouseEvent
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.time.temporal.TemporalAdjusters

class CodeWhispererServiceNode(
Expand All @@ -48,7 +49,7 @@ class CodeWhispererServiceNode(
// but that shouldn't happen often enough for us to care
val formatter = tryOrNull {
DateTimeFormatter.ofPattern(DateTimeFormatManager.getInstance().dateFormatPattern)
} ?: DateTimeFormatter.ofPattern(DateTimeFormatManager.DEFAULT_DATE_FORMAT)
} ?: DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
val date = LocalDate.now().with(TemporalAdjusters.firstDayOfNextMonth())

FreeTierUsageLimitHitNode(nodeProject, formatter.format(date))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CreateEcrRepoDialog(
private val project: Project,
private val ecrClient: EcrClient,
parent: Component? = null
) : DialogWrapper(project, parent, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, parent, false, IdeModalityType.IDE) {
var repoName: String = ""

private val panel = panel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ internal class PushToEcrDialog(
private val project: Project,
selectedRepository: Repository,
private val dockerRuntime: Deferred<DockerRuntimeFacade>
) : DialogWrapper(project, null, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, null, false, IdeModalityType.IDE) {
private val coroutineScope = projectCoroutineScope(project)
private val defaultTag = "latest"
private val localImageRepoTags = CollectionComboBoxModel<LocalImage>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CreateIamRoleDialog(
parent: Component? = null,
@Language("JSON") defaultPolicyDocument: String,
@Language("JSON") defaultAssumeRolePolicyDocument: String
) : DialogWrapper(project, parent, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, parent, false, IdeModalityType.IDE) {

private val view = CreateRolePanel(project)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CreateIamServiceRoleDialog(
private val managedPolicyName: String,
name: String = "",
parent: Component? = null,
) : DialogWrapper(project, parent, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, parent, false, IdeModalityType.IDE) {
private val coroutineScope = projectCoroutineScope(project)
var name: String = name
private set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.jetbrains.python.PythonLanguage
import com.jetbrains.python.PythonModuleTypeBase
import com.jetbrains.python.psi.LanguageLevel
import com.jetbrains.python.sdk.PythonSdkType
import com.jetbrains.python.sdk.PythonSdkUtil
import software.aws.toolkits.core.lambda.LambdaRuntime
import software.aws.toolkits.jetbrains.services.lambda.BuiltInRuntimeGroups
import software.aws.toolkits.jetbrains.services.lambda.SdkBasedRuntimeGroup
Expand All @@ -28,11 +29,14 @@ class PythonRuntimeGroup : SdkBasedRuntimeGroup() {
)

override fun runtimeForSdk(sdk: Sdk): LambdaRuntime? = when {
sdk.sdkType is PythonSdkType && PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON311) -> LambdaRuntime.PYTHON3_11
sdk.sdkType is PythonSdkType && PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON310) -> LambdaRuntime.PYTHON3_10
sdk.sdkType is PythonSdkType && PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON39) -> LambdaRuntime.PYTHON3_9
sdk.sdkType is PythonSdkType && PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON38) -> LambdaRuntime.PYTHON3_8
sdk.sdkType is PythonSdkType && PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON37) -> LambdaRuntime.PYTHON3_7
!PythonSdkUtil.isPythonSdk(sdk) -> null

PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON311) -> LambdaRuntime.PYTHON3_11
PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON310) -> LambdaRuntime.PYTHON3_10
PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON39) -> LambdaRuntime.PYTHON3_9
PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON38) -> LambdaRuntime.PYTHON3_8
PythonSdkType.getLanguageLevelForSdk(sdk).isAtLeast(LanguageLevel.PYTHON37) -> LambdaRuntime.PYTHON3_7

else -> null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.openapi.ui.ValidationInfo
import com.intellij.ui.IdeBorderFactory
import com.intellij.ui.SortedComboBoxModel
import com.intellij.util.io.isFile
import software.amazon.awssdk.services.lambda.model.PackageType
import software.amazon.awssdk.services.lambda.model.Runtime
import software.aws.toolkits.jetbrains.core.awsClient
Expand All @@ -37,6 +36,7 @@ import javax.swing.JComboBox
import javax.swing.JLabel
import javax.swing.JPanel
import javax.swing.JRadioButton
import kotlin.io.path.isRegularFile

class LambdaConfigPanel(private val project: Project, private val isUpdate: Boolean) : JPanel(BorderLayout()) {
lateinit var handlerPanel: HandlerPanel
Expand Down Expand Up @@ -158,7 +158,7 @@ class LambdaConfigPanel(private val project: Project, private val isUpdate: Bool
handlerPanel.validateHandler(handlerMustExist = !isUpdate)?.let { return it }
}
PackageType.IMAGE -> {
if (dockerFile.isVisible && (dockerFile.text.isEmpty() || !Paths.get(dockerFile.text).isFile())) {
if (dockerFile.isVisible && (dockerFile.text.isEmpty() || !Paths.get(dockerFile.text).isRegularFile())) {
return dockerFile.validationInfo(message("lambda.upload_validation.dockerfile_not_found"))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import com.intellij.openapi.ui.TextBrowseFolderListener
import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.openapi.ui.ValidationInfo
import com.intellij.ui.IdeBorderFactory
import com.intellij.util.io.isFile
import software.amazon.awssdk.services.lambda.model.PackageType
import software.aws.toolkits.jetbrains.ui.HandlerPanel
import software.aws.toolkits.jetbrains.utils.ui.validationInfo
import software.aws.toolkits.resources.message
import java.nio.file.Paths
import javax.swing.JLabel
import javax.swing.JPanel
import kotlin.io.path.isRegularFile

class UpdateFunctionCodePanel internal constructor(private val project: Project, private val packageType: PackageType) {
lateinit var content: JPanel
Expand Down Expand Up @@ -65,7 +65,7 @@ class UpdateFunctionCodePanel internal constructor(private val project: Project,
handlerPanel.validateHandler(handlerMustExist = true) ?: codeStorage.validatePanel()
}
PackageType.IMAGE -> {
if (dockerFile.text.isEmpty() || !Paths.get(dockerFile.text).isFile()) {
if (dockerFile.text.isEmpty() || !Paths.get(dockerFile.text).isRegularFile()) {
dockerFile.validationInfo(message("lambda.upload_validation.dockerfile_not_found"))
} else {
codeStorage.validatePanel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CreateS3BucketDialog(
private val project: Project,
private val s3Client: S3Client,
parent: Component? = null
) : DialogWrapper(project, parent, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, parent, false, IdeModalityType.IDE) {

val view = CreateBucketPanel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.util.io.isDirectory
import kotlinx.coroutines.launch
import software.amazon.awssdk.services.s3.model.NoSuchBucketException
import software.aws.toolkits.core.utils.deleteIfExists
Expand All @@ -35,6 +34,7 @@ import software.aws.toolkits.resources.message
import software.aws.toolkits.telemetry.S3Telemetry
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.io.path.isDirectory

class DownloadObjectAction :
S3ObjectAction(message("s3.download.object.action"), AllIcons.Actions.Download) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import com.intellij.openapi.fileChooser.FileChooserFactory
import com.intellij.openapi.project.Project
import com.intellij.util.io.isDirectory
import kotlinx.coroutines.launch
import software.aws.toolkits.jetbrains.core.coroutines.projectCoroutineScope
import software.aws.toolkits.jetbrains.core.utils.getRequiredData
Expand All @@ -21,6 +20,7 @@ import software.aws.toolkits.resources.message
import software.aws.toolkits.telemetry.Result
import software.aws.toolkits.telemetry.S3Telemetry
import java.nio.file.Path
import kotlin.io.path.isDirectory

class UploadObjectAction : S3ObjectAction(message("s3.upload.object.action"), AllIcons.Actions.Upload) {
override fun performAction(dataContext: DataContext, nodes: List<S3TreeNode>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ConfirmIamPolicyDialog(
private val functionName: String,
private val queue: Queue,
parent: Component? = null
) : DialogWrapper(project, parent, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, parent, false, IdeModalityType.IDE) {
private val coroutineScope = projectCoroutineScope(project)
private val rolePolicy: String by lazy { createSqsPollerPolicy(queue.arn) }
private val policyName: String by lazy { "AWSLambdaSQSPollerExecutionRole-$functionName-${queue.queueName}-${queue.region.id}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ConfirmQueuePolicyDialog(
topicArn: String,
private val existingPolicy: String?,
parent: Component? = null
) : DialogWrapper(project, parent, false, IdeModalityType.PROJECT) {
) : DialogWrapper(project, parent, false, IdeModalityType.IDE) {
private val coroutineScope = projectCoroutineScope(project)
private val policyStatement = createSqsSnsSubscribePolicyStatement(queue.arn, topicArn)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
package software.aws.toolkits.jetbrains.utils

import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.util.io.size
import java.io.FileInputStream
import java.io.FilterInputStream
import java.io.FilterOutputStream
import java.io.InputStream
import java.io.OutputStream
import java.nio.file.Path
import kotlin.io.path.fileSize

class ProgressMonitorInputStream(
indicator: ProgressIndicator,
Expand Down Expand Up @@ -40,7 +40,10 @@ class ProgressMonitorInputStream(
}

companion object {
fun fromFile(indicator: ProgressIndicator, path: Path): InputStream = ProgressMonitorInputStream(indicator, FileInputStream(path.toFile()), path.size())
fun fromFile(
indicator: ProgressIndicator,
path: Path
): InputStream = ProgressMonitorInputStream(indicator, FileInputStream(path.toFile()), path.fileSize())
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.jetbrains.utils

import com.intellij.openapi.vfs.VirtualFile
import com.intellij.testFramework.runInEdtAndWait
import org.jetbrains.idea.maven.model.MavenExplicitProfiles
import org.jetbrains.idea.maven.project.MavenProjectsManager

@Suppress("UNUSED_PARAMETER", "RedundantSuspendModifier")
suspend fun MavenProjectsManager.addManagedFilesWithProfilesAndUpdate(
poms: List<VirtualFile>,
profiles: MavenExplicitProfiles,
nothing: Nothing?,
nothing1: Nothing?
) {
resetManagedFilesAndProfilesInTests(poms, profiles)
runInEdtAndWait {
waitForReadingCompletion()
}
}
Loading

0 comments on commit 221a731

Please sign in to comment.