Skip to content

Commit

Permalink
1.39.0 (#46)
Browse files Browse the repository at this point in the history
* Update jars
* Update logging and kotlin jars
  • Loading branch information
pambrose authored Jun 12, 2024
1 parent c085089 commit a4baf16
Show file tree
Hide file tree
Showing 57 changed files with 243 additions and 156 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ depends:
./gradlew dependencies

upgrade-wrapper:
./gradlew wrapper --gradle-version=8.5 --distribution-type=bin
./gradlew wrapper --gradle-version=8.8 --distribution-type=bin
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ buildscript {
plugins {
id 'java'
id 'application'
id 'org.jetbrains.kotlin.jvm' version '1.9.22' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22' apply false
id 'org.jmailen.kotlinter' version "4.1.1" apply false
id 'com.github.gmazzo.buildconfig' version '5.3.2' apply false
id "com.github.ben-manes.versions" version '0.50.0' apply false
id "org.flywaydb.flyway" version "10.4.1"
id 'org.jetbrains.kotlin.jvm' version '2.0.0' apply false
id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.0' apply false
id 'org.jmailen.kotlinter' version "4.3.0" apply false
id 'com.github.gmazzo.buildconfig' version '5.3.5' apply false
id "com.github.ben-manes.versions" version '0.51.0' apply false
id "org.flywaydb.flyway" version "10.15.0"
}

ext {
Expand Down Expand Up @@ -87,7 +87,7 @@ ext {
allprojects {
description = 'ReadingBat Core'
group 'com.github.readingbat'
version '1.38.0'
version '1.39.0'

apply plugin: 'application'
apply plugin: 'java-library'
Expand Down Expand Up @@ -134,7 +134,7 @@ subprojects {

//implementation "dev.hayden:khealth:$khealth_version"

implementation "io.github.microutils:kotlin-logging:$logging_version"
implementation "io.github.oshai:kotlin-logging-jvm:$logging_version"
implementation "ch.qos.logback:logback-classic:$logback_version"

runtimeOnly "org.jetbrains.kotlin:kotlin-scripting-jsr223:$kotlin_version"
Expand Down
36 changes: 18 additions & 18 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
kotlin.code.style=official
kotlin.incremental=true
#kotlin.incremental=true
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx8g -Dkotlin.daemon.jvm.options=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
cloud_version=1.15.1
commons_version=1.11.0
css_version=1.0.0-pre.681
exposed_version=0.46.0
cloud_version=1.19.0
commons_version=1.12.0
css_version=1.0.0-pre.757
exposed_version=0.51.1
flexmark_version=0.64.8
github_api_version=1.318
gson_version=2.10.1
github_api_version=1.321
gson_version=2.11.0
hikari_version=5.1.0
java_script_version=2.0.0
khealth_version=2.1.1
kotest_version=5.8.0
kotest_version=5.9.1
kotest_ktor_version=4.4.3
kotlin_version=1.9.22
ktor_version=2.3.7
logback_version=1.4.14
logging_version=4.0.0-beta-2
kotlin_version=2.0.0
ktor_version=2.3.11
logback_version=1.5.6
logging_version=6.0.9
pgjdbc_version=0.8.9
postgres_version=42.7.1
postgres_version=42.7.3
prometheus_version=0.16.0
proxy_version=1.21.0
redis_version=5.0.2
serialization_version=1.6.2
sendgrid_version=4.10.1
utils_version=1.44.2
proxy_version=1.22.0
redis_version=5.1.3
serialization_version=1.7.0
sendgrid_version=4.10.2
utils_version=2.0.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion readingbat-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ buildConfig {

buildConfigField('String', 'CORE_NAME', "\"${project.name}\"")
buildConfigField('String', 'CORE_VERSION', "\"${project.version}\"")
buildConfigField('String', 'CORE_RELEASE_DATE', "\"02/06/24\"")
buildConfigField('String', 'CORE_RELEASE_DATE', "\"06/11/24\"")
}

// Include build uberjars in heroku deploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import com.github.readingbat.server.EnrolleesTable
import com.github.readingbat.server.UsersTable
import com.pambrose.common.exposed.get
import com.pambrose.common.exposed.readonlyTx
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.http.*
import mu.two.KLogging
import org.jetbrains.exposed.sql.Count
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.and
Expand Down Expand Up @@ -137,7 +137,9 @@ data class ClassCode(val classCode: String) {

override fun toString() = classCode

companion object : KLogging() {
companion object {
private val logger = KotlinLogging.logger {}

internal val DISABLED_CLASS_CODE = ClassCode(DISABLED_MODE)

internal fun newClassCode() = ClassCode(randomId(15))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import com.github.readingbat.server.LanguageName
import com.github.readingbat.server.SessionAnswerHistoryTable
import com.github.readingbat.server.SessionChallengeInfoTable
import com.pambrose.common.exposed.readonlyTx
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.server.application.*
import io.ktor.server.auth.*
import io.ktor.server.sessions.*
import kotlinx.serialization.json.Json.Default.decodeFromString
import mu.two.KLogging
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.insertAndGetId
import org.jetbrains.exposed.sql.transactions.transaction
Expand Down Expand Up @@ -86,7 +86,9 @@ data class BrowserSession(val id: String, val created: Long = Instant.now().toEp
}
}.firstOrNull() ?: ChallengeHistory(invocationVal)

companion object : KLogging() {
companion object {
private val logger = KotlinLogging.logger {}

fun createBrowserSession(id: String) =
with(BrowserSessionsTable) {
insertAndGetId { row -> row[sessionId] = id }.value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import com.sendgrid.Request
import com.sendgrid.SendGrid
import com.sendgrid.helpers.mail.Mail
import com.sendgrid.helpers.mail.objects.Content
import mu.two.KLogging
import io.github.oshai.kotlinlogging.KotlinLogging

internal object Emailer {
private val logger = KotlinLogging.logger {}

internal object Emailer : KLogging() {
fun sendEmail(to: Email, from: Email, subject: String, msg: Message) {
val content = Content("text/plain", msg.value)
val mail =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import com.github.readingbat.server.LanguageName
import com.github.readingbat.server.ScriptPools.kotlinEvaluatorPool
import com.github.readingbat.server.ScriptPools.pythonEvaluatorPool
import com.github.readingbat.utils.StringUtils.toCapitalized
import mu.two.KLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import javax.script.ScriptException

class FunctionInfo(
Expand Down Expand Up @@ -158,7 +158,7 @@ class FunctionInfo(
val answered = userResponse.isNotBlank()
val correctAndHint =
if (answered) {
logger.debug("""Comparing user response: "$userResponse" with correct answer: "$correctAnswer"""")
logger.debug { """Comparing user response: "$userResponse" with correct answer: "$correctAnswer"""" }
if (languageName.isJvm) {
if (correctAnswer.isBracketed())
userResponse.equalsAsJvmList(correctAnswer)
Expand All @@ -183,7 +183,9 @@ class FunctionInfo(
)
}

companion object : KLogging() {
companion object {
private val logger = KotlinLogging.logger {}

private fun String.isJavaBoolean() = this == "true" || this == "false"

private fun String.isPythonBoolean() = this == "True" || this == "False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ import com.github.readingbat.common.PropertyNames.CONTENT
import com.github.readingbat.common.PropertyNames.DBMS
import com.github.readingbat.common.PropertyNames.READINGBAT
import com.github.readingbat.common.PropertyNames.SITE
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.server.application.*
import io.ktor.server.config.*
import mu.two.KLogging
import java.util.concurrent.atomic.AtomicBoolean

open class KtorProperty(
Expand Down Expand Up @@ -102,7 +102,8 @@ open class KtorProperty(

override fun toString() = "$name: $propertyName=${maskFunc(this)}"

companion object : KLogging() {
companion object {
private val logger = KotlinLogging.logger {}
private val initialized = AtomicBoolean(false)
private val instances = mutableListOf<KtorProperty>()

Expand Down Expand Up @@ -364,7 +365,9 @@ sealed class Property(
object REDIS_MIN_IDLE_SIZE :
Property(RedisUtils.REDIS_MIN_IDLE_SIZE, initFunc = { setPropertyFromConfig(it, "1") })

companion object : KLogging() {
companion object {
private val logger = KotlinLogging.logger {}

fun initProperties() =
listOf(
DSL_FILE_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.github.readingbat.server.UsersTable
import com.pambrose.common.exposed.dateTimeExpr
import com.pambrose.common.exposed.get
import com.pambrose.common.exposed.readonlyTx
import mu.two.KLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import org.jetbrains.exposed.sql.Count
import org.jetbrains.exposed.sql.Max
import org.jetbrains.exposed.sql.SortOrder
Expand All @@ -39,7 +39,8 @@ import kotlin.math.min
import kotlin.time.Duration
import kotlin.time.measureTimedValue

internal object SessionActivites : KLogging() {
internal object SessionActivites {
private val logger = KotlinLogging.logger {}
private val session_id = BrowserSessionsTable.sessionId
private val fullName = UsersTable.fullName
private val email = UsersTable.email
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ import com.github.readingbat.server.ws.PubSubCommandsWs.PubSubTopic.USER_ANSWERS
import com.pambrose.common.exposed.get
import com.pambrose.common.exposed.readonlyTx
import com.pambrose.common.exposed.upsert
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.html.Entities.nbsp
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import mu.two.KLogging
import org.jetbrains.exposed.sql.Count
import org.jetbrains.exposed.sql.ResultRow
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
Expand Down Expand Up @@ -540,7 +540,7 @@ class User {

override fun toString() = "User(userId='$userId', name='$fullName')"

companion object : KLogging() {
companion object {
// Class code a user is enrolled in. Will report answers to when in student mode
// This is not browser-id specific
// internal const val ENROLLED_CLASS_CODE_FIELD = "enrolled-class-code"
Expand All @@ -553,6 +553,8 @@ class User {
// This is browser-id specific
// private const val PREVIOUS_TEACHER_CLASS_CODE_FIELD = "previous-teacher-class-code"

private val logger = KotlinLogging.logger {}

val userIdCache = ConcurrentHashMap<String, Long>()
val emailCache = ConcurrentHashMap<String, Email>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import com.github.readingbat.dsl.challenge.PythonChallenge
import com.github.readingbat.server.ChallengeName
import com.github.readingbat.server.GroupName
import com.github.readingbat.server.ReadingBatServer.redisPool
import mu.two.KLogging
import io.github.oshai.kotlinlogging.KotlinLogging
import java.io.File
import kotlin.reflect.KProperty

Expand Down Expand Up @@ -237,5 +237,7 @@ class ChallengeGroup<T : Challenge>(

override fun toString() = "ChallengeGroup(name='$groupName', challenges=$challenges, packageName='$packageName')"

companion object : KLogging()
companion object {
private val logger = KotlinLogging.logger {}
}
}
Loading

0 comments on commit a4baf16

Please sign in to comment.