From 130a5be7c44c588effa64565ca85623bb2779663 Mon Sep 17 00:00:00 2001 From: Artsiom Trubchyk Date: Sat, 22 Jul 2023 20:37:04 +0300 Subject: [PATCH] Upgrade to support Defold 1.4.8 --- .github/workflows/main.yml | 6 +++--- README.md | 16 ++++++++-------- playable_ad/gulpfile.js | 12 ++++++++++++ playable_ad/manifests/web/engine_template.html | 1 + 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58dd67c..7b6b78f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,13 +19,13 @@ jobs: - name: Install Java ♨️ uses: actions/setup-java@v2 with: - distribution: "adopt" - java-version: "11" + distribution: "temurin" + java-version: "17" - name: Install Node uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '18' - name: Install Zstd run: | diff --git a/README.md b/README.md index ce47c22..2221706 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Feel free to ask questions: [the topic about this asset is on the Defold forum]( | Tool Version | Defold Version | Status | | -------------- | -------------- | ------------- | -| 1.2.4 | 1.3.6 | Tested ✅ | +| 1.2.5 | 1.4.8 | Tested ✅ | ### Supported Platforms @@ -35,14 +35,14 @@ Accepted sizes for HTML5 playable ad vary between ad networks: You will need the following apps installed on your environment: - Node.js 12 or newer. -- Java 11. +- Java 17 (Defold >=1.4.8). - Zstd 1.4 or newer. - Gulp CLI. ### Windows -1. Download and install [Java 11](https://adoptopenjdk.net/). -2. Download and unpack [Zstd for Windows 64-bit](https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-v1.5.0-win64.zip). Add the path to the `zstd.exe` executable to the PATH environment variable. +1. Download and install [Java 17](https://adoptium.net/). +2. Download and unpack [Zstd for Windows 64-bit](https://github.com/facebook/zstd/releases/download/v1.5.5/zstd-v1.5.5-win64.zip). Add the path to the `zstd.exe` executable to the PATH environment variable. 3. Download [Node.js Windows Installer (.msi) for 64-bit](https://nodejs.org/en/download/) and install it. 4. Open `cmd.exe` and run to install Gulp CLI: @@ -53,7 +53,7 @@ npm install --global gulp-cli ### Ubuntu/Debian or [Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/about) ``` -sudo apt install --no-install-recommends openjdk-11-jre-headless nodejs npm zstd +sudo apt install --no-install-recommends openjdk-17-jre-headless nodejs npm zstd npm install --global gulp-cli ``` @@ -63,9 +63,9 @@ npm install --global gulp-cli Install [brew](https://brew.sh/) and paste that in a macOS Terminal prompt: ``` -brew install node@14 -brew install openjdk@11 -brew install zstd@1.5.0 +brew install node@18 +brew install openjdk@17 +brew install zstd@1.5.5 npm install --global gulp-cli ``` diff --git a/playable_ad/gulpfile.js b/playable_ad/gulpfile.js index 543e0a5..35cdc9f 100644 --- a/playable_ad/gulpfile.js +++ b/playable_ad/gulpfile.js @@ -327,6 +327,17 @@ function bundleArchiveJs() { .pipe(dest(dir + "/")); } +function removeRunningFromFileWarning() { + return through2.obj(function (file, _, cb) { + if (file.isBuffer()) { + const input = file.contents.toString(); + const output = input.replace('window.location.href.startsWith("file://")', 'false'); + file.contents = Buffer.from(output); + } + cb(null, file); + }); +} + function embedImages(dir) { return through2.obj(function (file, _, cb) { if (file.isBuffer()) { @@ -436,6 +447,7 @@ function printSize(type, maxSize) { function bundlePlayableAds() { const dir = bundleJsWebPath + "/" + projectTitle; return src(dir + "/index.html") + .pipe(removeRunningFromFileWarning()) .pipe(embedImages(dir)) .pipe(embedJs(dir)) .pipe(rename(sanitisedTitle + ".html")) diff --git a/playable_ad/manifests/web/engine_template.html b/playable_ad/manifests/web/engine_template.html index 75cc1a6..d9cc9f8 100644 --- a/playable_ad/manifests/web/engine_template.html +++ b/playable_ad/manifests/web/engine_template.html @@ -240,6 +240,7 @@ +