2
2
// SPDX-License-Identifier: Apache-2.0
3
3
4
4
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension.Output
5
- import org.jetbrains.intellij.Utils
6
5
import org.jetbrains.intellij.tasks.DownloadRobotServerPluginTask
7
6
import org.jetbrains.intellij.tasks.RunIdeForUiTestTask
8
- import software.aws.toolkits.gradle.intellij.IdeVersions
9
7
import software.aws.toolkits.gradle.ciOnly
10
8
import software.aws.toolkits.gradle.findFolders
11
- import software.aws.toolkits.gradle.intellij
9
+ import software.aws.toolkits.gradle.intellij.IdeVersions
12
10
import software.aws.toolkits.gradle.intellij.ToolkitIntelliJExtension
13
11
import software.aws.toolkits.gradle.intellij.ToolkitIntelliJExtension.IdeFlavor
12
+ import software.aws.toolkits.gradle.isCi
14
13
15
14
val toolkitIntelliJ = project.extensions.create<ToolkitIntelliJExtension >(" intellijToolkit" )
16
15
@@ -51,8 +50,6 @@ configurations {
51
50
runtimeClasspath {
52
51
// Exclude dependencies that ship with iDE
53
52
exclude(group = " org.slf4j" )
54
- exclude(group = " org.jetbrains.kotlin" )
55
- exclude(group = " org.jetbrains.kotlinx" )
56
53
57
54
// Exclude dependencies we don't use to make plugin smaller
58
55
exclude(group = " software.amazon.awssdk" , module = " netty-nio-client" )
@@ -65,92 +62,83 @@ tasks.processResources {
65
62
}
66
63
67
64
// Run after the project has been evaluated so that the extension (intellijToolkit) has been configured
68
- afterEvaluate {
69
- val flavor = toolkitIntelliJ.ideFlavor.get()
70
- val productProfile = when (flavor) {
71
- IdeFlavor .IC -> ideProfile.community
72
- IdeFlavor .IU -> ideProfile.ultimate
73
- IdeFlavor .RD -> ideProfile.rider
74
- }
65
+ intellij {
66
+ pluginName.set(" aws-toolkit-jetbrains" )
67
+ version.set(toolkitIntelliJ.productProfile().map { it.sdkVersion })
68
+ plugins.set(toolkitIntelliJ.productProfile().map { it.plugins.toMutableList() })
75
69
76
- intellij {
77
- pluginName = " aws-toolkit-jetbrains "
78
- version = productProfile.sdkVersion
70
+ downloadSources.set(toolkitIntelliJ.ideFlavor.map { it == IdeFlavor . IC && ! project.isCi() })
71
+ instrumentCode.set(toolkitIntelliJ.ideFlavor.map { it != IdeFlavor . RD })
72
+ }
79
73
80
- setPlugins(* productProfile.plugins)
74
+ tasks.jar {
75
+ archiveBaseName.set(toolkitIntelliJ.ideFlavor.map { " aws-toolkit-jetbrains-$it " })
76
+ }
81
77
82
- downloadSources = flavor != IdeFlavor .IC
83
- instrumentCode = flavor != IdeFlavor .RD
84
- }
78
+ tasks.patchPluginXml {
79
+ sinceBuild.set(toolkitIntelliJ.ideProfile().map { it.sinceVersion })
80
+ untilBuild.set(toolkitIntelliJ.ideProfile().map { it.untilVersion })
81
+ }
85
82
86
- tasks.jar {
87
- archiveBaseName.set(" aws-toolkit-jetbrains-$flavor " )
88
- }
83
+ // Disable building the settings search cache since it 1. fails the build, 2. gets run on the final packaged plugin
84
+ tasks.buildSearchableOptions {
85
+ enabled = false
86
+ }
89
87
90
- tasks.patchPluginXml {
91
- setSinceBuild(ideProfile.sinceVersion )
92
- setUntilBuild(ideProfile.untilVersion )
93
- }
88
+ tasks.withType< Test >().all {
89
+ systemProperty( " log.dir " , intellij.sandboxDir.map { " $it -test/logs " }.get() )
90
+ systemProperty( " testDataPath " , project.rootDir.resolve( " testdata " ).absolutePath )
91
+ }
94
92
95
- // Disable building the settings search cache since it 1. fails the build, 2. gets run on the final packaged plugin
96
- tasks.buildSearchableOptions {
97
- enabled = false
98
- }
93
+ tasks.withType<JavaExec > {
94
+ systemProperty(" aws.toolkits.enableTelemetry" , false )
95
+ }
99
96
100
- tasks.withType<Test >().all {
101
- systemProperty(" log.dir" , " ${Utils .stringInput(intellij.sandboxDirectory)} -test/logs" )
102
- systemProperty(" testDataPath" , project.rootDir.resolve(" testdata" ).absolutePath)
97
+ tasks.runIde {
98
+ val alternativeIde = providers.environmentVariable(" ALTERNATIVE_IDE" ).forUseAtConfigurationTime()
99
+ if (alternativeIde.isPresent) {
100
+ // remove the trailing slash if there is one or else it will not work
101
+ val value = alternativeIde.get()
102
+ val path = File (value.trimEnd(' /' ))
103
+ if (path.exists()) {
104
+ ideDir.set(path)
105
+ } else {
106
+ throw GradleException (" ALTERNATIVE_IDE path not found $value " )
107
+ }
103
108
}
109
+ }
104
110
105
- tasks.withType<JavaExec > {
106
- systemProperty( " aws.toolkits.enableTelemetry " , false )
107
- }
111
+ tasks.withType<DownloadRobotServerPluginTask > {
112
+ version.set(remoteRobotVersion )
113
+ }
108
114
109
- tasks.runIde {
110
- val alternativeIde = System .getenv(" ALTERNATIVE_IDE" )
111
- if (alternativeIde != null ) {
112
- // remove the trailing slash if there is one or else it will not work
113
- val path = alternativeIde.trimEnd(' /' )
114
- if (File (path).exists()) {
115
- setIdeDirectory(path)
116
- } else {
117
- throw GradleException (" ALTERNATIVE_IDE path not found $alternativeIde " )
118
- }
119
- }
115
+ // Enable coverage for the UI test target IDE
116
+ extensions.getByType<JacocoPluginExtension >().applyTo(tasks.withType<RunIdeForUiTestTask >())
117
+ tasks.withType<RunIdeForUiTestTask >().all {
118
+ systemProperty(" robot-server.port" , remoteRobotPort)
119
+ systemProperty(" ide.mac.file.chooser.native" , " false" )
120
+ systemProperty(" jb.consents.confirmation.enabled" , " false" )
121
+ // This does some magic in EndUserAgreement.java to make it not show the privacy policy
122
+ systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
123
+ // This only works on 2020.3+ FIX_WHEN_MIN_IS_203 remove this explanation
124
+ systemProperty(" ide.show.tips.on.startup.default.value" , false )
125
+
126
+ systemProperty(" aws.telemetry.skip_prompt" , " true" )
127
+ systemProperty(" aws.suppress_deprecation_prompt" , true )
128
+
129
+ // These are experiments to enable for UI tests
130
+ systemProperty(" aws.feature.connectedLocalTerminal" , true )
131
+ ciOnly {
132
+ systemProperty(" aws.sharedCredentialsFile" , " /tmp/.aws/credentials" )
120
133
}
121
134
122
- tasks.withType<DownloadRobotServerPluginTask >() {
123
- version = remoteRobotVersion
135
+ debugOptions {
136
+ enabled.set(true )
137
+ suspend .set(false )
124
138
}
125
139
126
- // Enable coverage for the UI test target IDE
127
- extensions.getByType<JacocoPluginExtension >().applyTo(tasks.withType<RunIdeForUiTestTask >())
128
- tasks.withType<RunIdeForUiTestTask >().all {
129
- systemProperty(" robot-server.port" , remoteRobotPort)
130
- systemProperty(" ide.mac.file.chooser.native" , " false" )
131
- systemProperty(" jb.consents.confirmation.enabled" , " false" )
132
- // This does some magic in EndUserAgreement.java to make it not show the privacy policy
133
- systemProperty(" jb.privacy.policy.text" , " <!--999.999-->" )
134
- // This only works on 2020.3+ FIX_WHEN_MIN_IS_203 remove this explanation
135
- systemProperty(" ide.show.tips.on.startup.default.value" , false )
136
-
137
- systemProperty(" aws.telemetry.skip_prompt" , " true" )
138
- systemProperty(" aws.suppress_deprecation_prompt" , true )
139
-
140
- // These are experiments to enable for UI tests
141
- systemProperty(" aws.feature.connectedLocalTerminal" , true )
142
- ciOnly() {
143
- systemProperty(" aws.sharedCredentialsFile" , " /tmp/.aws/credentials" )
144
- }
145
-
146
- debugOptions {
147
- enabled.set(true )
148
- suspend .set(false )
149
- }
150
-
151
- configure<JacocoTaskExtension > {
152
- includes = listOf (" software.aws.toolkits.*" )
153
- output = Output .TCP_CLIENT // Dump to our jacoco server instead of to a file
154
- }
140
+ configure<JacocoTaskExtension > {
141
+ includes = listOf (" software.aws.toolkits.*" )
142
+ output = Output .TCP_CLIENT // Dump to our jacoco server instead of to a file
155
143
}
156
144
}
0 commit comments