You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lc...@apache.org on 2018/01/10 01:05:00 UTC

[beam] branch master updated: Add the ability to create an offline repository using https://github.com/mdietrichstein/gradle-offline-dependencies-plugin

This is an automated email from the ASF dual-hosted git repository.

lcwik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 7d240c0  Add the ability to create an offline repository using https://github.com/mdietrichstein/gradle-offline-dependencies-plugin
7d240c0 is described below

commit 7d240c0bb171af6868f1a6e95196c9dcfc9ac640
Author: Luke Cwik <lc...@google.com>
AuthorDate: Tue Jan 2 09:52:27 2018 -0800

    Add the ability to create an offline repository using https://github.com/mdietrichstein/gradle-offline-dependencies-plugin
---
 .gitignore         |  3 +++
 build.gradle       | 37 ++++++++++++++++++++++++++-----------
 build_rules.gradle | 36 +++++++++++++++++++++++++++++++++++-
 gradle.properties  |  1 +
 4 files changed, 65 insertions(+), 12 deletions(-)

diff --git a/.gitignore b/.gitignore
index 2b9951a..00b57a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,9 @@
 # is an input to 'maven-assembly-plugin' that generates source distribution.
 # This is typically in files named 'src.xml' throughout this repository.
 
+# Ignore any offline repositories the user may have created.
+**/offline-repository/**/*
+
 # Ignore files generated by the Gradle build process.
 **/.gradle/**/*
 **/.gogradle/**/*
diff --git a/build.gradle b/build.gradle
index ea19fac..e34007e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -152,6 +152,17 @@ ext.library = [
 // fetch and enable plugins.
 buildscript {
   repositories {
+    maven { url offlineRepositoryRoot }
+
+    // To run gradle in offline mode, one must first invoke
+    // 'updateOfflineRepository' to create an offline repo
+    // inside the root project directory. See the application
+    // of the offline repo plugin within build_rules.gradle
+    // for further details.
+    if (gradle.startParameter.isOffline()) {
+      return
+    }
+
     mavenLocal()
     mavenCentral()
     jcenter()
@@ -159,17 +170,18 @@ buildscript {
     maven { url "http://repo.spring.io/plugins-release" }
   }
   dependencies {
-    classpath "net.ltgt.gradle:gradle-apt-plugin:0.12"                         // Enable a Java annotation processor
-    classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.1"               // Enable proto code generation
-    classpath "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE"                 // Enable provided and optional configurations
-    classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.1"     // Enable Apache license enforcement
-    classpath "com.commercehub.gradle.plugin:gradle-avro-plugin:0.11.0"        // Enable Avro code generation
-    classpath "com.diffplug.spotless:spotless-plugin-gradle:3.6.0"             // Enable a code formatting plugin
-    classpath "gradle.plugin.com.github.blindpirate:gogradle:0.7.0"            // Enable Go code compilation
-    classpath "gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.13.0"  // Enable building Docker containers
-    classpath "cz.malohlava:visteg:1.0.3"                                      // Enable generating Gradle task dependencies as ".dot" files
-    classpath "com.github.jengelman.gradle.plugins:shadow:2.0.1"               // Enable shading Java dependencies
-    classpath "ca.coglinc:javacc-gradle-plugin:2.4.0"                          // Enable the JavaCC parser generator
+    classpath "net.ltgt.gradle:gradle-apt-plugin:0.12"                                                  // Enable a Java annotation processor
+    classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.1"                                        // Enable proto code generation
+    classpath "io.spring.gradle:propdeps-plugin:0.0.9.RELEASE"                                          // Enable provided and optional configurations
+    classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.1"                              // Enable Apache license enforcement
+    classpath "com.commercehub.gradle.plugin:gradle-avro-plugin:0.11.0"                                 // Enable Avro code generation
+    classpath "com.diffplug.spotless:spotless-plugin-gradle:3.6.0"                                      // Enable a code formatting plugin
+    classpath "gradle.plugin.com.github.blindpirate:gogradle:0.7.0"                                     // Enable Go code compilation
+    classpath "gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.13.0"                           // Enable building Docker containers
+    classpath "cz.malohlava:visteg:1.0.3"                                                               // Enable generating Gradle task dependencies as ".dot" files
+    classpath "com.github.jengelman.gradle.plugins:shadow:2.0.1"                                        // Enable shading Java dependencies
+    classpath "ca.coglinc:javacc-gradle-plugin:2.4.0"                                                   // Enable the JavaCC parser generator
+    classpath "gradle.plugin.io.pry.gradle.offline_dependencies:gradle-offline-dependencies-plugin:0.3" // Enable creating an offline repository
   }
 }
 
@@ -186,6 +198,9 @@ rat {
   htmlOutput = false
   failOnError = true
   excludes = [
+    // Ignore any offline repositories the user may have created.
+    "**/${offlineRepositoryRoot}/**/*",
+
     // Exclude files generated by the Gradle build process
     "**/.gradle/**/*",
     "**/.gogradle/**/*",
diff --git a/build_rules.gradle b/build_rules.gradle
index 94ea28a..65d0249 100644
--- a/build_rules.gradle
+++ b/build_rules.gradle
@@ -29,7 +29,6 @@
 //
 // For example, see applyJavaNature below.
 
-
 println "Applying build_rules.gradle to $project.name"
 
 /*************************************************************************************************/
@@ -40,6 +39,17 @@ version = "2.3.0-SNAPSHOT"
 
 // Define the default set of repositories for all builds.
 repositories {
+  maven { url offlineRepositoryRoot }
+
+  // To run gradle in offline mode, one must first invoke
+  // 'updateOfflineRepository' to create an offline repo
+  // inside the root project directory. See the application
+  // of the offline repo plugin within build_rules.gradle
+  // for further details.
+  if (gradle.startParameter.isOffline()) {
+    return
+  }
+
   mavenLocal()
   mavenCentral()
   jcenter()
@@ -70,6 +80,30 @@ apply plugin: "project-report"
 // See https://github.com/mmalohlava/gradle-visteg for further details.
 apply plugin: "cz.malohlava.visteg"
 
+// Apply a plugin which provides the 'updateOfflineRepository' task that creates an offline
+// repository. This offline repository satisfies all Gradle build dependencies and Java
+// project dependencies. The offline repository is placed within $rootDir/offline-repo
+// but can be overridden by specifying the 'offlineRepositoryRoot' Gradle option.
+// Note that parallel build must be disabled when executing 'updateOfflineRepository'
+// by specifying '-Dorg.gradle.parallel=false', see
+// https://github.com/mdietrichstein/gradle-offline-dependencies-plugin/issues/3
+apply plugin: "io.pry.gradle.offline_dependencies"
+
+offlineDependencies {
+  repositories {
+    maven { url offlineRepositoryRoot }
+    mavenLocal()
+    mavenCentral()
+    jcenter()
+    maven { url "https://plugins.gradle.org/m2/" }
+    maven { url "http://repo.spring.io/plugins-release" }
+  }
+
+  includeSources = false
+  includeJavadocs = false
+  includeIvyXmls = false
+}
+
 /*************************************************************************************************/
 
 
diff --git a/gradle.properties b/gradle.properties
index 95465df..a89dc72 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,3 +17,4 @@
 ################################################################################
 org.gradle.parallel=true
 org.gradle.configureondemand=true
+offlineRepositoryRoot=offline-repository

-- 
To stop receiving notification emails like this one, please contact
['"commits@beam.apache.org" <co...@beam.apache.org>'].