Skip to content

Commit

Permalink
chore: start updating IntelliJ quickstart
Browse files Browse the repository at this point in the history
Signed-off-by: Jendrik Johannes <[email protected]>
  • Loading branch information
jjohannes committed Apr 15, 2024
1 parent fb77f93 commit 5f93bf0
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 15 deletions.
Binary file added docs/assets/gradle-jdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion docs/gradle-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Module System compatible, you may also need to add [patching rules](#patching-3r
Some 3rd party libraries we use are not yet fully Java Module System compatible. And some modules pull in other
dependencies that we can neglect. Situations like this are treated as wrong/incomplete metadata in our Gradle
setup and the file
[com.hedera.gradlebuild.patch-metadata.gradle.kts](gradle/plugins/src/main/kotlin/com.hedera.gradlebuild.patch-metadata.gradle.kts)
[com.hedera.hashgraph.jpms-modules.gradle.kts](../gradle/plugins/src/main/kotlin/com.hedera.hashgraph.jpms-modules.gradle.kts)
contains the rules to adjust or extend the metadata of 3rd party libraries to address such problems.

Note: This project utilizes the
Expand Down
42 changes: 33 additions & 9 deletions docs/intellij-quickstart.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# IntelliJ quickstart

## JVM

OpenJDK17 is strongly recommended. You can [download it from IntelliJ](https://www.jetbrains.com/help/idea/sdk.html)
if you don't have it already.

## Preliminaries

Clone this repository:
Expand All @@ -15,15 +10,44 @@ git clone https://github.com/hashgraph/hedera-services.git

From IntelliJ, choose `File -> Open` the _hedera-services/_ directory you just cloned.

Make sure you are using JDK17 as the project SDK:
## Configure the JDK used by Gradle

The project is imported as a Gradle project. Before you can use all features reliably, make sure that Gradle is
started with the JDK we use in the project, which currently is:
**Eclipse Temurin, 21.0.1**

You can use IntelliJ to download the JDK if you do not have it installed.

<p>
<img src="./assets/gradle-jdk.png" />
</p>


## Reload Project with Gradle

After everything is configured, and everytime you change something in the project setup, you should press the
**Reload All Gradle project** in IntelliJ.

Changes to the project setup include,
- Changing `build.gradle.kts` files
- Changing dependencies in `src/main/java/module-info.java` files
- Changing build configuration in `gradle/plugins/src/main/kotlin`

<p>
<img src="assets/jdk-17.png"/>
<img src="./assets/gradle-reload.png" />
</p>

Run the Gradle `assemble` task in the root project (for example, via the IntelliJ Gradle tool window).
See [gradle-quickstart](gradle-quickstart.md) for more details on modifying the project setup.

## Run Gradle tasks

You can run all tasks described in [gradle-quickstart](gradle-quickstart.md) from the Gradle tool window.

<p>
<img src="./assets/gradle-tasks.png" />
</p>

This will both,
Running the Gradle `assemble` task will both,
<ol>
<li>Build the <i>hedera-node/data/apps/HederaNode.jar</i>; and,
<li>Populate your <i>hedera-node/data/config</i> directory with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plugins {
id("com.autonomousapps.dependency-analysis")
}

spotless { kotlinGradle { target("build-logic/**/*.gradle.kts") } }
spotless { kotlinGradle { target("gradle/plugins/**/*.gradle.kts") } }

val productVersion = layout.projectDirectory.versionTxt().asFile.readText().trim()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ develocity {
buildScan {
termsOfUseUrl = "https://gradle.com/help/legal-terms-of-use"
termsOfUseAgree = "yes"
publishing.onlyIf { false } // only publish with explicit '--scan'
}
}

Expand Down
8 changes: 4 additions & 4 deletions hedera-node/docs/design/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Java modules.
Each module needs a `build.gradle.kts` file that describes the module.

General best practices for all our (Java) modules are defined in custom plugins that can be found
under `build-logic/src/main/kotlin`. For a Java module the `com.hedera.hashgraph.javaConventions` plugin should be used.
under `gradle/plugins/src/main/kotlin`. For a Java module the `com.hedera.hashgraph.java` plugin should be used.
Next to this each module should have a description. Since nothing else is needed for a minimal module the most simple
`build.gradle.kts` looks like this:

```
plugins {
id("com.hedera.hashgraph.javaConventions")
id("com.hedera.hashgraph.java")
}
description = "A minimal module without any dependecies"
Expand All @@ -45,14 +45,14 @@ specific path below the `src/main/resources/com/hedera/node/app/services/foo` fo

## Tests

All modules can have different types of tests. The `com.hedera.hashgraph.javaConventions` plugin provides direct support
All modules can have different types of tests. The `com.hedera.hashgraph.java` plugin provides direct support
for unit test, integration tests, and end-to-end tests. Next to this the test fixtures functionality of Gradle is
supported.

### Test fixtures

To create clean and readable unit tests it is best practice to provide common functionality for tests in the test
fixtures of a module. Based on the `com.hedera.hashgraph.javaConventions` plugin test fixtures are supported for all
fixtures of a module. Based on the `com.hedera.hashgraph.java` plugin test fixtures are supported for all
Java modules.

All Java sources for the test fixtures must be placed under `src/testFixtures/java`. Additional resources that should be
Expand Down

0 comments on commit 5f93bf0

Please sign in to comment.