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

Upgrade build script and dependencies for java 8+ #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ jdk:
- oraclejdk11

script:
- ./gradlew clean build -x test
- ./gradlew clean build
33 changes: 32 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
defaultTasks 'clean', 'build', 'distZip', 'distTar'
plugins {
id 'org.sonarqube' version "$sonarQubeVersion"
id 'distribution'
}

configure(subprojects) {
apply(plugin: 'java')

java {
withSourcesJar()
}

repositories {
mavenCentral()
}

dependencies {
implementation "org.apache.logging.log4j:log4j-api:$log4jVersion"
implementation "org.apache.logging.log4j:log4j-core:$log4jVersion"
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4jVersion"
implementation "net.openhft:chronicle-bytes:$openhftBytesVersion"
implementation "net.openhft:chronicle-core:$openhftCoreVersion"
implementation "commons-configuration:commons-configuration:$commonsCfgVersion"

testImplementation "junit:junit:$junitVersion"
}
}

group "$projectGroup"
version "$projectVersion"

defaultTasks 'clean', 'build', 'distZip', 'distTar'
37 changes: 2 additions & 35 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
group 'com.epam.cme'
version '2.1.4'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

jar {
baseName 'b2bits-jmdp3-core'
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
baseName 'b2bits-jmdp3-core'
}

artifacts {
archives sourcesJar
}

task copyToLib(type: Copy) {
into "$buildDir/libs"
from configurations.runtime
}
build.dependsOn(copyToLib)
archivesBaseName = "$moduleNamePrefix-core"

dependencies {
implementation "javax.xml.bind:jaxb-api:2.3.1"
implementation "com.sun.xml.bind:jaxb-core:2.3.0"
implementation "com.sun.xml.bind:jaxb-impl:2.3.0"
implementation "javax.activation:activation:1.1.1"
implementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'

compile group: 'net.openhft', name: 'chronicle-bytes', version: '1.7.17'
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
runtime group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
testCompile group: 'junit', name: 'junit', version: '4.12'
runtimeOnly group: 'commons-collections', name: 'commons-collections', version: "$commonsCollectionsVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void wrapForParse(final ByteBuffer bb) {

@Override
public void release() {
this.bytes.release();
this.bytes.releaseLast();
}

@Override
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue Jul 16 09:58:55 MSK 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
56 changes: 13 additions & 43 deletions mbp-only/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
plugins {
id "java"
id "maven"
id "java-library-distribution"
id "org.sonarqube" version "2.7.1"
id "me.champeau.gradle.jmh" version "0.5.0-rc-1"
id 'distribution'
}
group = 'com.epam.cme'
version = '2.1.4'
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
}

jar {
baseName 'b2bits-jmdp3'
}
archivesBaseName = "$moduleNamePrefix-mbp"

configurations {
cucumberRuntime {
Expand All @@ -25,26 +12,14 @@ configurations {
}

dependencies {
compile project(':core')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.5'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.5'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
runtime group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.5'
compile group: 'net.openhft', name: 'koloboke-api-jdk8', version: '0.6.8'
runtime group: 'net.openhft', name: 'koloboke-impl-jdk8', version: '0.6.8'
compile group: 'net.openhft', name: 'chronicle-core', version: '1.7.6'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'uk.co.real-logic', name: 'sbe-tool', version: '1.6.0'
implementation project(':core')
implementation group: 'org.apache.commons', name: 'commons-lang3', version: "$commonsLang3Version"
implementation group: 'net.openhft', name: 'koloboke-api-jdk8', version: "$openhftKolobokeVersion"
runtimeOnly group: 'net.openhft', name: 'koloboke-impl-jdk8', version: "$openhftKolobokeVersion"
testImplementation group: 'uk.co.real-logic', name: 'sbe-tool', version: '1.6.0'
testImplementation 'io.cucumber:cucumber-java:4.3.1'
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
baseName 'b2bits-jmdp3'
}


task cucumber() {
dependsOn assemble, compileTestJava
doLast {
Expand All @@ -56,21 +31,16 @@ task cucumber() {
}
}

artifacts {
archives sourcesJar
}

task copyToLib(type: Copy) {
into "$buildDir/libs/lib"
from configurations.runtime
}
build.dependsOn(copyToLib)

distributions {
main {
baseName = 'b2bits-jmdp3'
distributionBaseName = "$archivesBaseName"
contents {
from { '../dist' }
from jar
from sourcesJar
into('libs') {
from(project.configurations.runtimeClasspath)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.epam.cme.mdp3.sbe.message.meta.SbePrimitiveType;
import com.epam.cme.mdp3.sbe.schema.MdpMessageTypeBuildException;
import com.epam.cme.mdp3.test.SbeDataDumpHelper;
import net.openhft.chronicle.bytes.NativeBytesStore;
import net.openhft.chronicle.bytes.internal.NativeBytesStore;
import org.openjdk.jmh.annotations.*;

import java.net.URISyntaxException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.epam.cme.mdp3.MutableMdpGroupEntry;
import com.epam.cme.mdp3.sbe.message.SbeBuffer;
import com.epam.cme.mdp3.sbe.message.meta.SbeGroupType;
import net.openhft.chronicle.bytes.NativeBytesStore;
import net.openhft.chronicle.bytes.internal.NativeBytesStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.epam.cme.mdp3.core.control.IncrementalRefreshQueue.IncrementalRefreshQueueEntry;
Expand All @@ -43,7 +43,7 @@ public boolean put(final IncrementalRefreshQueueEntry queueEntry, final long rpt
this.incrPcktSeqNum = queueEntry.incrPcktSeqNum;

if (store.capacity() < entrySize) {
store.release();
store.releaseLast();
store = NativeBytesStore.nativeStoreWithFixedCapacity(entrySize);
}
incrEntry.buffer().copyTo(incrEntry.getAbsoluteEntryOffset(), this.store, entrySize);
Expand Down Expand Up @@ -81,6 +81,6 @@ public void reset() {

public void release() {
rptSeqNumHolder = 0;
this.store.release();
this.store.releaseLast();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package com.epam.cme.mdp3.core.control;

import com.epam.cme.mdp3.MdpPacket;
import net.openhft.chronicle.bytes.NativeBytesStore;
import net.openhft.chronicle.bytes.internal.NativeBytesStore;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

Expand All @@ -34,7 +34,7 @@ public boolean put(final MdpPacket mdpPacket, final long seqNum) {
packetSize = mdpPacket.getPacketSize();

if (store.capacity() < packetSize) {
store.release();
store.releaseLast();
store = NativeBytesStore.nativeStoreWithFixedCapacity(packetSize);
}
mdpPacket.buffer().copyTo(this.store);
Expand Down Expand Up @@ -65,6 +65,6 @@ public void reset() {

public void release() {
seqNumHolder = 0;
this.store.release();
this.store.releaseLast();
}
}
59 changes: 15 additions & 44 deletions mbp-with-mbo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,63 +1,34 @@
plugins {
id "java"
id "maven"
id "java-library-distribution"
id "me.champeau.gradle.jmh" version "0.5.0-rc-1"
id 'distribution'
}

group = 'com.epam.cme'
version = '2.1.4'
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
}

jar {
baseName 'b2bits-jmdp3'
}
archivesBaseName = "$moduleNamePrefix-mbo"

dependencies {
compile project(':core')
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.5'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.5'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
runtime group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.5'
compile group: 'net.openhft', name: 'koloboke-api-jdk8', version: '0.6.8'
runtime group: 'net.openhft', name: 'koloboke-impl-jdk8', version: '0.6.8'
compile group: 'net.openhft', name: 'chronicle-core', version: '1.7.6'
compile group: 'org.agrona', name: 'agrona', version: '0.9.5'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'uk.co.real-logic', name: 'sbe-tool', version: '1.6.0'
testCompile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
implementation project(':core')
implementation group: 'org.apache.commons', name: 'commons-lang3', version: "$commonsLang3Version"
implementation group: 'org.agrona', name: 'agrona', version: "$agronaVersion"
implementation group: 'net.openhft', name: 'koloboke-api-jdk8', version: "$openhftKolobokeVersion"
runtimeOnly group: 'net.openhft', name: 'koloboke-impl-jdk8', version: "$openhftKolobokeVersion"
testImplementation group: 'uk.co.real-logic', name: 'sbe-tool', version: '1.6.0'
testImplementation group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
}

distributions {
main {
baseName = 'b2bits-jmdp3'
distributionBaseName = "$archivesBaseName"
contents {
from { '../dist' }
from jar
from sourcesJar
into('libs') {
from(project.configurations.runtimeClasspath)
}
}
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
baseName 'b2bits-jmdp3'
}

artifacts {
archives sourcesJar
}

task copyToLib(type: Copy) {
into "$buildDir/libs/lib"
from configurations.runtime
}
build.dependsOn(copyToLib)

task testJar(type: Jar) {
classifier = 'tests'
from sourceSets.test.output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

import com.epam.cme.mdp3.MdpPacket;
import com.epam.cme.mdp3.sbe.message.SbeConstants;
import net.openhft.chronicle.bytes.NativeBytesStore;

import net.openhft.chronicle.bytes.internal.NativeBytesStore;
import static com.epam.cme.mdp3.sbe.message.SbeConstants.MESSAGE_SEQ_NUM_OFFSET;

public class MDPOffHeapBuffer implements IMDPOffHeapBuffer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package com.epam.cme.mdp3.control;

import net.openhft.chronicle.bytes.BytesStore;
import net.openhft.chronicle.bytes.NativeBytesStore;
import net.openhft.chronicle.bytes.internal.NativeBytesStore;
import org.agrona.collections.Long2ObjectHashMap;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
Expand Down Expand Up @@ -132,7 +132,7 @@ public LongArray(long length) {
}

public void reInit(long length){
bytes.release();
bytes.releaseLast();
this.bytes = NativeBytesStore.nativeStore(length * Long.BYTES);
this.length = length;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import com.epam.cme.mdp3.test.gen.*;
import net.openhft.chronicle.bytes.NativeBytesStore;
import net.openhft.chronicle.bytes.internal.NativeBytesStore;
import org.agrona.ExpandableArrayBuffer;
import org.agrona.MutableDirectBuffer;

Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
rootProject.name = 'java-cme-mdp3-handler'

include 'core'
include 'mbp-only'
include 'mbp-with-mbo'
Expand Down