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