Skip to content

Commit 71cf7e5

Browse files
committed
Use gradle as the build system
1 parent 9aa2580 commit 71cf7e5

File tree

164 files changed

+1881
-1869
lines changed

Some content is hidden

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

164 files changed

+1881
-1869
lines changed

.github/workflows/ci.yml

+3-14
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,6 @@ jobs:
3333
fi
3434
fi
3535
36-
cpp-check:
37-
runs-on: ubuntu-latest
38-
needs: check-for-pr
39-
if: endsWith(github.repository, 'java-profiler-library') && !needs.check-for-pr.outputs.skip
40-
steps:
41-
- uses: actions/checkout@v3
42-
- name: Setup
43-
run: sudo apt -y update && sudo apt -y install cppcheck
44-
- name: Check
45-
run: make cppcheck
46-
4736
build-linux-glibc:
4837
runs-on: ubuntu-latest
4938
needs: check-for-pr
@@ -53,7 +42,7 @@ jobs:
5342
- name: Clean
5443
run: make clean
5544
- name: Build
56-
run: mvn package -DskipTests
45+
run: "./gradlew :ddprof-lib:copyLibs -x test"
5746
- name: Upload temp build artifact
5847
uses: actions/upload-artifact@v3
5948
if: success()
@@ -73,11 +62,11 @@ jobs:
7362
steps:
7463
- uses: actions/checkout@v3
7564
- name: Setup system
76-
run: apk update && apk add curl moreutils wget hexdump linux-headers bash make g++ git maven cppcheck jq >/dev/null
65+
run: apk update && apk add curl moreutils wget hexdump linux-headers bash make g++ clang git maven cppcheck jq >/dev/null
7766
- name: Clean
7867
run: make clean
7968
- name: Build
80-
run: mvn package -DskipTests
69+
run: "./gradlew :ddprof-lib:copyLibs -x test"
8170
- name: Upload temp build artifact
8271
uses: actions/upload-artifact@v3
8372
if: success()

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
/build/
2-
/build/debug/
1+
**/build/
32
/nbproject/
43
/out/
54
/.idea/
@@ -12,10 +11,10 @@
1211
.classpath
1312
.project
1413
.settings
14+
.gradle
1515
*.iml
1616

1717
**/.resources/
18-
**/*.jar
1918

2019
# ignore all temporary locations related to maven builds
2120
datadog/maven/tmp
@@ -24,3 +23,4 @@ datadog/maven/resources
2423

2524
**/harness*
2625
**/launcher*
26+
/gradle.properties

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Changelog
2-
!TODO!
2+
!TODO!

Makefile

-136
This file was deleted.

README.md

+1-34
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,7 @@ If you need a full-fledged Java profiler head back to [async-profiler](https://g
1010

1111

1212
## Build
13-
### Building Local Artifacts
14-
In order to ease up consuming of the java-profiler library in downstream projects (eg. dd-trace-java) it is possible to quickly build a maven artifact (jar) which can replace the stable dependency to test the changes.
15-
16-
#### Prerequisites
17-
The local build requires docker and Java 11 to be installed.
18-
19-
#### Build script
20-
Use `./datadog/scripts/build_locally.sh` to build linux-x64 only maven artifact.
21-
22-
After running this script you should see something like
23-
```shell
24-
jaroslav.bachorik@COMP-C02FJ0PSMD6V java-profiler % ./datadog/scripts/build_locally.sh
25-
=== Building Java Profiler
26-
== Version : 2.6-DD-jb_local_artifact-bc38fb7712459603349d7a36a90c9d02611a450d
27-
== Architecture: linux-amd64
28-
== With tests : no
29-
-> Building native library
30-
-> Building maven artifact
31-
-> Build done : Artifacts available |
32-
* file:///tmp/ap-tools-2.6-DD-jb_local_artifact-bc38fb7712459603349d7a36a90c9d02611a450d.jar
33-
```
34-
35-
The artifact version contain the encoded branch name and the HEAD commit hash - which makes it easily identifiable. The actual path of the built artifact depends on your system but you can easily copy-paste it around.
36-
37-
##### Supported arguments
38-
The build script support the following arguments:
39-
- `-a <architecture>`
40-
- one of `linux-x64`, `linux-x64-musl` or `linux-arm64` (defaults to `linux-x64`)
41-
- `-f`
42-
- force docker image rebuild
43-
- `-t`
44-
- force test run
45-
- `-h`
46-
- show help
13+
As simple as `./gradlew build`. The resulting artifact is located in `ddprof-lib/build/libs/ddprof-<version>.jar`
4714

4815
### Consuming the artifact
4916
For dd-trace-java you just need to set the `java.profiler.jar` project property.

build.gradle

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
buildscript {
2+
dependencies {
3+
classpath "pl.allegro.tech.build:axion-release-plugin:1.14.4"
4+
}
5+
repositories {
6+
mavenLocal()
7+
mavenCentral()
8+
gradlePluginPortal()
9+
}
10+
}
11+
12+
plugins {
13+
id 'pl.allegro.tech.build.axion-release' version '1.14.4'
14+
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
15+
id "com.diffplug.spotless" version "6.11.0"
16+
}
17+
18+
repositories {
19+
mavenLocal()
20+
mavenCentral()
21+
gradlePluginPortal()
22+
23+
maven {
24+
content {
25+
includeGroup "com.datadoghq"
26+
}
27+
mavenContent {
28+
snapshotsOnly()
29+
}
30+
url 'https://oss.sonatype.org/content/repositories/snapshots/'
31+
}
32+
}
33+
34+
apply from: "$rootDir/gradle/scm.gradle"
35+
apply from: "$rootDir/gradle/spotless.gradle"
36+
37+
allprojects {
38+
group = 'com.datadoghq'
39+
version = scmVersion.version
40+
41+
apply from: rootProject.file('common.gradle')
42+
}
43+
44+
apply from: rootProject.file('common.gradle')
45+
46+
def isCI = System.getenv("CI") != null
47+
48+
nexusPublishing {
49+
repositories {
50+
def forceLocal = project.hasProperty('forceLocal')
51+
52+
if (forceLocal && !isCI) {
53+
local {
54+
// For testing use with https://hub.docker.com/r/sonatype/nexus
55+
// docker run --rm -d -p 8081:8081 --name nexus sonatype/nexus
56+
// Doesn't work for testing releases though... (due to staging)
57+
nexusUrl = uri("http://localhost:8081/nexus/content/repositories/releases/")
58+
snapshotRepositoryUrl = uri("http://localhost:8081/nexus/content/repositories/snapshots/")
59+
username = "admin"
60+
password = "admin123"
61+
}
62+
} else {
63+
sonatype {
64+
username = System.getenv("SONATYPE_USERNAME")
65+
password = System.getenv("SONATYPE_PASSWORD")
66+
}
67+
}
68+
}
69+
}

build_support/make_for_maven.sh

-40
This file was deleted.

0 commit comments

Comments
 (0)