Skip to content

Commit

Permalink
Merge pull request #893 from ubports/refactor-0.3.0-beta
Browse files Browse the repository at this point in the history
Refactor 0.3.0-beta and 0.3.1-beta
  • Loading branch information
NeoTheThird authored Oct 5, 2019
2 parents f368b7b + a4644ce commit d554e70
Show file tree
Hide file tree
Showing 27 changed files with 2,262 additions and 3,437 deletions.
30 changes: 21 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@ pipeline {
stages {
stage('Install') {
steps {
sh 'curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash'
sh 'chmod +x "$HOME/.nvm/nvm.sh"'
sh '$HOME/.nvm/nvm.sh install 8'
sh 'npm install'
sh 'npm prune'
script {
try {
sh 'curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash'
sh 'chmod +x "$HOME/.nvm/nvm.sh"'
sh '$HOME/.nvm/nvm.sh install 8'
sh 'npm install'
sh 'npm prune'
} catch (e) {
echo e
}
}
}
}
stage('Build') {
steps {
sh 'npm run dist:linux:deb'
sh 'npm run dist:linux:appimage'
sh 'npm run dist:linux:snap'
sh 'mv ./*.snap ./dist/.'
script {
try {
sh 'npm run dist:linux:deb'
sh 'npm run dist:linux:appimage'
sh 'npm run dist:linux:snap'
sh 'mv ./*.snap ./dist/.'
} catch (e) {
echo e
}
}
}
}
}
Expand Down
33 changes: 11 additions & 22 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Author: Marius Gripsgard <[email protected]>

const builder = require("electron-builder")
const cli = require("commander");
const utils = require("./src/utils");
const unzip = require("unzipper");
const path = require("path");
const fs = require("fs-extra");
const download = require('download');
const events = require("events");
class event extends events {}
const Platform = builder.Platform
Expand Down Expand Up @@ -142,8 +142,12 @@ switch (cli.package) {
case "":
break;
default:
console.log("Building " + cli.package + " is not configured!");
process.exit(1);
if (!cli.downloadOnly) {
console.log("Building " + cli.package + " is not configured!");
process.exit(1);
} else {
break;
}
}

var build = () => {
Expand Down Expand Up @@ -175,31 +179,16 @@ var build = () => {

// Download platform tools
if (cli.platformTools) {
const downloadEvent = new event();
utils.downloadFiles(getAndroidPlatformTools(), downloadEvent);
downloadEvent.on("download:done", () => {
download(getAndroidPlatformTools()[0].url,getAndroidPlatformTools()[0].path).then(() => {
console.log('files downloaded!');
extractPlatformTools(getAndroidPlatformTools(), () => {
console.log("Platform tools downloaded successfully!");
if (!cli.downloadOnly) build();
});
});
downloadEvent.on("download:error", (r) => {
console.log("Download error " + r);
}).catch(() => {
console.error("Failed to download files!")
process.exit(1);
});
downloadEvent.on("error", (r) => {
console.log("Error: " + r);
process.exit(1);
});
downloadEvent.on("download:start", (r) => {
console.log("Starting download of " + r + " files");
});
downloadEvent.on("download:next", (i) => {
console.log(`Downloading next file, ${i} left`);
});
downloadEvent.on("download:progress", (i) => {
process.stdout.write(`Downloading file, ${Math.ceil(i.percent*100)}% complete\r`);
});
} else {
build();
}
2 changes: 1 addition & 1 deletion buildconfig-generic.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"appId": "com.ubports.installer",
"productName": "ubports-installer",
"copyright": "Copyright © year UBports Foundation",
"copyright": "Copyright © 2017-2019 UBports Foundation",
"publish": [],
"files": [
"src/**/*",
Expand Down
Loading

0 comments on commit d554e70

Please sign in to comment.