Skip to content

Commit

Permalink
back to graalvm 23
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaidioz committed May 17, 2024
1 parent 732dcef commit f87caee
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .sdkmanrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=22.0.1-graalce
java=21.0.1-graalce
13 changes: 8 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ lazy val snapiTruffle = (project in file("snapi-truffle"))
runJavaAnnotationProcessor := {
println("Running Java annotation processor")

val annotationProcessorJar = baseDirectory.value / "truffle-dsl-processor-24.0.1.jar"
val annotationProcessorJar = baseDirectory.value / "truffle-dsl-processor-23.1.0.jar"

val javaSources = baseDirectory.value / "src" / "main" / "java"
val targetDir = baseDirectory.value / "target" / "java-processed-sources"
Expand All @@ -190,8 +190,10 @@ lazy val snapiTruffle = (project in file("snapi-truffle"))

val javacOptions = Seq(
"javac",
"--release",
"22",
"-source",
"21",
"-target",
"21",
"-d",
targetDir.getAbsolutePath,
"--module-path",
Expand Down Expand Up @@ -279,7 +281,8 @@ lazy val pythonClient = (project in file("python-client"))
missingInterpolatorCompileSettings,
testSettings,
Compile / packageBin / packageOptions += Package.ManifestAttributes("Automatic-Module-Name" -> "raw.python.client"),
libraryDependencies ++= Seq(trufflePolyglot, trufflePython))
libraryDependencies += trufflePython
)

lazy val jinjaSqlClient = (project in file("jinja-sql-client"))
.dependsOn(
Expand All @@ -290,6 +293,6 @@ lazy val jinjaSqlClient = (project in file("jinja-sql-client"))
commonSettings,
missingInterpolatorCompileSettings,
testSettings,
libraryDependencies ++= Seq(trufflePolyglot, trufflePython) ++ truffleCompiler
libraryDependencies += trufflePython
)

2 changes: 1 addition & 1 deletion client/src/main/scala/raw/client/api/CompilerService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

package raw.client.api

import com.fasterxml.jackson.annotation.JsonSubTypes.{Type => JsonType}
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
import org.graalvm.polyglot.{Engine, Value}
import raw.utils.{RawException, RawService, RawSettings}

import java.io.OutputStream
import scala.collection.mutable
import scala.util.control.NonFatal
import com.fasterxml.jackson.annotation.JsonSubTypes.{Type => JsonType}

// Exception that wraps the underlying error so that it includes the extra debug info.
final class CompilerServiceException(
Expand Down
4 changes: 1 addition & 3 deletions jinja-sql-client/src/main/resources/python/rawjinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fix(self, val):
elif isinstance(val, list):
items = ["(" + self.fix(i) + ")" for i in val]
return "(VALUES " + ",".join(items) + ")"
elif val is None:
elif val is None or val == None:
return "NULL"
else:
return val
Expand All @@ -99,8 +99,6 @@ def _apply(self, code, args):

def apply(self, code, scopes, secret, args):
d = {key: self._toPython(args.get(key)) for key in args.keySet()}
print(dir(scopes))
print(dir(secret))
d['environment'] = RawEnvironment([s for s in scopes.iterator()], lambda s: secret.apply(s))
return self._apply(code, d)

Expand Down
2 changes: 1 addition & 1 deletion jinja-sql-client/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
raw.client.jinja-sql {
graalpy {
executable = "/Users/bgaidioz/tmp/jinja-pyenv/bin/graalpy"
home = "/Users/bgaidioz/.pyenv/versions/graalpy-24.0.0"
home = "/Users/bgaidioz/.pyenv/versions/graalpy-23.0.1"
logging = false
}
}
4 changes: 2 additions & 2 deletions launcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>24.0.1</version>
<version>23.1.0</version>
</dependency>
<dependency>
<groupId>com.raw-labs</groupId>
Expand Down Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>python</artifactId>
<version>24.0.1</version>
<version>23.1.0</version>
<scope>runtime</scope>
<type>pom</type>
</dependency>
Expand Down
19 changes: 9 additions & 10 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ object Dependencies {
val typesafeConfig = "com.typesafe" % "config" % "1.4.2"

// from client
val trufflePolyglot = "org.graalvm.polyglot" % "polyglot" % "24.0.1"
val trufflePython = "org.graalvm.python" % "python-language" % "24.0.1"
val trufflePolyglot = "org.graalvm.polyglot" % "polyglot" % "23.1.0"
val trufflePython = "org.graalvm.polyglot" % "python" % "23.1.0"

// from snapi-parser
val antlr4Runtime = "org.antlr" % "antlr4-runtime" % "4.12.0"
Expand All @@ -56,8 +56,7 @@ object Dependencies {
val kiamaVersion = IO.read(new File("./deps/kiama/version")).trim
val kiama = "org.bitbucket.inkytonik.kiama" %% "kiama" % kiamaVersion

val aws =
"software.amazon.awssdk" % "s3" % "2.20.69" exclude ("commons-logging", "commons-logging") // spring.jcl is the correct replacement for this one.
val aws = "software.amazon.awssdk" % "s3" % "2.20.69" exclude ("commons-logging", "commons-logging") // spring.jcl is the correct replacement for this one.
val woodstox = "com.fasterxml.woodstox" % "woodstox-core" % "6.5.1"
val kryo = "com.esotericsoftware" % "kryo" % "5.5.0"
val commonsLang = "org.apache.commons" % "commons-lang3" % "3.13.0"
Expand All @@ -77,13 +76,13 @@ object Dependencies {
val jwtImpl = "io.jsonwebtoken" % "jjwt-impl" % "0.11.5"
val jwtCore = "com.github.jwt-scala" %% "jwt-core" % "9.4.4-rawlabs"
val springCore = "org.springframework" % "spring-core" % "5.3.13"
val truffleApi = "org.graalvm.truffle" % "truffle-api" % "24.0.1"
val truffleCompiler = Seq(
truffleApi,
"org.graalvm.truffle" % "truffle-compiler" % "24.0.1",
"org.graalvm.truffle" % "truffle-nfi" % "24.0.1",
"org.graalvm.truffle" % "truffle-nfi-libffi" % "24.0.1",
"org.graalvm.truffle" % "truffle-runtime" % "24.0.1"
"org.graalvm.truffle" % "truffle-api" % "23.1.0",
"org.graalvm.truffle" % "truffle-api" % "23.1.0",
"org.graalvm.truffle" % "truffle-compiler" % "23.1.0",
"org.graalvm.truffle" % "truffle-nfi" % "23.1.0",
"org.graalvm.truffle" % "truffle-nfi-libffi" % "23.1.0",
"org.graalvm.truffle" % "truffle-runtime" % "23.1.0"
)
val scalaCompiler = Seq(
"org.scala-lang" % "scala-compiler" % "2.12.18",
Expand Down
2 changes: 1 addition & 1 deletion project/JavaAnnotationProcessorPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object JavaAnnotationProcessorPlugin extends AutoPlugin {
runJavaAnnotationProcessor := {
val log = streams.value.log
log.info("Running Java annotation processor")
val annotationProcessorJar = baseDirectory.value / "truffle-dsl-processor-24.0.1.jar"
val annotationProcessorJar = baseDirectory.value / "truffle-dsl-processor-23.1.0.jar"
val javaSources = baseDirectory.value / "src" / "main" / "java"
val targetDir = baseDirectory.value / "target" / "java-processed-sources"
val projectClasspath = calculateSnapiTruffleClasspath.value.mkString(":")
Expand Down
4 changes: 2 additions & 2 deletions rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export COURSIER_PROGRESS=false
[ "$CI" == "true" ] && { export HOME=/home/sbtuser; }
. ~/.sdkman/bin/sdkman-init.sh

yes n | sdk install java 22.0.1-graalce || true
sdk use java 22.0.1-graalce
yes n | sdk install java 21.0.1-graalce || true
sdk use java 21.0.1-graalce

cd "${SCRIPT_HOME}"
sbt clean compile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import raw.client.api._
import raw.client.sql.antlr4._

import java.sql.{Connection, ResultSet, ResultSetMetaData}
import java.time.{LocalDateTime, LocalTime}
import scala.collection.mutable

/* This class is wrapping the PreparedStatement class from the JDBC API.
Expand Down Expand Up @@ -546,8 +545,8 @@ class NamedParametersPreparedStatement(conn: Connection, parsedTree: ParseProgra
case java.sql.Types.FLOAT => RawFloat(rs.getFloat(1))
case java.sql.Types.DOUBLE => RawDouble(rs.getDouble(1))
case java.sql.Types.DATE => RawDate(rs.getDate(1).toLocalDate)
case java.sql.Types.TIME => RawTime(rs.getObject(1, classOf[LocalTime]))
case java.sql.Types.TIMESTAMP => RawTimestamp(rs.getObject(1, classOf[LocalDateTime]))
case java.sql.Types.TIME => RawTime(rs.getTime(1).toLocalTime)
case java.sql.Types.TIMESTAMP => RawTimestamp(rs.getTimestamp(1).toLocalDateTime)
case java.sql.Types.BOOLEAN => RawBool(rs.getBoolean(1))
case java.sql.Types.VARCHAR => RawString(rs.getString(1))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import raw.client.utils.RecordFieldsNaming

import java.io.{IOException, OutputStream}
import java.sql.ResultSet
import java.time.{LocalDateTime, LocalTime}
import java.time.format.DateTimeFormatter
import scala.annotation.tailrec

Expand Down Expand Up @@ -103,11 +102,11 @@ class TypedResultSetJsonWriter(os: OutputStream) {
val date = v.getDate(i).toLocalDate
gen.writeString(dateFormatter.format(date))
case _: RawTimeType =>
val time = v.getObject(i, classOf[LocalTime])
val time = v.getTime(i).toLocalTime
val formatted = timeFormatter.format(time)
gen.writeString(formatted)
case _: RawTimestampType =>
val dateTime = v.getObject(i, classOf[LocalDateTime])
val dateTime = v.getTimestamp(i).toLocalDateTime
val formatted = timestampFormatter.format(dateTime)
gen.writeString(formatted)
case _: RawIntervalType =>
Expand Down

0 comments on commit f87caee

Please sign in to comment.