You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2015/07/28 12:21:25 UTC

[1/2] zest-java git commit: ZEST-25 Add missing header to generated go-offline helpers in bin dist

Repository: zest-java
Updated Branches:
  refs/heads/develop 5d3d759d5 -> ce95ca7d4


ZEST-25 Add missing header to generated go-offline helpers in bin dist


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

Branch: refs/heads/develop
Commit: 7b8fd18fcf342d46fd6f9164c1b870c4d62e0368
Parents: 5d3d759
Author: Paul Merlin <pa...@nosphere.org>
Authored: Tue Jul 28 11:36:36 2015 +0200
Committer: Paul Merlin <pa...@nosphere.org>
Committed: Tue Jul 28 11:36:36 2015 +0200

----------------------------------------------------------------------
 build.gradle   | 36 ++++++++++++++++++++++++++++++------
 etc/header.txt | 14 ++++++++++++++
 2 files changed, 44 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b8fd18f/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index f342ad4..2e0a4e4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -582,29 +582,53 @@ task buildAll( dependsOn: [
     ':org.qi4j.manual:website'
 ] ) { }
 
+// Generate license headers with comment styles
+def licenseHeader_wrap( base, top, left, bottom ) {
+  ( top ? "$top\n" : '' ) + base.readLines().collect{ "${left}${it}" }.join( '\n' ) + '\n' + ( bottom ? "$bottom\n" : '' )
+}
+def licenseHeader( flavour ) {
+  def base = project.file( 'etc/header.txt' ).text
+  def header
+  switch( flavour ) {
+    case 'java': case 'groovy': case 'scala': case 'js':
+      header = licenseHeader_wrap( base, '/*', ' * ', ' */' ) ; break
+    case 'xml': case 'html':
+      header = licenseHeader_wrap( base, '<!--', '  ', '-->' ) ; break
+    case 'txt': case 'shell': case 'python': case 'ruby':
+      header = licenseHeader_wrap( base, null, '# ', null ) ; break
+    case 'adoc': case 'asciidoc':
+      header = licenseHeader_wrap( base, null, '// ', null ) ; break
+    default:
+      header = base
+  }
+  header
+}
+
 task generateBinDistGoOfflineHelpers {
   def goOfflineGradleFile = file( 'build/go-offline-helpers/go-offline.gradle' )
   def goOfflinePomFile = file( 'build/go-offline-helpers/go-offline.pom')
   outputs.files goOfflineGradleFile
   outputs.files goOfflinePomFile
   doLast {
-    
-    def goOfflineGradle = '// This gradle build file has the sole purpose of downloading all dependencies in this directory.\n'
+
+    def goOfflineGradle = licenseHeader( 'java' )
+    goOfflineGradle += '// This gradle build file has the sole purpose of downloading all dependencies in a directory relative to this file named \'dependencies\'.\n'
     goOfflineGradle += '// Use the following command: gradle -b go-offline.gradle download\n'
     goOfflineGradle += 'apply plugin: \'java\'\nconfigurations { download }\nrepositories {\n'
-    def goOfflinePom = '<project>\n  <modelVersion>4.0.0</modelVersion>\n'
+    def goOfflinePom = licenseHeader( 'xml' )
+    goOfflinePom += '<project>\n  <modelVersion>4.0.0</modelVersion>\n'
     goOfflinePom += "  <groupId>org.qi4j</groupId>\n  <artifactId>go-offline-helper</artifactId>\n  <version>$version</version>\n"
     goOfflinePom += '  <packaging>pom</packaging>\n'
-    goOfflinePom += '  <!--\n  This pom has the sole purpose of downloading all dependencies in this directory.\n'
+    goOfflinePom += '  <!--\n  This pom has the sole purpose of downloading all dependencies in a directory relative to this file named \'dependencies\'.\n'
     goOfflinePom += '  Use the following command:\n\n  mvn -f go-offline.pom validate\n  -->\n  <repositories>\n'
-    
+
     def repoCount = 1
     repos_urls.each { repo_url ->
       goOfflineGradle += "  maven { url '${repo_url.value}' }\n"
       goOfflinePom += "    <repository><id>go-offline-repo-$repoCount</id><url>${repo_url.value}</url></repository>\n"
       repoCount++
     }
-    
+
     goOfflineGradle += '}\ndependencies {\n'
     goOfflinePom += '  </repositories>\n  <dependencies>\n'
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b8fd18f/etc/header.txt
----------------------------------------------------------------------
diff --git a/etc/header.txt b/etc/header.txt
new file mode 100644
index 0000000..9f4ff31
--- /dev/null
+++ b/etc/header.txt
@@ -0,0 +1,14 @@
+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.
\ No newline at end of file


[2/2] zest-java git commit: ZEST-25 Better dependencies resolution for bin dist go-offline helpers

Posted by pa...@apache.org.
ZEST-25 Better dependencies resolution for bin dist go-offline helpers

Now apply the Zest resolution strategy before generation so there’s no
surprise when using the helpers.

Note that as some of our modules depends on != versions of some
artifacts, the resolution strategy flatten this using the most up to
date versions.


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

Branch: refs/heads/develop
Commit: ce95ca7d4a2ff35031be66fc0923f29e9b15d500
Parents: 7b8fd18
Author: Paul Merlin <pa...@nosphere.org>
Authored: Tue Jul 28 12:16:01 2015 +0200
Committer: Paul Merlin <pa...@nosphere.org>
Committed: Tue Jul 28 12:16:01 2015 +0200

----------------------------------------------------------------------
 build.gradle     | 20 +++++++++++---------
 libraries.gradle | 12 ++++++++++++
 2 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/ce95ca7d/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 2e0a4e4..d7666e6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -632,15 +632,17 @@ task generateBinDistGoOfflineHelpers {
     goOfflineGradle += '}\ndependencies {\n'
     goOfflinePom += '  </repositories>\n  <dependencies>\n'
 
-    def handledDeps = []
-    releaseApprovedProjects.each { p ->
-      p.configurations.runtime.incoming.resolutionResult.allComponents.each { comp ->
-        def depCoords = "${comp.moduleVersion.group}:${comp.moduleVersion.name}:${comp.moduleVersion.version}"
-        if( !comp.moduleVersion.group.startsWith( 'org.qi4j' ) && !handledDeps.contains( depCoords ) ) {
-          goOfflineGradle += "  download( '$depCoords' ) { transitive = false }\n"
-          goOfflinePom += "    <dependency><groupId>${comp.moduleVersion.group}</groupId><artifactId>${comp.moduleVersion.name}</artifactId><version>${comp.moduleVersion.version}</version></dependency>\n"
-          handledDeps << depCoords
-        }
+    // Do the global dependency resolution here so there won't be any suprise when using the helpers
+    // This also allow to apply the resolution strategy defined in libraries.gradle
+    // WARN some of our modules depends on != versions of some artifacts, this resolution flatten this using the most up to date
+    def allRuntimeDeps = releaseApprovedProjects.collect{ it.configurations.runtime.allDependencies }.flatten()
+    rootProject.configurations.create( 'goOfflineHelpers' )
+    rootProject.dependencies { allRuntimeDeps.each{ goOfflineHelpers it } }
+    rootProject.configurations.goOfflineHelpers.incoming.resolutionResult.allComponents.each { comp ->
+      def depCoords = "${comp.moduleVersion.group}:${comp.moduleVersion.name}:${comp.moduleVersion.version}"
+      if( !comp.moduleVersion.group.startsWith( 'org.qi4j' ) ) {
+        goOfflineGradle += "  download( '$depCoords' ) { transitive = false }\n"
+        goOfflinePom += "    <dependency><groupId>${comp.moduleVersion.group}</groupId><artifactId>${comp.moduleVersion.name}</artifactId><version>${comp.moduleVersion.version}</version></dependency>\n"
       }
     }
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/ce95ca7d/libraries.gradle
----------------------------------------------------------------------
diff --git a/libraries.gradle b/libraries.gradle
index c02a901..1507bc8 100644
--- a/libraries.gradle
+++ b/libraries.gradle
@@ -261,6 +261,18 @@ allprojects {
         if( dep.requested.group == 'org.slf4j' ) {
           dep.useTarget group: dep.requested.group, name: dep.requested.module, version: slf4jVersion
         }
+        // Always resolve ASM to the same version
+        if( dep.requested.group == 'org.ow2.asm' ) {
+          dep.useTarget group: dep.requested.group, name: dep.requested.module, version: asmVersion
+        }
+        // Always resolve OSGi to the same version
+        if( dep.requested.group == 'org.osgi' ) {
+          dep.useTarget group: dep.requested.group, name: dep.requested.module, version: osgiVersion
+        }
+        // Always resolve Jackson to the same version
+        if( dep.requested.group.startsWith( 'com.fasterxml.jackson' ) ) {
+          dep.useTarget group: dep.requested.group, name: dep.requested.module, version: jacksonVersion
+        }
         // woodstox:wstx-asl is broken (no pom), use org.codehaus.woodstox:wstx-asl instead
         if( dep.requested.group == 'woodstox' && dep.requested.module == 'wstx-asl' ) {
           dep.useTarget group: 'org.codehaus.woodstox', name: 'wstx-asl', version: dep.requested.version