|
1 | 1 | # How to Build |
2 | 2 |
|
3 | | -## Prepare dependencies |
| 3 | +## Hardware Requirements |
4 | 4 |
|
5 | | -* JDK 1.8 (JDK 1.9+ are not supported yet) |
6 | | -* On Linux Ubuntu system (e.g. Ubuntu 16.04.4 LTS), ensure that the machine has [__Oracle JDK 8__](https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04), instead of having __Open JDK 8__ in the system. If you are building the source code by using __Open JDK 8__, you will get [__Build Failed__](https://github.com/tronprotocol/java-tron/issues/337) result. |
7 | | -* Open **UDP** ports for connection to the network |
8 | | -* **Minimum** 2 CPU Cores |
| 5 | +For mainnet deployment, refer to the [Hardware Requirements for Mainnet](README.md#hardware-requirements-for-mainnet) table in the README. |
9 | 6 |
|
10 | | -## Build and Deploy automatically using scripts |
| 7 | +For compilation only (not running a node), a minimum of **4 CPU cores, 16 GB RAM, and 10 GB free disk space** is sufficient. |
11 | 8 |
|
12 | | -- Please take a look at the [Tron Deployment Scripts](https://github.com/tronprotocol/TronDeployment) repository. |
| 9 | +## Prerequisites, Source Code, and Console Build |
13 | 10 |
|
14 | | -## Getting the code with git |
| 11 | +See [Building the Source Code](README.md#building-the-source-code) in the README for: |
| 12 | +- Hardware/OS/JDK prerequisites |
| 13 | +- Dependency installation (`install_dependencies.sh`) |
| 14 | +- `git clone` and `./gradlew build` instructions |
15 | 15 |
|
16 | | -* Use Git from the console, see the [Setting up Git](https://help.github.com/articles/set-up-git/) and [Fork a Repo](https://help.github.com/articles/fork-a-repo/) articles. |
17 | | -* `develop` branch: the newest code |
18 | | -* `master` branch: more stable than develop. |
19 | | -In the shell command, type: |
20 | | - ```bash |
21 | | - git clone https://github.com/tronprotocol/java-tron.git |
22 | | - git checkout -t origin/master |
23 | | - ``` |
| 16 | +## Building in IntelliJ IDEA |
24 | 17 |
|
25 | | -* For Mac, you can also install **[GitHub for Mac](https://mac.github.com/)** then **[fork and clone our repository](https://guides.github.com/activities/forking/)**. |
| 18 | +Run `./gradlew build -x test` once from the terminal before opening the project to generate protobuf sources. |
26 | 19 |
|
27 | | -* If you'd rather not use Git, **[Download the ZIP](https://github.com/tronprotocol/java-tron/archive/develop.zip)** |
| 20 | +1. Open IntelliJ IDEA and select **File → Open**, locate the `java-tron` directory, and click **Open**. |
| 21 | +2. When prompted, select **Trust Project**. |
| 22 | +3. Wait for Gradle sync to complete. |
| 23 | +4. In **Settings → Build, Execution, Deployment → Compiler → Annotation Processors**, enable **Annotation Processing**. |
| 24 | +5. In the **Gradle** panel, navigate to **Tasks → build** and double-click **build**. |
28 | 25 |
|
29 | | -## Including java-tron as dependency |
| 26 | +## Including java-tron as a Dependency |
30 | 27 |
|
31 | | -If you don't want to checkout the code and build the project, you can include it directly as a dependency. |
| 28 | +**Gradle:** |
32 | 29 |
|
33 | | -**Using gradle:** |
34 | | - |
35 | | -``` |
| 30 | +```groovy |
36 | 31 | repositories { |
37 | | - maven { url 'https://jitpack.io' } |
| 32 | + maven { url 'https://jitpack.io' } |
38 | 33 | } |
39 | 34 | dependencies { |
40 | | - implementation 'com.github.tronprotocol:java-tron:develop-SNAPSHOT' |
| 35 | + implementation 'com.github.tronprotocol:java-tron:develop-SNAPSHOT' |
41 | 36 | } |
42 | 37 | ``` |
43 | | - |
44 | | -**Using maven:** |
| 38 | + |
| 39 | +**Maven:** |
45 | 40 |
|
46 | 41 | ```xml |
47 | 42 | <repositories> |
48 | | - <repository> |
49 | | - <id>jitpack.io</id> |
50 | | - <url>https://jitpack.io</url> |
| 43 | + <repository> |
| 44 | + <id>jitpack.io</id> |
| 45 | + <url>https://jitpack.io</url> |
51 | 46 | </repository> |
52 | 47 | </repositories> |
53 | 48 |
|
54 | 49 | <dependency> |
55 | 50 | <groupId>com.github.tronprotocol</groupId> |
56 | 51 | <artifactId>java-tron</artifactId> |
57 | 52 | <version>develop-SNAPSHOT</version> |
58 | | - <!--You can use any of the tag/branch name available--> |
59 | 53 | </dependency> |
60 | 54 | ``` |
61 | | - |
62 | | -## Building from source code |
63 | | - |
64 | | -- **Building using the console:** |
65 | | - |
66 | | - ```bash |
67 | | - cd java-tron |
68 | | - ./gradlew build |
69 | | - ``` |
70 | | - |
71 | | -- **Building using [IntelliJ IDEA](https://www.jetbrains.com/idea/) (community version is enough):** |
72 | | - |
73 | | - **Please run `./gradlew build` once to build the protocol files** |
74 | | - |
75 | | - 1. Start IntelliJ. |
76 | | - Select `File` -> `Open`, then locate to the java-tron folder which you have git cloned to your local drive. Then click `Open` button on the right bottom. |
77 | | - 2. Check on `Use auto-import` on the `Import Project from Gradle` dialog. Select JDK 1.8 in the `Gradle JVM` option. Then click `OK`. |
78 | | - 3. IntelliJ will import the project and start gradle syncing, which will take several minutes, depending on your network connection and your IntelliJ configuration |
79 | | - 4. Enable Annotations, `Preferences` -> Search `annotations` -> check `Enable Annotation Processing`. |
80 | | - 5. When the syncing finishes, select `Gradle` -> `Tasks` -> `build`, and then double click `build` option. |
81 | | - |
0 commit comments