Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ jobs:
echo BACKTRACE_CORONER_TOKEN=\"${{ secrets.BACKTRACE_CORONER_TOKEN }}\" >> ./local.properties

- name: Accept Android SDK licences
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --licenses
run: yes | "${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager" --licenses

- name: Check Code Style
run: ./gradlew spotlessCheck

- name: Build and check
run: ./gradlew assembleDebug assembleDebugAndroidTest build check
Expand Down
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: local
hooks:
- id: start-hook
name: start-hook
entry: echo 'Start pre-commit'
language: system
stages: [pre-commit]
pass_filenames: false
## TODO: before merge - remove above and uncomment below
# - id: spotless-apply
# name: Spotless Apply
# entry: ./gradlew spotlessApply
# language: system
# stages: [pre-commit]
# pass_filenames: false
# - id: spotless-check
# name: Spotless Check
# entry: ./gradlew spotlessCheck
# language: system
# stages: [pre-commit]
# pass_filenames: false
79 changes: 54 additions & 25 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# Contributing
Thank you for considering contributing to Backtrace Android SDK library. Here are some guidelines to help you get started:

### Getting Started

1. **Clone the Repository**
- Clone the repository to your local machine using:
```bash
git clone https://github.com/backtrace-labs/backtrace-android.git
```

2. **Create a Branch**
- It's good practice to create a new branch for each feature or bugfix, if you have jira ticket put ticket number as branch prefix:
```bash
git checkout -b jira-ticket/your-feature-name
```
Thank you for your interest in contributing to the Backtrace Android SDK. Please review the following guidelines to help you get started.

## Getting Started

1. **Clone the repository**
```bash
git clone https://github.com/backtrace-labs/backtrace-android.git
```

2. **Install pre-commit**
```bash
pip install pre-commit
pre-commit install
```

3. **Create a branch** - it's good practice to create a new branch for each feature or bugfix, if you have jira ticket put ticket number as branch prefix:
```bash
git checkout -b jira-ticket/your-feature-name
```

3. **Update submodules**
```bash
git submodule update --recursive --remote
git submodule update --init --recursive
```

### Coding Guidelines
4. **Update submodules**
```bash
git submodule update --recursive --remote
git submodule update --init --recursive
```
## Coding Guidelines

1. **Code Formatting**
- Make sure that your code is properly formatted using the default Android Studio formatter.
Expand All @@ -34,7 +38,7 @@ git submodule update --init --recursive
3. **Write Tests**
- Ensure that you write tests for the new functionality or changes made. This helps maintain the integrity of the project.

### Commit and Push
## Commit and Push

1. **Commit Your Changes**
- Write clear and concise commit messages. Follow the convention of using the imperative mood in the subject line.
Expand All @@ -48,7 +52,7 @@ git submodule update --init --recursive
git push origin jira-ticket/your-feature-name
```

### Create a Pull Request
## Create a Pull Request

1. **Submit a Pull Request**
- Go to the repository on GitHub and click on the `New Pull Request` button.
Expand All @@ -57,8 +61,33 @@ git submodule update --init --recursive
2. **Review Process**
- One of the project maintainers will review your pull request. Please be responsive to any comments or suggestions made.

### Additional Notes
## Additional Notes

- Ensure that your code follows the existing code style and structure.
- Keep your branch up to date with the latest changes from the `master` branch to avoid merge conflicts.


## Code Formatting

This project uses **[Spotless](https://github.com/diffplug/spotless)** (a code formatting plugin) integrated with **[pre-commit](https://pre-commit.com/)** to ensure consistent code style and automatic formatting before each commit.

### Setup Instructions

1. Run Spotless check
This verifies that your code meets the project’s formatting standards.
```bash
./gradlew spotlessCheck
```

2. (Optional) Automatically reformat code
If formatting issues are found, you can automatically fix them with:
```bash
./gradlew spotlessApply
```

**Notes**
- The pre-commit hook ensures code formatting is validated automatically before commits are created.
- You can manually trigger all pre-commit checks at any time with:
```bash
pre-commit run --all-files
```
52 changes: 52 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,58 @@ buildscript {
}
}

plugins {
id 'com.diffplug.spotless' version '8.0.0' apply false
}

def spotlessExcludes = [
'.github/**',
'.gradle/**',
'.idea/**',
'build/**',
'**/cpp/**',
'**/jniLibs/**',
'**/build/**',
'**/build-*/**',
'**/.cxx/**',
'**/generated/**'
]

subprojects {
apply plugin: 'com.diffplug.spotless'
spotless {
java {
target '**/*.java'
targetExclude spotlessExcludes
palantirJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
json {
target '**/*.json'
targetExclude spotlessExcludes
simple()
}

format 'gradle', {
target '**/*.gradle'
targetExclude spotlessExcludes
leadingTabsToSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}


format 'misc', {
target '*.md', '.gitignore'
targetExclude spotlessExcludes
trimTrailingWhitespace()
endWithNewline()
}
}
}

allprojects {
repositories {
google()
Expand Down
Loading