Skip to content

Commit

Permalink
Have database generation happen in its own method (cashapp#1699)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alec Strong committed May 31, 2020
1 parent 6696c83 commit 39fbc6b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Expand Up @@ -125,6 +125,7 @@ class SqlDelightEnvironment(
}

sourceFile?.let {
SqlDelightCompiler.writeDatabaseInterface(module, it, moduleName, writer)
SqlDelightCompiler.writeImplementations(module, it, moduleName, writer)
}

Expand Down
Expand Up @@ -42,6 +42,14 @@ object SqlDelightCompiler {
writeViewInterfaces(module, file, implementationFolder, output)
writeQueryInterfaces(module, file, implementationFolder, output)
writeQueriesInterface(module, file, implementationFolder, output)
}

fun writeDatabaseInterface(
module: Module,
file: SqlDelightFile,
implementationFolder: String,
output: FileAppender
) {
writeQueryWrapperInterface(module, file, implementationFolder, output)
}

Expand Down
Expand Up @@ -80,5 +80,6 @@ abstract class SqlDelightProjectTestCase : LightCodeInsightFixtureTestCase() {
return@iterateContentUnderDirectory true
}
SqlDelightCompiler.writeInterfaces(module, fileToGenerateDb!!, module.name, virtualFileWriter)
SqlDelightCompiler.writeDatabaseInterface(module, fileToGenerateDb!!, module.name, virtualFileWriter)
}
}
Expand Up @@ -113,7 +113,10 @@ object FixtureCompiler {
}
}

if (generateDb) SqlDelightCompiler.writeImplementations(environment.module, file!!, "testmodule", fileWriter)
if (generateDb) {
SqlDelightCompiler.writeDatabaseInterface(environment.module, file!!, "testmodule", fileWriter)
SqlDelightCompiler.writeImplementations(environment.module, file!!, "testmodule", fileWriter)
}

return CompilationResult(outputDirectory, compilerOutput, errors, sourceFiles.toString(), file!!)
}
Expand Down

0 comments on commit 39fbc6b

Please sign in to comment.