Compare commits
10
Commits
v0.6.1
..
eeee6e1f18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eeee6e1f18 | ||
|
|
1d64087e40 | ||
|
|
faad0bec0a | ||
|
|
75f3d0e1e4 | ||
|
|
9e245fea4b | ||
|
|
a99490ec05 | ||
|
|
9e67513897 | ||
|
|
e41d461ba6 | ||
|
|
acf0706bef | ||
|
|
8874f5c04f |
+3
-19
@@ -1,21 +1,5 @@
|
||||
PROJECT=puzzlez
|
||||
SDK_PATH=$HOME/sdk
|
||||
PUBLISH_PATH=$HOME/public/$PROJECT
|
||||
BUILD_PATH=./build
|
||||
TARGET_PATH=./target
|
||||
KEY_STORE=<keystore.jks>
|
||||
KEY_PASS=<passphrase>
|
||||
REPO=https://git.shmyga.ru/api/packages/InfernalGames
|
||||
PUBLISH_USER=<username>
|
||||
PUBLISH_PASSWORD=<passphrase>
|
||||
|
||||
DOCKER_REPO=git.shmyga.ru
|
||||
DOCKER_GROUP=infernalgames
|
||||
DOCKER_ROOT="$DOCKER_REPO/$DOCKER_GROUP"
|
||||
VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+.\d+')
|
||||
DOCKER_PROJECTS=(
|
||||
"$PROJECT-web:web"
|
||||
)
|
||||
DOCKER_ARGS=(
|
||||
"PROJECT_NAME=$PROJECT"
|
||||
)
|
||||
|
||||
PUBLISH_REPO=git.shmyga.ru
|
||||
PUBLISH_GROUP=InfernalGames
|
||||
@@ -0,0 +1,46 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["*"]
|
||||
|
||||
env:
|
||||
PUBLISH_USER: ${{ vars.PUBLISH_USERNAME }}
|
||||
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_TOKEN }}
|
||||
KEY_STORE: keystore.jks
|
||||
KEY_PASS: ${{ secrets.KEY_PASS }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
- run: echo '' > requirements.txt
|
||||
- uses: https://git.shmyga.ru/InfernalGames/project-manager@master
|
||||
- name: Restore haxe cache
|
||||
id: cache-haxe-restore
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
key: ${{ runner.os }}-haxe
|
||||
path: |
|
||||
$HOME/sdk
|
||||
./build
|
||||
- run: echo "${{ secrets.KEY_STORE }}" | base64 --decode > keystore.jks
|
||||
- run: pm build:docker -vv
|
||||
- name: Save haxe cache
|
||||
id: cache-haxe-save
|
||||
#if: always() && steps.cache-haxe-restore.outputs.cache-hit != 'true'
|
||||
if: always()
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
key: ${{ steps.cache-haxe-restore.outputs.cache-primary-key }}
|
||||
path: |
|
||||
$HOME/sdk
|
||||
./build
|
||||
- uses: docker/login-action@v4
|
||||
with:
|
||||
registry: git.shmyga.ru
|
||||
username: ${{ vars.PUBLISH_USERNAME }}
|
||||
password: ${{ secrets.PUBLISH_TOKEN }}
|
||||
- run: pm publish:docker -vv
|
||||
- run: pm publish:gitea -vv
|
||||
+5
-5
@@ -1,4 +1,4 @@
|
||||
/build/
|
||||
build/
|
||||
target/
|
||||
src-gen/
|
||||
out/
|
||||
@@ -10,8 +10,8 @@ out/
|
||||
.idea/
|
||||
.ideaDataSources/
|
||||
config.json
|
||||
/node_modules
|
||||
/log
|
||||
/ansible/*.retry
|
||||
node_modules
|
||||
log
|
||||
ansible/*.retry
|
||||
.npmrc
|
||||
.env
|
||||
.env
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
modules = ["."]
|
||||
|
||||
#[presets.haxe]
|
||||
#variables.haxe_sources = [
|
||||
# "./src/common/haxe",
|
||||
# "./src/app/haxe",
|
||||
# "./src/server/haxe",
|
||||
#]
|
||||
#tasks = {}
|
||||
|
||||
[presets.docker]
|
||||
variables.docker_target = "web"
|
||||
variables.docker_build_args = { PROJECT_NAME = "{{ project_name }}" }
|
||||
variables.docker_name = "{{ project_name }}-web"
|
||||
|
||||
[presets.docker.tasks.build.compose]
|
||||
priority = 1
|
||||
variables.sdk_path = "{{ 'SDK_PATH' | env('$HOME/sdk') }}"
|
||||
variables.publish_path = "{{ 'PUBLISH_PATH' | env('$HOME/public/' + project_name) }}"
|
||||
variables.build_path = "{{ 'BUILD_PATH' | env('./build') }}"
|
||||
variables.target_path = "{{ 'TARGET_PATH' | env('./target') }}"
|
||||
commands = [
|
||||
"mkdir -p \"{{ sdk_path }}\" \"{{ publish_path }}\" \"{{ build_path }}\" \"{{ target_path }}\" \"src-gen\"",
|
||||
"PROJECT={{ project_name }} SDK_PATH={{ sdk_path }} BUILD_PATH={{ build_path }} TARGET_PATH={{ target_path }} PUBLISH_PATH={{ publish_path }} docker compose run --rm --user $(id -u):$(id -g) --build --remove-orphans builder",
|
||||
]
|
||||
|
||||
[presets.gitea]
|
||||
variables.publish_artefacts.debian = "target/app/debian/{{ project_name }}_{{ project_version }}_all.deb"
|
||||
variables.publish_artefacts.android = "target/app/android/{{ project_name }}_{{ project_version }}.apk"
|
||||
variables.publish_artefacts.archive_linux = "target/app/archive/{{ project_name }}_{{ project_version }}_linux.tar.gz"
|
||||
variables.publish_artefacts.archive_win = "target/app/archive/{{ project_name }}_{{ project_version }}_win.zip"
|
||||
variables.publish_artefacts.installer = "target/app/installer/{{ project_name }}_{{ project_version }}.exe"
|
||||
+13
-13
@@ -1,10 +1,10 @@
|
||||
FROM ubuntu:noble AS base
|
||||
RUN apt update && apt install -y \
|
||||
nodejs \
|
||||
npm \
|
||||
openjdk-11-jre \
|
||||
protobuf-compiler \
|
||||
jq
|
||||
nodejs \
|
||||
npm \
|
||||
openjdk-11-jre \
|
||||
protobuf-compiler \
|
||||
jq
|
||||
RUN node -v
|
||||
RUN npm -v
|
||||
|
||||
@@ -12,16 +12,16 @@ FROM base AS builder
|
||||
ENV GRADLE_USER_HOME=/sdk/gradle
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY gulpfile.js protohx.json ./
|
||||
COPY tasks ./tasks
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci
|
||||
COPY gulpfile.ts protohx.json ./
|
||||
COPY config.example.json ./config.example.json
|
||||
RUN --mount=type=secret,id=KEY_STORE \
|
||||
cat /run/secrets/KEY_STORE > ./key.jks
|
||||
RUN --mount=type=secret,id=KEY_PASS,env=KEY_PASS \
|
||||
jq --arg key_pass "$KEY_PASS" \
|
||||
'.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \
|
||||
config.example.json > config.json
|
||||
cat /run/secrets/KEY_STORE > ./key.jks
|
||||
RUN --mount=type=secret,id=KEY_PASS \
|
||||
jq --arg key_pass "$(cat /run/secrets/KEY_PASS)" \
|
||||
'.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \
|
||||
config.example.json > config.json
|
||||
COPY src ./src
|
||||
COPY dependencies ./dependencies
|
||||
VOLUME ["/sdk", "/app/build", "/app/target", "/app/publish", "/app/src-gen"]
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
# Puzzlez
|
||||
# Puzzle'z
|
||||
|
||||
Puzzle game
|
||||
|
||||

|
||||
|
||||
## Play
|
||||
|
||||
https://shmyga.ru/puzzlez/html5/index.html
|
||||
|
||||
## Packages
|
||||
## Releases
|
||||
|
||||
https://git.shmyga.ru/InfernalGames/-/packages/generic/puzzlez
|
||||
https://git.shmyga.ru/InfernalGames/puzzlez/releases
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
[defaults]
|
||||
hash_behaviour = merge
|
||||
host_key_checking = False
|
||||
#callback_whitelist = profile_tasks
|
||||
display_skipped_hosts = False
|
||||
stdout_callback = yaml
|
||||
bin_ansible_callbacks = True
|
||||
|
||||
[ssh_connection]
|
||||
pipelining = True
|
||||
ssh_args = -o ForwardAgent=yes
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
- hosts: all
|
||||
vars:
|
||||
ansible_user: "{{ deploy_user }}"
|
||||
roles:
|
||||
- ansible-deploy
|
||||
- build
|
||||
post_tasks:
|
||||
- include_role:
|
||||
name: ansible-deploy
|
||||
tasks_from: complete.yml
|
||||
@@ -1,2 +0,0 @@
|
||||
all:
|
||||
hosts: localhost
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
project_name: puzzlez
|
||||
project_user: holop
|
||||
|
||||
deploy_user: "{{ project_user }}"
|
||||
deploy_project: "{{ project_name }}"
|
||||
deploy_repo_url: "git@bitbucket.org:infernalgames/{{ project_name }}.git"
|
||||
deploy_repo_version: master
|
||||
deploy_npm: yes
|
||||
@@ -1,4 +0,0 @@
|
||||
all:
|
||||
hosts: shmyga.ru
|
||||
vars:
|
||||
config_src: "/home/holop/puzzlez/config.json"
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
- name: ansible-deploy
|
||||
src: git@bitbucket.org:shmyga/ansible-deploy.git
|
||||
version: master
|
||||
scm: git
|
||||
@@ -1,2 +0,0 @@
|
||||
config_src: "{{ deploy_release_dir }}/config.{{ inventory_hostname }}.json"
|
||||
config_dest: "{{ deploy_release_dir }}/config.json"
|
||||
@@ -1,11 +0,0 @@
|
||||
---
|
||||
- name: "Copy config"
|
||||
copy:
|
||||
src: "{{ config_src }}"
|
||||
dest: "{{ config_dest }}"
|
||||
remote_src: true
|
||||
|
||||
- name: "Gulp build"
|
||||
command: "{{ deploy_release_dir }}/node_modules/.bin/gulp default"
|
||||
args:
|
||||
chdir: "{{ deploy_release_dir }}"
|
||||
+2
-4
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"SdkDir": "C:\\sdk",
|
||||
"BuildDir": null,
|
||||
"PublishDir": "",
|
||||
"PublishUrl": "https://shmyga.ru/repo/puzzlez",
|
||||
"SdkDir": "$HOME/sdk",
|
||||
"Develop": false,
|
||||
"UseRuffle": true,
|
||||
"Key": {
|
||||
"store": "keystore.jks",
|
||||
"pass": null
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:::ANDROID_GRADLE_PLUGIN::'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
namespace "ru.m.android"
|
||||
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
|
||||
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':deps:extension-api')
|
||||
}
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="android" default="help">
|
||||
<property environment="env" />
|
||||
<property name="sdk.dir" value="${env.ANDROID_SDK}" />
|
||||
|
||||
<property file="local.properties" />
|
||||
<property file="ant.properties" />
|
||||
<property file="project.properties" />
|
||||
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
</project>
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
android.library=true
|
||||
android.library.reference.1=../extension-api
|
||||
target=android-::ANDROID_TARGET_SDK_VERSION::
|
||||
Vendored
+1
-2
@@ -1,3 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ru.m.android">
|
||||
</manifest>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ru.m.android" />
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 357 KiB |
-139
@@ -1,139 +0,0 @@
|
||||
const gulp = require("gulp");
|
||||
const gulpClean = require("gulp-clean");
|
||||
const Config = require("./config.json");
|
||||
const packageInfo = require("./package.json");
|
||||
const { System, Sdk, Haxe, Project } = require("gulp-haxetool");
|
||||
const dateformat = require("dateformat");
|
||||
const publish = require("./tasks/gulp-publish");
|
||||
|
||||
if (packageInfo.haxe) {
|
||||
Haxe.VERSION = packageInfo.haxe;
|
||||
}
|
||||
|
||||
if (Config.SdkDir) {
|
||||
Sdk.dir = Config.SdkDir;
|
||||
}
|
||||
|
||||
if (Config.BuildDir) {
|
||||
Haxe.buildDir = Config.BuildDir;
|
||||
}
|
||||
|
||||
exports.clean = function clean() {
|
||||
return gulp.src("target/*", { read: false }).pipe(gulpClean());
|
||||
};
|
||||
|
||||
exports.setup = function setup() {
|
||||
const builder = Project.Builder.new(
|
||||
app.config,
|
||||
Project.Platform.ANDROID,
|
||||
app.buildSystem,
|
||||
);
|
||||
return builder.prepare();
|
||||
};
|
||||
|
||||
exports.generate = function generate() {
|
||||
return exports.setup().then(() =>
|
||||
new Haxe()
|
||||
.haxelib(["run", "protohx", "generate", "protohx.json"])
|
||||
.then(({ stdout }) => {
|
||||
if (stdout.indexOf("FAIL") > -1) {
|
||||
throw stdout;
|
||||
}
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
const config = new Project.Config({
|
||||
meta: {
|
||||
title: "Puzzle'z",
|
||||
filename: "puzzlez",
|
||||
icon: "src/app/resources/icon.png",
|
||||
pack: "ru.m.puzzlez",
|
||||
author: "shmyga <shmyga.z@gmail.com>",
|
||||
company: "MegaLoMania",
|
||||
version: packageInfo.version + (Config.Develop ? "-SNAPSHOT" : ""),
|
||||
},
|
||||
key: Config.Key,
|
||||
libs: packageInfo.haxeDependencies,
|
||||
macros: [
|
||||
`CompilationOption.set('build','${dateformat(new Date(), "yyyy-mm-dd HH:MM:ss")}')`,
|
||||
`CompilationOption.set('UNSPLASH_KEY','${Config.UnsplashKey}')`,
|
||||
`CompilationOption.set('PIXABAY_KEY','${Config.PixabayKey}')`,
|
||||
],
|
||||
flags: ["proto_debug"],
|
||||
});
|
||||
|
||||
const app = new Project(
|
||||
Project.BuildSystem.OPENFL,
|
||||
[
|
||||
Project.Platform.FLASH,
|
||||
Project.Platform.HTML5,
|
||||
Project.Platform.LINUX,
|
||||
Project.Platform.WINDOWS,
|
||||
Project.Platform.ANDROID,
|
||||
],
|
||||
config.branch({
|
||||
name: "app",
|
||||
sources: ["src-gen/haxe", "src/common/haxe", "src/app/haxe"],
|
||||
android: [
|
||||
{
|
||||
path: "dependencies/android",
|
||||
extensions: ["ru.m.android.FileUtil"],
|
||||
},
|
||||
],
|
||||
assets: ["src/app/resources"],
|
||||
main: "ru.m.puzzlez.PuzzlezApp",
|
||||
meta: {
|
||||
width: 1280,
|
||||
height: 768,
|
||||
},
|
||||
flags: ["app"],
|
||||
}),
|
||||
).bind(module, gulp);
|
||||
|
||||
const server = new Project(
|
||||
Project.BuildSystem.HAXE,
|
||||
[Project.Platform.NEKO, Project.Platform.CPP],
|
||||
config.branch({
|
||||
name: "server",
|
||||
sources: ["src-gen/haxe", "src/common/haxe", "src/server/haxe"],
|
||||
main: "ru.m.puzzlez.PuzzlezServer",
|
||||
}),
|
||||
).bind(module, gulp);
|
||||
|
||||
module.exports.publish = publish(
|
||||
packageInfo.name,
|
||||
packageInfo.version,
|
||||
Config.PublishDir,
|
||||
Config.PublishUrl,
|
||||
);
|
||||
|
||||
const defaultSeries = [
|
||||
exports.clean,
|
||||
exports.generate,
|
||||
module.exports["app:flash:build"],
|
||||
module.exports["app:flash:html"],
|
||||
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"],
|
||||
);
|
||||
}
|
||||
|
||||
defaultSeries.push(exports.publish);
|
||||
|
||||
module.exports.default = gulp.series(defaultSeries);
|
||||
@@ -0,0 +1,8 @@
|
||||
import gulp from "gulp";
|
||||
import { Preset } from "gulp-haxetool";
|
||||
import config from "./config.json" with { type: "json" };
|
||||
import presetData from "./haxetool.json" with { type: "json" };
|
||||
import packageInfo from "./package.json" with { type: "json" };
|
||||
|
||||
const preset = new Preset(presetData, config, packageInfo);
|
||||
export default preset.register(gulp);
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"default": {
|
||||
"meta": {
|
||||
"title": "Puzzle'z",
|
||||
"filename": "puzzlez",
|
||||
"icon": "src/app/resources/icon.png",
|
||||
"pack": "ru.m.puzzlez",
|
||||
"author": "shmyga <shmyga.z@gmail.com>",
|
||||
"company": "MegaLoMania",
|
||||
"version": "<%=package.version%>"
|
||||
},
|
||||
"sources": ["src-gen/haxe", "src/common/haxe"],
|
||||
"libs": {
|
||||
"haxework": "2.1.0",
|
||||
"lime": "8.3.2",
|
||||
"openfl": "9.5.2",
|
||||
"hxcpp": "4.2.1",
|
||||
"svg": "1.1.3",
|
||||
"protohx": "0.4.6",
|
||||
"yield": "3.2.2",
|
||||
"formatter": "1.16.0"
|
||||
},
|
||||
"key": {
|
||||
"store": "<%=config.Key.store%>",
|
||||
"pass": "<%=config.Key.pass%>"
|
||||
},
|
||||
"macros": [
|
||||
"CompilationOption.set('build','<%=dateformat(Date.now(), 'yyyy-mm-dd HH:MM:ss')%>')",
|
||||
"CompilationOption.set('UNSPLASH_KEY','<%=config.UnsplashKey%>')",
|
||||
"CompilationOption.set('PIXABAY_KEY','<%=config.PixabayKey%>')"
|
||||
],
|
||||
"flags": ["proto_debug"]
|
||||
},
|
||||
"app": {
|
||||
"buildSystem": "openfl",
|
||||
"platforms": ["flash", "html5", "linux", "windows", "android"],
|
||||
"sources": ["src/app/haxe"],
|
||||
"android": [
|
||||
{
|
||||
"path": "dependencies/android",
|
||||
"extensions": ["ru.m.android.FileUtil"]
|
||||
}
|
||||
],
|
||||
"assets": ["src/app/resources"],
|
||||
"main": "ru.m.puzzlez.PuzzlezApp",
|
||||
"meta": {
|
||||
"width": 1280,
|
||||
"height": 768
|
||||
},
|
||||
"macros": [
|
||||
"CompilationOption.set('host','<%=env.HOST || '0.0.0.0'%>')",
|
||||
"CompilationOption.set('port',<%=env.PORT || '5000'%>)"
|
||||
],
|
||||
"flags": ["app"]
|
||||
},
|
||||
"server": {
|
||||
"buildSystem": "haxe",
|
||||
"platforms": ["cpp"],
|
||||
"sources": ["src/server/haxe"],
|
||||
"main": "ru.m.puzzlez.PuzzlezServer"
|
||||
}
|
||||
}
|
||||
Generated
+7177
-13630
File diff suppressed because it is too large
Load Diff
+8
-22
@@ -1,26 +1,12 @@
|
||||
{
|
||||
"name": "puzzlez",
|
||||
"version": "0.6.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"version": "0.6.2",
|
||||
"scripts": {
|
||||
"build": "hxt default",
|
||||
"dev": "hxt app:flash:test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dateformat": "^3.0.3",
|
||||
"fs-extra": "^10.0.0",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-add": "0.0.2",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-cli": "^2.2.0",
|
||||
"gulp-haxetool": "^0.1.9",
|
||||
"yargs": "^13.2.4"
|
||||
},
|
||||
"haxeDependencies": {
|
||||
"haxework": "2.1.0",
|
||||
"lime": "8.0.0",
|
||||
"openfl": "9.2.0",
|
||||
"hxcpp": "4.2.1",
|
||||
"svg": "1.1.3",
|
||||
"protohx": "0.4.6",
|
||||
"yield": "3.2.2",
|
||||
"formatter": "1.16.0"
|
||||
},
|
||||
"haxe": "4.2.5"
|
||||
"gulp-haxetool": "^2.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname $(dirname "$0"))" || exit
|
||||
|
||||
source .env
|
||||
|
||||
mkdir -p "$SDK_PATH" "$PUBLISH_PATH" "$BUILD_PATH" "$TARGET_PATH" "src-gen"
|
||||
docker compose run --rm --user $(id -u):$(id -g) --build --remove-orphans builder
|
||||
docker compose run --rm --user $(id -u):$(id -g) --build --remove-orphans builder
|
||||
|
||||
./scripts/docker-action
|
||||
+3
-3
@@ -3,8 +3,6 @@ set -e
|
||||
cd "$(dirname $(dirname "$0"))" || exit
|
||||
source .env
|
||||
|
||||
VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+\.\d+')
|
||||
|
||||
PACKAGES=(
|
||||
"android/${PROJECT}_${VERSION}.apk"
|
||||
"debian/${PROJECT}_${VERSION}_all.deb"
|
||||
@@ -32,4 +30,6 @@ do
|
||||
"${REPO}/debian/pool/noble/main/upload"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
DOCKER_ACTION=publish ./scripts/docker-action
|
||||
@@ -33,7 +33,8 @@ class Device {
|
||||
#end
|
||||
}
|
||||
|
||||
private static var MOBILES(default, never):Array<String> = ["Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "Windows Phone",];
|
||||
private static var MOBILES(default,
|
||||
never):Array<String> = ["Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "Windows Phone",];
|
||||
|
||||
public static function isMobile():Bool {
|
||||
#if android
|
||||
@@ -56,7 +57,8 @@ class Device {
|
||||
private static function get_fullScreenSignal():Signal<Bool> {
|
||||
if (fullScreenSignal == null) {
|
||||
fullScreenSignal = new Signal();
|
||||
Lib.current.stage.addEventListener(FullScreenEvent.FULL_SCREEN, (event:FullScreenEvent) -> fullScreenSignal.emit(event.fullScreen));
|
||||
Lib.current.stage.addEventListener(FullScreenEvent.FULL_SCREEN,
|
||||
(event:FullScreenEvent) -> fullScreenSignal.emit(event.fullScreen));
|
||||
}
|
||||
return fullScreenSignal;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ class Callback<T> {
|
||||
|
||||
class ModernFileReference extends FileReference {
|
||||
#if android
|
||||
private static var fileUtilBrowse = lime.system.JNI.createStaticMethod("ru.m.android.FileUtil", "browse", "(Lorg/haxe/lime/HaxeObject;)V");
|
||||
private static var fileUtilBrowse = lime.system.JNI.createStaticMethod("ru.m.android.FileUtil", "browse",
|
||||
"(Lorg/haxe/lime/HaxeObject;)V");
|
||||
#end
|
||||
|
||||
override public function browse(?typeFilter:Array<FileFilter>):Bool {
|
||||
|
||||
@@ -60,7 +60,8 @@ class PixabayApi {
|
||||
return '${baseUrl}?${query}';
|
||||
}
|
||||
|
||||
public function getPage(page:Int, perPage:Int, category:PixabayCategory = PixabayCategory.NATURE):Promise<PixabayResponse> {
|
||||
public function getPage(page:Int, perPage:Int,
|
||||
category:PixabayCategory = PixabayCategory.NATURE):Promise<PixabayResponse> {
|
||||
return new JsonLoader<PixabayResponse>().GET(buildRequest([
|
||||
"category" => category,
|
||||
"image_type" => PixabayImageType.PHOTO,
|
||||
@@ -71,6 +72,7 @@ class PixabayApi {
|
||||
}
|
||||
|
||||
public function get(id:Int):Promise<PixabayImage> {
|
||||
return new JsonLoader<PixabayResponse>().GET(buildRequest(["id" => id])).then((response:PixabayResponse) -> response.hits[0]);
|
||||
return new JsonLoader<PixabayResponse>().GET(buildRequest(["id" => id]))
|
||||
.then((response:PixabayResponse) -> response.hits[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,14 +208,20 @@ class Render extends SpriteView implements IRender {
|
||||
private function onMouseMove(event:MouseEvent):Void {
|
||||
var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY));
|
||||
var partPosition = cast(activePart.position, PointExt).add(newPoint).subtract(activePoint);
|
||||
actions.emit(new GameAction().setAction(Action.MOVE).setPlayerId(playerId).setPartId(activePart.id).setPosition(partPosition));
|
||||
actions.emit(new GameAction().setAction(Action.MOVE)
|
||||
.setPlayerId(playerId)
|
||||
.setPartId(activePart.id)
|
||||
.setPosition(partPosition));
|
||||
activePoint = newPoint;
|
||||
}
|
||||
|
||||
private function onMouseUp(event:MouseEvent):Void {
|
||||
var newPoint:PointExt = tableView.globalToLocal(new FlashPoint(event.stageX, event.stageY));
|
||||
var partPosition = cast(activePart.position, PointExt).add(newPoint).subtract(activePoint);
|
||||
actions.emit(new GameAction().setAction(Action.PUT).setPlayerId(playerId).setPartId(activePart.id).setPosition(partPosition));
|
||||
actions.emit(new GameAction().setAction(Action.PUT)
|
||||
.setPlayerId(playerId)
|
||||
.setPartId(activePart.id)
|
||||
.setPosition(partPosition));
|
||||
tableView.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
|
||||
tableView.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
|
||||
activePart = null;
|
||||
|
||||
@@ -5,7 +5,8 @@ import ru.m.puzzlez.proto.game.BoundType;
|
||||
import ru.m.puzzlez.proto.game.PartBound;
|
||||
|
||||
class ClassicPartBuilder extends BasePartBuilder {
|
||||
override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float, bound:PartBound):Void {
|
||||
override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float,
|
||||
bound:PartBound):Void {
|
||||
var dx = toX == fromX ? 0 : (toX - fromX) / Math.abs(toX - fromX);
|
||||
var dy = toY == fromY ? 0 : (toY - fromY) / Math.abs(toY - fromY);
|
||||
var boundLength = Math.max(Math.abs(toX - fromX), Math.abs(toY - fromY));
|
||||
@@ -23,7 +24,8 @@ class ClassicPartBuilder extends BasePartBuilder {
|
||||
}
|
||||
switch bound.spike {
|
||||
case BoundType.IN | BoundType.OUT:
|
||||
path.commands.push(LINE_TO(fromX + spikeOffset * dx + spikeSideOffset * dy, fromY + spikeOffset * dy + spikeSideOffset * dx));
|
||||
path.commands.push(LINE_TO(fromX + spikeOffset * dx + spikeSideOffset * dy,
|
||||
fromY + spikeOffset * dy + spikeSideOffset * dx));
|
||||
path.commands.push(CURVE_TO(fromX
|
||||
+ (spikeOffset * 0.7) * dx
|
||||
- spikeDepth * dy
|
||||
@@ -50,7 +52,8 @@ class ClassicPartBuilder extends BasePartBuilder {
|
||||
+ spikeSideOffset * dx,
|
||||
fromX
|
||||
+ (spikeOffset + spikeWidth) * dx
|
||||
+ spikeSideOffset * dy, fromY
|
||||
+ spikeSideOffset * dy,
|
||||
fromY
|
||||
+ (spikeOffset + spikeWidth) * dy
|
||||
+ spikeSideOffset * dx));
|
||||
case _:
|
||||
|
||||
@@ -5,7 +5,8 @@ import ru.m.puzzlez.proto.game.BoundType;
|
||||
import ru.m.puzzlez.proto.game.PartBound;
|
||||
|
||||
class SquarePartBuilder extends BasePartBuilder {
|
||||
override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float, bound:PartBound):Void {
|
||||
override private function createBound(path:DrawPath, fromX:Float, fromY:Float, toX:Float, toY:Float,
|
||||
bound:PartBound):Void {
|
||||
var dx = toX == fromX ? 0 : (toX - fromX) / Math.abs(toX - fromX);
|
||||
var dy = toY == fromY ? 0 : (toY - fromY) / Math.abs(toY - fromY);
|
||||
var boundLength = Math.max(Math.abs(toX - fromX), Math.abs(toY - fromY));
|
||||
@@ -20,8 +21,10 @@ class SquarePartBuilder extends BasePartBuilder {
|
||||
case BoundType.NONE:
|
||||
case BoundType.IN | BoundType.OUT:
|
||||
path.commands.push(LINE_TO(fromX + spikeOffset * dx,
|
||||
fromY + spikeOffset * dy)) path.commands.push(LINE_TO(fromX + spikeOffset * dx - spikeDepth * dy, fromY + spikeDepth * dx + spikeOffset * dy));
|
||||
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx - spikeDepth * dy, fromY + spikeDepth * dx + (spikeOffset + spikeWidth) * dy));
|
||||
fromY + spikeOffset * dy)) path.commands.push(LINE_TO(fromX + spikeOffset * dx - spikeDepth * dy,
|
||||
fromY + spikeDepth * dx + spikeOffset * dy));
|
||||
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx - spikeDepth * dy,
|
||||
fromY + spikeDepth * dx + (spikeOffset + spikeWidth) * dy));
|
||||
path.commands.push(LINE_TO(fromX + (spikeOffset + spikeWidth) * dx, fromY + (spikeOffset + spikeWidth) * dy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class NginxImageSource implements ImageSource {
|
||||
public var id(default, never):String = "nginx";
|
||||
|
||||
private var baseUrl:String;
|
||||
private var cache:Map<String, Promise<NginxResponse>> = new Map();
|
||||
|
||||
public function new(baseUrl:String) {
|
||||
this.baseUrl = baseUrl;
|
||||
@@ -36,31 +37,35 @@ class NginxImageSource implements ImageSource {
|
||||
|
||||
public function getPage(page:Page):Promise<DataPage<ImageId>> {
|
||||
var category = page.filter.get("category");
|
||||
return new JsonLoader<NginxResponse>().GET(category != null ? this.baseUrl + category + "/" : this.baseUrl)
|
||||
.then((response:NginxResponse) -> {
|
||||
var data:Array<ImageId> = [];
|
||||
for (item in response) {
|
||||
if (item.type == NginxResponseItemType.FILE) {
|
||||
var itemId = category != null ? category + "@" + item.name : item.name;
|
||||
data.push(new ImageId().setSource(id).setId(itemId));
|
||||
}
|
||||
var url = category != null ? this.baseUrl + category + "/" : this.baseUrl;
|
||||
if (!this.cache.exists(url)) {
|
||||
this.cache.set(url, new JsonLoader<NginxResponse>().GET(url));
|
||||
}
|
||||
return this.cache.get(url).then((response:NginxResponse) -> {
|
||||
var data:Array<ImageId> = [];
|
||||
for (item in response) {
|
||||
if (item.type == NginxResponseItemType.FILE) {
|
||||
var itemId = category != null ? category + "@" + item.name : item.name;
|
||||
data.push(new ImageId().setSource(id).setId(itemId));
|
||||
}
|
||||
return {
|
||||
page: page,
|
||||
data: data,
|
||||
total: response.length,
|
||||
}
|
||||
});
|
||||
}
|
||||
data = data.slice(page.index * page.count, (page.index + 1) * page.count);
|
||||
return {
|
||||
page: page,
|
||||
data: data,
|
||||
total: response.length,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function load(id:String, thumb:Bool = false):Promise<ImageValue> {
|
||||
var url = this.baseUrl + StringTools.replace(id, "@", "/");
|
||||
if (thumb) {
|
||||
var parts = url.split(".");
|
||||
var index = parts.length - 2;
|
||||
parts[index] = parts[index] + "-thumbnail";
|
||||
url = parts.join(".");
|
||||
}
|
||||
// TODO: default size by screen width?
|
||||
var width = thumb ? 360 : 1920;
|
||||
var parts = url.split(".");
|
||||
var index = parts.length - 2;
|
||||
parts[index] = parts[index] + '-w${width}';
|
||||
url = parts.join(".");
|
||||
return Promise.promise(ImageValue.URL(url));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,23 @@ import ru.m.puzzlez.render.Background;
|
||||
|
||||
@:singleton @:template class BackgroundPopup extends PopupView<Background> {
|
||||
private static var colorsList:Array<Color> = [
|
||||
'#FFFFFF', '#001f3f', '#0074D9', '#7FDBFF', '#39CCCC', '#3D9970', '#2ECC40', '#01FF70', '#FFDC00', '#FF851B', '#FF4136', '#85144b', '#F012BE', '#B10DC9',
|
||||
'#111111', '#AAAAAA', '#DDDDDD',
|
||||
'#FFFFFF',
|
||||
'#001f3f',
|
||||
'#0074D9',
|
||||
'#7FDBFF',
|
||||
'#39CCCC',
|
||||
'#3D9970',
|
||||
'#2ECC40',
|
||||
'#01FF70',
|
||||
'#FFDC00',
|
||||
'#FF851B',
|
||||
'#FF4136',
|
||||
'#85144b',
|
||||
'#F012BE',
|
||||
'#B10DC9',
|
||||
'#111111',
|
||||
'#AAAAAA',
|
||||
'#DDDDDD',
|
||||
];
|
||||
|
||||
@:view("selected") var selectedView:SpriteView;
|
||||
|
||||
@@ -33,7 +33,8 @@ abstract Version(Array<Int>) {
|
||||
@:from public static function fromString(value:String):Version {
|
||||
var r = ~/(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?/;
|
||||
return if (r.match(value)) {
|
||||
new Version(Std.parseInt(r.matched(1)), Std.parseInt(r.matched(2)), Std.parseInt(r.matched(3)), r.matched(4) != null);
|
||||
new Version(Std.parseInt(r.matched(1)), Std.parseInt(r.matched(2)), Std.parseInt(r.matched(3)),
|
||||
r.matched(4) != null);
|
||||
} else {
|
||||
new Version(0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ class EventUtil {
|
||||
}
|
||||
|
||||
public static function change(part:Part):GameEvent {
|
||||
return new GameEvent().setChange(new GameChange().setPartId(part.id).setLocation(part.location).setPosition(part.position).setPlayerId(part.playerId));
|
||||
return new GameEvent().setChange(new GameChange().setPartId(part.id)
|
||||
.setLocation(part.location)
|
||||
.setPosition(part.position)
|
||||
.setPlayerId(part.playerId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,8 @@ class Game implements IGame {
|
||||
case Action.PUT:
|
||||
part.playerId = null;
|
||||
var target = new PointExt(state.preset.imageRect.x,
|
||||
state.preset.imageRect.y).add(new PointExt(part.point.x * part.rect.width, part.point.y * part.rect.height));
|
||||
state.preset.imageRect.y).add(new PointExt(part.point.x * part.rect.width,
|
||||
part.point.y * part.rect.height));
|
||||
var d = distance(target, event.action.position);
|
||||
if (d < 70) {
|
||||
part.location = PartLocation.IMAGE;
|
||||
|
||||
@@ -41,7 +41,8 @@ abstract RectangleExt(Rectangle) from Rectangle to Rectangle {
|
||||
public function intersect(rect:Rectangle):Bool {
|
||||
var thisRect:RectangleExt = this;
|
||||
var otherRect:RectangleExt = rect;
|
||||
return !(thisRect.left > otherRect.right || otherRect.left > thisRect.right || thisRect.top > otherRect.bottom || otherRect.top > thisRect.bottom);
|
||||
return !(thisRect.left > otherRect.right || otherRect.left > thisRect.right || thisRect.top > otherRect.bottom
|
||||
|| otherRect.top > thisRect.bottom);
|
||||
}
|
||||
|
||||
public function clone():Rectangle {
|
||||
|
||||
@@ -5,8 +5,8 @@ import ru.m.puzzlez.proto.pack.GameListResponse;
|
||||
import ru.m.puzzlez.proto.pack.GameListRequest;
|
||||
import hw.connect.session.ProtoSession;
|
||||
import hw.log.BaseLogger.LoggerUtil;
|
||||
import ru.m.puzzlez.image.Game;
|
||||
import ru.m.puzzlez.image.GameUtil;
|
||||
import ru.m.puzzlez.game.Game;
|
||||
import ru.m.puzzlez.game.GameUtil;
|
||||
import ru.m.puzzlez.proto.core.User;
|
||||
import ru.m.puzzlez.proto.event.GameAction;
|
||||
import ru.m.puzzlez.proto.event.GameEvent;
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
const gulp = require("gulp");
|
||||
const fs = require("fs");
|
||||
const fse = require("fs-extra");
|
||||
const path = require("path");
|
||||
const through = require("through2");
|
||||
|
||||
class Package {
|
||||
constructor(platform, type, version, versionInt) {
|
||||
this.platform = platform;
|
||||
this.type = type;
|
||||
this.version = version;
|
||||
this.versionInt = versionInt;
|
||||
}
|
||||
|
||||
get key() {
|
||||
return [this.platform, this.type].join(":");
|
||||
}
|
||||
|
||||
static getPlatform(filename) {
|
||||
for (const [platform, r] of [
|
||||
["android", /^.*?\.apk$/],
|
||||
["linux", /^.*?\.deb$/],
|
||||
["linux", /^.*?linux\.tar\.gz$/],
|
||||
["windows", /^.*?win\.zip$/],
|
||||
["windows", /^.*?\.exe$/],
|
||||
]) {
|
||||
if (r.test(filename)) {
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static getType(filename) {
|
||||
for (const [type, r] of [
|
||||
["apk", /^.*?\.apk$/],
|
||||
["deb", /^.*?\.deb$/],
|
||||
["archive", /^.*?\.tar\.gz$/],
|
||||
["archive", /^.*?\.zip$/],
|
||||
["exe", /^.*?\.exe$/],
|
||||
]) {
|
||||
if (r.test(filename)) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static getVersion(filename) {
|
||||
const m = /(\d+)\.(\d+)\.(\d+)/.exec(filename);
|
||||
if (m) {
|
||||
return [
|
||||
m[0],
|
||||
parseInt(m[1]) * 10000 + parseInt(m[2]) * 100 + parseInt(m[3]),
|
||||
];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static parseFilename(filename) {
|
||||
const platform = this.getPlatform(filename);
|
||||
const type = this.getType(filename);
|
||||
const version = this.getVersion(filename);
|
||||
if (platform && type && version) {
|
||||
return new Package(platform, type, version[0], version[1]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (name, version, publishDir, publishUrl) =>
|
||||
function publish(cb) {
|
||||
const packages = {};
|
||||
fse.ensureDirSync(publishDir);
|
||||
return gulp.series([
|
||||
function copy() {
|
||||
return gulp
|
||||
.src("target/app/@(android|archive|debian|installer)/*")
|
||||
.pipe(
|
||||
through.obj(function (file, enc, cb) {
|
||||
const pack = Package.parseFilename(file.path);
|
||||
if (pack) {
|
||||
this.push(file);
|
||||
}
|
||||
cb(null);
|
||||
})
|
||||
)
|
||||
.pipe(gulp.dest(publishDir));
|
||||
},
|
||||
function generate() {
|
||||
return gulp
|
||||
.src(`${publishDir}/*/*`)
|
||||
.pipe(
|
||||
through.obj(function (file, enc, cb) {
|
||||
const basepath = file.path.replace(file.base + path.sep, "");
|
||||
const pack = Package.parseFilename(file.path);
|
||||
if (pack) {
|
||||
if (
|
||||
!packages[pack.key] ||
|
||||
packages[pack.key].versionInt < pack.versionInt
|
||||
) {
|
||||
packages[pack.key] = {
|
||||
platform: pack.platform,
|
||||
type: pack.type,
|
||||
version: pack.version,
|
||||
versionInt: pack.versionInt,
|
||||
path: basepath,
|
||||
filename: basepath.split(path.sep).pop(),
|
||||
url: `${publishUrl}/${basepath.replace(path.sep, "/")}`,
|
||||
};
|
||||
}
|
||||
}
|
||||
cb(null);
|
||||
})
|
||||
)
|
||||
.on("end", function () {
|
||||
fs.writeFileSync(
|
||||
path.join(publishDir, "packages.json"),
|
||||
JSON.stringify(
|
||||
{
|
||||
name: name,
|
||||
version: version,
|
||||
packages: Object.values(packages),
|
||||
},
|
||||
null,
|
||||
4
|
||||
)
|
||||
);
|
||||
});
|
||||
},
|
||||
])(cb);
|
||||
};
|
||||
|
||||
module.exports.Package = Package;
|
||||
Reference in New Issue
Block a user