Skip to content

Commit

Permalink
docs: update CONTRIBUTING.md guide (#81)
Browse files Browse the repository at this point in the history
Added section about:

- building
- testing
- code style
- using local build as a dependency

---------

Co-authored-by: sachin shinde <[email protected]>
  • Loading branch information
ttypic and sacOO7 authored Dec 4, 2024
1 parent b84b113 commit cb58c0b
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 8 deletions.
112 changes: 105 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,102 @@
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request

### Building

A gradle wrapper is included, so these tasks can run without any prior installation of gradle. The Linux/OSX form of the commands, given
below, is:

```bash
./gradlew <task name>
```

For Windows, use the batch file:

```cmd
gradlew.bat <task name>
```

To build the library’s AAR package, execute:

```bash
./gradlew chat-android:assemble
```

The built AAR package will be located in the `chat-android/build/outputs/aar/` directory.

### Code Standard

#### Detekt

We use [Detekt](https://detekt.dev/) for code style checks and static analysis in this project.
Detekt helps maintain a consistent codebase and identify potential issues in the code.
Before submitting a pull request, ensure that your code passes all Detekt checks.

#### Running Detekt Locally

You can run Detekt locally to verify your code against the configured rules. Use the following command:

```bash
./gradlew detekt
```

#### Updating the rules

Detekt’s rules can be updated by modifying the [detekt.yml](https://github.com/ably/ably-chat-kotlin/blob/main/detekt.yml) configuration
file. Ensure that any changes to the rules are well-documented and align with the project’s coding standards.

### Running Tests

Our tests are written using JUnit and can be executed with the following command:

```bash
./gradlew test
```

This will run all unit tests in the project. Ensure all tests pass before submitting a pull request.

## Using `chat-android` locally in other projects

If you wish to make changes to the source code and test them immediately in another project, follow these steps:

### Step 1: Update the Version Property

Modify the version property in `gradle.properties` to reflect a local version:

```properties
VERSION_NAME=0.1.0-local.1
```

### Step 2: Publish to Maven Local

Publish the library to your local Maven repository by running:

```bash
./gradlew publishToMavenLocal
```

### Step 3: Use the Local Version in Another Project

In the project where you want to use the updated library:

1. Add the mavenLocal() repository to your repositories block:
```kotlin
repositories {
mavenLocal()
// other repositories...
}
```

2. Add a dependency for the local version of the library:
```kotlin
implementation("com.ably.chat:chat-android:0.1.0-local.1")
```

> [!NOTE]
> - Ensure the version number (`0.1.0-local.1`) matches the one you set in gradle.properties.
> - The `mavenLocal()` repository should typically be used only during development to avoid conflicts with published versions in remote
repositories.

## Release Process

### Prerequisites for Release
Expand All @@ -21,6 +117,7 @@ Before starting the release process, ensure you have:
mavenCentralPassword=user-token-password
```
2. GPG key for signing artifacts:

- Generate a key pair if you don't have one: `gpg --gen-key`
- Export the secret key to gradle.properties:
```properties
Expand All @@ -40,13 +137,14 @@ This library uses [semantic versioning](http://semver.org/). For each release, t
the [CHANGELOG](./CHANGELOG.md). This may require some manual intervention, both in terms of how the command is run and how the change
log file is modified. Your mileage may vary:
- The command you will need to run will look something like this:
`github_changelog_generator -u ably -p ably-chat-kotlin --since-tag v1.2.3 --output delta.md --token $GITHUB_TOKEN_WITH_REPO_ACCESS`.
Generate token [here](https://github.com/settings/tokens/new?description=GitHub%20Changelog%20Generator%20token).
- Using the command above, `--output delta.md` writes changes made after `--since-tag` to a new file.
- The contents of that new file (`delta.md`) then need to be manually inserted at the top of the `CHANGELOG.md`, changing the "Unreleased"
heading and linking with the current version numbers.
- Also ensure that the "Full Changelog" link points to the new version tag instead of the `HEAD`.
- The command you will need to run will look something like this:
`github_changelog_generator -u ably -p ably-chat-kotlin --since-tag v1.2.3 --output delta.md --token $GITHUB_TOKEN_WITH_REPO_ACCESS`.
Generate token [here](https://github.com/settings/tokens/new?description=GitHub%20Changelog%20Generator%20token).
- Using the command above, `--output delta.md` writes changes made after `--since-tag` to a new file.
- The contents of that new file (`delta.md`) then need to be manually inserted at the top of the `CHANGELOG.md`, changing the "
Unreleased"
heading and linking with the current version numbers.
- Also ensure that the "Full Changelog" link points to the new version tag instead of the `HEAD`.
4. Commit [CHANGELOG](./CHANGELOG.md)
5. Make a PR against `main`
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies {
allprojects {
repositories {
google()
mavenLocal()
mavenCentral()
}
}
Expand Down

0 comments on commit cb58c0b

Please sign in to comment.