Skip to content

Commit 5486bfc

Browse files
authored
Re-enable spotless formatting and checks for the project (#128)
1 parent 5a012f4 commit 5486bfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+13939
-13565
lines changed

.github/workflows/ci.yml

+23-1
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,31 @@ jobs:
4242
echo "skip=true" >> "$GITHUB_OUTPUT"
4343
fi
4444
fi
45-
test-matrix:
45+
check-formatting:
46+
runs-on: ubuntu-latest
4647
needs: check-for-pr
4748
if: needs.check-for-pr.outputs.skip != 'true'
49+
steps:
50+
- uses: actions/checkout@v3
51+
- name: Setup OS
52+
run: |
53+
sudo apt-get update
54+
sudo apt-get install -y clang-format-11
55+
# we need this to make sure we are actually using clang-format v. 11
56+
sudo mv /usr/bin/clang-format /usr/bin/clang-format-14
57+
sudo mv /usr/bin/clang-format-11 /usr/bin/clang-format
58+
- name: Prepare test JDK
59+
uses: actions/setup-java@v3
60+
with:
61+
distribution: 'temurin'
62+
java-version: "21.0.3"
63+
- name: Check
64+
run: |
65+
./gradlew --no-daemon spotlessCheck
66+
67+
test-matrix:
68+
needs: check-formatting
69+
if: needs.check-for-pr.outputs.skip != 'true'
4870
uses: ./.github/workflows/test_workflow.yml
4971
with:
5072
configuration: '["debug"]'

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ If you need a full-fledged Java profiler head back to [async-profiler](https://g
1515
1. This project contains Java code and is built by gradle, as such, you need to install a JDK in order to build it. Run `brew install openjdk` to install it on MacOS.
1616
If building and testing on Apple Silicon (M1+), be sure to install an aarch64 OpenJDK distribution, otherwise the architecture used for compilation and the JVM based test suite will not match, which means the tests will not be able to load the dynamic library at runtime.
1717
2. The build requires make, which is included in XCode, but can also be installed by running `brew install make`
18-
4. The build supports googletest for unit testing. To install it, run `brew install googletest` or `sudo apt install libgtest-dev` or `apk add gtest-dev` depending on your platform.
18+
3. The build supports googletest for unit testing. To install it, run `brew install googletest` or `sudo apt install libgtest-dev` or `apk add gtest-dev` depending on your platform.
19+
4. The build is applying consistent formatting using 'spotless' Gradle plugin. For C/C++ files it will use `clang-format` version 11. To install it, run `brew install clang-format-11` or `sudo apt install clang-format-11` or `apk add clang-format-11` depending on your platform. If the installed version does not provide `/usr/bin/clang-format` executable create a link like `sudo ln -s /usr/bin/clang-format-11 /usr/bin/clang-format` in order for the 'spotles' pluging to function correctly.
1920

2021

2122
Once prerequisites have been installed simple as `./gradlew assembleAll`. The resulting artifact is located in `ddprof-lib/build/libs/ddprof-<version>.jar`

build.gradle

+9-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ version = "1.14.0"
1919
apply plugin: "com.dipien.semantic-version"
2020
version = project.hasProperty("ddprof_version") ? project.ddprof_version : version
2121

22+
allprojects {
23+
repositories {
24+
mavenCentral()
25+
mavenCentral()
26+
gradlePluginPortal()
27+
}
28+
}
29+
2230
repositories {
2331
mavenLocal()
2432
mavenCentral()
@@ -35,13 +43,12 @@ repositories {
3543
}
3644
}
3745

38-
apply from: "$rootDir/gradle/spotless.gradle"
39-
4046
allprojects {
4147
group = 'com.datadoghq'
4248

4349
apply from: rootProject.file('common.gradle')
4450
apply from: rootProject.file('gradle/configurations.gradle')
51+
apply from: "$rootDir/gradle/spotless.gradle"
4552
}
4653

4754
subprojects {

0 commit comments

Comments
 (0)