Skip to content

Commit cff6b0f

Browse files
Improve contributing guide (#645)
1 parent f426c39 commit cff6b0f

File tree

1 file changed

+46
-30
lines changed

1 file changed

+46
-30
lines changed

CONTRIBUTING.md

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,23 @@ This doc is intended for contributors to `cadence-java-client` (hopefully that's
77
## Development Environment
88

99
* Java 11 (currently, we use Java 11 to compile Java 8 code).
10-
* Thrift 0.9.3
11-
* Gradle build tool
10+
* Thrift 0.9.3 (use [homebrew](https://formulae.brew.sh/formula/[email protected]) or [distribution](https://downloads.apache.org/thrift/0.9.3/))
11+
* Gradle build tool [6.x](https://github.com/uber/cadence-java-client/blob/master/gradle/wrapper/gradle-wrapper.properties)
1212
* Docker
1313

14+
:warning: Note 1: You must install the 0.9.x version of Thrift. Otherwise compiling would fail at error `error: package org.apache.thrift.annotation does not exist`
15+
16+
:warning: Note 2: It's currently compatible with Java 8 compiler but no guarantee in the future.
17+
18+
## IntelliJ IDE integration (Optional)
19+
20+
* Make sure you set the gradle path with the right version ([currently 6.x](https://github.com/uber/cadence-java-client/blob/master/gradle/wrapper/gradle-wrapper.properties))
21+
22+
![IntelliJ](https://user-images.githubusercontent.com/4523955/135696878-81c1e62e-eb04-45e6-9bcb-785ac38b6607.png)
23+
24+
* Then all the below `gradlew` command can be replaced with the Gradle plugin operation
25+
![Gradle](https://user-images.githubusercontent.com/4523955/135696922-d43bc36d-18a4-4b7b-adee-0fe8300bf855.png)
26+
1427
## Licence headers
1528

1629
This project is Open Source Software, and requires a header at the beginning of
@@ -32,16 +45,42 @@ Overcommit adds some requirements to your commit messages. At Uber, we follow th
3245
[Chris Beams](http://chris.beams.io/posts/git-commit/) guide to writing git
3346
commit messages. Read it, follow it, learn it, love it.
3447

35-
## Test
3648

37-
Testing and building cadence-java-client requires running cadence docker locally, execute:
49+
## Build & Publish & Test locally
50+
Build with:
51+
52+
```bash
53+
./gradlew build
54+
```
55+
56+
To test locally, you can publish to [MavenLocal](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:case-for-maven-local)
57+
58+
1. Change `build.gradle`:
59+
Comment out the first section in `publications` ( line 160 to line 191 in [this commit](https://github.com/uber/cadence-java-client/blob/c9ec6786aa9f866b0310292ea3ee5df63adc8799/build.gradle#L160))
3860

61+
2. Change the [version](https://github.com/uber/cadence-java-client/blob/c9ec6786aa9f866b0310292ea3ee5df63adc8799/build.gradle#L43) to add a `local` suffix. E.g.
62+
```
63+
version = '3.3.0'
64+
````
65+
to
66+
```
67+
version = '3.3.0-local'
68+
```
69+
Then run the command
3970
```bash
40-
curl -O https://raw.githubusercontent.com/uber/cadence/master/docker/docker-compose.yml
41-
docker-compose up
71+
./gradlew publishToMavenLocal
4272
```
73+
Now you have the local cadence-java-client in your machine using veriosn `3.3.0-local`
4374

44-
(If this does not work, see instructions for running the Cadence Server at https://github.com/uber/cadence/blob/master/README.md.)
75+
3. To test with Cadence Java Samples, [change](https://github.com/uber/cadence-java-samples/blob/master/build.gradle#L32) `mavenCentral()` to `mavenLocal()`
76+
and also change the [version](https://github.com/uber/cadence-java-samples/blob/a79d8d6e5860cf9986bf549fc1f96badecb09f8f/build.gradle#L38) with your suffix.
77+
78+
Then `./gradlew build` and refer to the sample repo for how to run the code(it needs to run with a [Cadence server](https://github.com/uber/cadence)).
79+
80+
:warning: If you run into problem with `version.properties` [creation task](https://github.com/uber/cadence-java-client/blob/c9ec6786aa9f866b0310292ea3ee5df63adc8799/build.gradle#L109), you can comment the task out. It's okay for local testing.
81+
The property file is being used by [Version class](https://github.com/uber/cadence-java-client/blob/master/src/main/java/com/uber/cadence/internal/Version.java#L39)to report the library version for logging/metrics.
82+
83+
## Unit & Integration Test
4584

4685
Then run all the tests with:
4786

@@ -60,26 +99,3 @@ STICKY_OFF=true USE_DOCKER_SERVICE=true ./gradlew test
6099

61100
Also, if there is any Buildkite test failure that you cannot reproduce locally,
62101
follow [buildkite docker-compose](./docker/buildkite/README.md) instructions to run the tests.
63-
64-
## Build & Publish
65-
Build with:
66-
67-
```bash
68-
./gradlew build
69-
```
70-
71-
To test locally, change `build.gradle`:
72-
1. Comment out the whole `publications`
73-
2. Change
74-
```
75-
group = 'com.uber.cadence'
76-
````
77-
to
78-
```
79-
group = 'com.local.cadence'
80-
```
81-
Then run the command
82-
```bash
83-
./gradlew publishToMavenLocal
84-
```
85-
Now you can use the local cadence-java-client in your laptop.

0 commit comments

Comments
 (0)