@@ -5,6 +5,7 @@ def installBuildRequirements(){
5
5
env. PATH = " ${ env.PATH} :${ nodeHome} /bin"
6
6
sh " npm install -g typescript"
7
7
sh ' npm install -g "vsce"'
8
+ sh ' npm install -g "ovsx"'
8
9
}
9
10
10
11
def buildVscodeExtension (){
@@ -23,33 +24,27 @@ def packageSpecificExtensions() {
23
24
def embeddedJRE = 17
24
25
for (platform in platforms){
25
26
sh " npx gulp download_jre --target ${ platform} --javaVersion ${ embeddedJRE} "
26
- if (publishPreRelease. equals(' true' )) {
27
- sh " vsce package --pre-release --target ${ platform} -o java-${ platform} -${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
28
- } else {
29
- sh " vsce package --target ${ platform} -o java-${ platform} -${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
30
- }
27
+ sh " vsce package ${ env.publishPreReleaseFlag} --target ${ platform} -o java-${ platform} -${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
31
28
}
32
29
}
33
30
34
31
def packageExtensions () {
32
+ env. publishPreReleaseFlag = " "
35
33
if (publishPreRelease. equals(' true' )) {
36
- // for pre-release versions we only package platform specific extensions
37
34
stage " replace extension version"
38
35
sh " npx gulp prepare_pre_release"
39
36
40
37
def packageJson = readJSON file : ' package.json'
41
38
env. EXTENSION_VERSION = " ${ packageJson.version} "
39
+ env. publishPreReleaseFlag = " --pre-release"
42
40
43
41
packageSpecificExtensions()
44
42
} else {
45
43
stage " package generic version"
46
44
def packageJson = readJSON file : ' package.json'
47
45
env. EXTENSION_VERSION = " ${ packageJson.version} "
48
46
49
- sh " vsce package -o java-${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
50
-
51
- def vsix = findFiles(glob : ' **.vsix' )
52
- stash name :' vsix' , includes :vsix[0 ]. path
47
+ sh " vsce package ${ env.publishPreReleaseFlag} -o java-${ env.EXTENSION_VERSION} -${ env.BUILD_NUMBER} .vsix"
53
48
54
49
packageSpecificExtensions()
55
50
stash name :' platformVsix' , includes :' java-win32-*.vsix,java-linux-*.vsix,java-darwin-*.vsix'
@@ -62,57 +57,48 @@ def packageExtensions() {
62
57
sh " sftp ${ UPLOAD_LOCATION} /jdt.ls/staging <<< \$ 'mkdir ${ artifactDir} \n put -r ${ artifactDir} '"
63
58
// Clean up build vsix
64
59
sh " rm -rf ${ artifactDir} "
60
+ unstash ' platformVsix'
65
61
}
66
62
}
67
63
68
64
def publishExtensions () {
69
- if (publishPreRelease. equals(' true' )) {
70
- stage " publish generic version"
71
- withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
72
- // Clean up embedded jre folder from previous build
73
- sh ' npx gulp clean_jre'
74
- // Publish a generic version
75
- sh ' vsce publish --pre-release -p ${TOKEN} --target win32-ia32 win32-arm64 linux-armhf alpine-x64 alpine-arm64'
76
- }
65
+ // Clean up embedded jre folder from previous build
66
+ sh ' npx gulp clean_jre'
77
67
78
- stage " publish specific version"
79
- // for pre-release versions, vsixs are not stashed and kept in project folder
80
- withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
81
- def platformVsixes = findFiles(glob : ' **.vsix' )
82
- for (platformVsix in platformVsixes){
83
- sh ' vsce publish -p ${TOKEN}' + " --packagePath ${ platformVsix.path} "
84
- }
85
- }
86
- } else if (publishToMarketPlace. equals(' true' )) {
68
+ if (publishToMarketPlace. equals(' true' ) || publishToOVSX. equals(' true' )) {
87
69
timeout(time :5 , unit :' DAYS' ) {
88
70
input message :' Approve deployment?' , submitter : ' fbricon,rgrunber'
89
71
}
72
+ }
90
73
91
- stage " Publish to Open-vsx Marketplace"
92
- unstash ' vsix'
93
- def vsix = findFiles(glob : ' **.vsix' )
94
- // Open-vsx Marketplace
95
- sh ' npm install -g "ovsx"'
96
- withCredentials([[$class : ' StringBinding' , credentialsId : ' open-vsx-access-token' , variable : ' OVSX_TOKEN' ]]) {
97
- sh ' ovsx publish -p ${OVSX_TOKEN}' + " ${ vsix[0].path} "
74
+ def platformVsixes = findFiles(glob : ' **.vsix' )
75
+
76
+ stage " publish generic version to VS Code Marketplace"
77
+ withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
78
+ sh ' vsce publish -p ${TOKEN} --target win32-ia32 win32-arm64 linux-armhf alpine-x64 alpine-arm64' + " ${ env.publishPreReleaseFlag} "
79
+ }
80
+
81
+ stage " publish specific version to VS Code Marketplace"
82
+
83
+ withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
84
+ for (platformVsix in platformVsixes){
85
+ sh ' vsce publish -p ${TOKEN}' + " --packagePath ${ platformVsix.path} "
98
86
}
87
+ }
99
88
100
- stage " Publish to VS Code Marketplace"
101
- // VS Code Marketplace
102
- withCredentials([[$class : ' StringBinding' , credentialsId : ' vscode_java_marketplace' , variable : ' TOKEN' ]]) {
103
- // Clean up embedded jre folder from previous build
104
- sh ' npx gulp clean_jre'
105
- // Publish a generic version
106
- sh ' vsce publish -p ${TOKEN} --target win32-ia32 win32-arm64 linux-armhf alpine-x64 alpine-arm64'
107
-
108
- // Publish platform specific versions
109
- unstash ' platformVsix'
110
- def platformVsixes = findFiles(glob : ' **.vsix' , excludes : vsix[0 ]. path)
111
- for (platformVsix in platformVsixes){
112
- sh ' vsce publish -p ${TOKEN}' + " --packagePath ${ platformVsix.path} "
113
- }
89
+ stage " Publish generic version to Open-VSX Marketplace"
90
+ withCredentials([[$class : ' StringBinding' , credentialsId : ' open-vsx-access-token' , variable : ' OVSX_TOKEN' ]]) {
91
+ sh ' ovsx publish -p ${OVSX_TOKEN} --target win32-ia32 win32-arm64 linux-armhf alpine-x64 alpine-arm64' + " ${ env.publishPreReleaseFlag} "
92
+ }
93
+
94
+ stage " Publish specific version to Open-VSX Marketplace"
95
+ withCredentials([[$class : ' StringBinding' , credentialsId : ' open-vsx-access-token' , variable : ' OVSX_TOKEN' ]]) {
96
+ for (platformVsix in platformVsixes){
97
+ sh ' ovsx publish -p ${OVSX_TOKEN}' + " --packagePath ${ platformVsix.path} "
114
98
}
99
+ }
115
100
101
+ if (publishToMarketPlace. equals(' true' ) || publishToOVSX. equals(' true' )) {
116
102
stage " Publish to http://download.jboss.org/jbosstools/static/jdt.ls/stable/"
117
103
def artifactDir = " java-${ env.EXTENSION_VERSION} "
118
104
sh " mkdir ${ artifactDir} "
@@ -168,5 +154,7 @@ node('rhel8'){
168
154
169
155
packageExtensions()
170
156
171
- publishExtensions()
157
+ if (publishPreRelease. equals(' true' ) || publishToMarketPlace. equals(' true' ) || publishToOVSX. equals(' true' )) {
158
+ publishExtensions()
159
+ }
172
160
}
0 commit comments