From 964f264c9d03dd60e00c7ae04aedd290e11ab67d Mon Sep 17 00:00:00 2001 From: Weimin Yu Date: Wed, 2 Oct 2019 14:27:36 -0400 Subject: [PATCH] Add maven-publish task for SQL schema jar (#289) * Add maven-publish task for SQL schema jar Add task to publish SQL schema jar with flyway scripts and golden schema to a maven repo. This will be used for pre-release testing in the future. This task is not part of build and needs to be invoked explicitly. User needs to provide schema_jar_repo and schema_version properties. * Merge branch 'master' of https://github.com/google/nomulus into publish-schema-jar * Add maven-publish task for SQL schema jar Add task to publish SQL schema jar with flyway scripts and golden schema to a maven repo. This will be used for pre-release testing in the future. This task is not part of build and needs to be invoked explicitly. User needs to provide schema_jar_repo and schema_version properties. --- db/build.gradle | 32 ++++++++++++++++++++++++++++++-- gradle.properties | 5 +++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/db/build.gradle b/db/build.gradle index 0a90411da..e5ade8b8b 100644 --- a/db/build.gradle +++ b/db/build.gradle @@ -12,10 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -import com.google.common.collect.ImmutableList - plugins { id "org.flywaydb.flyway" version "6.0.1" + id 'maven-publish' } ext { @@ -75,6 +74,35 @@ ext { } } +task schemaJar(type: Jar) { + archiveBaseName = 'schema' + from(sourceSets.main.resources) { + include 'sql/flyway/**' + include 'sql/schema/nomulus.golden.sql' + } +} + +artifacts { + archives schemaJar +} + +publishing { + repositories { + maven { + url project.schema_jar_repo + } + } + publications { + schemaOrmPublication(MavenPublication) { + groupId 'google.registry' + artifactId 'schema' + version project.schema_version + artifact schemaJar + } + } +} + + flyway { def accessInfo = project.ext.getJdbcAccessInfo() diff --git a/gradle.properties b/gradle.properties index 9c64a627e..73510aea0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,3 +15,8 @@ dbServer= dbName=postgres dbUser= dbPassword= + +# Maven repository of the Cloud SQL schema jar, which contains the +# SQL DDL scripts. +schema_jar_repo= +schema_version=