mirror of https://github.com/nasa/ziggy.git
82 lines
3.3 KiB
Groovy
82 lines
3.3 KiB
Groovy
// The logging.captureStandard* settings squelch Hibernate's output. Use gradle --info to see it.
|
|
|
|
// TODO Disable connection pooling altogether
|
|
// While the HSQLDB memory database allows the tasks to run, it is 10
|
|
// seconds slower then running without a connection pool. Find a
|
|
// property that will disable connection pooling and use it instead of
|
|
// hibernate.connection.url.
|
|
|
|
task generateHsqldbCreateScript(type: JavaExec, dependsOn: copyLibs) {
|
|
inputs.dir "$buildDir/libs"
|
|
outputs.dir "$buildDir/schema"
|
|
outputs.file "$buildDir/schema/ddl.hsqldb-create.sql"
|
|
|
|
mainClass.set("gov.nasa.ziggy.services.database.ZiggySchemaExport")
|
|
classpath fileTree(dir: "$buildDir/libs", include: "*.jar")
|
|
jvmArgs "-Dhibernate.dialect=org.hibernate.dialect.HSQLDialect",
|
|
"-Djava.library.path=$outsideDir/lib",
|
|
"-Dhibernate.connection.url=jdbc:hsqldb:mem:test"
|
|
args "--create", "--output=$buildDir/schema/ddl.hsqldb-create.sql"
|
|
|
|
logging.captureStandardOutput LogLevel.INFO
|
|
logging.captureStandardError LogLevel.INFO
|
|
}
|
|
|
|
test.dependsOn generateHsqldbCreateScript
|
|
assemble.dependsOn generateHsqldbCreateScript
|
|
|
|
task generateHsqldbDropScript(type: JavaExec, dependsOn: copyLibs) {
|
|
inputs.dir "$buildDir/libs"
|
|
outputs.dir "$buildDir/schema"
|
|
outputs.file "$buildDir/schema/ddl.hsqldb-drop.sql"
|
|
|
|
mainClass.set("gov.nasa.ziggy.services.database.ZiggySchemaExport")
|
|
classpath fileTree(dir: "$buildDir/libs", include: "*.jar")
|
|
jvmArgs "-Dhibernate.dialect=org.hibernate.dialect.HSQLDialect",
|
|
"-Djava.library.path=$outsideDir/lib",
|
|
"-Dhibernate.connection.url=jdbc:hsqldb:mem:test"
|
|
args "--drop", "--output=$buildDir/schema/ddl.hsqldb-drop.sql"
|
|
|
|
logging.captureStandardOutput LogLevel.INFO
|
|
logging.captureStandardError LogLevel.INFO
|
|
}
|
|
|
|
test.dependsOn generateHsqldbDropScript
|
|
assemble.dependsOn generateHsqldbDropScript
|
|
|
|
task generatePostgresqlCreateScript(type: JavaExec, dependsOn: copyLibs) {
|
|
inputs.dir "$buildDir/libs"
|
|
outputs.dir "$buildDir/schema"
|
|
outputs.file "$buildDir/schema/ddl.postgresql-create.sql"
|
|
|
|
mainClass.set("gov.nasa.ziggy.services.database.ZiggySchemaExport")
|
|
classpath fileTree(dir: "$buildDir/libs", include: "*.jar")
|
|
jvmArgs "-Dhibernate.dialect=org.hibernate.dialect.PostgreSQLDialect",
|
|
"-Djava.library.path=$outsideDir/lib",
|
|
"-Dhibernate.connection.url=jdbc:hsqldb:mem:test"
|
|
args "--create", "--output=$buildDir/schema/ddl.postgresql-create.sql"
|
|
|
|
logging.captureStandardOutput LogLevel.INFO
|
|
logging.captureStandardError LogLevel.INFO
|
|
}
|
|
|
|
assemble.dependsOn generatePostgresqlCreateScript
|
|
|
|
task generatePostgresqlDropScript(type: JavaExec, dependsOn: copyLibs) {
|
|
inputs.dir "$buildDir/libs"
|
|
outputs.dir "$buildDir/schema"
|
|
outputs.file "$buildDir/schema/ddl.postgresql-drop.sql"
|
|
|
|
mainClass.set("gov.nasa.ziggy.services.database.ZiggySchemaExport")
|
|
classpath fileTree(dir: "$buildDir/libs", include: "*.jar")
|
|
jvmArgs "-Dhibernate.dialect=org.hibernate.dialect.PostgreSQLDialect",
|
|
"-Djava.library.path=$outsideDir/lib",
|
|
"-Dhibernate.connection.url=jdbc:hsqldb:mem:test"
|
|
args "--drop", "--output=$buildDir/schema/ddl.postgresql-drop.sql"
|
|
|
|
logging.captureStandardOutput LogLevel.INFO
|
|
logging.captureStandardError LogLevel.INFO
|
|
}
|
|
|
|
assemble.dependsOn generatePostgresqlDropScript
|