Skip to content
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ jobs:
strategy:
fail-fast: false
matrix:
jdk: [8, 9]
jdk: [8, 11]
optimizely_default_parser: [GSON_CONFIG_PARSER, JACKSON_CONFIG_PARSER, JSON_CONFIG_PARSER, JSON_SIMPLE_CONFIG_PARSER]
steps:
- name: checkout
uses: actions/checkout@v4

- name: set up JDK ${{ matrix.jdk }}
uses: AdoptOpenJDK/install-jdk@v1
uses: actions/setup-java@v4
with:
version: ${{ matrix.jdk }}
architecture: x64
distribution: 'zulu'
java-version: ${{ matrix.jdk }}

- name: Grant execute permission for gradlew
run: chmod +x gradlew
Expand Down
44 changes: 6 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'jacoco'
id 'me.champeau.gradle.jmh' version '0.5.3'
id 'nebula.optional-base' version '3.1.0'
id 'com.github.hierynomus.license' version '0.16.1'
id 'com.github.spotbugs' version "6.0.14"
id 'maven-publish'
Expand Down Expand Up @@ -46,7 +45,6 @@ configure(publishedProjects) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'nebula.optional-base'
apply plugin: 'com.github.hierynomus.license'

sourceCompatibility = 1.8
Expand Down Expand Up @@ -88,6 +86,10 @@ configure(publishedProjects) {
jmh.java.srcDirs += sourceSets.test.java.srcDirs
}

tasks.named('compileJmhJava') {
dependsOn processTestResources, compileTestJava
}

dependencies {
jmh 'org.openjdk.jmh:jmh-core:1.12'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.12'
Expand Down Expand Up @@ -183,42 +185,8 @@ nexusPublishing {
}
}

task jacocoMerge(type: JacocoMerge) {
publishedProjects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}

task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn publishedProjects.test, jacocoMerge

getAdditionalSourceDirs().setFrom(files(publishedProjects.sourceSets.main.allSource.srcDirs))
getSourceDirectories().setFrom(files(publishedProjects.sourceSets.main.allSource.srcDirs))
getAdditionalClassDirs().setFrom(files(publishedProjects.sourceSets.main.output))
executionData jacocoMerge.destinationFile

reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
}

coveralls {
sourceDirs = publishedProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}

tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'

dependsOn jacocoRootReport
onlyIf { System.env.'CI' && !JavaVersion.current().isJava9Compatible() }
}
// Note: Aggregate JaCoCo reporting has been removed due to type resolution issues with Gradle 8.x
// Individual subprojects still generate their own coverage reports via the jacoco plugin

// standard POM format required by MavenCentral
def customizePom(pom, title) {
Expand Down
8 changes: 4 additions & 4 deletions core-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ dependencies {
testImplementation group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion

// an assortment of json parsers
compileOnly group: 'com.google.code.gson', name: 'gson', version: gsonVersion, optional
compileOnly group: 'org.json', name: 'json', version: jsonVersion, optional
compileOnly group: 'com.googlecode.json-simple', name: 'json-simple', version: jsonSimpleVersion, optional
compileOnly group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion, optional
compileOnly group: 'com.google.code.gson', name: 'gson', version: gsonVersion
compileOnly group: 'org.json', name: 'json', version: jsonVersion
compileOnly group: 'com.googlecode.json-simple', name: 'json-simple', version: jsonSimpleVersion
compileOnly group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
}

tasks.named('processJmhResources') {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* Copyright 2016-2017, 2019, Optimizely and contributors
* Copyright 2016-2017, 2019, 2025 Optimizely and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,13 +19,13 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;

class JacksonSerializer implements Serializer {

private ObjectMapper mapper =
new ObjectMapper().setPropertyNamingStrategy(
PropertyNamingStrategy.SNAKE_CASE);
PropertyNamingStrategies.SNAKE_CASE);

public <T> String serialize(T payload) {
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.optimizely.ab.event.internal.payload.EventBatch;

import org.junit.Test;
Expand All @@ -42,7 +42,7 @@ public class JacksonSerializerTest {
private JacksonSerializer serializer = new JacksonSerializer();
private ObjectMapper mapper =
new ObjectMapper().setPropertyNamingStrategy(
PropertyNamingStrategy.SNAKE_CASE);
PropertyNamingStrategies.SNAKE_CASE);


@Test
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion java-quickstart/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ dependencies {
implementation project(':core-api')
implementation project(':core-httpclient-impl')

implementation group: 'com.google.code.gson', name: 'gson', version: gsonVersion
// implementation group: 'com.google.code.gson', name: 'gson', version: gsonVersion
implementation(platform("com.fasterxml.jackson:jackson-bom:2.20.0"))
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")

implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: httpClientVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4jVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: log4jVersion
Expand Down
Loading