@@ -18,7 +18,10 @@ import groovy.json.JsonOutput
1818 * limitations under the License.
1919 */
2020
21- plugins { id ' org.apache.beam.module' }
21+ plugins {
22+ id ' org.apache.beam.module'
23+ id ' application'
24+ }
2225applyJavaNature( automaticModuleName : ' org.apache.beam.sdk.extensions.sql.jdbc' ,
2326 exportJavadoc : false ,
2427 testShadowJar : true ,
@@ -37,14 +40,26 @@ dependencies {
3740 implementation " sqlline:sqlline:1.4.0"
3841 implementation library. java. vendored_calcite_1_28_0
3942 permitUnusedDeclared library. java. vendored_calcite_1_28_0
40- testImplementation project(path : " :sdks:java:io:google-cloud-platform" , configuration : " testRuntimeMigration" )
43+ testImplementation project(path : " :sdks:java:core" , configuration : " shadow" )
44+ testImplementation project(path : " :sdks:java:io:google-cloud-platform" )
45+ testImplementation project(path : " :sdks:java:extensions:google-cloud-platform-core" )
46+ testImplementation library. java. jackson_databind
47+ testImplementation library. java. joda_time
4148 testImplementation library. java. junit
4249 testImplementation library. java. vendored_guava_32_1_2_jre
4350 // Depending on outputs so integrationTest can run with only test dependencies.
4451 // This enables us to test the JDBC jar being loaded on a custom classloader.
4552 integrationTest sourceSets. test. output
4653 integrationTest sourceSets. main. output
4754 integrationTest library. java. junit
55+
56+ if (project. hasProperty(" beam.sql.shell.bundled" )) {
57+ project. getProperty(" beam.sql.shell.bundled" ). tokenize(" ," ). each {
58+ subproject ->
59+ implementation project(path : subproject)
60+ permitUnusedDeclared project(path : subproject)
61+ }
62+ }
4863}
4964
5065processResources {
@@ -107,3 +122,29 @@ task postCommit {
107122 description = " Various integration tests"
108123 dependsOn endToEndTest
109124}
125+
126+ processResources {
127+ filter org.apache.tools.ant.filters.ReplaceTokens , tokens : [
128+ ' beam.version' : version,
129+ ]
130+ }
131+
132+ /**
133+ * Gradle console will interfere with SQL shell, so to run this command
134+ * we need to configure it:
135+ * - disable daemon with '--no-daemon';
136+ * - decrease verbosity with '--console plain';
137+ * - quiet it with '-q';
138+ *
139+ * So, correct gradle invocation to start the SQL shell
140+ * looks something like this:
141+ *
142+ * ./gradlew :sdks:java:extensions:sql:jdbc:run --console plain -q --no-daemon
143+ *
144+ * To add extra Beam project, set subproject property like
145+ * `-Pbeam.sql.shell.bundled="sdks:java:extensions:sql:hcatalog"`
146+ */
147+ run {
148+ mainClassName = " org.apache.beam.sdk.extensions.sql.jdbc.BeamSqlLine"
149+ standardInput System . in
150+ }
0 commit comments