You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2019/09/26 07:54:49 UTC
[lucene-solr] branch jira/SOLR-13452_gradle_7_refguide updated
(6990b08 -> f1eabf7)
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a change to branch jira/SOLR-13452_gradle_7_refguide
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.
from 6990b08 Remove tasks that aren't working yet
new cfde143 Initial round of changes mimicking ant task order.
new f1eabf7 More cleanups. Property values. Bare-bones HTML generation.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
solr/solr-ref-guide/build.gradle | 241 ++++++++++++++++++++++++++++++---------
1 file changed, 186 insertions(+), 55 deletions(-)
[lucene-solr] 02/02: More cleanups. Property values. Bare-bones
HTML generation.
Posted by dw...@apache.org.
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 f1eabf7a30564f464d6c9cbd6c9eb049d7dbea32
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Thu Sep 26 09:53:07 2019 +0200
More cleanups. Property values. Bare-bones HTML generation.
---
solr/solr-ref-guide/build.gradle | 77 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 75 insertions(+), 2 deletions(-)
diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index 07c6394..ac0b066 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -79,6 +79,24 @@ forbiddenApisTools {
ext {
buildContentDir = file("${buildDir}/content")
mainPage = "index"
+
+ solrDocsVersion = "${version}".replaceAll(/^(\d+\.\d+)(|\..*)$/, "\$1")
+ solrDocsVersionPath = "${solrDocsVersion}".replaceAll(/^(\d+)\.(\d+)$/, "\$1_\$2_0")
+
+ if (!project.hasProperty("solrGuideVersion")) {
+ solrGuideVersion = "${solrDocsVersion}-DRAFT"
+ }
+
+ solrGuideDraftStatus = "${!solrGuideVersion.matches(/^\d+\.\d+(|\.\d+)$/)}"
+ solrGuideVersionPath = solrGuideVersion.replaceAll(/^(\d+)\.(\d+)(-DRAFT)?.*/, "\$1_\$2\$3")
+
+ if (project.hasProperty("local.javadocs")) {
+ htmlSolrJavadocs = "link:../../docs/"
+ htmlLuceneJavadocs = "link:../../../../lucene/build/docs/"
+ } else {
+ htmlSolrJavadocs = "https://lucene.apache.org/solr/${solrDocsVersionPath}/"
+ htmlLuceneJavadocs = "https://lucene.apache.org/core/${solrDocsVersionPath}/"
+ }
}
// Tasks modeled after ant file until we have a working build.
@@ -86,13 +104,32 @@ ext {
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.
+
+ // TODO: Compute remaining property values as they are in ant. What should we do with dependency/ ivy versions?
def props = [
- // TODO: define other props. What should we do with dependency/ ivy versions?
- "solr-guide-draft-status": "foo"
+ "solr-guide-draft-status": solrGuideDraftStatus,
+ "solr-guide-version": solrGuideVersion,
+ "solr-guide-version-path": solrGuideVersionPath,
+ "solr-docs-version": solrDocsVersion,
+ "java-javadocs": "(javadoc.link)",
+ "solr-javadocs": htmlSolrJavadocs,
+ "lucene-javadocs": htmlLuceneJavadocs,
+ "build-date": "(DSTAMP)",
+ "build-year": "(current.year)",
+ "ivy-commons-codec-version": "(ivyversions./commons-codec/commons-codec)",
+ "ivy-dropwizard-version": "(ivyversions.io.dropwizard.metrics.version)",
+ "ivy-log4j-version": "(ivyversions.org.apache.logging.log4j.version)",
+ "ivy-opennlp-version": "(ivyversions./org.apache.opennlp/opennlp-tools)",
+ "ivy-tika-version": "(ivyversions.org.apache.tika.version)",
+ "ivy-velocity-tools-version": "(ivyversions.org.apache.velocity.tools.version)",
+ "ivy-zookeeper-version": "(ivyversions./org.apache.zookeeper/zookeeper)"
]
def dummyAntProject = new org.apache.tools.ant.Project()
props.each { k, v -> dummyAntProject.setProperty(k, v) }
+ // Emit info about properties for clarity.
+ logger.warn("Building ref guide with:\n" + props.collect({k, v -> " ${k} -> ${v}"}).join('\n'))
+
// If replaceable properties change, we have to rerun.
inputs.properties props
@@ -125,9 +162,45 @@ task buildNavDataFiles(type: JavaExec) {
"${buildContentDir}",
"${mainPage}"
])
+
+ doFirst {
+ // Remove previously generated files first.
+ [
+ "pdf-main-body.adoc",
+ "scrollnav.json",
+ "sidebar.json"
+ ].each { name ->
+ project.delete(file("${buildContentDir}/_data/${name}"))
+ }
+ }
}
+def bareBonesDir = file("${buildDir}/bare-bones-html")
+task bareBonesAsciiDoctor(type: org.asciidoctor.gradle.AsciidoctorTask) {
+ dependsOn buildNavDataFiles
+
+ sourceDir buildContentDir
+ outputDir bareBonesDir
+ backend "html5"
+
+ logDocuments true
+
+ attributes([
+ "solr-javadocs": htmlSolrJavadocs,
+ "lucene-javadocs": htmlLuceneJavadocs
+ ])
+
+ doFirst {
+ project.delete(bareBonesDir)
+ bareBonesDir.mkdirs()
+ }
+}
+
+task bareBonesHtmlValidation() {
+ dependsOn bareBonesAsciiDoctor
+ description("Builds (w/o Jekyll) a very simple html version of the guide and runs link/anchor validation on it")
+}
// Define the asciidoctorj version
asciidoctorj {
[lucene-solr] 01/02: Initial round of changes mimicking ant task
order.
Posted by dw...@apache.org.
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 <dw...@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