Skip to content

Commit

Permalink
Merge pull request #67 from ndw/master
Browse files Browse the repository at this point in the history
DocBook XSLT Stylesheets 2.0.13 released
  • Loading branch information
ndw committed Sep 10, 2015
2 parents 76db205 + 473c596 commit fe891fa
Show file tree
Hide file tree
Showing 9 changed files with 379 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ language: java
script: gradle dist
sudo: false
install:
- ".travis/setup-diff.sh"
- echo sonatypeUsername=none >> gradle.properties
- echo sonatypePassword=none >> gradle.properties
- ".travis/setup-diff.sh"
env:
global:
- secure: EEcwLo3rIHqaV46h/AOMGafxqaZcy4i9WA8RlFO53wj23QJGmeUdYa2ka4IC2c+J+iNFYu1+dRkR52G6S6tY3LnsDmZGHj9xT9n7tPr/h/OmMXhdtNy3Nl5AWQORMZhqGCXwMxRZUyhWp6CjtY1LeGaVenwf1A3PiLEQmEJw9nY=
Expand Down
160 changes: 155 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
// Gradle to accept resources directly from xslt/ without losing the
// top-level xslt/ part of the path names. So I punted.

import groovy.swing.SwingBuilder
import java.awt.Point

buildscript {
repositories {
// maven { url uri('/tmp/repo') }
mavenLocal()
mavenCentral()
maven {
url 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
}
maven { url "http://maven.restlet.org" }
maven { url "http://developer.marklogic.com/maven2" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
Expand All @@ -24,6 +25,7 @@ buildscript {
plugins {
id "java"
id "osgi"
id "groovy"
id "maven"
id "maven-publish"
id "signing"
Expand All @@ -45,6 +47,10 @@ configurations.all {
}
}

configurations {
pluginApi
}

dependencies {
compile fileTree(dir: 'delta').include("*.jar")
compile (
Expand All @@ -54,8 +60,10 @@ dependencies {
[group: 'com.xmlcalabash', name: 'xmlcalabash1-print', version: '1.1.4'],
[group: 'com.thaiopensource', name: 'jing', version: '20091111', transitive: false],
[group: 'org.docbook', name: 'docbook-xsl-java-saxon', version: '1.2.1-95'],
[group: 'commons-cli', name: 'commons-cli', version: '1.3.1']
// 1.2 because that's what gradleApi requires :-(
[group: 'commons-cli', name: 'commons-cli', version: '1.2'],
)
pluginApi gradleApi()
}

project.ext.saxonRelease = saxonVersion.substring(0,5)
Expand All @@ -68,6 +76,30 @@ def versionPropsFile = file("src/main/resources/etc/version.properties")
versionProps['version'] = releaseVersion
versionProps.store(versionPropsFile.newWriter(),null)

compileGroovy {
classpath += configurations.pluginApi
}

compileJava {
classpath += configurations.pluginApi
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives jar
archives sourcesJar
archives javadocJar
}

task copyLib(type: Copy) {
FileCollection runtime = configurations.runtime
FileCollection localLib = fileTree(dir: 'delta').include("*.jar")
Expand Down Expand Up @@ -245,7 +277,12 @@ jar {
javax.xml.*,\
*;resolution:=optional'
instruction 'DynamicImport-Package', '*'
instruction 'Class-Path', project.ext.runtimeClasspath + " lib"
// This is a bit of a hack; special case the three most likely
// commercial jar files for printing with CSS or FO.
instruction 'Class-Path', project.ext.runtimeClasspath \
+ " lib/XfoJavaCtl.jar" \
+ " lib/xep.jar" \
+ " lib/prince.jar"
}
}

Expand Down Expand Up @@ -357,3 +394,116 @@ task clean.doFirst {
delete "test/actual"
delete "test/result"
}

/*
uploadArchives {
repositories {
mavenDeployer {
repository(url: uri('/tmp/repo'))
}
}
}
*/

signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

// I refuse to put my PGP password in a file.
//
// Adapted from
// https://www.timroes.de/2014/01/19/using-password-prompts-with-gradle-build-files/
//
// N.B. This can't work in a CI environment so there's no way to
// automatically publish the artifacts from, for example, Travis CI.
//
gradle.taskGraph.whenReady { taskGraph ->
if(taskGraph.hasTask(':uploadArchives')) {

def pass = ''
if(System.console() == null) {
new SwingBuilder().edt {
dialog(modal: true,
title: 'Enter password',
alwaysOnTop: true,
resizable: false,
locationRelativeTo: null,
locationByPlatform: true,
// On my Linux multi-monitor setup, the dialog "appears" at
// the top of the virtual desktop below my desktop. So move
// the damned thing somewhere visible. Meh.
location: new Point(100,100),
pack: true,
show: true
) {
vbox { //
label(text: "Please enter key passphrase:")
input = passwordField()
button(defaultButton: true, text: 'OK', actionPerformed: {
pass = input.password;
dispose();
})
}
}
}
} else {
pass = System.console().readPassword("\nPlease enter key passphrase: ")
pass = new String(pass)
}

if (pass.size() <= 0) {
throw new InvalidUserDataException("You must enter a password to proceed.")
}

allprojects { ext."signing.password" = pass }

}
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}

pom.project {
name 'DocBook XSLT 2.0 Stylesheets'
packaging 'jar'
description 'DocBook XSLT 2.0 stylesheets'
url 'https://github.com/docbook/xslt20-stylesheets'

scm {
url 'scm:[email protected]:docbook/xslt20-stylesheets.git'
connection 'scm:[email protected]:docbook/xslt20-stylesheets.git'
developerConnection 'scm:[email protected]:docbook/xslt20-stylesheets.git'
}

licenses {
license {
name 'Apache License version 2.0'
url 'https://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}

developers {
developer {
id 'ndw'
name 'Norman Walsh'
}
}
}
}
}
}

3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
version=2.0.12
version=2.0.13
snapshot=
builtBy=Norman Walsh
baseline=0
print=cssprint
css=resources/css/paged-bw.css
include=.*.xml
group=org.docbook

saxonVersion=9.6.0-4

Expand Down
10 changes: 10 additions & 0 deletions src/main/groovy/org/docbook/DocBookPlugin.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.docbook

import org.gradle.api.Project
import org.gradle.api.Plugin

class DocBookPlugin implements Plugin<Project> {
void apply(Project target) {
target.task('orgDocBook', type: DocBookTask)
}
}
Loading

0 comments on commit fe891fa

Please sign in to comment.