@@ -46,85 +46,18 @@ export class IDEService {
46
46
return this . ideService . resolveWorkspaceConfig ( req ) ;
47
47
}
48
48
49
- resolveGitpodTasks ( ws : Workspace ) : TaskConfig [ ] {
49
+ resolveGitpodTasks ( ws : Workspace , ideConfig : IDEConfig ) : TaskConfig [ ] {
50
50
const tasks : TaskConfig [ ] = [ ] ;
51
51
if ( ws . config . tasks ) {
52
52
tasks . push ( ...ws . config . tasks ) ;
53
53
}
54
- // TODO(ak) it is a hack to get users going, we should rather layer JB products on prebuild workspaces and move logic to corresponding images
55
- if ( ws . type === "prebuild" && ws . config . jetbrains ) {
56
- let warmUp = "" ;
57
- for ( const key in ws . config . jetbrains ) {
58
- let productCode ;
59
- if ( key === "intellij" ) {
60
- productCode = "IIU" ;
61
- } else if ( key === "goland" ) {
62
- productCode = "GO" ;
63
- } else if ( key === "pycharm" ) {
64
- productCode = "PCP" ;
65
- } else if ( key === "phpstorm" ) {
66
- productCode = "PS" ;
67
- } else if ( key === "rubymine" ) {
68
- productCode = "RM" ;
69
- } else if ( key === "webstorm" ) {
70
- productCode = "WS" ;
71
- } else if ( key === "rider" ) {
72
- productCode = "RD" ;
73
- } else if ( key === "clion" ) {
74
- productCode = "CL" ;
75
- }
76
- const prebuilds = productCode && ws . config . jetbrains [ key as keyof JetBrainsConfig ] ?. prebuilds ;
77
- if ( prebuilds ) {
78
- warmUp +=
79
- prebuilds . version === "latest"
80
- ? ""
81
- : `
82
- echo 'warming up stable release of ${ key } ...'
83
- echo 'downloading stable ${ key } backend...'
84
- mkdir /tmp/backend
85
- curl -sSLo /tmp/backend/backend.tar.gz "https://download.jetbrains.com/product?type=release&distribution=linux&code=${ productCode } "
86
- tar -xf /tmp/backend/backend.tar.gz --strip-components=1 --directory /tmp/backend
87
-
88
- echo 'configuring JB system config and caches aligned with runtime...'
89
- printf '\nshared.indexes.download.auto.consent=true' >> "/tmp/backend/bin/idea.properties"
90
- unset JAVA_TOOL_OPTIONS
91
- export IJ_HOST_CONFIG_BASE_DIR=/workspace/.config/JetBrains
92
- export IJ_HOST_SYSTEM_BASE_DIR=/workspace/.cache/JetBrains
93
-
94
- echo 'running stable ${ key } backend in warmup mode...'
95
- /tmp/backend/bin/remote-dev-server.sh warmup "$GITPOD_REPO_ROOT"
96
-
97
- echo 'removing stable ${ key } backend...'
98
- rm -rf /tmp/backend
99
- ` ;
100
- warmUp +=
101
- prebuilds . version === "stable"
102
- ? ""
103
- : `
104
- echo 'warming up latest release of ${ key } ...'
105
- echo 'downloading latest ${ key } backend...'
106
- mkdir /tmp/backend-latest
107
- curl -sSLo /tmp/backend-latest/backend-latest.tar.gz "https://download.jetbrains.com/product?type=release,eap,rc&distribution=linux&code=${ productCode } "
108
- tar -xf /tmp/backend-latest/backend-latest.tar.gz --strip-components=1 --directory /tmp/backend-latest
109
-
110
- echo 'configuring JB system config and caches aligned with runtime...'
111
- printf '\nshared.indexes.download.auto.consent=true' >> "/tmp/backend-latest/bin/idea.properties"
112
- unset JAVA_TOOL_OPTIONS
113
- export IJ_HOST_CONFIG_BASE_DIR=/workspace/.config/JetBrains-latest
114
- export IJ_HOST_SYSTEM_BASE_DIR=/workspace/.cache/JetBrains-latest
115
-
116
- echo 'running ${ key } backend in warmup mode...'
117
- /tmp/backend-latest/bin/remote-dev-server.sh warmup "$GITPOD_REPO_ROOT"
118
-
119
- echo 'removing latest ${ key } backend...'
120
- rm -rf /tmp/backend-latest
121
- ` ;
122
- }
123
- }
124
- if ( warmUp ) {
125
- tasks . push ( {
126
- init : warmUp . trim ( ) ,
127
- } ) ;
54
+ if ( ideConfig . tasks ) {
55
+ try {
56
+ let ideTasks : TaskConfig [ ] = JSON . parse ( ideConfig . tasks ) ;
57
+ tasks . push ( ...ideTasks ) ;
58
+ } catch ( e ) {
59
+ console . error ( "failed get tasks from ide config:" , e ) ;
60
+ // shall we throw?
128
61
}
129
62
}
130
63
return tasks ;
0 commit comments