Skip to content

Commit

Permalink
Package and publish platform specific extensions.
Browse files Browse the repository at this point in the history
- Create platform specific vsix files for linux-x64, darwin-x64 &
  win32-x64
- Add 'build_server_with_binary' gulpfile task

Signed-off-by: Roland Grunberg <[email protected]>
  • Loading branch information
rgrunber committed Jun 25, 2022
1 parent dff3831 commit 1ad2e0c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 14 deletions.
35 changes: 22 additions & 13 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,33 +56,40 @@ node('rhel8'){
sh "sed -i -e 's|${downloadLocation}/releases/download/latest|${downloadLocation}/releases/download/${packageJson.version}|g' package.json"
}

stage 'package binary hashes'
sh "mkdir ./server"
unstash name: 'checksums'
sh "cp lemminx-*.sha256 ./server"

stage 'install vscode-xml build requirements'
installBuildRequirements()

stage 'Build vscode-xml'
buildVscodeExtension()
unstash 'server_distro'
def files = findFiles(glob: '**/org.eclipse.lemminx*-uber.jar')
sh "mkdir ./server"
sh "mv ${files[0].path} ./server"

stage "Package vscode-xml"
sh "mkdir ../staging"
unstash 'binaries'
unstash 'checksums'
sh "mv lemminx-* ../staging"
def platformToTarget = [ "linux" : "linux-x64", "win32" : "win32-x64", "osx-x86_64" : "darwin-x64" ]
for(entry in platformToTarget){
def platform = entry.key
def target = entry.value
sh "unzip -d ./server ../staging/lemminx-${platform}.zip"
sh "cp ../staging/lemminx-${platform}.sha256 ./server"
sh "vsce package --target ${target} -o vscode-xml-${target}-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
sh "rm ./server/lemminx-*"
}
sh "vsce package -o vscode-xml-${packageJson.version}-${env.BUILD_NUMBER}.vsix"

//stage 'Test vscode-xml for staging'
//wrap([$class: 'Xvnc']) {
// sh "npm test --silent"
//}

stage 'Upload to /vscode-xml/staging'
def vsix = findFiles(glob: '**.vsix')
unstash 'binaries'
archiveArtifacts artifacts: 'lemminx-*.zip,*.sha256,*.vsix'
stash name:'vsix', includes:vsix[0].path
stage 'Archive artifacts'
archiveArtifacts artifacts: '*.vsix'
stash name:'vsix', includes:'*.vsix'
}

node('rhel8'){
Expand All @@ -96,7 +103,11 @@ node('rhel8'){
def vsix = findFiles(glob: '**.vsix')
// VS Code Marketplace
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
def platformVsixes = findFiles(glob: '**.vsix', excludes: vsix[0].path)
for(platformVsix in platformVsixes){
sh 'vsce publish -p ${TOKEN}' + " --packagePath ${platformVsix.path}"
}
sh 'vsce publish -p ${TOKEN} --target win32-ia32 win32-arm64 linux-arm64 linux-armhf alpine-x64 alpine-arm64 darwin-arm64 --packagePath' + " ${vsix[0].path}"
}

// Open-vsx Marketplace
Expand All @@ -105,7 +116,5 @@ node('rhel8'){
sh 'ovsx publish -p ${OVSX_TOKEN}' + " ${vsix[0].path}"
}

stage "Upload to /vscode-xml/stable"
// copy this stable build to Akamai-mirrored /static/ URL, so staging can be cleaned out more easily
}// if publishToMarketPlace
}
18 changes: 18 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const gulp = require('gulp');
const gulp_tslint = require('gulp-tslint');
const cp = require('child_process');
const server_dir = '../lemminx';
const fse = require('fs-extra');
const glob = require('glob');

gulp.task('tslint', () => {
return gulp.src(['**/*.ts', '!**/*.d.ts', '!node_modules/**'])
Expand All @@ -17,6 +19,22 @@ gulp.task('build_server', function(done) {
done();
});

gulp.task('build_server_with_binary', function(done) {
cp.execSync(mvnw()+ " clean verify -DskipTests -Dnative", {cwd:server_dir, stdio:[0,1,2]} );
gulp.src([server_dir +'/org.eclipse.lemminx/target/org.eclipse.lemminx-uber.jar', server_dir +'/org.eclipse.lemminx/target/lemminx-*'])
.pipe(gulp.dest('./server'))
.on('end', function () {
glob.Glob('./server/lemminx-*.txt', (_er, txtfiles) => {
fse.removeSync(txtfiles[0]);
glob.Glob('./server/lemminx-*-*', (_err, binfiles) => {
fse.moveSync(binfiles[0], './server/lemminx-' + (isWin() ? 'win32.exe' : (isMac() ? 'osx-x86_64' : 'linux')), { overwrite: true });
});
});
});
done();
});


function isWin() {
return /^win/.test(process.platform);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}
},
"engines": {
"vscode": "^1.52.0"
"vscode": "^1.61.0"
},
"activationEvents": [
"onLanguage:xml",
Expand Down

0 comments on commit 1ad2e0c

Please sign in to comment.