Skip to content

Commit

Permalink
Upgrade to support Defold 1.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
aglitchman authored Jul 22, 2023
1 parent 2bfdaa9 commit 130a5be
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:

Expand All @@ -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
```
Expand All @@ -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 [email protected].0
brew install node@18
brew install openjdk@17
brew install [email protected].5
npm install --global gulp-cli
```
Expand Down
12 changes: 12 additions & 0 deletions playable_ad/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions playable_ad/manifests/web/engine_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
</script>
</head>
<body>
<div id="running-from-file-warning" merge="keep"></div>
<script id="engine-loader" src="dmloader.js" embed="compress"></script>
<script data-src="{{exe-name}}_archive.js" embed></script>
</body>
Expand Down

0 comments on commit 130a5be

Please sign in to comment.