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
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ jobs:
strategy:
matrix:
pg: [10, 11, 12, 13]
jdk: [8, 11]
jdk: [11, 16]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2
with:
java-version: ${{ matrix.jdk }}
distribution: 'zulu'
- name: Setup PostgreSQL SSL Permissions
run: |
chmod 0400 ./driver/src/test/resources/certdir/server/server.key
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ subprojects {
mavenCentral()
}

extra["moduleDescriptor"] = false
}

val isSnapshot: Boolean by project
Expand Down
30 changes: 29 additions & 1 deletion driver/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@

plugins {
`java-library`
id("com.adarshr.test-logger") version Versions.testLoggerPlugin
}

description = "PostgreSQL JDBC - NG - Driver"

sourceSets.create("java11") {
java.srcDir("src/main/java")
java.srcDir("src/main/java11")
java.srcDir("$buildDir/generated/sources/annotationProcessor/java/java11")
}

dependencies {

Expand All @@ -29,6 +33,8 @@ dependencies {

}

project.extra["moduleDescriptor"] = true

apply {
from("src/build/compile.gradle.kts")
from("src/build/checkstyle.gradle.kts")
Expand All @@ -37,11 +43,33 @@ apply {
from("$rootDir/shared/src/build/publishing.gradle.kts")
}

// Gradle has a bug which prevents using --processor-module-path
// So, we need to re-use the generated sources from compileJava
tasks.create<Copy>("generate-java11-sources") {
from("$buildDir/generated/sources/annotationProcessor/java/main")
into("$buildDir/generated/sources/annotationProcessor/java/java11")
class Filter : Transformer<String, String> {

override fun transform(line: String): String {
return line.replace("javax.annotation.Generated", "javax.annotation.processing.Generated")
}
}
filter(Filter())
}

tasks {
compileJava {
outputs.dir("$buildDir/generated/docs")
}
named("generate-java11-sources") {
dependsOn(project.tasks.named("compileJava"))
}
named<JavaCompile>("compileJava11Java") {
dependsOn(project.tasks.named("generate-java11-sources"))
}
classes {
dependsOn(project.tasks.named("compileJava11Java"))
}
processResources {
expand(project.properties)
}
Expand Down
3 changes: 3 additions & 0 deletions driver/src/build/checkstyle.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ configure<CheckstyleExtension> {

tasks.named<Checkstyle>("checkstyleMain") { exclude("**/guava/**") }
tasks.named<Checkstyle>("checkstyleTest") { exclude("**/jdbc/shared/**") }
tasks.named<Checkstyle>("checkstyleJava11") {
onlyIf { false }
}
6 changes: 6 additions & 0 deletions driver/src/build/compile.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ tasks.named<JavaCompile>("compileJava") {
options.annotationProcessorGeneratedSourcesDirectory = file("$buildDir/generated/sources/annotationProcessor/java/main")
}

tasks.named<JavaCompile>("compileJava11Java") {
options.compilerArgs.add("-Adoc.dir=$buildDir/generated/docs-java11/")
options.isDeprecation = true
options.annotationProcessorGeneratedSourcesDirectory = file("$buildDir/generated/sources/annotationProcessor/java/java11")
}

tasks.named<JavaCompile>("compileTestJava") {
options.compilerArgs.add("-parameters")
options.isDeprecation = true
Expand Down
79 changes: 79 additions & 0 deletions driver/src/main/java11/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
module com.impossibl.postgres {
requires transitive com.impossibl.jdbc.spy;

requires io.netty.buffer;
requires io.netty.codec;
requires io.netty.common;
requires io.netty.handler;
requires io.netty.transport;
requires static io.netty.transport.epoll;
requires static io.netty.transport.kqueue;
requires static io.netty.transport.unix.common;

requires static java.compiler;
requires transitive java.logging;
requires transitive java.naming;
requires java.security.sasl;
requires transitive java.sql;
requires transitive java.transaction.xa;
requires java.xml;

exports com.impossibl.postgres.api.data;
exports com.impossibl.postgres.api.jdbc;
exports com.impossibl.postgres.jdbc;
exports com.impossibl.postgres.jdbc.xa;

uses com.impossibl.postgres.system.procs.ProcProvider;

provides com.impossibl.postgres.system.procs.ProcProvider with
com.impossibl.postgres.system.procs.ACLItems,
com.impossibl.postgres.system.procs.Arrays,
com.impossibl.postgres.system.procs.BitMods,
com.impossibl.postgres.system.procs.Bits,
com.impossibl.postgres.system.procs.Bools,
com.impossibl.postgres.system.procs.Boxes,
com.impossibl.postgres.system.procs.Bytes,
com.impossibl.postgres.system.procs.Cidrs,
com.impossibl.postgres.system.procs.Circles,
com.impossibl.postgres.system.procs.Dates,
com.impossibl.postgres.system.procs.Domains,
com.impossibl.postgres.system.procs.Float4s,
com.impossibl.postgres.system.procs.Float8s,
com.impossibl.postgres.system.procs.HStores,
com.impossibl.postgres.system.procs.Inets,
com.impossibl.postgres.system.procs.Int2s,
com.impossibl.postgres.system.procs.Int2Vectors,
com.impossibl.postgres.system.procs.Int4s,
com.impossibl.postgres.system.procs.Int8s,
com.impossibl.postgres.system.procs.Intervals,
com.impossibl.postgres.system.procs.Jsons,
com.impossibl.postgres.system.procs.Lines,
com.impossibl.postgres.system.procs.LSegs,
com.impossibl.postgres.system.procs.MacAddrs,
com.impossibl.postgres.system.procs.MacAddr8s,
com.impossibl.postgres.system.procs.Moneys,
com.impossibl.postgres.system.procs.Names,
com.impossibl.postgres.system.procs.NumericMods,
com.impossibl.postgres.system.procs.Numerics,
com.impossibl.postgres.system.procs.Oids,
com.impossibl.postgres.system.procs.OidVectors,
com.impossibl.postgres.system.procs.Paths,
com.impossibl.postgres.system.procs.Points,
com.impossibl.postgres.system.procs.Polygons,
com.impossibl.postgres.system.procs.Ranges,
com.impossibl.postgres.system.procs.Records,
com.impossibl.postgres.system.procs.RefCursors,
com.impossibl.postgres.system.procs.Strings,
com.impossibl.postgres.system.procs.Tids,
com.impossibl.postgres.system.procs.TimeMods,
com.impossibl.postgres.system.procs.TimestampMods,
com.impossibl.postgres.system.procs.TimestampsWithoutTZ,
com.impossibl.postgres.system.procs.TimestampsWithTZ,
com.impossibl.postgres.system.procs.TimesWithoutTZ,
com.impossibl.postgres.system.procs.TimesWithTZ,
com.impossibl.postgres.system.procs.UInt4s,
com.impossibl.postgres.system.procs.UUIDs,
com.impossibl.postgres.system.procs.XMLs;
provides java.sql.Driver with
com.impossibl.postgres.jdbc.PGDriver;
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
systemProp.org.gradle.java.compile-classpath-packaging=true
16 changes: 11 additions & 5 deletions shared/src/build/compile-java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ configure<JavaPluginExtension> {
}
}

val javaToolchains = extensions.getByName("javaToolchains") as JavaToolchainService
tasks.named<JavaCompile>("compileJava") {
val targetVersion: Int = Integer.parseInt(Versions.javaTarget.majorVersion)
options.release.set(targetVersion)
}

if (project.extra["moduleDescriptor"] as Boolean) {
tasks.named<JavaCompile>("compileJava11Java") {
options.release.set(11)
options.javaModuleVersion.set(project.version as String)
}

tasks.withType<JavaCompile>().configureEach {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(Versions.javaTarget.majorVersion))
})
configurations["java11CompileClasspath"].extendsFrom(configurations["compileClasspath"])
}
9 changes: 9 additions & 0 deletions shared/src/build/packaging.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ val jar = tasks.named<Jar>("jar") {
"Created-By" to "${System.getProperty("java.version")} (${System.getProperty("java.vendor")})"
)
}
if (project.extra["moduleDescriptor"] as Boolean) {
manifest {
attributes("Multi-Release" to "true")
}
into("META-INF/versions/11") {
from(project.the<SourceSetContainer>()["java11"].output)
include("module-info.class")
}
}
}


Expand Down
23 changes: 23 additions & 0 deletions spy/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ dependencies {
}

val genDir = file("$buildDir/generated")
val gen11Dir = file("$buildDir/generated-java11")

sourceSets {
main {
java.srcDirs(genDir)
java.include("com/impossibl/**")
}
}
sourceSets.create("java11") {
java.srcDir("src/main/java")
java.srcDir(genDir)
java.srcDir("src/main/java11")
}

tasks {

Expand All @@ -32,18 +39,34 @@ tasks {
SpyGen().generateTo(genDir)
}
}
val gen11Task = register("generator11") {
outputs.dir(gen11Dir)

doLast {
gen11Dir.mkdirs()
SpyGen().generateTo(gen11Dir)
}
}

compileJava {
dependsOn(genTask)
options.isDeprecation = true
}

val compileJavaTask = named("compileJava")
named<JavaCompile>("compileJava11Java") {
dependsOn(compileJavaTask)
options.isDeprecation = true
}

javadoc {
dependsOn(genTask)
}

}

project.extra["moduleDescriptor"] = true

apply {
from("$rootDir/shared/src/build/compile-java.gradle.kts")
from("$rootDir/shared/src/build/packaging.gradle.kts")
Expand Down
4 changes: 4 additions & 0 deletions spy/src/main/java11/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module com.impossibl.jdbc.spy {
requires transitive java.sql;
exports com.impossibl.jdbc.spy;
}