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/17 14:31:21 UTC

[2/5] zest-qi4j git commit: ZEST-25 Documentation build now honor ReleaseSpec regarding libs/exts/tools inclusion

ZEST-25 Documentation build now honor ReleaseSpec regarding libs/exts/tools inclusion


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

Branch: refs/heads/develop
Commit: 1da62b8ff67d6608665589f227d1971dd2a65bd8
Parents: f68c830
Author: Paul Merlin <pa...@apache.org>
Authored: Fri Jul 17 14:22:52 2015 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Fri Jul 17 14:22:52 2015 +0200

----------------------------------------------------------------------
 build.gradle                                    |  7 ++--
 .../org/qi4j/gradle/plugin/Documentation.groovy | 41 ++++++++++++++++++--
 settings.gradle                                 | 14 +++----
 3 files changed, 49 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1da62b8f/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index b164793..4843f5b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -56,10 +56,9 @@ sourceCompatibility = "1.7"
 // Collect the modules that fulfills the Release Criteria.
 project.ext {
   releaseSpec = new org.qi4j.gradle.plugin.ModuleReleaseSpecification()
+  releaseApprovedProjects = allprojects.findAll( { p -> rootProject.releaseSpec.satisfiedBy( p ) } )
 }
 
-def releaseApprovedProjects = allprojects.findAll( { project ->  rootProject.ext.releaseSpec.satisfiedBy( project ) } )
-
 rat {
     excludes = [
         '**/.DS_Store/**', '**/._*',
@@ -133,7 +132,9 @@ allprojects {
   defaultTasks 'classes', 'test'
 
   group = name == 'org.qi4j' ? 'org.qi4j' : name.substring( 0, name.lastIndexOf( '.' ) )
-  version = System.properties.version ?: "0"
+  if( version == 'unspecified' ) {
+    version = System.properties.version ?: "0"
+  }
   
   // UTF-8 For all compilations and javadocs
   // Deprecation warnings for all compilations

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1da62b8f/buildSrc/src/main/groovy/org/qi4j/gradle/plugin/Documentation.groovy
----------------------------------------------------------------------
diff --git a/buildSrc/src/main/groovy/org/qi4j/gradle/plugin/Documentation.groovy b/buildSrc/src/main/groovy/org/qi4j/gradle/plugin/Documentation.groovy
index db79967..ad8ca04 100644
--- a/buildSrc/src/main/groovy/org/qi4j/gradle/plugin/Documentation.groovy
+++ b/buildSrc/src/main/groovy/org/qi4j/gradle/plugin/Documentation.groovy
@@ -44,6 +44,7 @@ class Documentation extends DefaultTask
 
   @OutputDirectory def File getOutputDir() { project.file( "${project.buildDir}/docs/${docName}/" ) }
 
+  def File getTempAsciidocDir() { project.file( "${project.buildDir}/tmp-asciidoc" ) }
   def File getTempDir() { project.file( "${project.buildDir}/tmp/docs/${docName}") }
 
   @TaskAction
@@ -51,10 +52,11 @@ class Documentation extends DefaultTask
   {
     installAsciidocFilters()
 
-    [ outputDir, tempDir ]*.deleteDir()
-    [ outputDir, tempDir ]*.mkdirs()
+    [ outputDir, tempAsciidocDir, tempDir ]*.deleteDir()
+    [ outputDir, tempAsciidocDir, tempDir ]*.mkdirs()
 
     copySubProjectsDocsResources()
+    generateAsciidocAccordingToReleaseSpecification()
     generateXDoc()
     generateChunkedHtml()
     // generateSingleHtml()
@@ -102,6 +104,39 @@ class Documentation extends DefaultTask
     }
   }
 
+  def void generateAsciidocAccordingToReleaseSpecification()
+  {
+    project.copy {
+      from docsDir
+      into tempAsciidocDir
+      include '**'
+    }
+    if( project.version != '0' && !project.version.contains( 'SNAPSHOT' ) ) {
+      def licenseFile = new File( tempAsciidocDir, 'userguide/libraries.txt' )
+      def extensionsFile = new File( tempAsciidocDir, 'userguide/extensions.txt' )
+      def toolsFile = new File( tempAsciidocDir, 'userguide/tools.txt' )
+      [ licenseFile, extensionsFile, toolsFile ].each { asciidocFile ->
+        def filteredFileContent = ''
+        asciidocFile.readLines().each { line ->
+          if( line.startsWith( 'include::' ) ) {
+            def approved = false
+            project.rootProject.releaseApprovedProjects.collect{it.projectDir}.each { approvedProjectDir ->
+              if( line.contains( "${approvedProjectDir.parentFile.name}/${approvedProjectDir.name}" ) ) {
+                approved = true
+              }
+            }
+            if( approved ) {
+              filteredFileContent += "$line\n"
+            }
+          } else {
+            filteredFileContent += "$line\n"
+          }
+        }
+        asciidocFile.text = filteredFileContent
+      }
+    }
+  }
+
   def void generateXDoc()
   {
     project.exec {
@@ -112,7 +147,7 @@ class Documentation extends DefaultTask
       def docbookConfigPath = relativePath( project.rootDir, new File( configDir, 'docbook45.conf' ) )
       def linkimagesConfigPath = relativePath( project.rootDir, new File( configDir, 'linkedimages.conf' ) )
       def xdocOutputPath =  relativePath( project.rootDir, new File( tempDir, 'xdoc-temp.xml' ) )
-      def asciidocIndexPath = relativePath( project.rootDir, new File( docsDir, "$docName/index.txt" ) )
+      def asciidocIndexPath = relativePath( project.rootDir, new File( tempAsciidocDir, "$docName/index.txt" ) )
       args = [
               '--attribute', 'revnumber=' + project.version,
               '--attribute', 'level1=' + (docType.equals('article') ? 1 : 0),

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1da62b8f/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 3243f26..da84170 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -17,13 +17,13 @@
  * under the License.
  */
 
-include "core:functional",
-        "core:io",
-        "core:api",
-        "core:spi",
-        "core:testsupport",
-        "core:bootstrap",
-        "core:runtime",
+include 'core:functional',
+        'core:io',
+        'core:api',
+        'core:spi',
+        'core:testsupport',
+        'core:bootstrap',
+        'core:runtime',
         'libraries:alarm',
         'libraries:circuitbreaker',
         'libraries:constraints',