|
1 | 1 | # Defold Editor
|
2 | 2 |
|
3 |
| -## Requirements |
4 |
| -* [Java 11](https://jdk.java.net/11/) ([installation instructions](#installing-jdk11) - Note that we do not yet officially support development with a newer version of Java than 11. |
5 |
| -* Leiningen ([install instructions](#install-leiningen)) |
| 3 | +## Overview |
| 4 | +Editor overview [here](README_SYSTEMS_OVERVIEW.md). |
6 | 5 |
|
7 |
| -## Installing JDK 11 |
8 |
| -### macOS |
9 |
| - |
10 |
| -* Download the [macOS](https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_osx-x64_bin.tar.gz) version and extract it |
11 |
| -* Run `sudo cp -R <path-to-extracted-folder>/jdk-11.0.2.jdk /Library/Java/JavaVirtualMachines/` |
12 |
| -* Verify that the jdk version is available by running `/usr/libexec/java_home -V` |
13 |
| -* Switch to the new version by running `/usr/libexec/java_home -v 11.0.2` |
14 |
| - |
15 |
| -### Linux |
16 |
| - |
17 |
| -* Download [Linux](https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz) version and extract it somewhere |
18 |
| -* Run `sudo update-alternatives --install "/usr/bin/java" "java" "/path/to/jdk/bin/java" 1102` |
19 |
| -* Run `sudo update-alternatives --install "/usr/bin/javac" "javac" "/path/to/jdk/bin/javac" 1102` |
20 |
| -* If require, switch to new version using `sudo update-alternatives --config java` and `sudo update-alternatives --config javac` |
21 |
| - |
22 |
| -### Notes |
23 |
| - |
24 |
| -If you are using IntelliJ for lein tasks, you will need to first add the new SDK (file->project structure/SDKs) |
25 |
| -and then set the project SDK setting (file->project structure/Project) to the new version. |
26 |
| - |
27 |
| -## Installing Leiningen |
28 |
| -### Windows |
29 |
| - |
30 |
| -First of all, follow the Windows instructions in [Defold Readme](../README.md) |
31 |
| - |
32 |
| -* Start `msys.bat` as described |
33 |
| -* Download the [lein.sh script](https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein) from [Leiningen.org](http://leiningen.org) Put it somewhere in your (msys) path - if you're lazy, put it in `C:\MinGW\msys\1.0\bin`. You might need to `chmod a+x lein.sh`. |
34 |
| -* Run `lein` in the `editor` subdirectory |
35 |
| - This will attempt to download leiningen and dependencies to your home directory. |
36 |
| - |
37 |
| - - If this fails with message |
38 |
| - |
39 |
| - Could not find or load main class clojure.main |
40 |
| - |
41 |
| - Try pointing your `HOME` environment variable to your “windows home”. For instance change it from `/home/Erik.Angelin` (msys) to `/c/Users/erik.angelin`: |
42 |
| - |
43 |
| - export HOME="/c/Users/erik.angelin" |
44 |
| - |
45 |
| - The problem seems to be that the (windows) java class path points to an invalid home directory. |
46 |
| - |
47 |
| - - If this fails because the github certificate cannot be verified: |
48 |
| - |
49 |
| - export HTTP_CLIENT='wget --no-check-certificate -O' |
50 |
| - |
51 |
| -### macOS/Linux |
52 |
| - |
53 |
| -* Install Leiningen `brew install leiningen` |
54 | 6 |
|
55 | 7 | ## Setup
|
56 |
| -* Open a terminal/console and change directory to `defold`. |
57 |
| - |
58 |
| - `cd defold` |
59 |
| - |
60 |
| -* Setup the shell environment (consider putting it in an alias in your bash profile): |
61 |
| - |
62 |
| - `./scripts/build.py shell --platform=...` |
63 |
| - |
64 |
| -* Run install_ext for the correct platform: |
65 |
| - |
66 |
| - `./scripts/build.py install_ext --platform=...` |
67 |
| - |
68 |
| -* Build the engine: |
69 |
| - |
70 |
| - `./scripts/build.py build_engine --platform=... --skip-tests -- --skip-build-tests` |
71 |
| - |
72 |
| -* Build builtins: |
73 |
| - |
74 |
| - `scripts/build.py build_builtins` |
75 |
| - |
76 |
| -* Build reference documentation: |
77 |
| - |
78 |
| - `scripts/build.py build_docs` |
79 |
| - |
80 |
| -* Build Bob: |
81 |
| - |
82 |
| - `scripts/build.py build_bob --skip-tests` |
83 |
| - |
84 |
| -* Change directory to the editor directory |
85 |
| - |
86 |
| - `cd editor` |
87 |
| - |
88 |
| -* Run: |
89 |
| - |
90 |
| - `lein init` |
| 8 | +(Setup instructions for the engine [here](../README_SETUP.md)). |
91 | 9 |
|
92 |
| -## Cursive IDE Setup |
93 |
| -Some of the remaining instructions are about EMACS. If instead you want to use the Cursive IDE, read the [Cursive setup guide](README_CURSIVE.md). |
| 10 | +* macOS - [Setup instructions](README_SETUP_MACOS.md) |
| 11 | +* Windows - [Setup instructions](README_SETUP_WINDOWS.md) |
| 12 | +* Linux - [Setup instructions](README_SETUP_LINUX.md) |
94 | 13 |
|
95 |
| -## Running Tests |
96 |
| -`lein test` will run all the tests including the integration tests. |
| 14 | +If you want to use the Cursive IDE, read the [Cursive setup guide](README_CURSIVE.md). |
97 | 15 |
|
98 |
| -If you are using a repl, you can also run the tests by calling `(suite/suite)`. |
99 | 16 |
|
100 |
| -## Setup NREPL for debugging |
| 17 | +## Build and debug/REPL |
| 18 | +Build and debug/REPL instructions [here](README_BUILD.md). |
101 | 19 |
|
102 |
| -If you want to work on the editor chances are you want to `connect` or `jack-in` to a REPL as described below. |
103 |
| - |
104 |
| -For this to work you will need a `~/.lein/profiles.clj` file and put the nREPL, Cider (etc) dependencies there; |
105 |
| - |
106 |
| -``` |
107 |
| -{:user {:plugins [[cider/cider-nrepl "0.10.2"] |
108 |
| - [refactor-nrepl "1.1.0" :exclusions [org.clojure/clojure]]] |
109 |
| - :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}} |
110 |
| -``` |
111 |
| - |
112 |
| -Please note that Lein will introduce a nREPL dependency automagically, but its a good idea to override to your preferred version here anyway. |
113 |
| - |
114 |
| -## Running the Editor |
115 |
| -`lein run` will launch the editor as well as providing a nrepl port |
116 |
| -for you to jack into |
117 |
| - |
118 |
| -## Building the Editor |
119 |
| - |
120 |
| -Use `scripts/bundle.py` to produce a bundled version of the editor. |
121 |
| - |
122 |
| -There are a few different scenarios in which you might want to build the editor locally: |
123 |
| - |
124 |
| -- Local editor sources, archived engine artifacts based on HEAD: |
125 |
| - - `./scripts/bundle.py --platform=x86_64-win32 --version=1.2.3.4 --engine-artifacts=archived` |
126 |
| - - This will fetch engine and launcher artifacts using the `HEAD` revision. |
127 |
| -- Local editor sources, archived engine artifacts based on a different revision: |
128 |
| - - `./scripts/bundle.py --platform=x86_64-win32 --version=1.2.3.4 --engine-artifacts=archived-stable` |
129 |
| - - This will fetch engine and launcher artifacts using the latest stable revision and is handy if you are on a branch where no engine artifacts have been archived. |
130 |
| -- Local editor sources, local engine artifacts, local launcher: |
131 |
| - - `./scripts/bundle.py --platform=x86_64-win32 --version=1.2.3.4 --engine-artifacts=dynamo-home` |
132 |
| - - This will use local engine artifacts from `$DYNAMO_HOME`, with the exception of the launcher. |
133 |
| -- Local editor sources, archived engine artifacts, local launcher: |
134 |
| - - `./scripts/bundle.py --platform=x86_64-win32 --version=1.2.3.4 --engine-artifacts=archived --launcher ../tmp/dynamo_home/bin/x86_64-darwin/launcher` |
135 |
| - - This will fetch engine artifacts using the `HEAD` revision. |
136 |
| - |
137 |
| - |
138 |
| -## Jacking into a REPL |
139 |
| - |
140 |
| -You can also use `M-x cider-jack-in` or launch the editor inside Cursive for debugging with breakpoints etc. |
141 |
| - |
142 |
| -First set the environment variable `DYNAMO_HOME`. Example of a value `/Users/martin/work/defold/tmp/dynamo_home`. |
143 |
| - |
144 |
| -After you jacked in do the following to load and start the app; |
145 |
| - |
146 |
| -``` |
147 |
| -user=> (dev) |
148 |
| -dev=> (go) |
149 |
| -``` |
150 |
| - |
151 |
| -## Running Benchmarks |
152 |
| -`lein benchmark` will run the benchmarks and put the results to the |
153 |
| -`test/benchmark/bench-result.txt` file. Make sure to have everything |
154 |
| -on your system closed down |
155 |
| - |
156 |
| -## Generating the docs |
157 |
| -Running `lein doc` will generate the codox to the target/docs directory |
158 | 20 |
|
159 | 21 | ## Styling
|
160 |
| -A single stylesheet is set on the root node (by convention) in the scene. The stylesheet `editor.css` is loaded as a regular java resource, from the uberjar or from the file-system in dev-mode. If an `editor.css` is found in the current working directory that file will take precedence over the aforementioned java resource. |
161 |
| - |
162 |
| -The stylesheet can be reloaded with the function key `F5`. |
163 |
| - |
164 |
| -The `editor.css` stylesheet is generated from the the sass/scss files in `styling/stylesheets`. To generate the file you can use either leiningen or gulp: |
165 |
| - |
166 |
| -**leiningen** |
167 |
| - |
168 |
| -- `lein sass once` to generate once |
169 |
| -- `lein sass watch` to watch and re-generate css on changes |
170 |
| - |
171 |
| -**nodejs** |
172 |
| - |
173 |
| -In the `styling` directory: |
174 |
| -- `npm install` |
175 |
| - |
176 |
| -- `gulp` to generate once |
177 |
| -- `gulp watch` to watch and re-generate css on changes |
178 |
| - |
179 |
| -See `styling/README.md` for details. |
180 |
| - |
181 |
| - |
182 |
| -### JavaFX Styling |
183 |
| - |
184 |
| -The best way to understand how JavaFX styling works is by studying the default stylesheet `modena.css` included in `jfxrt.jar` |
185 |
| - |
186 |
| -## Bundling games and running in browser |
187 |
| - |
188 |
| -As a temporary solution, we use Bob (from Editor1) as the content pipeline for bundling and running in the browser. In order to setup Bob locally, you need to: |
189 |
| - |
190 |
| -- Build the engine for the specific platform, e.g. `python scripts/build.py build_engine --platform=js-web --skip-tests -- --skip-build-tests` |
191 |
| - - For android, you also need to `build_go` through `build.py` to obtain `apkc` |
192 |
| -- Build Bob with local artifacts, `python scripts/build.py build_bob` |
193 |
| -- `lein init`, which will install `bob.jar` as a local maven package |
194 |
| - |
195 |
| -## Using a local bob.jar |
196 |
| - |
197 |
| -When developing it can be convenient to use a local bob.jar instead of the one bundled with the editor. This can by adding `,-Ddefold.dev=true` to the end of the `vmargs =` field of the editor config. |
198 |
| - |
199 |
| -* On macOS the config is inside the application file: `Defold.app/Contents/Resources/config` |
200 |
| -* On Windows and Linux the config file is located next to the Defold executable. |
| 22 | +Editor styling documentation [here](README_STYLING.md). |
0 commit comments