@@ -63,7 +63,11 @@ public static RemoteRobot runIde(IdeaVersion ideaVersion, int port) {
63
63
64
64
return step ("Start IntelliJ Idea ('" + ideaVersion .toString () + "') listening on port " + port , () -> {
65
65
UITestRunner .ideaVersion = ideaVersion ;
66
- makeSureAllTermsAndConditionsAreAccepted ();
66
+ acceptAllTermsAndConditions ();
67
+
68
+ if (ideaVersion .isUltimate ()) {
69
+ activateEvaluateForFree ();
70
+ }
67
71
68
72
String fileExtension = OS_NAME .contains ("windows" ) ? ".bat" : "" ;
69
73
ProcessBuilder pb = new ProcessBuilder ("." + File .separator + "gradlew" + fileExtension , "runIdeForUiTests" , "-PideaVersion=" + ideaVersion .toString (), "-Drobot-server.port=" + port );
@@ -154,8 +158,7 @@ public enum IdeaVersion {
154
158
ULTIMATE_V_2020_2 ("IU-2020.2" ),
155
159
ULTIMATE_V_2020_3 ("IU-2020.3" ),
156
160
ULTIMATE_V_2021_1 ("IU-2021.1" ),
157
- ULTIMATE_V_2021_2 ("IU-2021.2" ),
158
- ULTIMATE_V_2021_3 ("IU-2021.3" );
161
+ ULTIMATE_V_2021_2 ("IU-2021.2" );
159
162
160
163
private final String ideaVersionStringRepresentation ;
161
164
@@ -172,12 +175,21 @@ public int toInt() {
172
175
String ideaVersion = this .ideaVersionStringRepresentation .substring (3 ).replace ("." , "" );
173
176
return Integer .parseInt (ideaVersion );
174
177
}
178
+
179
+ public boolean isUltimate () {
180
+ return this .ideaVersionStringRepresentation .charAt (1 ) == 'U' ;
181
+ }
175
182
}
176
183
177
- private static void makeSureAllTermsAndConditionsAreAccepted () {
184
+ private static void acceptAllTermsAndConditions () {
178
185
if (OS_NAME .contains ("linux" )) {
179
186
step ("Copy the 'prefs.xml' file to the appropriate location" , () -> {
180
- String prefsXmlSourceLocation = "prefs.xml" ;
187
+ String prefsXmlSourceLocation ;
188
+ if (!ideaVersion .isUltimate ()) {
189
+ prefsXmlSourceLocation = "prefs.xml" ;
190
+ } else {
191
+ prefsXmlSourceLocation = "prefs_xml/ultimate_all/prefs.xml" ;
192
+ }
181
193
String prefsXmlDir = USER_HOME + "/.java/.userPrefs/jetbrains/_!(!!cg\" p!(}!}@\" j!(k!|w\" w!'8!b!\" p!':!e@==" ;
182
194
createDirectoryHierarchy (prefsXmlDir );
183
195
copyFileFromJarResourceDir (prefsXmlSourceLocation , prefsXmlDir + "/prefs.xml" );
@@ -190,7 +202,12 @@ private static void makeSureAllTermsAndConditionsAreAccepted() {
190
202
});
191
203
} else if (OS_NAME .contains ("os x" )) {
192
204
step ("Copy the 'com.apple.java.util.prefs.plist' file to the appropriate location" , () -> {
193
- String plistSourceLocation = "com.apple.java.util.prefs.plist" ;
205
+ String plistSourceLocation ;
206
+ if (!ideaVersion .isUltimate ()) {
207
+ plistSourceLocation = "com.apple.java.util.prefs.plist" ;
208
+ } else {
209
+ plistSourceLocation = "plist/ultimate_all/com.apple.java.util.prefs.plist" ;
210
+ }
194
211
String plistDir = USER_HOME + "/Library/Preferences" ;
195
212
copyFileFromJarResourceDir (plistSourceLocation , plistDir + "/com.apple.java.util.prefs.plist" );
196
213
});
@@ -224,6 +241,7 @@ private static void makeSureAllTermsAndConditionsAreAccepted() {
224
241
ProcessBuilder pb1 = new ProcessBuilder (powershellLocation , "New-Item" , powershellPathParameter , registryPath , "-Force" );
225
242
ProcessBuilder pb2 = new ProcessBuilder (powershellLocation , "New-ItemProperty" , powershellPathParameter , registryPath , "-Name" , "accepted_version" , "-Value" , "'2.1'" );
226
243
ProcessBuilder pb3 = new ProcessBuilder (powershellLocation , "New-ItemProperty" , powershellPathParameter , registryPath , "-Name" , "euacommunity_accepted_version" , "-Value" , "'1.0'" );
244
+ ProcessBuilder pb4 = new ProcessBuilder (powershellLocation , "New-ItemProperty" , powershellPathParameter , registryPath , "-Name" , "eua_accepted_version" , "-Value" , "'1.2'" );
227
245
228
246
try {
229
247
Process p1 = pb1 .start ();
@@ -232,6 +250,8 @@ private static void makeSureAllTermsAndConditionsAreAccepted() {
232
250
p2 .waitFor ();
233
251
Process p3 = pb3 .start ();
234
252
p3 .waitFor ();
253
+ Process p4 = pb4 .start ();
254
+ p4 .waitFor ();
235
255
} catch (IOException | InterruptedException e ) {
236
256
LOGGER .log (Level .SEVERE , e .getMessage (), e );
237
257
Thread .currentThread ().interrupt ();
@@ -240,6 +260,18 @@ private static void makeSureAllTermsAndConditionsAreAccepted() {
240
260
}
241
261
}
242
262
263
+ private static void activateEvaluateForFree () {
264
+ String targetEvaluationKeysDir = System .getProperty ("user.dir" ) + "/build/idea-sandbox/config-uiTest/eval/" ;
265
+ createDirectoryHierarchy (targetEvaluationKeysDir );
266
+
267
+ for (String ideaVersionSubstring : new String []{"202" , "203" , "211" , "212" }) {
268
+ String keyFilename = "idea" + ideaVersionSubstring + ".evaluation.key" ;
269
+ String sourcePathToKey = "evaluate_for_free_keys/" + keyFilename ;
270
+ String targetPathToKey = targetEvaluationKeysDir + keyFilename ;
271
+ copyFileFromJarResourceDir (sourcePathToKey , targetPathToKey );
272
+ }
273
+ }
274
+
243
275
private static void waitUntilIntelliJStarts (int port ) {
244
276
waitFor (Duration .ofSeconds (600 ), Duration .ofSeconds (3 ), "The IntelliJ Idea did not start in 10 minutes." , () -> isIntelliJUIVisible (port ));
245
277
}
0 commit comments