Extender is a build server that builds native extensions of the Defold engine. The build server can either by run using Docker or as a stand-alone server running on macOS.
This describes how to build and run the extender server using Docker. It involves 4 steps:
- Download and prepare required packages
- Serve the required packages
- Build the Docker image
- Run the Docker image in a container
Make sure you have Docker installed and running.
Most of the SDKs used by Extender server have licenses that prevent third party redistribution. To efficiently work with the build server it is recommended to package the SDKs and serve them from a private URL. The URL is defined as the DM_PACKAGES_URL environment variable.
The Dockerfile lists the actual packages needed per platform:
- Clang LLVM: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L49-L51
- HTML5
- Windows
- Microsoft Visual Studio 2019: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L103
- Windows Kits: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L169
- Android:
- iOS and macOS
- iOS, macOS, Xcode - previous version: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L475-L485
- iOS, macOS, Xcode - latest version: https://github.com/defold/extender/blob/dev/server/docker-base/Dockerfile#L488-L496
We have prepared scripts to package the required files. Use the scripts in the defold/scripts/package folder to create these packages.
NOTE: If you only plan to use the extender server to build for a single platform you may remove the setup steps for the other platforms to speed up the build process.
When the packages are downloaded you need to make them available when the Docker container is built. The recommended way is to serve the files using Python:
# Using python 2
$ export DM_PACKAGES_URL=https://localhost
$ cd local_sdks && python -m SimpleHTTPServer
# Using python 3
$ export DM_PACKAGES_URL=https://localhost:9999
$ cd local_sdks && python -m http.server 9999
Build the Extender Docker image by running:
./server/scripts/build.sh
To speed things up, tests can be disabled by passing -xtest
to the command line.
$ ./server/scripts/build.sh -xtest
NOTE: The first time you build it will take a while (approx. 45 minutes). After that the Docker cache will speed it up.
NOTE: For Windows, I ran this using Git Bash. It may be possible to speed it up by creating a .bat file for it, and running it in the Command Prompt.
Start the container based on the Docker image that was built by running:
Bash:
$ ./server/scripts/run-local.sh
Command Prompt:
> server\scripts\run-local.bat
The Extender server is now available on port https://localhost:9000
You can stop the server by pressing Ctrl-C
from the terminal prompt where it was started.
NOTE: On Windows, it may be that the Ctrol+C doesn't work. Then you can stop the container using the Docker Desktop client.
The stand-alone server is currently used on a machine runing macOS. The server is used to build darwin targets (macOS+iOS) using the Apple tools (XCode+Apple Clang). It is also possible to use this setup when developing on macOS.
Ensure that you have the following tools packaged
- macOS
- XCode
- iOS SDK
- Clang 13.0.0
- Swift
NOTE: Above requirements taken from the Dockerfile. Double-check that they are still accurate! Also see server/scripts/standalone/service-standalone.sh
.
To run the stand-alone server locally, you need to give it access to /usr/local/extender
:
$ sudo mkdir /usr/local/extender
$ sudo chown -R mawe:staff /usr/local/extender
Now the current user has access to the folder and can start the service.
$ ./server/scripts/run-standalone-local.sh
This will start a local server at. If you run the script again, the server will be stopped and then restarted with the latest extender.jar
You can change which folder to run the stand-alone server from by setting the TARGET_DIR
environment variable.
$ TARGET_DIR=/path/to/localextender ./server/scripts/run-standalone-local.sh
To stop a local server started with run-local.sh
, simply press CTRL+C
.
To stop the stand-alone service, you need to call stop on the current service script, and also provide the folder with the .pid
file:
$ /path/to/localextender/current/service.sh stop /path/to/localextender
or (if you used the vanilla startup):
$ /usr/local/extender/current/service.sh stop /usr/local/extender
Use the rebuild-and-run-standalone-local.sh
script to quickly rebuild and launch a new version of the stand-alone server:
$ ./server/scripts/rebuild-and-run-standalone-local.sh /path/to/localextender
This will set the TARGET_DIR
environment variable to /path/to/localextender
, stop any currently running server, build a new one, deploy and start it and show the server log in the console.