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

fix: EXPOSED-117 Set jvmToolchain to 8 for all modules #1855

Merged
merged 3 commits into from
Sep 15, 2023
Merged
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
4 changes: 4 additions & 0 deletions exposed-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(kotlin("stdlib"))
api(kotlin("reflect"))
Expand Down
4 changes: 4 additions & 0 deletions exposed-crypt/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
api("org.springframework.security", "spring-security-crypto", "5.7.3")
Expand Down
4 changes: 4 additions & 0 deletions exposed-dao/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
}
4 changes: 4 additions & 0 deletions exposed-java-time/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
testImplementation(project(":exposed-dao"))
Expand Down
4 changes: 4 additions & 0 deletions exposed-jdbc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
}
4 changes: 4 additions & 0 deletions exposed-jodatime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
api("joda-time", "joda-time", "2.10.13")
Expand Down
4 changes: 4 additions & 0 deletions exposed-json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
api("org.jetbrains.kotlinx", "kotlinx-serialization-json", Versions.kotlinxSerialization)
Expand Down
4 changes: 4 additions & 0 deletions exposed-kotlin-datetime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
api("org.jetbrains.kotlinx", "kotlinx-datetime-jvm", "0.4.0")
Expand Down
4 changes: 4 additions & 0 deletions exposed-money/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
api(project(":exposed-dao"))
Expand Down
4 changes: 4 additions & 0 deletions exposed-spring-boot-starter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
api(project(":exposed-dao"))
Expand Down
6 changes: 5 additions & 1 deletion exposed-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ plugins {
kotlin("jvm") apply true
}

kotlin {
jvmToolchain(8)
}

e5l marked this conversation as resolved.
Show resolved Hide resolved
repositories {
mavenCentral()
}
Expand All @@ -28,7 +32,7 @@ dependencies {
implementation("org.apache.logging.log4j", "log4j-api", Versions.log4j2)
implementation("org.apache.logging.log4j", "log4j-core", Versions.log4j2)

implementation("com.zaxxer", "HikariCP", "5.0.1")
implementation("com.zaxxer", "HikariCP", "4.0.3")
testCompileOnly("org.postgresql", "postgresql", Versions.postgre)
testCompileOnly("com.impossibl.pgjdbc-ng", "pgjdbc-ng", Versions.postgreNG)
compileOnly("com.h2database", "h2", Versions.h2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class StatisticsFunctionTests : DatabaseTestsBase() {
private object SampleTestTable : Table("sample_table") {
val number = integer("number").nullable()
}

private val data: List<Int?> = listOf(4, null, 5, null, 6)
private val scale = 4

Expand All @@ -63,7 +64,38 @@ class StatisticsFunctionTests : DatabaseTestsBase() {
}

private fun calculateStandardDeviation(isPopulation: Boolean): BigDecimal {
return calculateVariance(isPopulation).sqrt(MathContext(scale, RoundingMode.HALF_EVEN))
return calculateVariance(isPopulation).simpleSqrt()
}

fun BigDecimal.simpleSqrt(): BigDecimal {
if (this < BigDecimal.ZERO) throw ArithmeticException("Square root of negative number")
if (this == BigDecimal.ZERO) return BigDecimal.ZERO

val TWO = BigDecimal(2)
val EPSILON = BigDecimal(0.1).pow(scale)

var low = BigDecimal.ZERO
var high = max(BigDecimal.ONE)
var result = (low + high).divide(TWO)

while (true) {
val square = result.multiply(result)
val diff = square.subtract(this).abs()
if (diff < EPSILON) {
break
}

if (result.multiply(result) < this) {
low = result
} else {
high = result
}
result = (low + high).divide(TWO)
}

result = result.round(MathContext(scale, RoundingMode.HALF_EVEN))
result = result.setScale(scale)
return result
}

private fun calculateVariance(isPopulation: Boolean): BigDecimal {
Expand Down
4 changes: 4 additions & 0 deletions spring-transaction/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ repositories {
mavenCentral()
}

kotlin {
jvmToolchain(8)
}

dependencies {
api(project(":exposed-core"))
implementation(project(":exposed-jdbc"))
Expand Down