You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by ab...@apache.org on 2018/01/03 18:58:02 UTC

[4/5] incubator-gobblin git commit: [GOBBLIN-355] Add git scripts to publish to Nexus and generate signed sources

[GOBBLIN-355] Add git scripts to publish to Nexus and generate signed sources


Project: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/commit/fbc4cba3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/tree/fbc4cba3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-gobblin/diff/fbc4cba3

Branch: refs/heads/0.12.0
Commit: fbc4cba3157d6962ab2acc23892dcdf2f1310980
Parents: 20818ac
Author: Abhishek Tiwari <ab...@gmail.com>
Authored: Thu Jan 4 00:25:37 2018 +0530
Committer: Abhishek Tiwari <ab...@gmail.com>
Committed: Thu Jan 4 00:25:37 2018 +0530

----------------------------------------------------------------------
 gobblin-metastore/build.gradle                  |   2 +-
 .../gobblin-rest-api/build.gradle               |   2 +-
 .../gobblin-rest-client/build.gradle            |   2 +-
 .../gobblin-rest-server/build.gradle            |   2 +-
 gobblin-restli/api.gradle                       |   2 +-
 gobblin-runtime/build.gradle                    |   2 +-
 gobblin-service/build.gradle                    |   2 +-
 gradle.properties                               |   1 +
 gradle/scripts/buildscript.gradle               |  32 ++++
 gradle/scripts/defaultBuildProperties.gradle    |  13 +-
 gradle/scripts/mavenPublishing.gradle           |  24 +--
 gradle/scripts/nexusPublishing.gradle           | 188 +++++++++++++++++++
 gradle/scripts/release.gradle                   | 177 +++++++++++++++++
 13 files changed, 426 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-metastore/build.gradle
----------------------------------------------------------------------
diff --git a/gobblin-metastore/build.gradle b/gobblin-metastore/build.gradle
index bf8e998..a78df44 100644
--- a/gobblin-metastore/build.gradle
+++ b/gobblin-metastore/build.gradle
@@ -49,7 +49,7 @@ def installer = install.repositories.mavenInstaller
 [installer]*.pom*.whenConfigured {pom ->
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'
 }
-if (rootProject.publishToMaven) {
+if (rootProject.publishToMaven || rootProject.publishToNexus) {
     def deployer = uploadArchives.repositories.mavenDeployer
     [deployer]*.pom*.whenConfigured {pom ->
         pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-rest-service/gobblin-rest-api/build.gradle
----------------------------------------------------------------------
diff --git a/gobblin-rest-service/gobblin-rest-api/build.gradle b/gobblin-rest-service/gobblin-rest-api/build.gradle
index 43832ed..6745aa3 100644
--- a/gobblin-rest-service/gobblin-rest-api/build.gradle
+++ b/gobblin-rest-service/gobblin-rest-api/build.gradle
@@ -31,7 +31,7 @@ artifacts {
   archives mainDataTemplateJar
 }
 
-if (rootProject.ext.publishToMaven) {
+if (rootProject.ext.publishToMaven || rootProject.ext.publishToNexus) {
   configure(uploadArchives.repositories.mavenDeployer) {
     addFilter('gobblin-rest-api-rest-client') {artifact, file ->
       artifact.name == 'gobblin-rest-api-rest-client'

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-rest-service/gobblin-rest-client/build.gradle
----------------------------------------------------------------------
diff --git a/gobblin-rest-service/gobblin-rest-client/build.gradle b/gobblin-rest-service/gobblin-rest-client/build.gradle
index 551edad..aea8d95 100644
--- a/gobblin-rest-service/gobblin-rest-client/build.gradle
+++ b/gobblin-rest-service/gobblin-rest-client/build.gradle
@@ -31,7 +31,7 @@ def installer = install.repositories.mavenInstaller
 [installer]*.pom*.whenConfigured {pom ->
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'
 }
-if (rootProject.publishToMaven) {
+if (rootProject.publishToMaven || rootProject.publishToNexus) {
     def deployer = uploadArchives.repositories.mavenDeployer
     [deployer]*.pom*.whenConfigured {pom ->
         pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-rest-service/gobblin-rest-server/build.gradle
----------------------------------------------------------------------
diff --git a/gobblin-rest-service/gobblin-rest-server/build.gradle b/gobblin-rest-service/gobblin-rest-server/build.gradle
index c6a319b..9b99d29 100644
--- a/gobblin-rest-service/gobblin-rest-server/build.gradle
+++ b/gobblin-rest-service/gobblin-rest-server/build.gradle
@@ -43,7 +43,7 @@ def installer = install.repositories.mavenInstaller
 [installer]*.pom*.whenConfigured {pom ->
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-data-template'
 }
-if (rootProject.publishToMaven) {
+if (rootProject.publishToMaven || rootProject.publishToNexus) {
     def deployer = uploadArchives.repositories.mavenDeployer
     [deployer]*.pom*.whenConfigured {pom ->
         pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-data-template'

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-restli/api.gradle
----------------------------------------------------------------------
diff --git a/gobblin-restli/api.gradle b/gobblin-restli/api.gradle
index 095e7d9..688dae8 100644
--- a/gobblin-restli/api.gradle
+++ b/gobblin-restli/api.gradle
@@ -109,7 +109,7 @@ install {
   }
 }
 
-if (rootProject.ext.publishToMaven) {
+if (rootProject.ext.publishToMaven || rootProject.ext.publishToNexus) {
   uploadArchives {
     repositories {
       mavenDeployer {

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-runtime/build.gradle
----------------------------------------------------------------------
diff --git a/gobblin-runtime/build.gradle b/gobblin-runtime/build.gradle
index 422d6f3..b453a26 100644
--- a/gobblin-runtime/build.gradle
+++ b/gobblin-runtime/build.gradle
@@ -105,7 +105,7 @@ def installer = install.repositories.mavenInstaller
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-data-template'
 }
-if (rootProject.publishToMaven) {
+if (rootProject.publishToMaven || rootProject.publishToNexus) {
     def deployer = uploadArchives.repositories.mavenDeployer
     [deployer]*.pom*.whenConfigured {pom ->
         pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-rest-api' }.artifactId = 'gobblin-rest-api-rest-client'

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gobblin-service/build.gradle
----------------------------------------------------------------------
diff --git a/gobblin-service/build.gradle b/gobblin-service/build.gradle
index 0b461bd..268bc70 100644
--- a/gobblin-service/build.gradle
+++ b/gobblin-service/build.gradle
@@ -90,7 +90,7 @@ def installer = install.repositories.mavenInstaller
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-flow-config-service-api' }.artifactId = 'gobblin-flow-config-service-api-rest-client'
     pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-flow-config-service-api' }.artifactId = 'gobblin-flow-config-service-api-data-template'
 }
-if (rootProject.publishToMaven) {
+if (rootProject.publishToMaven || rootProject.publishToNexus) {
     def deployer = uploadArchives.repositories.mavenDeployer
     [deployer]*.pom*.whenConfigured {pom ->
         pom.dependencies.find {dep -> dep.groupId == project.group && dep.artifactId == 'gobblin-flow-config-service-api' }.artifactId = 'gobblin-flow-config-service-api-rest-client'

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gradle.properties
----------------------------------------------------------------------
diff --git a/gradle.properties b/gradle.properties
index 7aaf18d..88d130e 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -33,4 +33,5 @@ ide.recursive=true
 # Apache release specific
 version=0.12.0
 group=org.apache.gobblin
+release=false
 

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gradle/scripts/buildscript.gradle
----------------------------------------------------------------------
diff --git a/gradle/scripts/buildscript.gradle b/gradle/scripts/buildscript.gradle
new file mode 100644
index 0000000..3ad13c5
--- /dev/null
+++ b/gradle/scripts/buildscript.gradle
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+repositories {
+    repositories {
+        maven {
+            // For gradle-nexus-plugin
+            url 'http://jcenter.bintray.com/'
+        }
+    }
+}
+
+dependencies {
+    classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1'
+    classpath 'com.fizzpod:gradle-sweeney-plugin:1.0+'
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gradle/scripts/defaultBuildProperties.gradle
----------------------------------------------------------------------
diff --git a/gradle/scripts/defaultBuildProperties.gradle b/gradle/scripts/defaultBuildProperties.gradle
index 7f25b22..ce95473 100644
--- a/gradle/scripts/defaultBuildProperties.gradle
+++ b/gradle/scripts/defaultBuildProperties.gradle
@@ -19,8 +19,10 @@ import org.apache.gobblin.gradle.BuildProperties
 import org.apache.gobblin.gradle.BuildProperty
 
 def BuildProperties BUILD_PROPERTIES = new BuildProperties(project)
-    .register(new BuildProperty("artifactRepository", "https://oss.sonatype.org/service/local/staging/deploy/maven2/", "Maven repository to publish artifacts"))
-    .register(new BuildProperty("artifactSnapshotRepository", "https://oss.sonatype.org/content/repositories/snapshots/", "Maven repository to publish artifacts"))
+    .register(new BuildProperty("sonatypeArtifactRepository", "https://oss.sonatype.org/service/local/staging/deploy/maven2/", "Maven repository to publish artifacts"))
+    .register(new BuildProperty("sonatypeArtifactSnapshotRepository", "https://oss.sonatype.org/content/repositories/snapshots/", "Maven repository to publish artifacts"))
+    .register(new BuildProperty("nexusArtifactRepository", "https://repository.apache.org/service/local/staging/deploy/maven2", "Maven repository to publish artifacts"))
+    .register(new BuildProperty("nexusArtifactSnapshotRepository", "https://repository.apache.org/content/repositories/snapshots", "Maven repository to publish artifacts"))
     .register(new BuildProperty("avroVersion", "1.8.1", "Avro dependencies version"))
     .register(new BuildProperty("awsVersion", "1.11.8", "AWS dependencies version"))
     .register(new BuildProperty("bytemanVersion", "2.2.1", "Byteman dependencies version"))
@@ -35,6 +37,7 @@ def BuildProperties BUILD_PROPERTIES = new BuildProperties(project)
     .register(new BuildProperty("kafka09Version", "0.9.0.1", "Kafka 0.9 dependencies version"))
     .register(new BuildProperty("pegasusVersion", "11.0.0", "Pegasus dependencies version"))
     .register(new BuildProperty("publishToMaven", false, "Enable publishing of artifacts to a central Maven repository"))
+    .register(new BuildProperty("publishToNexus", false, "Enable publishing of artifacts to Nexus"))
     .register(new BuildProperty("salesforceVersion", "37.0.3", "Salesforce dependencies version"))
 
 task buildProperties(description: 'Lists main properties that can be used to customize the build') << {
@@ -47,8 +50,10 @@ BUILD_PROPERTIES.ensureDefined('gobblinFlavor')
 // Compiler compatibility
 BUILD_PROPERTIES.ensureDefined('jdkVersion')
 
-BUILD_PROPERTIES.ensureDefined('artifactRepository')
-BUILD_PROPERTIES.ensureDefined('artifactSnapshotRepository')
+BUILD_PROPERTIES.ensureDefined('sonatypeArtifactRepository')
+BUILD_PROPERTIES.ensureDefined('sonatypeArtifactSnapshotRepository')
+BUILD_PROPERTIES.ensureDefined('nexusArtifactRepository')
+BUILD_PROPERTIES.ensureDefined('nexusArtifactSnapshotRepository')
 BUILD_PROPERTIES.ensureDefined('doNotSignArtifacts')
 
 // Library dependencies versions

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gradle/scripts/mavenPublishing.gradle
----------------------------------------------------------------------
diff --git a/gradle/scripts/mavenPublishing.gradle b/gradle/scripts/mavenPublishing.gradle
index 044b4fc..799464c 100644
--- a/gradle/scripts/mavenPublishing.gradle
+++ b/gradle/scripts/mavenPublishing.gradle
@@ -21,7 +21,7 @@ import java.util.concurrent.locks.ReentrantLock
 // Set group for Maven
 allprojects {
   if (!project.hasProperty('group') || project.group.length() == 0) {
-    project.ext.group = 'com.linkedin.gobblin'
+    project.ext.group = 'org.apache.gobblin'
     project.group = project.ext.group
   }
 }
@@ -65,16 +65,16 @@ gradle.taskGraph.afterTask {
 }
 
 ext.pomAttributes = {
-  name "${project.name}"
   packaging 'jar'
   // optionally artifactId can be defined here
-  description 'Gobblin Ingestion Framework'
-  url 'https://github.com/linkedin/gobblin/'
+  name 'Apache Gobblin (incubating)'
+  description 'A distributed data integration framework for streaming and batch data ecosystems.'
+  url 'https://gobblin.apache.org/'
 
   scm {
-    connection 'scm:git:git@github.com:linkedin/gobblin.git'
-    developerConnection 'scm:git:git@github.com:linkedin/gobblin.git'
-    url 'git@github.com:linkedin/gobblin.git'
+    url 'https://git-wip-us.apache.org/repos/asf?p=incubator-gobblin.git;a=tree'
+    connection 'scm:http://git-wip-us.apache.org/repos/asf/incubator-gobblin.git'
+    developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-gobblin.git'
   }
 
   licenses {
@@ -141,10 +141,10 @@ subprojects {
         mavenInstaller {
           mavenLocal()
           pom.project {
-            name "${project.name}"
             packaging 'jar'
-            description 'Gobblin Ingestion Framework'
-            url 'https://github.com/linkedin/gobblin/'
+            name 'Apache Gobblin (incubating)'
+            description 'A distributed data integration framework for streaming and batch data ecosystems.'
+            url 'https://gobblin.apache.org/'
           }
         }
       }
@@ -165,11 +165,11 @@ subprojects {
               }
             }
 
-            repository(url: rootProject.artifactRepository) {
+            repository(url: rootProject.sonatypeArtifactRepository) {
               authentication(userName: rootProject.ext.ossrhUsername, password: rootProject.ext.ossrhPassword)
             }
 
-            snapshotRepository(url: rootProject.artifactSnapshotRepository) {
+            snapshotRepository(url: rootProject.sonatypeArtifactSnapshotRepository) {
               authentication(userName: rootProject.ext.ossrhUsername, password: rootProject.ext.ossrhPassword)
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gradle/scripts/nexusPublishing.gradle
----------------------------------------------------------------------
diff --git a/gradle/scripts/nexusPublishing.gradle b/gradle/scripts/nexusPublishing.gradle
new file mode 100644
index 0000000..86d89b3
--- /dev/null
+++ b/gradle/scripts/nexusPublishing.gradle
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.concurrent.atomic.AtomicBoolean
+import java.util.concurrent.locks.ReentrantLock
+
+// Set group for Maven
+allprojects {
+    if (!project.hasProperty('group') || project.group.length() == 0) {
+        project.ext.group = 'org.apache.gobblin'
+        project.group = project.ext.group
+    }
+}
+
+// Nexus publishing
+ext.buildProperties.ensureDefined('publishToNexus')
+if (ext.publishToNexus) {
+    plugins.apply('maven')
+    // Workaround for a bug in gradle's "maven" plugin. See https://discuss.gradle.org/t/error-in-parallel-build/7215/3
+    project.setProperty("org.gradle.parallel", "false")
+}
+
+ext.signArtifacts = !project.doNotSignArtifacts
+
+// Maven POM generation is not thread safe, so serialize all the Upload tasks we can use `--parallel`.
+// https://issues.gradle.org/browse/GRADLE-2492
+// When we start building with 2.3 and later we should remove this and just add a common output dir for all tasks and let Gradle serialize them
+def lock = new ReentrantLock()
+def available = lock.newCondition()
+def busy = new AtomicBoolean()
+def serializedTasks = []
+allprojects {
+    tasks.matching { it.name == "generatePom" || it instanceof Upload }.all {
+        serializedTasks << it
+        doFirst {
+            lock.lock()
+            while (busy.get()) {
+                available.await()
+            }
+            busy.set(true)
+        }
+    }
+}
+
+gradle.taskGraph.afterTask {
+    if (it in serializedTasks && lock.heldByCurrentThread) {
+        busy.set(false)
+        available.signal()
+        lock.unlock()
+    }
+}
+
+ext.pomAttributes = {
+    packaging 'jar'
+    // optionally artifactId can be defined here
+    name 'Apache Gobblin (incubating)'
+    description 'A distributed data integration framework for streaming and batch data ecosystems.'
+    url 'https://gobblin.apache.org/'
+
+    scm {
+        url 'https://git-wip-us.apache.org/repos/asf?p=incubator-gobblin.git;a=tree'
+        connection 'scm:http://git-wip-us.apache.org/repos/asf/incubator-gobblin.git'
+        developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-gobblin.git'
+    }
+
+    licenses {
+        license {
+            name 'The Apache License, Version 2.0'
+            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+        }
+    }
+
+    developers {
+        developer {
+            name 'Abhishek Tiwari'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Chavdar Botev'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Issac Buenrostro'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Min Tu'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Narasimha Veeramreddy'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Pradhan Cadabam'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Sahil Takiar'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Shirshanka Das'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Yinan Li'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Ying Dai'
+            organization 'LinkedIn'
+        }
+        developer {
+            name 'Ziyang Liu'
+            organization 'LinkedIn'
+        }
+    }
+}
+
+subprojects {
+    plugins.withType(JavaPlugin) {
+        plugins.apply('maven')
+
+        install {
+            repositories {
+                mavenInstaller {
+                    mavenLocal()
+                    pom.project {
+                        packaging 'jar'
+                        name 'Apache Gobblin (incubating)'
+                        description 'A distributed data integration framework for streaming and batch data ecosystems.'
+                        url 'https://gobblin.apache.org/'
+                    }
+                }
+            }
+        }
+
+        // Publishing of maven artifacts for subprojects
+        if (rootProject.ext.publishToNexus) {
+            if (rootProject.ext.signArtifacts) {
+                plugins.apply('signing')
+            }
+
+            uploadArchives {
+                repositories {
+                    mavenDeployer {
+                        beforeDeployment { MavenDeployment deployment ->
+                            if (rootProject.ext.signArtifacts) {
+                                signing.signPom(deployment)
+                            }
+                        }
+
+                        repository(url: rootProject.nexusArtifactRepository) {
+                            authentication(userName: rootProject.ext.nexusUsername, password: rootProject.ext.nexusPassword)
+                        }
+
+                        snapshotRepository(url: rootProject.nexusArtifactSnapshotRepository) {
+                            authentication(userName: rootProject.ext.nexusUsername, password: rootProject.ext.nexusPassword)
+                        }
+
+                        pom.project pomAttributes
+                    }
+                }
+            }
+
+            if (rootProject.ext.signArtifacts) {
+                signing {
+                    sign configurations.archives
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-gobblin/blob/fbc4cba3/gradle/scripts/release.gradle
----------------------------------------------------------------------
diff --git a/gradle/scripts/release.gradle b/gradle/scripts/release.gradle
new file mode 100644
index 0000000..98195b1
--- /dev/null
+++ b/gradle/scripts/release.gradle
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+project(':') {
+    apply plugin: 'base'
+    apply plugin: 'signing'
+}
+
+def isRelease = ext.release.toBoolean()
+
+def releaseVersion = project.version
+if (!isRelease) {
+    releaseVersion += "-SNAPSHOT"
+}
+
+// Modify the gradle.properties to indicate whether this is a release.  This results in the
+// source releases generating artifacts without -SNAPSHOT appended to the version when they are
+// built.
+task prepare_release_config(type: Copy) {
+    from "$rootDir/gradle.properties"
+    into "$rootDir"
+    rename { filename ->
+        filename + ".release" }
+    filter { line ->
+        if (isRelease && line.startsWith("release=")) {
+            "release=true"
+        }
+        else {
+            line
+        }
+    }
+}
+
+task sourceRelease(type: Tar, dependsOn: prepare_release_config) {
+    description = "Build a source release, specifically excluding the build directories and gradle wrapper files"
+    compression = Compression.GZIP
+
+    baseName "apache-gobblin-incubating-sources-${releaseVersion}"
+
+    from(project.rootDir) {
+        // don't include gradle.properties because we use a modified version
+        exclude "gradle.properties"
+        exclude '**/build'
+        exclude 'buildSrc'
+        exclude '.gradle'
+        exclude '.github'
+        exclude 'gradlew'
+        exclude 'gradlew.bat'
+        exclude 'gradle'
+        exclude 'maven-sonatype'
+        exclude 'travis'
+        exclude '.classpath*'
+        exclude '.project*'
+        exclude '.settings'
+        exclude '**/.idea'
+        exclude '**/*.iml'
+        exclude '**/*.iws'
+        exclude '**/*.ipr'
+        exclude '**/.classpath'
+        exclude '**/.project'
+        exclude '**/.settings'
+        exclude '**/*.swp'
+        exclude '**/*.swo'
+        exclude '**/*.log'
+        exclude '**/build/'
+        exclude '**/.gradle'
+        exclude 'test-output'
+        exclude '**/test-output'
+        exclude 'dist'
+        exclude 'target'
+        exclude 'tmp'
+        exclude 'out'
+        exclude '**/out'
+        exclude 'output'
+        exclude 'gobblin-test/basicTest'
+        exclude 'gobblin-test/jobOutput'
+        exclude 'gobblin-test/state-store'
+        exclude 'gobblin-tesTaskt/metrics'
+        exclude 'gobblin-test/byteman'
+        exclude 'gobblin-test/locks'
+        exclude 'gobblin-test/mr-jobs'
+        exclude '**/mainGeneratedDataTemplate'
+        exclude '**/mainGeneratedRest'
+        exclude 'gobblin-dist'
+        exclude 'metastore_db'
+        exclude 'GobblinKey_*.pem'
+        exclude 'node_modules'
+        exclude 'package-lock.json'
+        exclude '**/gen-java'
+        exclude '**/generated-gobblin-cluster.conf'
+    }
+
+    // rename gradle.properties.release to gradle.properties
+    rename { filename ->
+        if (filename.equals("gradle.properties.release")) {
+            "gradle.properties"
+        }
+        else {
+            filename
+        }
+    }
+
+    into(baseName)
+
+    // Set destination directory.
+    destinationDir = file("${project.buildDir}/distribution/source")
+
+    archiveName = "${baseName}.tgz"
+    doLast {
+        ant.checksum file:"$destinationDir/$archiveName", algorithm: "MD5", fileext: ".md5"
+        ant.checksum file:"$destinationDir/$archiveName", algorithm: "SHA-512", fileext: ".sha512"
+    }
+}
+
+// Signing requires a user ~/.gradle/gradle.properties file with signing information.
+// See: http://www.gradle.org/docs/current/userguide/signing_plugin.html
+signing {
+    // Sign the source archive if the proper configuration is in place to do so.  Otherwise
+    // skip the signing process (it isn't required).  This archive can be manually signed if
+    // needed.
+    required false
+    sign sourceRelease
+}
+
+task release(dependsOn: signSourceRelease)
+
+// Publishing to Apache's Maven repository (Nexus). To install the archives in the
+// local repository, run the 'install' task.
+//subprojects {
+//    apply plugin: 'nexus'
+//
+//    nexus {
+//        attachSources = false
+//        attachTests = false
+//        attachJavadoc = false
+//        sign = true
+//        repositoryUrl = 'https://repository.apache.org/service/local/staging/deploy/maven2'
+//        snapshotRepositoryUrl = 'https://repository.apache.org/content/repositories/snapshots'
+//    }
+//
+//    modifyPom {
+//        project {
+//            name 'Apache Gobblin (incubating)'
+//            description 'A distributed data integration framework for streaming and batch data ecosystems.'
+//            url 'https://gobblin.apache.org/'
+//
+//            scm {
+//                url 'https://git-wip-us.apache.org/repos/asf?p=incubator-gobblin.git;a=tree'
+//                connection 'scm:http://git-wip-us.apache.org/repos/asf/incubator-gobblin.git'
+//                developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-gobblin.git'
+//            }
+//
+//            licenses {
+//                license {
+//                    name 'The Apache Software License, Version 2.0'
+//                    url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+//                }
+//            }
+//        }
+//    }
+//}
\ No newline at end of file