Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding thread utils, base91 and largebitmap support. #49

Merged
merged 14 commits into from
Oct 14, 2024
Merged
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
56 changes: 21 additions & 35 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
GRADLE_OPTS: -Dorg.gradle.console=plain -Djava.security.egd=file:/dev/./urandom

jobs:
matrix_build:
name: "Matrix Build"
Expand All @@ -26,50 +33,35 @@ jobs:
SPRING_BOOT_VERSION: ${{ matrix.spring_boot_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test.
# cache-read-only: false
uses: gradle/actions/setup-gradle@v4
- name: "Assemble jar"
uses: gradle/gradle-build-action@v2
with:
arguments: assemble --console=plain --info --stacktrace --parallel
run: ./gradlew assemble --console=plain --info --stacktrace --parallel
- name: "Compile tests"
uses: gradle/gradle-build-action@v2
with:
arguments: compileTestJava compileTestGroovy --console=plain --info --stacktrace --parallel
run: ./gradlew compileTestJava --console=plain --info --stacktrace --parallel
- name: "Run checks"
uses: gradle/gradle-build-action@v2
with:
arguments: check -x test --console=plain --stacktrace
run: ./gradlew check -x test --console=plain --stacktrace
- name: "Run tests"
uses: gradle/gradle-build-action@v2
with:
arguments: -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace
run: ./gradlew -Dspring.profiles.include=continuous-integration test --console=plain --info --stacktrace
- name: "Test if publishing works"
uses: gradle/gradle-build-action@v2
with:
arguments: publishToMavenLocal --console=plain --info --stacktrace
run: ./gradlew publishToMavenLocal --console=plain --info --stacktrace
- name: "Publish Test Report"
uses: mikepenz/action-junit-report@v3
uses: mikepenz/action-junit-report@v4
if: always()
with:
check_name: Test Report-(${{ matrix.spring_boot_version }})
report_paths: '**/build/test-results/**/*.xml'
github_token: ${{ secrets.GITHUB_TOKEN }}
require_tests: true
- name: Publish checkstyle report
if: always()
uses: jwgmeligmeyling/checkstyle-github-action@master
uses: lcollins/checkstyle-github-action@v3.1.0
with:
name: Checkstyle Report-(${{ matrix.spring_boot_version }})
path: '**/build/reports/**/*.xml'
- name: Publish spotbugs report
if: always()
uses: jwgmeligmeyling/spotbugs-github-action@master
uses: lcollins/spotbugs-github-action@v3.1.0
with:
name: Spotbugs Report-(${{ matrix.spring_boot_version }})
path: '**/build/reports/**/*.xml'
Expand All @@ -78,7 +70,7 @@ jobs:
tar -zcvf all-test-reports-${{ matrix.spring_boot_version }}.tar.gz **/build/reports
if: always()
- name: "Store test results"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: all-test-reports-${{ matrix.spring_boot_version }}
Expand All @@ -98,15 +90,9 @@ jobs:
if: ${{ needs.matrix_build.result != 'success' }}
run: exit 1
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
# Comment out when you are upgrading gradle in a branch and doing tons of commits you would need to test.
# cache-read-only: false
uses: gradle/actions/setup-gradle@v4
- name: "Tag release"
if: github.ref == 'refs/heads/master'
uses: gradle/gradle-build-action@v2
with:
arguments: tagRelease --console=plain --info --stacktrace
run: ./gradlew tagRelease --console=plain --info --stacktrace
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.13.0] - 2024-10-11

### Added

* Base91 encoder.
* RoaringBitmap based LargeBitmap with better 64 bits support.
* ThreadUtils to take safe-point free thread dumps. Those thread dumps will be inconsistent, but still suitable in many cases.

### Changed

* Java 17+ is now required.

## [1.12.5] - 2024-07-16

### Changed

* Added support for Spring Boot 3.3.


## [1.12.4] - 2024-02-22

### Changed
Expand Down Expand Up @@ -64,7 +75,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Ported `JavaTimeModuleFactory` from old common lib so that the lib can be removed in the future. It provides consistent millisecond serialisation of `Instant` and `ZonedDateTime` objects.
* Ported `JavaTimeModuleFactory` from old common lib so that the lib can be removed in the future. It provides consistent millisecond serialisation of
`Instant` and `ZonedDateTime` objects.

## [1.10.2] - 2023-07-28

Expand Down
30 changes: 5 additions & 25 deletions build.common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ apply plugin: "java-library"
apply plugin: "checkstyle"
apply plugin: "idea"
apply plugin: "com.github.spotbugs"
apply plugin: "groovy"

apply from: "$rootProject.rootDir/build.libraries.gradle"

Expand Down Expand Up @@ -57,14 +56,8 @@ dependencies {
}

java {
if (springBootVersion.startsWith("3.")) {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
else{
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
Expand All @@ -89,20 +82,13 @@ compileJava {
}

compileTestJava {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}

options.fork = true
options.forkOptions.jvmArgs << '-Xmx256m'
}

test {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(17)
}
// To test ThreadUtils
// jvmArgs "-Xlog:safepoint=info"

useJUnitPlatform()

Expand All @@ -116,8 +102,6 @@ test {
}

tasks.findAll { it.name.startsWith("spotbugs") }*.configure {
effort = "max"

excludeFilter = file("$rootProject.rootDir/spotbugs-exclude.xml")

reports {
Expand All @@ -126,11 +110,7 @@ tasks.findAll { it.name.startsWith("spotbugs") }*.configure {
}
}

spotbugs {
spotbugsTest.enabled = false
}

tasks.withType(Checkstyle) {
tasks.withType(Checkstyle).configureEach {
config = resources.text.fromFile(file("$rootProject.rootDir/google_checks.xml"))

// Deprecated, checkstyle does not like the namings.
Expand Down
15 changes: 11 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import org.eclipse.jgit.api.errors.RefAlreadyExistsException
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort

plugins {
id "com.github.spotbugs" version "5.0.14"
id "com.github.spotbugs" version "6+"
id "idea"
id 'org.ajoberstar.grgit' version '5.2.0'
id 'io.github.gradle-nexus.publish-plugin' version "1.1.0"
id 'org.ajoberstar.grgit' version '5.3.0'
id 'io.github.gradle-nexus.publish-plugin' version "2.0.0"
}

idea.project {
Expand All @@ -19,7 +21,7 @@ ext.projectArtifactName = "tw-base-utils"

apply from: 'build.common.gradle'

task tagRelease {
tasks.register('tagRelease') {
doLast {
try {
grgit.tag.add {
Expand All @@ -43,4 +45,9 @@ nexusPublishing {
password = System.getenv("SONATYPE_PASSWORD")
}
}
}

spotbugs {
effort = Effort.valueOf('MAX')
reportLevel = Confidence.valueOf('DEFAULT')
}
10 changes: 6 additions & 4 deletions build.libraries.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
ext {
springBootVersion = "${System.getenv("SPRING_BOOT_VERSION") ?: "2.7.18"}"
springBootVersion = "${System.getenv("SPRING_BOOT_VERSION") ?: "3.2.2"}"

libraries = [
// version defined
awaitility : "org.awaitility:awaitility:4.2.0",
guava : 'com.google.guava:guava:33.0.0-jre',
awaitility : "org.awaitility:awaitility:4.2.2",
commonsIo : "commons-io:commons-io:2.17.0",
guava : 'com.google.guava:guava:33.3.1-jre',
jakartaValidationApi : 'jakarta.validation:jakarta.validation-api:3.0.2',
javaxValidationApi : "javax.validation:validation-api:2.0.1.Final",
spockCore : "org.spockframework:spock-core:2.3-groovy-4.0",
roaringBitmap : 'org.roaringbitmap:RoaringBitmap:1.3.0',
springBootDependencies: "org.springframework.boot:spring-boot-dependencies:${springBootVersion}",

// versions managed by spring-boot-dependencies platform
commonsLang3 : "org.apache.commons:commons-lang3",

junitJupiter : "org.junit.jupiter:junit-jupiter",
logbackClassic : "ch.qos.logback:logback-classic",
lombok : "org.projectlombok:lombok",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.12.5
version=1.13.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 3 additions & 1 deletion tw-base-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@ dependencies {
compileOnly libraries.javaxValidationApi

implementation libraries.commonsLang3
implementation libraries.commonsIo
implementation libraries.slf4jApi
implementation libraries.jacksonDatabind
implementation libraries.jacksonJsr310
implementation libraries.jacksonJdk8
implementation libraries.guava
implementation libraries.roaringBitmap
implementation libraries.spotbugsAnnotations

testImplementation libraries.awaitility
testImplementation libraries.guava
testImplementation libraries.junitJupiter
testImplementation libraries.micrometerCore
testImplementation libraries.spockCore
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.transferwise.common.baseutils.bitmap;

public interface LargeBitmap {

boolean isEmpty();

void set(long bit);

void set(long startBit, long endBit);

boolean checkedSet(long bit);

void clear(long startBit, long endBit);

void clear(long bit);

void clear();

boolean checkedClear(long bit);

boolean isSet(long bit);

long getFirstClearBit(long offset);

long getFirstSetBit(long offset);

long getFirstSetBit();

LargeBitmap copy();
}
Loading