lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject [lucene-solr] 01/02: Initial round of changes mimicking ant task order.
Date Thu, 26 Sep 2019 07:54:50 GMT
This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch jira/SOLR-13452_gradle_7_refguide
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit cfde143d1ab3b120bc34ea36d76e5a0cd309aab2
Author: Dawid Weiss <dweiss@apache.org>
AuthorDate: Wed Sep 25 20:55:53 2019 +0200

    Initial round of changes mimicking ant task order.
---
 solr/solr-ref-guide/build.gradle | 168 ++++++++++++++++++++++++++-------------
 1 file changed, 113 insertions(+), 55 deletions(-)

diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index 2c350d3..07c6394 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -15,62 +15,118 @@
  * limitations under the License.
  */
 
+// TODO: the separation of sources between tools and refGuide is awkward; it'd be
+// better to separate the refGuideTools as a plain Java module and then depend on
+// it as a project dependency. This would enable this module to *not* be a java module at
all
+// and inherit from base, adding just refGuide-related tasks.
+
+import com.github.jrubygradle.JRubyExec
 
 // Using 1.x versions of asciidoctor-gradle since 2.x wouldn't work
- plugins {
-   id 'org.asciidoctor.convert' version '1.6.1'
-   id 'com.github.jruby-gradle.base' version '1.4.0'
- }
-
- repositories {
-   maven { url 'http://rubygems-proxy.torquebox.org/releases' }
- }
-
- dependencies {
-   gems 'rubygems:jekyll:3.5.2'
-   gems 'rubygems:jekyll-asciidoc:2.1.0'
-   gems 'rubygems:slim:3.0.9'
- }
-
- apply plugin: 'java'
- apply plugin: 'com.github.jruby-gradle.base'
- import com.github.jrubygradle.JRubyExec
-
- configurations {
-   tools
-   refGuide
- }
-
- dependencies {
-   tools gradleApi()
-   tools localGroovy()
-
-//   tools ('org.asciidoctor:asciidoctor-ant')
-   tools ('com.vaadin.external.google:android-json')
-   tools ('org.jsoup:jsoup')
-   tools ('org.apache.pdfbox:pdfbox')
-   tools ('org.slf4j:jcl-over-slf4j')
-   tools ('org.slf4j:slf4j-api')
-   tools ('org.slf4j:slf4j-simple')
-   tools ('org.apache.logging.log4j:log4j-api')
-   tools ('org.apache.logging.log4j:log4j-core')
-   tools ('com.google.guava:guava')
-   tools ('commons-codec:commons-codec')
- }
-
- sourceSets {
+plugins {
+  id 'java'
+  id 'org.asciidoctor.convert' version '1.6.1'
+  id 'com.github.jruby-gradle.base' version '1.4.0'
+}
+
+repositories {
+  maven { url 'http://rubygems-proxy.torquebox.org/releases' }
+}
+
+configurations {
+  tools
+  refGuide
+}
+
+dependencies {
+  gems 'rubygems:jekyll:3.5.2'
+  gems 'rubygems:jekyll-asciidoc:2.1.0'
+  gems 'rubygems:slim:3.0.9'
+
+  tools gradleApi()
+  tools localGroovy()
+  tools ('org.asciidoctor:asciidoctor-ant')
+  tools ('com.vaadin.external.google:android-json')
+  tools ('org.jsoup:jsoup')
+  tools ('org.apache.pdfbox:pdfbox')
+  tools ('org.slf4j:jcl-over-slf4j')
+  tools ('org.slf4j:slf4j-api')
+  tools ('org.slf4j:slf4j-simple')
+  tools ('org.apache.logging.log4j:log4j-api')
+  tools ('org.apache.logging.log4j:log4j-core')
+  tools ('com.google.guava:guava')
+  tools ('commons-codec:commons-codec')
+}
+
+sourceSets {
    tools {
      compileClasspath += sourceSets.main.runtimeClasspath += configurations.tools
      runtimeClasspath += sourceSets.main.runtimeClasspath
+
+     resources {
+       srcDirs += file('tools')
+     }
    }
 
    tools.java.srcDirs = ['tools']
    refGuide.java.srcDirs = ['src']
- }
+}
 
- forbiddenApisTools {
+forbiddenApisTools {
    bundledSignatures -= 'jdk-system-out'
- }
+}
+
+ext {
+  buildContentDir = file("${buildDir}/content")
+  mainPage = "index"
+}
+
+// Tasks modeled after ant file until we have a working build.
+
+task buildInit(type: Sync) {
+  // TODO: we can do cleaner than going through ant here -- we could use gradle's expand
but
+  // it'd require a change in the template that is backwards incompatible.
+  def props = [
+    // TODO: define other props. What should we do with dependency/ ivy versions?
+    "solr-guide-draft-status": "foo"
+  ]
+  def dummyAntProject = new org.apache.tools.ant.Project()
+  props.each { k, v -> dummyAntProject.setProperty(k, v) }
+
+  // If replaceable properties change, we have to rerun.
+  inputs.properties props
+
+  from(file("src"), {
+    exclude '**/*.template'
+  })
+
+  from(file("src"), {
+    include '**/*.template'
+    rename '(.+)\\.template', '$1'
+    filteringCharset = 'UTF-8'
+    filter(org.apache.tools.ant.filters.ExpandProperties, project: dummyAntProject)
+  })
+
+  into buildContentDir
+}
+
+task buildToolsJar(type: Jar) {
+  dependsOn toolsClasses
+  from sourceSets.tools.output
+  archivesBaseName = 'solr-ref-guide-tools'
+}
+
+task buildNavDataFiles(type: JavaExec) {
+  dependsOn buildInit, buildToolsJar
+  classpath = sourceSets.tools.runtimeClasspath
+  main = 'BuildNavAndPDFBody'
+  workingDir = buildContentDir
+  args([
+    "${buildContentDir}",
+    "${mainPage}"
+  ])
+}
+
 
 
 // Define the asciidoctorj version
@@ -78,7 +134,6 @@ asciidoctorj {
   version = '1.5.0-beta.5'
 }
 
-
 // general Asciidoc params for HTML conversion - barebones if still needed?
 asciidoctor {
   doFirst {
@@ -95,15 +150,18 @@ asciidoctor {
   outputDir file('../build/solr-ref-guide/')
   options doctype: 'book'
 
-  attributes \
-    'safemode': 'unsafe',
-    'source-highlighter': 'coderay',
-    'figure-caption!': '',
-    'idprefix': '',
-    'idseparator': '-',
-    'icons': 'font',
-    'icon-set': 'fa',
-    'section-toc': ''
+  attributes [
+          /*
+    safemode: 'unsafe',
+    source-highlighter : 'coderay',
+    'figure-caption!' : '' ,
+    idprefix : '' ,
+    idseparator : '-' ,
+    icons : 'font' ,
+    icon-set : 'fa' ,
+    section-toc : ''
+           */
+  ]
 }
 
 // Jekyll for HTML conversion - doesn't work yet


Mime
View raw message