Skip to content

Commit

Permalink
Updated dependencies and migrated to th2 gradle plugin 0.0.6 (#19)
Browse files Browse the repository at this point in the history
* Migrated from jaxb-api: `2.3.1` to jakarta.xml.bind-api: `4.0.2`
  • Loading branch information
Nikita-Smirnov-Exactpro authored May 1, 2024
1 parent 2964744 commit f9a7713
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 107 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build-dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish dev release Docker image to Github Container Registry ghcr.io and publish dev release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: true
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
19 changes: 19 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Build and publish release Docker image to Github Container Registry ghcr.io and publish release jar to sonatype

on: workflow_dispatch

jobs:
build:
uses: th2-net/.github/.github/workflows/compound-java.yml@main
with:
build-target: 'Sonatype,Docker'
devRelease: false
createTag: true
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
24 changes: 24 additions & 0 deletions .github/workflows/build-sanpshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build and publish Docker image to Github Container Registry ghcr.io and publish snapshot jar to sonatype

on:
push:
branches-ignore:
- master
- version-*
- dependabot**
paths-ignore:
- README.md

jobs:
build-job:
uses: th2-net/.github/.github/workflows/compound-java-dev.yml@main
with:
build-target: 'Sonatype,Docker'
docker-username: ${{ github.actor }}
secrets:
docker-password: ${{ secrets.GITHUB_TOKEN }}
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
sonatypeSigningKey: ${{ secrets.SONATYPE_GPG_ARMORED_KEY }}
sonatypeSigningPassword: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
nvd-api-key: ${{ secrets.NVD_APIKEY }}
4 changes: 2 additions & 2 deletions .github/workflows/ci-unwelcome-words.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Checkout tool
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: exactpro-th2/ci-github-action
ref: master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-java-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
# Build package
- name: Set up JDK 11
uses: actions/setup-java@v1
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/dev-docker-publish.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/dev-release-java-publish-sonatype.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/docker-publish.yml

This file was deleted.

1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM gradle:7.6-jdk11 AS build
ARG release_version

COPY ./ .
RUN gradle --no-daemon clean build dockerPrepare -Prelease_version=${release_version}

Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AVRO codec (2.4.0)
# AVRO codec (3.0.0)
## Description
Designed for decode AVRO raw messages to parsed messages and encode back.
It is based on [th2-codec](https://github.com/th2-net/th2-codec).
Expand Down Expand Up @@ -85,6 +85,17 @@ Only one of settings `sessionAliasToDictionaryAlias` or `avroMessageIdToDictiona

## Release notes

### 3.0.0
+ Migrated from jaxb-api: `2.3.1` to jakarta.xml.bind-api: `4.0.2`
+ Because artifact was moved
+ Migrated to th2 gradle plugin: `0.0.6`
+ Updated:
+ bom `4.6.1`
+ common: `5.10.1-dev`
+ common-utils: `2.2.3-dev`
+ codec: `5.5.0-dev`
+ avro: `1.11.3`

### 2.4.0
+ Updated common: `5.7.2-dev`
+ Updated common-utils: `2.2.2-dev`
Expand Down
94 changes: 62 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,47 +1,77 @@
buildscript {
repositories {
maven {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath "com.exactpro.th2:th2-gradle-plugin:0.0.1-dev-5915772757-13a28ae-SNAPSHOT"
}
plugins {
id "org.jetbrains.kotlin.jvm" version "1.8.22"
id "org.jetbrains.kotlin.kapt" version "1.8.22"
id("java-library")
id("maven-publish")

id "com.exactpro.th2.gradle.publish" version "0.0.6"
id "com.exactpro.th2.gradle.component" version "0.0.6"

id "me.champeau.jmh" version "0.7.2"
}

plugins {
// for run ./gradlew jmh
id 'me.champeau.jmh' version '0.6.8'
group = 'com.exactpro.th2'
version = release_version

kotlin {
jvmToolchain(11)
}

apply plugin: "com.exactpro.th2.common-conventions"
apply plugin: "com.exactpro.th2.docker-conventions"
repositories {
mavenCentral()
maven {
name 'Sonatype_snapshots'
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
maven {
name 'Sonatype_releases'
url 'https://s01.oss.sonatype.org/content/repositories/releases/'
}
mavenLocal()

apply plugin: 'kotlin-kapt'
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
}
}

dependencies {
api platform('com.exactpro.th2:bom:4.5.0')
implementation "com.exactpro.th2:common:5.10.1-dev"
implementation "com.exactpro.th2:common-utils:2.2.3-dev"
implementation "com.exactpro.th2:codec:5.5.0-dev"
implementation "jakarta.xml.bind:jakarta.xml.bind-api:4.0.2"


implementation'org.apache.avro:avro:1.11.3'
implementation('org.apache.commons:commons-compress:1.26.1') {
because("commons-compress:1.22 transitive dependency of avro:1.11.3 has vulnerabilities")
}

implementation "com.exactpro.th2:common:5.7.2-dev"
implementation "com.exactpro.th2:common-utils:2.2.2-dev"
implementation "com.exactpro.th2:codec:5.4.1-dev"
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'commons-io:commons-io'

implementation 'org.apache.avro:avro:1.11.1'
implementation 'commons-io:commons-io:2.12.0'
implementation "io.github.microutils:kotlin-logging:3.0.5"

compileOnly 'com.google.auto.service:auto-service:1.0.1'
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5:1.6.21'
kapt 'com.google.auto.service:auto-service:1.0.1'
compileOnly 'com.google.auto.service:auto-service:1.1.1'
kapt 'com.google.auto.service:auto-service:1.1.1'

jmh 'org.openjdk.jmh:jmh-core:1.36'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.36'
jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.36'
jmh 'org.openjdk.jmh:jmh-core:1.37'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'

testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.3.1'
testImplementation 'io.strikt:strikt-core:0.34.1'
}

application {
mainClass.set("com.exactpro.th2.codec.MainKt")
}

jmh {
//profilers = ['stack'] // Use profilers to collect additional data. Supported profilers: [cl, comp, gc, stack, perf, perfnorm, perfasm, xperf, xperfasm, hs_cl, hs_comp, hs_gc, hs_rt, hs_thr, async]
test {
useJUnitPlatform()
}
dependencyLocking {
lockAllConfigurations()

dependencyCheck {
suppressionFile='supressions.xml'
}
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
release_version=2.4.0
app_main_class=com.exactpro.th2.codec.MainKt
release_version=3.0.0
description='th2 codec avro'
vcs_url=https://github.com/th2-net/th2-codec-avro
4 changes: 2 additions & 2 deletions src/main/kotlin/com/exactpro/th2/codec/AbstractAvroCodec.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Exactpro (Exactpro Systems Limited)
* Copyright 2023-2024 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,12 +32,12 @@ import com.google.protobuf.UnsafeByteOperations
import io.netty.buffer.ByteBuf
import io.netty.buffer.ByteBufUtil
import io.netty.buffer.Unpooled
import jakarta.xml.bind.DatatypeConverter
import org.apache.avro.io.Decoder
import org.apache.avro.io.Encoder
import org.apache.avro.io.EncoderFactory
import java.io.ByteArrayOutputStream
import java.io.IOException
import javax.xml.bind.DatatypeConverter
import com.exactpro.th2.common.grpc.AnyMessage as ProtoAnyMessage
import com.exactpro.th2.common.grpc.Message as ProtoMessage
import com.exactpro.th2.common.grpc.MessageGroup as ProtoMessageGroup
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/exactpro/th2/codec/MessageDatumReader.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Exactpro (Exactpro Systems Limited)
* Copyright 2023-2024 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@ import com.exactpro.th2.common.grpc.Value
import com.exactpro.th2.common.message.addField
import com.exactpro.th2.common.value.toValue
import com.google.protobuf.TextFormat.shortDebugString
import jakarta.xml.bind.DatatypeConverter
import org.apache.avro.Schema
import org.apache.avro.LogicalType
import org.apache.avro.Conversion
Expand All @@ -32,7 +33,6 @@ import org.apache.avro.io.Decoder
import org.apache.avro.io.ResolvingDecoder
import java.io.IOException
import java.nio.ByteBuffer
import javax.xml.bind.DatatypeConverter
import mu.KotlinLogging

class MessageDatumReader(
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/exactpro/th2/codec/MessageDatumWriter.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Exactpro (Exactpro Systems Limited)
* Copyright 2023-2024 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,6 +21,7 @@ import com.exactpro.th2.common.grpc.Value
import com.exactpro.th2.common.message.getField
import com.exactpro.th2.common.value.getList
import com.exactpro.th2.common.value.getMessage
import jakarta.xml.bind.DatatypeConverter
import org.apache.avro.UnresolvedUnionException
import org.apache.avro.AvroTypeException
import org.apache.avro.Schema
Expand All @@ -33,7 +34,6 @@ import org.apache.avro.path.LocationStep
import org.apache.avro.util.SchemaUtil
import java.io.IOException
import java.nio.ByteBuffer
import javax.xml.bind.DatatypeConverter

class MessageDatumWriter(schema: Schema, enableIdPrefixEnumFields: Boolean = false) :
AbstractMessageWriter<Message>(schema, enableIdPrefixEnumFields) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 Exactpro (Exactpro Systems Limited)
* Copyright 2023-2024 Exactpro (Exactpro Systems Limited)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,6 +18,7 @@ package com.exactpro.th2.codec

import com.exactpro.th2.codec.AbstractMessageWriter.Companion.UNION_FIELD_NAME_TYPE_DELIMITER
import com.exactpro.th2.codec.AbstractMessageWriter.Companion.UNION_ID_PREFIX
import jakarta.xml.bind.DatatypeConverter
import org.apache.avro.Schema
import org.apache.avro.LogicalType
import org.apache.avro.Conversion
Expand All @@ -27,7 +28,6 @@ import org.apache.avro.io.Decoder
import org.apache.avro.io.ResolvingDecoder
import java.io.IOException
import java.nio.ByteBuffer
import javax.xml.bind.DatatypeConverter
import mu.KotlinLogging

class TransportMessageDatumReader(
Expand Down
Loading

0 comments on commit f9a7713

Please sign in to comment.