Skip to content
Closed
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
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ permissions:
contents: read

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Check Java formatting
run: ./gradlew formatCheck

build:
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ Run `./gradlew publishToMavenLocal` to publish all three artifacts to your local
Maven repository, using the version from the `artifacts/` configuration files.
The published class files target Java 7, matching earlier SoLoader releases.

## Formatting Java sources

From this directory, run `./gradlew format` to format all Java sources, or
`./gradlew formatCheck` to check them without making changes. Both commands work
in a standalone checkout or in `fbsource/fbandroid/libraries/soloader` and use a
pinned Google Java Format version downloaded by Gradle. No formatter binary is
stored in the repository.

The existing [Buck](https://buckbuild.com/) build is also available. Once you have
Buck installed, run the following commands from the project root directory:
```shell
Expand Down
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
plugins {
id 'com.android.library' version '9.2.1' apply false
id 'com.diffplug.spotless' version '8.0.0'
}

spotless {
java {
target 'java/**/*.java'
googleJavaFormat('1.25.2')
}
}

tasks.register('format') {
group = 'formatting'
description = 'Format all SoLoader Java sources.'
dependsOn 'spotlessApply'
}

tasks.register('formatCheck') {
group = 'verification'
description = 'Check formatting of all SoLoader Java sources.'
dependsOn 'spotlessCheck'
}

def artifactVersions = ['ANNOTATION', 'NATIVELOADER', 'SOLOADER'].collect { artifact ->
Expand Down