1
1
#! /usr/bin/env groovy
2
2
3
3
def installBuildRequirements (){
4
- def nodeHome = tool ' nodejs-12.13 .1'
4
+ def nodeHome = tool ' nodejs-14.19 .1'
5
5
env. PATH = " ${ env.PATH} :${ nodeHome} /bin"
6
6
sh " npm install -g typescript"
7
- sh ' npm install -g "vsce@<2 "'
7
+ sh ' npm install -g "vsce"'
8
8
}
9
9
10
10
def buildVscodeExtension (){
11
11
sh " npm install"
12
12
sh " npm run vscode:prepublish"
13
13
}
14
14
15
- node( ' rhel8 ' ) {
16
- stage ' Build JDT LS '
17
-
18
- env . JAVA_HOME = " ${ tool 'openjdk-11' } "
19
- env . PATH = " ${ env.JAVA_HOME } /bin: ${ env.PATH } "
20
- sh ' java -version '
21
-
22
- git url : ' https://github.com/eclipse/eclipse.jdt.ls.git '
23
- sh " ./mvnw clean verify -B -U -e -Pserver-distro -Dtycho.disableP2Mirrors=true -DskipTests -P!jboss-maven-repos,!redhat-ga-repository,!redhat-ea-repository "
24
-
25
- def files = findFiles( glob : ' **/org.eclipse.jdt.ls.product/distro/**.tar.gz ' )
26
- stash name : ' server_distro ' , includes :files[ 0 ] . path
15
+ def packageSpecificExtensions () {
16
+ stage " Package platform specific vscode-java "
17
+ def platforms = [ " win32-x64 " , " linux-x64 " , " linux-arm64 " , " darwin-x64 " , " darwin-arm64 " ]
18
+ def embeddedJRE = 17
19
+ for (platform in platforms){
20
+ sh " npx gulp download_jre --target ${ platform } --javaVersion ${ embeddedJRE } "
21
+ if (publishPreRelease . equals( ' true ' )) {
22
+ sh " vsce package --pre-release --target ${ platform } -o java- ${ platform } - ${ env.EXTENSION_VERSION } - ${ env.BUILD_NUMBER } .vsix "
23
+ } else {
24
+ sh " vsce package --target ${ platform } -o java- ${ platform } - ${ env.EXTENSION_VERSION } - ${ env.BUILD_NUMBER } .vsix "
25
+ }
26
+ }
27
27
}
28
28
29
- node(' rhel8' ){
30
- env. JAVA_HOME = " ${ tool 'openjdk-11'} "
31
- env. PATH = " ${ env.JAVA_HOME} /bin:${ env.PATH} "
32
- stage ' Checkout vscode-java code'
33
- deleteDir()
34
- git url : ' https://github.com/redhat-developer/vscode-java.git'
35
-
36
- stage ' install vscode-java build requirements'
37
- installBuildRequirements()
29
+ def packageExtensions () {
30
+ if (publishPreRelease. equals(' true' )) {
31
+ // for pre-release versions we only package platform specific extensions
32
+ stage " replace extension version"
33
+ sh " npx gulp prepare_pre_release"
38
34
39
- stage ' Build vscode-java'
40
- buildVscodeExtension()
41
- unstash ' server_distro'
42
- def files = findFiles(glob : ' **/org.eclipse.jdt.ls.product/distro/**.tar.gz' )
43
- sh " rm -rf ./out"
44
- sh " mkdir ./server"
45
- sh " tar -xvzf ${ files[0].path} -C ./server"
35
+ def packageJson = readJSON file : ' package.json'
36
+ env. EXTENSION_VERSION = " ${ packageJson.version} "
46
37
47
- stage " Package vscode-java"
48
- def packageJson = readJSON file : ' package.json'
49
- env. EXTENSION_VERSION = " ${ packageJson.version} "
50
- sh " vsce package -o java-${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
38
+ packageSpecificExtensions()
39
+ } else {
40
+ stage " package generic version"
41
+ def packageJson = readJSON file : ' package.json'
42
+ env. EXTENSION_VERSION = " ${ packageJson.version} "
51
43
52
- stage ' Test vscode-java for staging'
53
- wrap([$class : ' Xvnc' ]) {
54
- sh " npm run compile" // compile the test code too
55
- env. SKIP_COMMANDS_TEST = " true"
56
- sh " npm test --silent"
57
- }
44
+ sh " vsce package -o java-${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
58
45
59
- def vsix = findFiles(glob : ' **.vsix' )
60
- stash name :' vsix' , includes :vsix[0 ]. path
46
+ def vsix = findFiles(glob : ' **.vsix' )
47
+ stash name :' vsix' , includes :vsix[0 ]. path
61
48
62
- // Package platform specific versions
63
- stage " Package platform specific vscode-java"
64
- def platforms = [" win32-x64" , " linux-x64" , " linux-arm64" , " darwin-x64" , " darwin-arm64" ]
65
- def embeddedJRE = 17
66
- for (platform in platforms){
67
- sh " npx gulp download_jre --target ${ platform} --javaVersion ${ embeddedJRE} "
68
- sh " vsce package --target ${ platform} -o java-${ platform} -${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
69
- }
70
- stash name :' platformVsix' , includes :' java-win32-*.vsix,java-linux-*.vsix,java-darwin-*.vsix'
49
+ packageSpecificExtensions()
50
+ stash name :' platformVsix' , includes :' java-win32-*.vsix,java-linux-*.vsix,java-darwin-*.vsix'
71
51
72
- stage ' Upload vscode-java to staging'
73
- def artifactDir = " java-${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} "
74
- sh " mkdir ${ artifactDir} "
75
- sh " mv *.vsix ${ artifactDir} "
52
+ stage ' Upload vscode-java to staging'
53
+ def artifactDir = " java-${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} "
54
+ sh " mkdir ${ artifactDir} "
55
+ sh " mv *.vsix ${ artifactDir} "
76
56
77
- sh " sftp ${ UPLOAD_LOCATION} /jdt.ls/staging <<< \$ 'mkdir ${ artifactDir} \n put -r ${ artifactDir} '"
78
- // Clean up build vsix
79
- sh " rm -rf ${ artifactDir} "
57
+ sh " sftp ${ UPLOAD_LOCATION} /jdt.ls/staging <<< \$ 'mkdir ${ artifactDir} \n put -r ${ artifactDir} '"
58
+ // Clean up build vsix
59
+ sh " rm -rf ${ artifactDir} "
60
+ }
80
61
}
81
62
82
- node(' rhel8' ){
83
- if (publishToMarketPlace. equals(' true' )){
63
+ def publishExtensions () {
64
+ if (publishPreRelease. equals(' true' )) {
65
+ stage " publish generic version"
66
+ withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
67
+ sh ' vsce publish --pre-release -p ${TOKEN} --target win32-ia32 win32-arm64 linux-armhf alpine-x64 alpine-arm64'
68
+ }
69
+
70
+ stage " publish specific version"
71
+ // for pre-release versions, vsixs are not stashed and kept in project folder
72
+ withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
73
+ def platformVsixes = findFiles(glob : ' **.vsix' )
74
+ for (platformVsix in platformVsixes){
75
+ sh ' vsce publish -p ${TOKEN}' + " --packagePath ${ platformVsix.path} "
76
+ }
77
+ }
78
+ } else if (publishToMarketPlace. equals(' true' )) {
84
79
timeout(time :5 , unit :' DAYS' ) {
85
80
input message :' Approve deployment?' , submitter : ' fbricon,rgrunber'
86
81
}
@@ -89,7 +84,7 @@ node('rhel8'){
89
84
unstash ' vsix'
90
85
def vsix = findFiles(glob : ' **.vsix' )
91
86
// Open-vsx Marketplace
92
- sh ' npm install -g "ovsx@<0.3.0 "'
87
+ sh ' npm install -g "ovsx"'
93
88
withCredentials([[$class : ' StringBinding' , credentialsId : ' open-vsx-access-token' , variable : ' OVSX_TOKEN' ]]) {
94
89
sh ' ovsx publish -p ${OVSX_TOKEN}' + " ${ vsix[0].path} "
95
90
}
@@ -119,5 +114,49 @@ node('rhel8'){
119
114
120
115
// copy this stable build to Akamai-mirrored /static/ URL, so staging can be cleaned out more easily
121
116
sh " sftp ${ UPLOAD_LOCATION} /static/jdt.ls/stable/ <<< \$ 'mkdir ${ artifactDir} \n put -r ${ artifactDir} '"
122
- }// if publishToMarketPlace
117
+ }
118
+ }
119
+
120
+ node(' rhel8' ){
121
+ stage ' Build JDT LS'
122
+
123
+ env. JAVA_HOME = " ${ tool 'openjdk-11'} "
124
+ env. PATH = " ${ env.JAVA_HOME} /bin:${ env.PATH} "
125
+ sh ' java -version'
126
+
127
+ git url : ' https://github.com/eclipse/eclipse.jdt.ls.git'
128
+ sh " ./mvnw clean verify -B -U -e -Pserver-distro -Dtycho.disableP2Mirrors=true -DskipTests -P!jboss-maven-repos,!redhat-ga-repository,!redhat-ea-repository"
129
+
130
+ def files = findFiles(glob : ' **/org.eclipse.jdt.ls.product/distro/**.tar.gz' )
131
+ stash name : ' server_distro' , includes :files[0 ]. path
132
+ }
133
+
134
+ node(' rhel8' ){
135
+ env. JAVA_HOME = " ${ tool 'openjdk-11'} "
136
+ env. PATH = " ${ env.JAVA_HOME} /bin:${ env.PATH} "
137
+ stage ' Checkout vscode-java code'
138
+ deleteDir()
139
+ git url : ' https://github.com/redhat-developer/vscode-java.git'
140
+
141
+ stage ' install vscode-java build requirements'
142
+ installBuildRequirements()
143
+
144
+ stage ' Build vscode-java'
145
+ buildVscodeExtension()
146
+ unstash ' server_distro'
147
+ def files = findFiles(glob : ' **/org.eclipse.jdt.ls.product/distro/**.tar.gz' )
148
+ sh " rm -rf ./out"
149
+ sh " mkdir ./server"
150
+ sh " tar -xvzf ${ files[0].path} -C ./server"
151
+
152
+ stage ' Test vscode-java for staging'
153
+ wrap([$class : ' Xvnc' ]) {
154
+ sh " npm run compile" // compile the test code too
155
+ env. SKIP_COMMANDS_TEST = " true"
156
+ sh " npm test --silent"
157
+ }
158
+
159
+ packageExtensions()
160
+
161
+ publishExtensions()
123
162
}
0 commit comments