[all] fixes for windows
This commit is contained in:
59
README.md
Normal file → Executable file
59
README.md
Normal file → Executable file
@@ -8,6 +8,7 @@
|
||||
* Universal project config for simple HaXe build and OpenFL build.
|
||||
* Branch project config for many build presets (many OpenFL apps in one project).
|
||||
* Packaging linux output in DEB.
|
||||
* Packaging windows output in exe install with InnoSetup.
|
||||
* Create html wrapper for flash output.
|
||||
|
||||
### Flaws
|
||||
@@ -15,9 +16,7 @@
|
||||
* Hardcode build output in {projectDir}/target (need param in Project.Config).
|
||||
* HTML5 run output not caught.
|
||||
* Adobe AIR Build System in progress.
|
||||
* Packaging Windows application in progress (with [Inno Setup](http://www.jrsoftware.org/isinfo.php))
|
||||
* OpenFL android build failed due to problems with Android NDK
|
||||
|
||||
* Windows target depends Visual Studio 2017 build tools
|
||||
|
||||
## API
|
||||
|
||||
@@ -60,10 +59,15 @@ create gulp tasks in module:
|
||||
<config.name>:<platform>:test
|
||||
|
||||
<config.name>:flash:html
|
||||
|
||||
<config.name>:linux:archive
|
||||
<config.name>:linux:deb
|
||||
|
||||
<config.name>:windows:archive
|
||||
<config.name>:windows:installer
|
||||
```
|
||||
|
||||
eg: ```gulp app:flash:build```
|
||||
eg: ```gulp app:flash:test```
|
||||
|
||||
## Example
|
||||
|
||||
@@ -75,12 +79,12 @@ eg: ```gulp app:flash:build```
|
||||
"devDependencies": {
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-haxetool": "^0.0.21"
|
||||
"gulp-haxetool": "^0.1.0"
|
||||
},
|
||||
"haxeDependencies": {
|
||||
"lime": "6.0.1",
|
||||
"openfl": "7.0.0",
|
||||
"hxcpp": "3.4.188"
|
||||
"lime": "7.6.0",
|
||||
"openfl": "8.9.2",
|
||||
"hxcpp": "4.0.19"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -108,7 +112,7 @@ class Main {
|
||||
const gulp = require('gulp');
|
||||
const gulpClean = require('gulp-clean');
|
||||
const packageInfo = require('./package.json');
|
||||
const {Sdk, Haxe, Project} = require('gulp-haxetool');
|
||||
const {System, Sdk, Haxe, Project} = require('gulp-haxetool');
|
||||
|
||||
//Sdk.dir = '/opt/sdk';
|
||||
|
||||
@@ -144,19 +148,38 @@ const project = new Project(
|
||||
Project.Platform.FLASH,
|
||||
Project.Platform.HTML5,
|
||||
Project.Platform.LINUX,
|
||||
Project.Platform.WINDOWS,
|
||||
],
|
||||
config
|
||||
).bind(module);
|
||||
|
||||
module.exports.default = gulp.series(
|
||||
|
||||
const defaultSeries = [
|
||||
exports.clean,
|
||||
exports.install,
|
||||
module.exports['app:flash:build'],
|
||||
module.exports['app:html5:build'],
|
||||
module.exports['app:linux:build'],
|
||||
module.exports['app:flash:html'],
|
||||
module.exports['app:linux:deb'],
|
||||
);
|
||||
module.exports['app:html5:build'],
|
||||
];
|
||||
|
||||
if (System.isLinux) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:linux:build'],
|
||||
module.exports['app:linux:archive'],
|
||||
module.exports['app:linux:deb'],
|
||||
|
||||
module.exports['app:android:build'],
|
||||
);
|
||||
}
|
||||
|
||||
if (System.isWindows) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:windows:build'],
|
||||
module.exports['app:windows:archive'],
|
||||
module.exports['app:windows:installer'],
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.default = gulp.series(defaultSeries);
|
||||
```
|
||||
|
||||
Build for all platforms: `gulp default`
|
||||
@@ -165,6 +188,10 @@ Build app for specific platform: `gulp app:flash:build`
|
||||
|
||||
Build and run flash app in flashplayer: `gulp app:flash:test`
|
||||
|
||||
Build and run html5 app in brpwser: `gulp app:html5:test`
|
||||
Build and run html5 app in browser: `gulp app:html5:test`
|
||||
|
||||
Build and run linux app native: `gulp app:linux:test`
|
||||
|
||||
Build and run windows app native: `gulp app:windows:test`
|
||||
|
||||
Build and run android app: `gulp app:android:test`
|
||||
|
||||
35
example/gulpfile.js
Normal file → Executable file
35
example/gulpfile.js
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
const gulp = require('gulp');
|
||||
const gulpClean = require('gulp-clean');
|
||||
const packageInfo = require('./package.json');
|
||||
const {Sdk, Haxe, Project} = require('gulp-haxetool');
|
||||
const {System, Sdk, Haxe, Project} = require('gulp-haxetool');
|
||||
|
||||
//Sdk.dir = '/opt/sdk';
|
||||
|
||||
@@ -37,16 +37,35 @@ const project = new Project(
|
||||
Project.Platform.FLASH,
|
||||
Project.Platform.HTML5,
|
||||
Project.Platform.LINUX,
|
||||
Project.Platform.WINDOWS,
|
||||
],
|
||||
config
|
||||
).bind(module, gulp);
|
||||
).bind(module);
|
||||
|
||||
module.exports.default = gulp.series(
|
||||
|
||||
const defaultSeries = [
|
||||
exports.clean,
|
||||
exports.install,
|
||||
module.exports['app:flash:build'],
|
||||
module.exports['app:html5:build'],
|
||||
module.exports['app:linux:build'],
|
||||
module.exports['app:flash:html'],
|
||||
module.exports['app:linux:deb'],
|
||||
);
|
||||
module.exports['app:html5:build'],
|
||||
];
|
||||
|
||||
if (System.isLinux) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:linux:build'],
|
||||
module.exports['app:linux:archive'],
|
||||
module.exports['app:linux:deb'],
|
||||
|
||||
module.exports['app:android:build'],
|
||||
);
|
||||
}
|
||||
|
||||
if (System.isWindows) {
|
||||
defaultSeries.push(
|
||||
module.exports['app:windows:build'],
|
||||
module.exports['app:windows:archive'],
|
||||
module.exports['app:windows:installer'],
|
||||
);
|
||||
}
|
||||
|
||||
module.exports.default = gulp.series(defaultSeries);
|
||||
|
||||
8
example/package.json
Normal file → Executable file
8
example/package.json
Normal file → Executable file
@@ -4,11 +4,11 @@
|
||||
"devDependencies": {
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-haxetool": "^0.0.21"
|
||||
"gulp-haxetool": "^0.1.0"
|
||||
},
|
||||
"haxeDependencies": {
|
||||
"lime": "6.0.1",
|
||||
"openfl": "7.0.0",
|
||||
"hxcpp": "3.4.188"
|
||||
"lime": "7.6.0",
|
||||
"openfl": "8.9.2",
|
||||
"hxcpp": "4.0.19"
|
||||
}
|
||||
}
|
||||
|
||||
4
haxetool/android.js
Normal file → Executable file
4
haxetool/android.js
Normal file → Executable file
@@ -2,8 +2,8 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const exec = require('./exec');
|
||||
const {StringWritable} = require('./tail');
|
||||
const System = require('./system');
|
||||
const Command = require('../run/command');
|
||||
|
||||
const through = require('through2');
|
||||
const Sdk = require('./sdk');
|
||||
const Env = require('./env');
|
||||
@@ -25,7 +25,7 @@ class Android extends Sdk {
|
||||
}
|
||||
|
||||
get link() {
|
||||
const system = Sdk.System.isWindows ? 'windows' : Sdk.System.isLinux ? 'linux' : null;
|
||||
const system = System.isWindows ? 'windows' : System.isLinux ? 'linux' : null;
|
||||
if (!system) throw 'Unsupported system';
|
||||
if (this.version.indexOf('.') > -1) {
|
||||
return `https://dl.google.com/android/repository/tools_r${this.version}-${system}.zip`;
|
||||
|
||||
@@ -4,6 +4,7 @@ const fse = require('fs-extra');
|
||||
const os = require('os');
|
||||
const through = require('through2');
|
||||
const Sdk = require('./sdk');
|
||||
const System = require('./system');
|
||||
const run = require('../run/index');
|
||||
const {TailVinyl} = require('./tail');
|
||||
|
||||
@@ -29,9 +30,9 @@ class FlashPlayer extends Sdk {
|
||||
|
||||
get link() {
|
||||
const baseUrl = `https://fpdownload.macromedia.com/pub/flashplayer/updaters/${this.version}/`;
|
||||
if (Sdk.System.isWindows) {
|
||||
if (System.isWindows) {
|
||||
return baseUrl + `flashplayer_${this.version}_sa${this.debug ? '_debug' : ''}.exe`;
|
||||
} else if (Sdk.System.isLinux) {
|
||||
} else if (System.isLinux) {
|
||||
return baseUrl + `flash_player_sa_linux${this.debug ? '_debug' : ''}.x86_64.tar.gz`;
|
||||
} else {
|
||||
throw `Unsupported os '${os.type()}'`;
|
||||
|
||||
@@ -4,6 +4,7 @@ const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
const exec = require('./exec');
|
||||
const Sdk = require('./sdk');
|
||||
const System = require('./system');
|
||||
const Env = require('./env');
|
||||
const Neko = require('./neko');
|
||||
const vfs = require('vinyl-fs');
|
||||
@@ -13,9 +14,9 @@ const rename = require('gulp-rename');
|
||||
class Haxe extends Sdk {
|
||||
|
||||
getBin(name) {
|
||||
if (Sdk.System.isWindows) {
|
||||
if (System.isWindows) {
|
||||
return path.join(this.path, name + '.exe');
|
||||
} else if (Sdk.System.isLinux) {
|
||||
} else if (System.isLinux) {
|
||||
const binPath = path.join(this.path, name);
|
||||
if (fs.existsSync(binPath)) {
|
||||
fs.chmodSync(binPath, 0o755);
|
||||
@@ -62,10 +63,10 @@ class Haxe extends Sdk {
|
||||
}
|
||||
|
||||
get link() {
|
||||
if (Sdk.System.isWindows) {
|
||||
if (System.isWindows) {
|
||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-win.zip`;
|
||||
} else if (Sdk.System.isLinux) {
|
||||
let arch = Sdk.System.archInt;
|
||||
} else if (System.isLinux) {
|
||||
let arch = System.archInt;
|
||||
return `https://github.com/HaxeFoundation/haxe/releases/download/${this.version}/haxe-${this.version}-linux${arch}.tar.gz`;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +141,7 @@ class Haxe extends Sdk {
|
||||
const target = path.resolve(buildDir, platform, 'bin');
|
||||
fse.emptyDirSync(target);
|
||||
for (const asset of config.assets) {
|
||||
fse.copySync(asset, path.join(target, asset.split(path.sep).pop()));
|
||||
fse.copySync(asset, path.join(target, asset.split("/").pop()));
|
||||
}
|
||||
return this.haxe(args).then(() => vfs.src(`${target}/**/*`));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ const os = require('os');
|
||||
const path = require('path');
|
||||
const Sdk = require('./sdk');
|
||||
const exec = require('./exec');
|
||||
const Env = require('./env');
|
||||
const template = require('lodash.template');
|
||||
|
||||
class InnoSetup extends Sdk {
|
||||
@@ -21,14 +20,14 @@ class InnoSetup extends Sdk {
|
||||
let result = super.prepare(strip);
|
||||
if (!this.prepared) {
|
||||
result = result.then(() => {
|
||||
return exec(this.path, 'is.exe /VERYSILENT /SUPPRESSMSGBOXES');
|
||||
return exec(this.path, `is.exe /VERYSILENT /SUPPRESSMSGBOXES /DIR=${this.path}`);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
get isccBin() {
|
||||
return path.join(Env.get('ProgramFiles(x86)'), `Inno Setup ${this.version}`, 'ISCC.exe')
|
||||
return path.join(this.path, 'ISCC.exe')
|
||||
}
|
||||
|
||||
get prepared() {
|
||||
|
||||
@@ -9,32 +9,6 @@ const progress = require('cli-progress');
|
||||
const fse = require('fs-extra');
|
||||
const Log = require('./log');
|
||||
|
||||
|
||||
class System {
|
||||
|
||||
static get isWindows() {
|
||||
return os.type() === 'Windows_NT';
|
||||
}
|
||||
|
||||
static get isLinux() {
|
||||
return os.type() === 'Linux';
|
||||
}
|
||||
|
||||
static get archInt() {
|
||||
if (os.arch() === 'ia32') return 32;
|
||||
if (os.arch() === 'x64') return 64;
|
||||
}
|
||||
|
||||
static get isArch32() {
|
||||
return this.archInt === 32;
|
||||
}
|
||||
|
||||
static get isArch64() {
|
||||
return this.archInt === 64;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Downloader {
|
||||
|
||||
static createProgressBar() {
|
||||
@@ -151,6 +125,5 @@ class Sdk {
|
||||
}
|
||||
|
||||
Sdk.Downloader = Downloader;
|
||||
Sdk.System = System;
|
||||
|
||||
module.exports = Sdk;
|
||||
|
||||
27
haxetool/system.js
Executable file
27
haxetool/system.js
Executable file
@@ -0,0 +1,27 @@
|
||||
const os = require('os');
|
||||
|
||||
class System {
|
||||
|
||||
static get isWindows() {
|
||||
return os.type() === 'Windows_NT';
|
||||
}
|
||||
|
||||
static get isLinux() {
|
||||
return os.type() === 'Linux';
|
||||
}
|
||||
|
||||
static get archInt() {
|
||||
if (os.arch() === 'ia32') return 32;
|
||||
if (os.arch() === 'x64') return 64;
|
||||
}
|
||||
|
||||
static get isArch32() {
|
||||
return this.archInt === 32;
|
||||
}
|
||||
|
||||
static get isArch64() {
|
||||
return this.archInt === 64;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = System;
|
||||
1
index.js
Normal file → Executable file
1
index.js
Normal file → Executable file
@@ -1,4 +1,5 @@
|
||||
module.exports = {
|
||||
System: require('./haxetool/system'),
|
||||
Sdk: require('./haxetool/sdk'),
|
||||
Haxe: require('./haxetool/haxe'),
|
||||
FlashPlayer: require('./haxetool/flashplayer'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gulp-haxetool",
|
||||
"version": "0.0.24",
|
||||
"version": "0.1.0",
|
||||
"description": "HaXe Tool for Gulp",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user