JIRA: https://jira.spring.io/browse/INT-2625, https://jira.spring.io/browse/INT-4050, https://jira.spring.io/browse/INT-4052 Make some refactoring for consistency: - Move `JdbcMessageStore` to the `store` package - Make `JdbcMessageStore` only ctor-based configuration for the `JdbcOperations` - Remove `/channel/` SQL scripts in favor of combined in the `/jdbc/` directory - Make scripts for the `INT_CHANNEL_MESSAGE` table and indexes generated via VPP Fix drop script generation Fix `schema-derby.sql` for suspicious `[]` Looks like `foundrylogic.vpp` tool generates somehow wrong SQL Further fix for the `drop` scripts generation Address PR comments: * Remove deprecated code in the `JdbcMessageStore` * Remove separate MySQL script in favor of only one for latest version * Remove the note in the `jdbc.adoc` about recommendation to use new MySQL version
50 lines
1.7 KiB
Groovy
50 lines
1.7 KiB
Groovy
//apply plugin: 'java'
|
|
|
|
/**
|
|
* Generate schema creation and drop scripts for various databases
|
|
* supported by the Spring Integration JDBC adapter.
|
|
*
|
|
* @author David Syer (original Ant/Maven work)
|
|
* @author Chris Beams (port to Gradle)
|
|
*/
|
|
task generateSql {
|
|
group = "Build"
|
|
description = "Generates schema creation and drop scripts for supported databases."
|
|
|
|
configurations { vpp }
|
|
dependencies { vpp 'foundrylogic.vpp:vpp:2.2.1' }
|
|
|
|
inputs.dir new File('src/main/sql')
|
|
|
|
def generatedResourcesDir = new File('src/main/resources/org/springframework/integration/jdbc')
|
|
|
|
outputs.dir generatedResourcesDir
|
|
|
|
ant.typedef(resource: 'foundrylogic/vpp/typedef.properties',
|
|
classpath: configurations.vpp.asPath)
|
|
ant.taskdef(resource: 'foundrylogic/vpp/taskdef.properties',
|
|
classpath: configurations.vpp.asPath)
|
|
|
|
doLast {
|
|
['hsqldb', 'h2', 'db2', 'derby', 'mysql', 'oracle', 'postgresql', 'sqlserver', 'sybase']
|
|
.each { dbType ->
|
|
ant.vppcopy(todir: generatedResourcesDir) {
|
|
config {
|
|
context {
|
|
property key: 'includes', value: 'src/main/sql'
|
|
property file: "src/main/sql/${dbType}.properties"
|
|
}
|
|
engine {
|
|
property key: 'velocimacro.library', value: "src/main/sql/${dbType}.vpp"
|
|
}
|
|
}
|
|
fileset dir: 'src/main/sql', includes: 'schema*.sql.vpp'
|
|
mapper type: 'glob', from: '*.sql.vpp', to: "*-${dbType}.sql"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// tie schema generation to the build lifecycle
|
|
compileJava.dependsOn generateSql
|