Skip to content

Commit c334986

Browse files
authored
Improve handling of raw-queries (#3147)
* Remove codegen-tests for now since they break local-builds. Will add back in a different build or project. * Fix build scripts. Was using bad sqlserver version. * Better raw query support. Do not wrap top-level infixes. * Fix Spark cases * Another fix * Fix another tests * fix test
1 parent 87bcdb2 commit c334986

File tree

34 files changed

+196
-1188
lines changed

34 files changed

+196
-1188
lines changed

build.sbt

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ lazy val dbModules = Seq[sbt.ClasspathDep[sbt.ProjectReference]](
5353

5454
lazy val codegenModules = Seq[sbt.ClasspathDep[sbt.ProjectReference]](
5555
`quill-codegen`,
56-
`quill-codegen-jdbc`,
57-
`quill-codegen-tests`
56+
`quill-codegen-jdbc`
5857
)
5958

6059
lazy val bigdataModules = Seq[sbt.ClasspathDep[sbt.ProjectReference]](
@@ -93,7 +92,7 @@ lazy val filteredModules = {
9392
val moduleStrings =
9493
ListSet(
9594
modulesStr
96-
.getOrElse("all")
95+
.getOrElse("nocodegen")
9796
.split(",")
9897
.map(_.trim): _*
9998
)
@@ -121,8 +120,10 @@ lazy val filteredModules = {
121120
println("SBT =:> Invoking Aggregate Project")
122121
Seq[sbt.ClasspathDep[sbt.ProjectReference]]()
123122
case _ | "all" =>
124-
println("SBT =:> Compiling All Modules")
125-
allModules
123+
println("Compiling Not-Code Generator Modules")
124+
baseModules ++ dbModules ++ bigdataModules
125+
// println("SBT =:> Compiling All Modules")
126+
// allModules
126127
}
127128

128129
val selectedModules = {
@@ -264,39 +265,39 @@ lazy val `quill-codegen-jdbc` =
264265
.dependsOn(`quill-codegen` % "compile->compile;test->test")
265266
.dependsOn(`quill-jdbc` % "compile->compile")
266267

267-
lazy val `quill-codegen-tests` =
268-
(project in file("quill-codegen-tests"))
269-
.settings(commonSettings: _*)
270-
.settings(
271-
publish / skip := true,
272-
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % Test,
273-
Test / fork := true,
274-
(Test / sourceGenerators) += Def.task {
275-
def recursiveList(file: JFile): List[JFile] =
276-
if (file.isDirectory)
277-
Option(file.listFiles()).map(_.flatMap(child => recursiveList(child)).toList).toList.flatten
278-
else
279-
List(file)
280-
val r = (Compile / runner).value
281-
val s = streams.value.log
282-
val sourcePath = sourceManaged.value
283-
val classPath = (`quill-codegen-jdbc` / Test / fullClasspath).value.map(_.data)
284-
285-
// We could put the code generated products directly in the `sourcePath` directory but for some reason
286-
// intellij doesn't like it unless there's a `main` directory inside.
287-
val fileDir = new File(sourcePath, "main").getAbsoluteFile
288-
val dbs = Seq("testH2DB", "testMysqlDB", "testPostgresDB", "testSqliteDB", "testSqlServerDB", "testOracleDB")
289-
println(s"Running code generation for DBs: ${dbs.mkString(", ")}")
290-
r.run(
291-
"io.getquill.codegen.integration.CodegenTestCaseRunner",
292-
classPath,
293-
fileDir.getAbsolutePath +: dbs,
294-
s
295-
)
296-
recursiveList(fileDir)
297-
}.tag(CodegenTag)
298-
)
299-
.dependsOn(`quill-codegen-jdbc` % "compile->test")
268+
//lazy val `quill-codegen-tests` =
269+
// (project in file("quill-codegen-tests"))
270+
// .settings(commonSettings: _*)
271+
// .settings(
272+
// publish / skip := true,
273+
// libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % Test,
274+
// Test / fork := true,
275+
// (Test / sourceGenerators) += Def.task {
276+
// def recursiveList(file: JFile): List[JFile] =
277+
// if (file.isDirectory)
278+
// Option(file.listFiles()).map(_.flatMap(child => recursiveList(child)).toList).toList.flatten
279+
// else
280+
// List(file)
281+
// val r = (Compile / runner).value
282+
// val s = streams.value.log
283+
// val sourcePath = sourceManaged.value
284+
// val classPath = (`quill-codegen-jdbc` / Test / fullClasspath).value.map(_.data)
285+
//
286+
// // We could put the code generated products directly in the `sourcePath` directory but for some reason
287+
// // intellij doesn't like it unless there's a `main` directory inside.
288+
// val fileDir = new File(sourcePath, "main").getAbsoluteFile
289+
// val dbs = Seq("testH2DB", "testMysqlDB", "testPostgresDB", "testSqliteDB", "testSqlServerDB", "testOracleDB")
290+
// println(s"Running code generation for DBs: ${dbs.mkString(", ")}")
291+
// r.run(
292+
// "io.getquill.codegen.integration.CodegenTestCaseRunner",
293+
// classPath,
294+
// fileDir.getAbsolutePath +: dbs,
295+
// s
296+
// )
297+
// recursiveList(fileDir)
298+
// }.tag(CodegenTag)
299+
// )
300+
// .dependsOn(`quill-codegen-jdbc` % "compile->test")
300301

301302
val excludeTests =
302303
sys.props.getOrElse("excludeTests", "false") match {

build/Dockerfile-sqlserver

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Builds a ubuntu-based postgres image whose latency can be modified to be highe
2+
# for performance experimentation.
3+
FROM mcr.microsoft.com/mssql/server:2022-CU13-ubuntu-22.04
4+
USER root
5+
RUN apt-get update && \
6+
apt-get install iproute2 iputils-ping -y

docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ services:
4242
init: true
4343

4444
sqlserver:
45-
image: mcr.microsoft.com/azure-sql-edge:latest # use this because it supports ARM64 architecture for M1 Mac
45+
build:
46+
context: .
47+
dockerfile: ./build/Dockerfile-sqlserver
4648
ports:
4749
- "11433:1433"
4850
environment:
4951
- ACCEPT_EULA=Y
5052
- SA_PASSWORD=QuillRocks!
53+
cap_add:
54+
- NET_ADMIN
5155

5256
oracle:
5357
image: quillbuilduser/oracle-18-xe-micro-sq

quill-codegen-tests/src/test/scala/io/getquill/codegen/H2CodegenTestCases.scala

Lines changed: 0 additions & 110 deletions
This file was deleted.

quill-codegen-tests/src/test/scala/io/getquill/codegen/MysqlCodegenTestCases.scala

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)