diff --git a/.github/workflows/test_jdk17.yml b/.github/workflows/test_jdk17.yml new file mode 100644 index 000000000..e2a7ca221 --- /dev/null +++ b/.github/workflows/test_jdk17.yml @@ -0,0 +1,26 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI JDK 17 + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Build with Gradle + uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee + with: + arguments: build \ No newline at end of file diff --git a/.gitignore b/.gitignore index f8b92c3aa..3060674fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .gradle build +.idea \ No newline at end of file diff --git a/README.md b/README.md index 1865604d6..ed18b7319 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,6 @@ http://www.lightningj.org Build status Master JDK 8: ![JDK 8 Build Status](https://github.com/lightningj-org/lightningj/actions/workflows/test_jdk8.yml/badge.svg?branch=master) -Build status Master JDK 11: ![JDK 11 Build Status](https://github.com/lightningj-org/lightningj/actions/workflows/test_jdk11.yml/badge.svg?branch=master) \ No newline at end of file +Build status Master JDK 11: ![JDK 11 Build Status](https://github.com/lightningj-org/lightningj/actions/workflows/test_jdk11.yml/badge.svg?branch=master) + +Build status Master JDK 17: ![JDK 17 Build Status](https://github.com/lightningj-org/lightningj/actions/workflows/test_jdk17.yml/badge.svg?branch=master) \ No newline at end of file diff --git a/build.gradle b/build.gradle index 014820954..fedbe4d4c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,88 +1,87 @@ -group 'org.lightningj' - -version '0.15.1-Beta' - -apply plugin: "groovy" -apply plugin: 'com.google.protobuf' -apply plugin: 'idea' -apply plugin: 'org.asciidoctor.convert' -apply plugin: 'project-report' -apply plugin: 'org.ajoberstar.git-publish' -apply plugin: 'signing' -apply plugin: 'maven' - -description = "LightningJ - Lightning APIs for Java" - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -repositories { - // Spock releases are available from Maven Central - mavenCentral() - // Spock snapshots are available from the Sonatype OSS snapshot repository - // maven { url "http://oss.sonatype.org/content/repositories/snapshots/" } -} - buildscript { repositories { mavenLocal() mavenCentral() - jcenter() - maven { url "https://dl.bintray.com/asciidoctor/maven/"} + gradlePluginPortal() } dependencies { - classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.10" + classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.16" - classpath "org.spockframework:spock-core:1.3-groovy-2.5" + //classpath "org.spockframework:spock-core:1.3-groovy-2.5" // optional dependencies for using Spock classpath "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used classpath "net.bytebuddy:byte-buddy:1.9.7" // allows mocking of classes (in addition to interfaces) classpath "org.objenesis:objenesis:2.5.1" // allows mocking of classes without default constructor (together with CGLIB) - // Documentation generation - classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7' - classpath 'org.ajoberstar:gradle-git-publish:2.1.3' + // https://mvnrepository.com/artifact/org.asciidoctor/asciidoctor-gradle-plugin + // classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.6.1' + classpath 'org.ajoberstar.git-publish:gradle-git-publish:3.0.1' // JAX-B dependencies for JDK 9+ - classpath "javax.xml.bind:jaxb-api:2.2.11" - classpath "com.sun.xml.bind:jaxb-core:2.2.11" - classpath "com.sun.xml.bind:jaxb-impl:2.2.11" - classpath "javax.activation:activation:1.1.1" + classpath 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.0' + classpath 'com.sun.xml.bind:jaxb-impl:3.0.0' + classpath 'javax.annotation:javax.annotation-api:1.3.2' } } +plugins { + id 'java-library' + id 'groovy' + id 'com.google.protobuf' version "0.8.16" + id 'idea' + id 'project-report' + id 'org.ajoberstar.git-publish' version "3.0.1" + id 'org.asciidoctor.jvm.convert' version '3.3.2' + id 'signing' + id 'maven-publish' +} + +group 'org.lightningj' + +version '0.15.3-Beta' + +description = "LightningJ - Lightning APIs for Java" + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +repositories { + mavenCentral() +} + dependencies { //gRPC - compile 'com.google.api.grpc:googleapis-common-protos:0.0.3' - compile 'io.netty:netty-tcnative-boringssl-static:2.0.40.Final' - compile 'io.grpc:grpc-netty-shaded:1.39.0' - compile 'io.grpc:grpc-protobuf:1.39.0' - compile 'io.grpc:grpc-stub:1.39.0' + implementation 'com.google.api.grpc:proto-google-common-protos:2.9.6' + implementation 'io.netty:netty-tcnative-boringssl-static:2.0.54.Final' + api "io.grpc:grpc-netty-shaded:$grpcVersion" + implementation "io.grpc:grpc-protobuf:$grpcVersion" + implementation "io.grpc:grpc-stub:$grpcVersion" // JSON-P - compile 'javax.json:javax.json-api:1.0' - compile 'org.glassfish:javax.json:1.1.2' + implementation 'javax.json:javax.json-api:1.1.4' + implementation 'org.glassfish:javax.json:1.1.4' // JAX-B dependencies for JDK 9+ - compile "javax.xml.bind:jaxb-api:2.2.11" - compile "com.sun.xml.bind:jaxb-core:2.2.11" - compile "com.sun.xml.bind:jaxb-impl:2.2.11" - compile "javax.activation:activation:1.1.1" - - compile("javax.annotation:javax.annotation-api:1.3.2") + implementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.0' + implementation 'com.sun.xml.bind:jaxb-impl:3.0.0' + implementation 'javax.annotation:javax.annotation-api:1.3.2' // JMacaroon - // compile 'com.github.nitram509:jmacaroons:0.3.1' + // implementation 'com.github.nitram509:jmacaroons:0.3.1' + + testImplementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.0' + testImplementation 'com.sun.xml.bind:jaxb-impl:3.0.0' + testImplementation 'javax.annotation:javax.annotation-api:1.3.2' // mandatory dependencies for using Spock - testCompile "org.spockframework:spock-core:1.3-groovy-2.5" + testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") + testImplementation "org.spockframework:spock-core" // optional dependencies for using Spock - testCompile "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used - testRuntime "net.bytebuddy:byte-buddy:1.9.7" // allows mocking of classes (in addition to interfaces) - testRuntime "org.objenesis:objenesis:2.5.1" // allows mocking of classes without default constructor (together with CGLIB) - + testImplementation 'org.hamcrest:hamcrest-core:2.2' // only necessary if Hamcrest matchers are used + testRuntimeOnly 'net.bytebuddy:byte-buddy:1.12.17' // allows mocking of classes (in addition to interfaces) + testRuntimeOnly 'org.objenesis:objenesis:3.3' // allows mocking of classes without default constructor (together with CGLIB) } /* @@ -90,11 +89,11 @@ dependencies { */ protobuf { protoc { - artifact = "com.google.protobuf:protoc:3.7.1" + artifact = "com.google.protobuf:protoc:$protobufVersion" } plugins { grpc { - artifact = 'io.grpc:protoc-gen-grpc-java:1.23.0' + artifact = "io.grpc:protoc-gen-grpc-java:$grpcVersion" } } generateProtoTasks { @@ -111,6 +110,9 @@ compileJava { source += ['build/generated/source/wrapper/main/java'] } +test { + useJUnitPlatform() +} /* Generate High Level LDN API using custom WrapperClassGenerator in buildSrc @@ -128,8 +130,11 @@ task compileWrapperMessages(type: JavaCompile, dependsOn: generateWrappers){ source = compileJava.source //classpath = files('build/classes/main') classpath = compileJava.classpath + files('build/classes/java/main') - destinationDir = compileJava.destinationDir + destinationDirectory.set(compileJava.destinationDirectory.get()) } +compileTestGroovy.dependsOn(compileWrapperMessages) +javadoc.dependsOn(compileWrapperMessages) + /* Generate XSD of all generated High Level Message classes, fist dependency configuration then @@ -139,8 +144,8 @@ configurations{ xsdClassPathConf } dependencies { - xsdClassPathConf 'javax.json:javax.json-api:1.0' - xsdClassPathConf 'org.glassfish:javax.json:1.1.2' + xsdClassPathConf 'javax.json:javax.json-api:1.1.4' + xsdClassPathConf 'org.glassfish:javax.json:1.1.4' } task generateXSD(type: XSDGenerator, dependsOn: compileWrapperMessages){ @@ -154,6 +159,7 @@ task generateXSD(type: XSDGenerator, dependsOn: compileWrapperMessages){ */ jar.dependsOn.add(generateXSD) +//sourcesJar.dependsOn(generateProto) /* Adds generated source directories to be included in javadoc generation. */ @@ -172,7 +178,11 @@ asciidoctor { ] } -task ('doc',type: Copy,dependsOn: [javadoc, asciidoctor, htmlDependencyReport]){ + +task ('doc',type: Copy,dependsOn: [javadoc, asciidoctor, htmlDependencyReport, test]){ + from('build/docs/'){ + include('index.html') + } from('build/reports/project/'){ include('dependencies/**') } @@ -238,17 +248,19 @@ gitPublish { } task javadocJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier.set('javadoc') from javadoc } +javadocJar.dependsOn(asciidoctor) task sourcesJar(type: Jar) { - classifier = 'sources' + archiveClassifier.set('sources') from sourceSets.main.allSource from 'build/generated/source/proto/main/grpc' from 'build/generated/source/proto/main/java' from 'build/generated/source/wrapper/main/java' } +sourcesJar.dependsOn(compileWrapperMessages) artifacts { archives javadocJar, sourcesJar @@ -257,61 +269,73 @@ artifacts { // Add integration test task, with source sets etc. apply from: 'integrationTest.gradle' -// Use external gpg2 command to support signing by hardware keys (i.e. SmartCard) and sign only -// if build should be uploaded to Maven Central. -signing { - required { gradle.taskGraph.hasTask(uploadArchives) } - useGpgCmd() - sign configurations.archives -} - -signArchives.onlyIf {gradle.taskGraph.hasTask(uploadArchives)} - - -uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - - snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { - authentication(userName: ossrhUsername, password: ossrhPassword) - } - pom.project { - name 'lightningj' - packaging 'jar' +publishing { + publications { + maven(MavenPublication) { + from components.java + artifact tasks.sourcesJar + artifact tasks.javadocJar + pom { + name = 'lightningj' + packaging = 'jar' // optionally artifactId can be defined here - description 'LightningJ - Lightning APIs for Java' - url 'http://www.lightningj.org' + description = 'LightningJ - Lightning APIs for Java' + url ='http://www.lightningj.org' + scm { - connection 'https://github.com/lightningj-org/lightningj.git' - developerConnection 'https://github.com/lightningj-org/lightningj.git' - url 'https://github.com/lightningj-org/lightningj' + connection = 'https://github.com/lightningj-org/lightningj.git' + developerConnection = 'https://github.com/lightningj-org/lightningj.git' + url ='https://github.com/lightningj-org/lightningj' } licenses { license { - name 'GNU Lesser General Public License v3.0' - url 'http://www.gnu.org/licenses/lgpl.txt' + name = 'GNU Lesser General Public License v3.0' + url = 'http://www.gnu.org/licenses/lgpl.txt' } } developers { developer { - id 'herrvendil' - name 'Philip Vendil' - email 'info@lightningj.org' + id = 'herrvendil' + name = 'Philip Vendil' + email = 'info@lightningj.org' } } } } } + repositories { + maven { + // Currently is only releaes published. + // To add support for snapshot releases add following logic + //url = isReleaseBuild() ? "https://oss.sonatype.org/service/local/staging/deploy/maven2/": "https://oss.sonatype.org/content/repositories/snapshots/" + url = (project.version =~ "SNAPSHOT"? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/") + credentials { + username = ossrhUsername + password = ossrhPassword + } + } + } } -uploadArchives.dependsOn.add(signArchives) +// Use external gpg2 command to support signing by hardware keys (i.e. SmartCard) and sign only +// if build should be uploaded to Maven Central. +signing { + required { gradle.taskGraph.hasTask(publish) } + useGpgCmd() + sign publishing.publications.maven +} +signMavenPublication.onlyIf {gradle.taskGraph.hasTask(publish)} + +publish.dependsOn.add(signMavenPublication) + +afterEvaluate { + generateTestProto.dependsOn(compileWrapperMessages) + extractIncludeTestProto.dependsOn(compileWrapperMessages) + extractIncludeIntegrationTestProto.dependsOn(compileWrapperMessages) + compileIntegrationTestGroovy.dependsOn(compileWrapperMessages) +} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 2846096e9..46ef889f6 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,7 +1,7 @@ group 'test-buildsrc' version '1.0-SNAPSHOT' -sourceCompatibility = 1.7 +sourceCompatibility = 1.8 repositories { // Spock releases are available from Maven Central @@ -10,36 +10,34 @@ repositories { // maven { url "http://oss.sonatype.org/content/repositories/snapshots/" } } - +ext { + grpcVersion = "1.49.2" +} dependencies { //gRPC - compile group: 'com.google.api.grpc', name: 'googleapis-common-protos', version: '0.0.3' - compile 'io.netty:netty-tcnative-boringssl-static:2.0.6.Final' - compile 'io.grpc:grpc-netty:1.7.0' - compile 'io.grpc:grpc-protobuf:1.7.0' - compile 'io.grpc:grpc-stub:1.7.0' + implementation 'io.netty:netty-tcnative-boringssl-static:2.0.54.Final' + implementation "io.grpc:grpc-netty:$grpcVersion" + implementation "io.grpc:grpc-protobuf:$grpcVersion" + implementation "io.grpc:grpc-stub:$grpcVersion" // JAX-B dependencies for JDK 9+ - compile "javax.xml.bind:jaxb-api:2.2.11" - compile "com.sun.xml.bind:jaxb-core:2.2.11" - compile "com.sun.xml.bind:jaxb-impl:2.2.11" - compile "javax.activation:activation:1.1.1" + implementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.0' + implementation 'com.sun.xml.bind:jaxb-impl:3.0.0' + implementation 'javax.annotation:javax.annotation-api:1.3.2' // mandatory dependencies for using Spock - testCompile ("org.spockframework:spock-core:1.3-groovy-2.5"){ - transitive false - } - testCompile ("junit:junit:4.12") + testImplementation platform("org.spockframework:spock-bom:2.1-groovy-3.0") + testImplementation "org.spockframework:spock-core" + + testImplementation ("junit:junit:4.12") // optional dependencies for using Spock - testCompile "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used - testRuntime "net.bytebuddy:byte-buddy:1.9.7" // allows mocking of classes (in addition to interfaces) - testRuntime "org.objenesis:objenesis:2.5.1" // allows mocking of classes without default constructor (together with CGLIB) + testImplementation "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used + testRuntimeOnly "net.bytebuddy:byte-buddy:1.9.7" // allows mocking of classes (in addition to interfaces) + testRuntimeOnly "org.objenesis:objenesis:2.5.1" // allows mocking of classes without default constructor (together with CGLIB) // dependencies used by examples in this project - testRuntime "com.h2database:h2:1.4.182" - - + testRuntimeOnly "com.h2database:h2:1.4.182" } diff --git a/buildSrc/src/main/groovy/ClassGenerator.groovy b/buildSrc/src/main/groovy/ClassGenerator.groovy index 8d202318f..ce68ec8cc 100644 --- a/buildSrc/src/main/groovy/ClassGenerator.groovy +++ b/buildSrc/src/main/groovy/ClassGenerator.groovy @@ -19,7 +19,7 @@ import org.gradle.api.Project /** - * File containing static metods to generate wrapped message classes files into + * File containing static methods to generate wrapped message classes files into * directory build/generated/source/wrapper/main/org/lightningj/wrapper/message/ * * Created by Philip Vendil diff --git a/buildSrc/src/main/groovy/ClassNameUtils.groovy b/buildSrc/src/main/groovy/ClassNameUtils.groovy index 59df4f876..1469ede9d 100644 --- a/buildSrc/src/main/groovy/ClassNameUtils.groovy +++ b/buildSrc/src/main/groovy/ClassNameUtils.groovy @@ -17,7 +17,7 @@ import com.google.protobuf.Descriptors.FieldDescriptor.JavaType /** - * Contains util method to caluculate generated class names. + * Contains util method to calculate generated class names. * * Created by Philip Vendil */ diff --git a/buildSrc/src/main/groovy/ProtocolSettings.groovy b/buildSrc/src/main/groovy/ProtocolSettings.groovy index a7b82f3f9..5c7979460 100644 --- a/buildSrc/src/main/groovy/ProtocolSettings.groovy +++ b/buildSrc/src/main/groovy/ProtocolSettings.groovy @@ -331,21 +331,21 @@ import org.lightningj.lnd.wrapper.message.FeatureBit; String getExternalNamespaces(){ return """ - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/lndjapi_1_0", prefix = ""), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/autopilot_1_0", prefix = "autopilot"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/chainnotifier_1_0", prefix = "chainnotifier"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/invoices_1_0", prefix = "invoices"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/router_1_0", prefix = "router"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/signer_1_0", prefix = "signer"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/walletkit_1_0", prefix = "walletkit"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/watchtower_1_0", prefix = "watchtower"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/wtclient_1_0", prefix = "wtclient"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/verrpc_1_0", prefix = "verrpc"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/walletunlocker_1_0", prefix = "walletunlocker"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/stateservice_1_0", prefix = "stateservice"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/dev_1_0", prefix = "dev"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/neutrino_1_0", prefix = "neutrino"), - @javax.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/peers_1_0", prefix = "peers") + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/lndjapi_1_0", prefix = ""), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/autopilot_1_0", prefix = "autopilot"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/chainnotifier_1_0", prefix = "chainnotifier"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/invoices_1_0", prefix = "invoices"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/router_1_0", prefix = "router"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/signer_1_0", prefix = "signer"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/walletkit_1_0", prefix = "walletkit"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/watchtower_1_0", prefix = "watchtower"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/wtclient_1_0", prefix = "wtclient"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/verrpc_1_0", prefix = "verrpc"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/walletunlocker_1_0", prefix = "walletunlocker"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/stateservice_1_0", prefix = "stateservice"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/dev_1_0", prefix = "dev"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/neutrino_1_0", prefix = "neutrino"), + @jakarta.xml.bind.annotation.XmlNs(namespaceURI = "http://lightningj.org/xsd/peers_1_0", prefix = "peers") """ } diff --git a/buildSrc/src/main/groovy/WrapperClassGenerator.groovy b/buildSrc/src/main/groovy/WrapperClassGenerator.groovy index c3108afd8..43f792863 100644 --- a/buildSrc/src/main/groovy/WrapperClassGenerator.groovy +++ b/buildSrc/src/main/groovy/WrapperClassGenerator.groovy @@ -13,6 +13,7 @@ *************************************************************************/ import com.google.protobuf.Descriptors import org.gradle.api.DefaultTask +import org.gradle.api.tasks.Input import org.gradle.api.tasks.TaskAction @@ -23,6 +24,7 @@ import org.gradle.api.tasks.TaskAction */ class WrapperClassGenerator extends DefaultTask{ + @Input List protocols diff --git a/buildSrc/src/main/groovy/XSDGenerator.groovy b/buildSrc/src/main/groovy/XSDGenerator.groovy index 03582c1ec..f578da049 100644 --- a/buildSrc/src/main/groovy/XSDGenerator.groovy +++ b/buildSrc/src/main/groovy/XSDGenerator.groovy @@ -12,10 +12,12 @@ * * *************************************************************************/ import org.gradle.api.DefaultTask +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction -import javax.xml.bind.JAXBContext -import javax.xml.bind.SchemaOutputResolver +import jakarta.xml.bind.JAXBContext +import jakarta.xml.bind.SchemaOutputResolver import javax.xml.transform.Result import javax.xml.transform.stream.StreamResult import java.lang.reflect.Method @@ -28,14 +30,19 @@ import java.lang.reflect.Method */ class XSDGenerator extends DefaultTask{ + @Input List protocols + @Input def classpath + @Internal String compileClasses = "build/classes/java/main" + @Internal String generatedResourcesDir = "build/resources/main" + @Internal String systemId = "http://SomeURL" @TaskAction @@ -60,7 +67,7 @@ class XSDGenerator extends DefaultTask{ ncl.addClasspath(findProjectClassPath(compileClasses)) ncl.addClasspath(findProjectClassPath(generatedResourcesDir)) URL f = ncl.getResource(findProjectClassPath(protocolSettings.getJAXBIndexResouceLocation())) - Class c = ncl.loadClass("javax.xml.bind.JAXBContext") + Class c = ncl.loadClass("jakarta.xml.bind.JAXBContext") Method m = c.getMethod("newInstance",String.class,ClassLoader.class) return m.invoke(null,protocolSettings.getJaxbSrcDirectory(),ncl) diff --git a/buildSrc/src/main/resources/WrappedEnum.java.template b/buildSrc/src/main/resources/WrappedEnum.java.template index 6dd9aadcd..f82ceec6b 100644 --- a/buildSrc/src/main/resources/WrappedEnum.java.template +++ b/buildSrc/src/main/resources/WrappedEnum.java.template @@ -16,7 +16,7 @@ package ${wrapperBasePackageName}.message; import ${apiClassPath}; import ${wrapperBasePackageName}.*; -import javax.xml.bind.annotation.*; +import jakarta.xml.bind.annotation.*; ${specialAPIImports} /** diff --git a/buildSrc/src/main/resources/WrappedMessageClass.java.template b/buildSrc/src/main/resources/WrappedMessageClass.java.template index c53e3e28b..65a231fa5 100644 --- a/buildSrc/src/main/resources/WrappedMessageClass.java.template +++ b/buildSrc/src/main/resources/WrappedMessageClass.java.template @@ -22,7 +22,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; -import javax.xml.bind.annotation.*; +import jakarta.xml.bind.annotation.*; ${specialAPIImports} /** diff --git a/buildSrc/src/main/resources/package-info.java.template b/buildSrc/src/main/resources/package-info.java.template index 4df75579f..cba030b89 100644 --- a/buildSrc/src/main/resources/package-info.java.template +++ b/buildSrc/src/main/resources/package-info.java.template @@ -14,10 +14,10 @@ /** * Autogenerated package-info for Lightning API data structures. */ -@javax.xml.bind.annotation.XmlSchema(namespace = "${namespace}", +@jakarta.xml.bind.annotation.XmlSchema(namespace = "${namespace}", xmlns = { ${externalNameSpaces} }, - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -@javax.xml.bind.annotation.XmlAccessorType(javax.xml.bind.annotation.XmlAccessType.PROPERTY) + elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED) +@jakarta.xml.bind.annotation.XmlAccessorType(jakarta.xml.bind.annotation.XmlAccessType.PROPERTY) package ${wrapperBasePackageName}.message; diff --git a/docs/index.adoc b/docs/index.adoc index 56d1e22cd..31e10b1ab 100644 --- a/docs/index.adoc +++ b/docs/index.adoc @@ -5,8 +5,7 @@ = LightningJ -_Lightning APIs for Java_ -V {project-version}, {localdate} +_Lightning APIs for Java_ {localdate} == Introduction @@ -41,6 +40,9 @@ to the license agreement can be found link:LICENSE.txt[here]. == Whats New +* 0.15.3-Beta : Major update, Generated against 0.15.3 and updated Gradle to 7.5.1. + Updated grpc to 1.49.2 and protobuf to 3.21.7. Migrated from jaxb.xml.bind to jakarta.xml.bind. + Done with contribution from rachid-o. * 0.15.1-Beta : Generated against LND 0.15.1 API and also verified to work with 0.15.2 * 0.15.0-Beta : Generated against LND 0.15.0 API, Added Dev, Peers and Neutrino RPC APIs. * 0.14.3-Beta : Generated against LND 0.14.3 API @@ -130,7 +132,7 @@ Or to your build.gradle [subs="attributes"] ---- - compile 'org.lightningj:lightningj:{project-version}' + implementation 'org.lightningj:lightningj:{project-version}' ---- All tags and releases is signed with the following link:lightningj-release-pubkey.asc[GPG Key]. diff --git a/gradle.properties b/gradle.properties index cde3b5311..c9546b571 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,6 @@ // Maven Central Repository publishing, set correct data in user dir .gradle/gradle.properties ossrhUsername = 'set in gradle.properties' -ossrhPassword = 'set in gradle.properties' \ No newline at end of file +ossrhPassword = 'set in gradle.properties' + +grpcVersion=1.49.2 +protobufVersion=3.21.7 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 59b5f8928..ae04661ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/integrationTest.gradle b/integrationTest.gradle index b04993fe6..92ea81ffd 100644 --- a/integrationTest.gradle +++ b/integrationTest.gradle @@ -21,7 +21,7 @@ sourceSets{ } configurations { - integrationTestImplementation.extendsFrom testCompile + integrationTestImplementation.extendsFrom testImplementation integrationTestRuntimeOnly.extendsFrom runtimeOnly } @@ -55,10 +55,13 @@ task integrationTest(type: Test, group: "verification", description: "Runs integ } testClassesDirs = project.sourceSets.integrationTest.output.classesDirs classpath = project.sourceSets.integrationTest.runtimeClasspath + useJUnitPlatform() + dependsOn(compileWrapperMessages) } integrationTest.shouldRunAfter test + /* Task for specifying for Intellij which source directories to use. */ diff --git a/src/main/java/org/lightningj/lnd/wrapper/Message.java b/src/main/java/org/lightningj/lnd/wrapper/Message.java index a23e38afd..a635f7584 100644 --- a/src/main/java/org/lightningj/lnd/wrapper/Message.java +++ b/src/main/java/org/lightningj/lnd/wrapper/Message.java @@ -20,7 +20,7 @@ import javax.json.JsonException; import javax.json.JsonObjectBuilder; import javax.json.JsonReader; -import javax.xml.bind.annotation.XmlTransient; +import jakarta.xml.bind.annotation.XmlTransient; /** * Base Wrapper Message class containing the base functionality for diff --git a/src/main/java/org/lightningj/lnd/wrapper/StaticFileMacaroonContext.java b/src/main/java/org/lightningj/lnd/wrapper/StaticFileMacaroonContext.java index d44b23e07..bfb283ecd 100644 --- a/src/main/java/org/lightningj/lnd/wrapper/StaticFileMacaroonContext.java +++ b/src/main/java/org/lightningj/lnd/wrapper/StaticFileMacaroonContext.java @@ -14,7 +14,7 @@ package org.lightningj.lnd.wrapper; -import javax.xml.bind.DatatypeConverter; +import jakarta.xml.bind.DatatypeConverter; import java.io.File; import java.io.FileInputStream; diff --git a/src/main/java/org/lightningj/lnd/wrapper/XMLParser.java b/src/main/java/org/lightningj/lnd/wrapper/XMLParser.java index 0ce2848c9..563749241 100644 --- a/src/main/java/org/lightningj/lnd/wrapper/XMLParser.java +++ b/src/main/java/org/lightningj/lnd/wrapper/XMLParser.java @@ -16,10 +16,10 @@ import org.xml.sax.SAXException; import javax.xml.XMLConstants; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; import javax.xml.transform.Source; import javax.xml.transform.SourceLocator; import javax.xml.transform.stream.StreamSource; diff --git a/src/test/groovy/org/lightningj/lnd/wrapper/XMLParserSpec.groovy b/src/test/groovy/org/lightningj/lnd/wrapper/XMLParserSpec.groovy index 293559bae..1be389efb 100644 --- a/src/test/groovy/org/lightningj/lnd/wrapper/XMLParserSpec.groovy +++ b/src/test/groovy/org/lightningj/lnd/wrapper/XMLParserSpec.groovy @@ -38,7 +38,7 @@ import org.lightningj.lnd.wrapper.stateservice.message.GetStateRequest import org.lightningj.lnd.wrapper.dev.message.ImportGraphResponse import spock.lang.Specification -import javax.xml.bind.UnmarshalException +import jakarta.xml.bind.UnmarshalException import javax.xml.validation.Schema /**