Compare commits
5
Commits
bbb1d062f1
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f59ef2893e | ||
|
|
6a887d10ff | ||
|
|
6940c65b88 | ||
|
|
0a355ee680 | ||
|
|
bb6d82d538 |
@@ -1,29 +0,0 @@
|
||||
## v0.2.0 (2026-05-15)
|
||||
|
||||
### Feat
|
||||
|
||||
- **ruffle**: add alternative ruffle flash target runner
|
||||
|
||||
## 0.1.9 (2021-05-24)
|
||||
|
||||
### Feat
|
||||
|
||||
- **android**: up android sdk version
|
||||
|
||||
## 0.1.8 (2020-03-30)
|
||||
|
||||
## 0.1.7 (2020-03-25)
|
||||
|
||||
## 0.1.6 (2020-02-19)
|
||||
|
||||
## 0.1.5 (2020-02-18)
|
||||
|
||||
## 0.1.0 (2019-09-03)
|
||||
|
||||
## 0.0.18 (2019-05-20)
|
||||
|
||||
## 0.0.17 (2019-03-28)
|
||||
|
||||
## 0.0.16 (2019-03-14)
|
||||
|
||||
## 0.0.15 (2019-03-14)
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "gulp-haxetool",
|
||||
"version": "2.0.4",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gulp-haxetool",
|
||||
"version": "2.0.4",
|
||||
"version": "2.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ajv": "^8.20.0",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "gulp-haxetool",
|
||||
"type": "module",
|
||||
"version": "2.0.4",
|
||||
"version": "2.1.0",
|
||||
"description": "HaXe Tool with Gulp",
|
||||
"exports": {
|
||||
"./bin/cli": "./dist/bin/cli.mjs",
|
||||
|
||||
+2
-2
@@ -84,8 +84,8 @@ export const branch = (config: Config, source: ConfigSource | Config): Config =>
|
||||
if (source.haxe !== undefined) {
|
||||
result.haxe = source.haxe;
|
||||
}
|
||||
if (result.meta.icon) {
|
||||
result.icon = absolutePath(result.meta.icon);
|
||||
if (result.icon) {
|
||||
result.icon = absolutePath(result.icon);
|
||||
}
|
||||
|
||||
if (!result.meta.mobileWidth) {
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ export interface LibDef {
|
||||
export interface ConfigMeta {
|
||||
title?: string;
|
||||
filename?: string;
|
||||
icon?: string;
|
||||
version?: string;
|
||||
pack?: string;
|
||||
author?: string;
|
||||
@@ -74,7 +73,7 @@ export interface Config {
|
||||
libs: LibDef[];
|
||||
macros: string[];
|
||||
flags: string[];
|
||||
icon: string | null;
|
||||
icon: string;
|
||||
meta: ConfigMeta;
|
||||
key: SignKey | null;
|
||||
android: AndroidPreset[];
|
||||
|
||||
@@ -25,13 +25,10 @@ export class HaxeBuilder extends Builder {
|
||||
.then(() => this.android.activate())
|
||||
.then(() =>
|
||||
this.android.sdkmanager([
|
||||
// ToDo: android sdk dependencies config?
|
||||
//'tools',
|
||||
// TODO: android sdk dependencies config?
|
||||
"platform-tools",
|
||||
"build-tools;27.0.3",
|
||||
"platforms;android-28", //ToDo: lime version 7.6.0 -> 28; 7.0.0 -> 26
|
||||
//'ndk-bundle',
|
||||
//'lldb;3.1',
|
||||
"platforms;android-28",
|
||||
"cmake;3.6.4111459",
|
||||
]),
|
||||
);
|
||||
|
||||
@@ -8,6 +8,12 @@ import template from "../../../../common/template";
|
||||
import { type Config, Platform } from "../../../../core/type";
|
||||
import { Packer } from "../../../core/packer";
|
||||
|
||||
const UPDATE_MENUS = `
|
||||
if [ "$1" = "configure" ] && [ -x "\`which update-menus 2>/dev/null\`" ] ; then
|
||||
update-menus
|
||||
fi
|
||||
`;
|
||||
|
||||
export class LinuxDEBPacker extends Packer {
|
||||
static NAME = "deb";
|
||||
|
||||
@@ -18,7 +24,7 @@ export class LinuxDEBPacker extends Packer {
|
||||
call() {
|
||||
const target = this.targetPath;
|
||||
const buildDir = path.join(os.tmpdir(), "build", this.config.name, "debian");
|
||||
const icon = this.config.meta.icon!;
|
||||
const icon = this.config.icon;
|
||||
const iconfile = `${this.config.meta.filename}${path.extname(icon)}`;
|
||||
const desktop = template.render("linux/app.desktop", { iconfile: iconfile, ...this.config });
|
||||
fse.ensureDirSync(`${buildDir}/usr/share/applications`);
|
||||
@@ -35,11 +41,7 @@ export class LinuxDEBPacker extends Packer {
|
||||
maintainer: this.config.meta.author,
|
||||
description: this.config.meta.title,
|
||||
changelog: [],
|
||||
postinst: [
|
||||
'if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ] ; then\n' +
|
||||
" update-menus\n" +
|
||||
"fi",
|
||||
],
|
||||
postinst: [UPDATE_MENUS],
|
||||
_target: "/",
|
||||
_out: this.resolveTargetPath("debian"),
|
||||
_clean: true,
|
||||
|
||||
+5
-11
@@ -1,6 +1,6 @@
|
||||
import { branch, compile } from "../core/config";
|
||||
import type { Config } from "../core/type";
|
||||
import type { TaskBundle, TaskCompilerType } from "./core";
|
||||
import type { TaskCompilerType, TaskDef } from "./core";
|
||||
import { CleanTaskCompiler } from "./impl/clean";
|
||||
import { FormatTaskCompiler } from "./impl/format";
|
||||
import { ProjectTaskCompiler } from "./impl/project";
|
||||
@@ -10,20 +10,14 @@ import { SetupTaskCompiler } from "./impl/setup";
|
||||
const COMPILERS: TaskCompilerType[] = [FormatTaskCompiler, CleanTaskCompiler, SetupTaskCompiler, ProtoTaskCompiler];
|
||||
const PROJECT_COMPILERS: TaskCompilerType[] = [ProjectTaskCompiler];
|
||||
|
||||
export default (projects: Config[]): TaskBundle => {
|
||||
const bundle: TaskBundle = {};
|
||||
export default function* (projects: Config[]): Iterable<TaskDef> {
|
||||
const config = projects.reduce((config, project) => branch(config, project), compile({}));
|
||||
for (const compiler of COMPILERS) {
|
||||
for (const [name, task] of Object.entries(new compiler(config).compile())) {
|
||||
bundle[name] = task;
|
||||
}
|
||||
yield* new compiler(config).compile();
|
||||
}
|
||||
for (const compiler of PROJECT_COMPILERS) {
|
||||
for (const project of projects) {
|
||||
for (const [name, task] of Object.entries(new compiler(project).compile())) {
|
||||
bundle[name] = task;
|
||||
yield* new compiler(project).compile();
|
||||
}
|
||||
}
|
||||
}
|
||||
return bundle;
|
||||
};
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,22 +1,22 @@
|
||||
import type { TaskFunction } from "gulp";
|
||||
import type { Config } from "../core/type";
|
||||
|
||||
export type TaskBundle = Record<string, TaskFunction>;
|
||||
|
||||
export interface TaskCompiler {
|
||||
config: Config;
|
||||
debug?: boolean;
|
||||
|
||||
compile(): TaskBundle;
|
||||
compile(): Iterable<TaskDef>;
|
||||
}
|
||||
|
||||
export type TaskDef = readonly [string, TaskFunction] | readonly [string, TaskFunction, boolean];
|
||||
|
||||
export abstract class TaskCompilerImpl implements TaskCompiler {
|
||||
constructor(
|
||||
public config: Config,
|
||||
public debug?: boolean,
|
||||
) {}
|
||||
|
||||
abstract compile(): TaskBundle;
|
||||
abstract compile(): Iterable<TaskDef>;
|
||||
}
|
||||
|
||||
export type TaskCompilerType = new (config: Config, debug?: boolean) => TaskCompiler;
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import gulp from "gulp";
|
||||
import gulpClean from "gulp-clean";
|
||||
import { TaskCompilerImpl, type TaskBundle } from "../core";
|
||||
import { TaskCompilerImpl, type TaskDef } from "../core";
|
||||
|
||||
export class CleanTaskCompiler extends TaskCompilerImpl {
|
||||
compile(): TaskBundle {
|
||||
return {
|
||||
clean: () => {
|
||||
return gulp.src("target/*", { read: false }).pipe(gulpClean());
|
||||
},
|
||||
};
|
||||
*compile(): Iterable<TaskDef> {
|
||||
yield ["clean", () => gulp.src("target/*", { read: false }).pipe(gulpClean()), true];
|
||||
}
|
||||
}
|
||||
|
||||
+15
-6
@@ -1,10 +1,15 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { Haxe } from "../../impl/haxe";
|
||||
import { TaskCompilerImpl, type TaskBundle } from "../core";
|
||||
import { TaskCompilerImpl, type TaskDef } from "../core";
|
||||
|
||||
export class FormatTaskCompiler extends TaskCompilerImpl {
|
||||
compile(): TaskBundle {
|
||||
return {
|
||||
check: async () => {
|
||||
*compile(): Iterable<TaskDef> {
|
||||
const hxformatFile = path.join(".", "hxformat.json");
|
||||
if (fs.existsSync(hxformatFile)) {
|
||||
yield [
|
||||
"check",
|
||||
async () => {
|
||||
const haxe = new Haxe(this.config.haxe);
|
||||
await haxe.install({ formatter: "" });
|
||||
await haxe.haxelib(
|
||||
@@ -13,7 +18,10 @@ export class FormatTaskCompiler extends TaskCompilerImpl {
|
||||
),
|
||||
);
|
||||
},
|
||||
format: async () => {
|
||||
];
|
||||
yield [
|
||||
"format",
|
||||
async () => {
|
||||
const haxe = new Haxe(this.config.haxe);
|
||||
await haxe.install({ formatter: "" });
|
||||
await haxe.haxelib(
|
||||
@@ -22,6 +30,7 @@ export class FormatTaskCompiler extends TaskCompilerImpl {
|
||||
),
|
||||
);
|
||||
},
|
||||
};
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
import gulp from "gulp";
|
||||
import os from "os";
|
||||
import { Platform } from "../../core/type";
|
||||
import { Builder, Packer, Runner } from "../../project";
|
||||
import { TaskCompilerImpl, type TaskBundle } from "../core";
|
||||
import { TaskCompilerImpl, type TaskDef } from "../core";
|
||||
|
||||
const isPlatformSupported = (platform: Platform): boolean => {
|
||||
switch (platform) {
|
||||
case Platform.LINUX:
|
||||
return os.type() === "Linux";
|
||||
case Platform.WINDOWS:
|
||||
return os.type() === "Windows_NT";
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
export class ProjectTaskCompiler extends TaskCompilerImpl {
|
||||
compile(): TaskBundle {
|
||||
const tasks: TaskBundle = {};
|
||||
for (const platform of this.config.platforms) {
|
||||
*compile(): Iterable<TaskDef> {
|
||||
for (const platform of this.config.platforms.filter(isPlatformSupported)) {
|
||||
const builder = Builder.new(this.config, platform, this.config.buildSystem, this.debug);
|
||||
const setupKey = `${this.config.name}:${platform}:setup`;
|
||||
const buildKey = `${this.config.name}:${platform}:build`;
|
||||
tasks[setupKey] = builder.setup.bind(builder);
|
||||
tasks[buildKey] = gulp.series(builder.setup.bind(builder), builder.call.bind(builder));
|
||||
yield [setupKey, builder.setup.bind(builder)];
|
||||
yield [buildKey, gulp.series(builder.setup.bind(builder), builder.call.bind(builder)), true];
|
||||
|
||||
if (Runner.factory[platform]) {
|
||||
const testKey = `${this.config.name}:${platform}:test`;
|
||||
const runner = Runner.new(this.config, platform, this.debug);
|
||||
tasks[testKey] = gulp.series(builder.setup.bind(builder), runner.setup.bind(runner), runner.call.bind(runner));
|
||||
yield [testKey, gulp.series(builder.setup.bind(builder), runner.setup.bind(runner), runner.call.bind(runner))];
|
||||
}
|
||||
|
||||
if (Packer.factory[platform]) {
|
||||
for (const name of Object.keys(Packer.factory[platform])) {
|
||||
const packKey = `${this.config.name}:${platform}:${name}`;
|
||||
const packer = Packer.new(this.config, platform, name);
|
||||
tasks[packKey] = gulp.series(packer.setup.bind(packer), packer.call.bind(packer));
|
||||
yield [packKey, gulp.series(packer.setup.bind(packer), packer.call.bind(packer)), true];
|
||||
}
|
||||
}
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-5
@@ -1,16 +1,23 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { Haxe } from "../../impl/haxe";
|
||||
import { TaskCompilerImpl, type TaskBundle } from "../core";
|
||||
import { TaskCompilerImpl, type TaskDef } from "../core";
|
||||
|
||||
export class ProtoTaskCompiler extends TaskCompilerImpl {
|
||||
compile(): TaskBundle {
|
||||
return {
|
||||
"protohx:generate": async () => {
|
||||
*compile(): Iterable<TaskDef> {
|
||||
const protohxFile = path.join(".", "protohx.json");
|
||||
if (fs.existsSync(protohxFile)) {
|
||||
yield [
|
||||
"protohx:generate",
|
||||
async () => {
|
||||
const haxe = new Haxe(this.config.haxe);
|
||||
const result = await haxe.haxelib(["run", "protohx", "generate", "protohx.json"]);
|
||||
if (result.stdout.indexOf("FAIL") > -1) {
|
||||
throw result.stdout;
|
||||
}
|
||||
},
|
||||
};
|
||||
true,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Builder } from "../../project";
|
||||
import { TaskCompilerImpl, type TaskBundle } from "../core";
|
||||
import { TaskCompilerImpl, type TaskDef } from "../core";
|
||||
|
||||
export class SetupTaskCompiler extends TaskCompilerImpl {
|
||||
compile(): TaskBundle {
|
||||
return {
|
||||
clean: () => {
|
||||
return Promise.all(
|
||||
*compile(): Iterable<TaskDef> {
|
||||
yield [
|
||||
"setup",
|
||||
() =>
|
||||
Promise.all(
|
||||
this.config.platforms.map((platform) => Builder.new(this.config, platform, this.config.buildSystem).setup()),
|
||||
);
|
||||
},
|
||||
};
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,8 +1,15 @@
|
||||
import gulp from "gulp";
|
||||
import type { TaskBundle } from "./core";
|
||||
import type { TaskDef } from "./core";
|
||||
|
||||
export default (tasks: TaskBundle) => {
|
||||
for (const [name, task] of Object.entries(tasks)) {
|
||||
gulp.task(name, task);
|
||||
export default (tasks: Iterable<TaskDef>) => {
|
||||
const defaultTasks = [];
|
||||
for (const item of tasks) {
|
||||
gulp.task(item[0], item[1]);
|
||||
if (item[2]) {
|
||||
defaultTasks.push(item[0]);
|
||||
}
|
||||
}
|
||||
if (defaultTasks.length > 0) {
|
||||
gulp.task("default", gulp.series(defaultTasks));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user