-
Notifications
You must be signed in to change notification settings - Fork 36
BRJS Developer Setup
This page walks through the setup for developing core BladeRunnerJS, not BladeRunnerJS plugins or libraries.
- Since we're going to be using Git we need it installed
- Windows: git-bash is probably the best thing to use or install using the Git installer for Windows
- Mac: install Git either via HomeBrew or using the Git installer for Mac
- Linux: Use the Git installer for Linux
- DIY: Or follow the Git install guide
- If you're using Windows we recommend you set auto line endings
- Run
git config --global core.autocrlf true
- Set your identity
git config --global user.name <Your Name>
git config --global user.email <Your Email>
- Make sure the email is the same as the one used for your GitHub account
BRJS is written and compiled using Java 8, but we distribute it and run the tests against it using Java 7, courtesy of retrolambda. Because of this, you will need to do the following:
- Install both Java 7 and Java 8 JDKs.
- Configure
JAVA7_HOME
to point to the Java 7 JDK home directory. - Configure
JAVA8_HOME
to point to the Java 8 JDK home directory. - Configure
JAVA_HOME
to point to either the Java 7 or the Java 8 JDK home directory, as you prefer. - Configure the
path
environment variable to include$JAVA_HOME/bin
.
- Clone the BRJS repo
git clone https://github.com/BladeRunnerJS/brjs.git
- See what branches we have available
git branch -a
- Set up the submodules
git submodule init
git submodule update
- Checkout the 'develop' branch
git checkout develop
You may need to run git submodule sync
and git submodule update
when changing branches if submodules have changed.
These steps walkthrough setting up Eclipse, if you're using a different IDE you're on your own :)
- Use the Gradle build to create the Eclipse project files
- In the 'brjs' directory:
./gradlew eclipse
- Start Eclipse
- Select
File -> Import -> General -> Existing projects into workspace
- Under
options
clickSearch for nested projects
(You'll need Eclipse Kepler to see this option) - Select the
brjs
folder as the root directory and select all of the folders - Click finish
- Eclipse should now be set up and all project dependencies configured
- You may need to re-run
./gradlew eclipse
from time to time and refresh all projects, particularly if dependencies change.
Alternatively, you can use EGit to import Git projects.
- Install EGit
- In the Import dialog, select
Git -> Projects from Git
- Select
Local
, then selectAdd
- Navigate to where you cloned brjs to and add that as a local Git repo
- After adding the repo, select it and click next
- Leave
Import existing projects
selected - In the next screen, all the projects should already be selected, if not make sure you check
Search for nested projects
- Click finish
To run BRJS from Eclipse:
- From the menu, select 'Run' > 'Run configurations...'
- Scroll up to the 'Java Application' section and click the 'new' icon in the top-left.
- Browse to the 'brjs-runner' project.
- For the class, click the 'Search...' button and select the 'CommandRunner' class.
- On the 'Arguments' tab type
. . serve
into the 'Program arguments' input box - Select the 'Other' radio-button in the 'Working directory' section, click either the 'Workspace...' or 'File System...' button, and navigate to the root of SDK structure you'd like to test with.
- Click 'Apply' to save your changes, and 'Run' to use your new run configuration.
- To run the build, run
./gradlew build
from the brjs directory. - To run 'build' or 'test' for a particular project, navigate to that directory and run
./gradlew test
or./gradlew build
. - To build the distributable, either run
./gradlew :brjs-sdk:build
or navigate to the 'brjs-sdk' directory and run../gradlew build
. - The zip is then built and placed in 'brjs-sdk/build/distributions'
- The build is changing a lot at the moment, so this may change in the future
The BladeRunnerJS source code is encoded in UTF-8, which is the default file encoding on Mac and Linux, but not on Windows. Development on Windows is possible, but requires that you manually configure your tool chain to use UTF-8 encoding.
From within the brjs
repository, type:
git config gui.encoding utf-8
You will need to change your encoding to UTF-8, like so: Windows > Preferences > General > Content Types, set UTF-8 as the default encoding for all content types.
If you plan to edit using any other text editors, you'll need to ensure that these editors have also been configured to read and write files in UTF-8 format.
If you encounter this issue when doing a pull, you will need to enable the longpaths
property in Git:
- Update to msysgit 1.9 (or later)
- Launch Git Bash
- Go to your Git repository
- Enable long paths support with
git config core.longpaths true
See the Troubleshooting Guide