polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [07/33] polygene-java git commit: Build verify used Gradle version and nag if unsupported
Date Tue, 23 May 2017 02:13:50 GMT
Build verify used Gradle version and nag if unsupported


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/cf4876b7
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/cf4876b7
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/cf4876b7

Branch: refs/heads/yeoman-work
Commit: cf4876b708b6f3230f3ff5d900bcdd000dc33d6e
Parents: e3c5f7c
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Wed May 17 12:29:40 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Wed May 17 12:29:40 2017 +0200

----------------------------------------------------------------------
 .../DependenciesDeclarationExtension.groovy     |  1 +
 .../polygene/gradle/structure/RootPlugin.groovy | 23 ++++++++++++++++++++
 dependencies.gradle                             |  3 +++
 3 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf4876b7/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
index 9277e62..2f9284a 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/dependencies/DependenciesDeclarationExtension.groovy
@@ -25,6 +25,7 @@ import org.gradle.api.artifacts.component.ModuleComponentSelector
 @CompileStatic
 class DependenciesDeclarationExtension
 {
+  String gradleVersion
   final Map<String, String> repositoriesUrls = [ : ]
   final Map<String, Object> libraries = [ : ]
   final Map<String, List<Object>> defaultDependencies = [ : ]

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf4876b7/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/RootPlugin.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/RootPlugin.groovy
b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/RootPlugin.groovy
index 5b0c497..3f54424 100644
--- a/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/RootPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/polygene/gradle/structure/RootPlugin.groovy
@@ -19,8 +19,11 @@ package org.apache.polygene.gradle.structure
 
 import groovy.transform.CompileStatic
 import org.apache.polygene.gradle.BasePlugin
+import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
 import org.gradle.api.Plugin
 import org.gradle.api.Project
+import org.gradle.api.tasks.wrapper.Wrapper
+import org.gradle.util.GradleVersion
 
 @CompileStatic
 class RootPlugin implements Plugin<Project>
@@ -34,6 +37,7 @@ class RootPlugin implements Plugin<Project>
   {
     project.plugins.apply BasePlugin
     applyProjectMetadata( project )
+    applyGradleWrapper( project )
   }
 
   private static void applyProjectMetadata( Project project )
@@ -42,4 +46,23 @@ class RootPlugin implements Plugin<Project>
     extraProperties.set 'title', PROJECT_TITLE
     extraProperties.set 'description', PROJECT_DESCRIPTION
   }
+
+  private static void applyGradleWrapper( Project project )
+  {
+    def dependencies = project.extensions.getByType( DependenciesDeclarationExtension )
+    def requiredGradleVersion = GradleVersion.version( dependencies.gradleVersion )
+    def currentGradleVersion = GradleVersion.current()
+    if( currentGradleVersion != requiredGradleVersion ) {
+      def warning = "The Apache Polygeneâ„¢ build is not supported with $currentGradleVersion.
" +
+                    "The only supported version is $requiredGradleVersion."
+      project.logger.error( warning )
+      project.gradle.buildFinished {
+        project.logger.error( warning )
+      }
+    }
+    project.tasks.create( 'wrapper', Wrapper) { Wrapper wrapper ->
+      wrapper.gradleVersion = dependencies.gradleVersion
+      wrapper.distributionType = Wrapper.DistributionType.ALL
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/cf4876b7/dependencies.gradle
----------------------------------------------------------------------
diff --git a/dependencies.gradle b/dependencies.gradle
index 3bab48f..8cf7a17 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -19,6 +19,9 @@ import org.apache.polygene.gradle.dependencies.DependenciesDeclarationExtension
 
 def dependencies = extensions.getByType( DependenciesDeclarationExtension )
 
+// Gradle version
+dependencies.gradleVersion = '3.5'
+
 // Remote repositories
 dependencies.repositoriesUrls << [
   mavenCentral: "https://repo1.maven.org/maven2/",


Mime
View raw message