diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 122a2bdf..ea41ca72 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 +``` + +For Windows, use the batch file: + +```cmd +gradlew.bat +``` + +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 @@ -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 @@ -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` diff --git a/build.gradle.kts b/build.gradle.kts index 238d536e..f5524c54 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,6 @@ dependencies { allprojects { repositories { google() - mavenLocal() mavenCentral() } }