Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
code style re-format
Browse files Browse the repository at this point in the history
  • Loading branch information
stliu committed Mar 22, 2011
1 parent 3a2b7f3 commit c8e9a58
Show file tree
Hide file tree
Showing 49 changed files with 3,145 additions and 1,808 deletions.
45 changes: 34 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
/*
* jDocBook, processing of DocBook sources
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
apply plugin: 'groovy'
apply plugin: 'maven' // used for 'install' and 'upload'/'deploy' task
apply plugin: 'maven' // used for 'install' and 'upload'/'deploy' task
apply plugin: 'eclipse'
apply plugin: 'idea'
apply { url: 'https://loom.svn.sourceforge.net/svnroot/loom/shared/trunk/artifacts.gradle' } // sets up source and javadoc jar uploads
Expand Down Expand Up @@ -34,21 +57,21 @@ slf4j_impl = ['org.slf4j:slf4j-simple:1.6.1@jar',
dependencies {
compile gradleApi()
compile localGroovy()
compile 'org.jboss.jdocbook:jdocbook-core:1.0.5-SNAPSHOT'
compile 'org.jboss.jdocbook:jdocbook-core:1.0.5-SNAPSHOT'
compile 'org.apache.ant:ant:1.7.0'

groovy localGroovy()
testCompile 'junit:junit:4.8.1'
testCompile jmock, spock, slf4j_impl
testCompile 'junit:junit:4.8.1'
testCompile jmock, spock, slf4j_impl
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
}

manifest.mainAttributes(
provider: 'gradle',
'Implementation-Url': 'http://jboss.org',
'Implementation-Version': version,
'Implementation-Vendor': 'JBoss.org',
'Implementation-Vendor-Id': 'org.jboss'
provider: 'gradle',
'Implementation-Url': 'http://jboss.org',
'Implementation-Version': version,
'Implementation-Vendor': 'JBoss.org',
'Implementation-Vendor-Id': 'org.jboss'
)

def pomConfig = {
Expand Down Expand Up @@ -97,10 +120,10 @@ configure(install.repositories.mavenInstaller) {
pom.project pomConfig
}

if ( ! hasProperty('MY_JBOSS_USER') ) {
if (!hasProperty('MY_JBOSS_USER')) {
MY_JBOSS_USER = "";
}
if ( ! hasProperty('MY_JBOSS_PASS') ) {
if (!hasProperty('MY_JBOSS_PASS')) {
MY_JBOSS_PASS = "";
}

Expand Down
26 changes: 26 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/*
* jDocBook, processing of DocBook sources
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/



// until http://jira.codehaus.org/browse/GRADLE-338 is resolved the recommended approach
// for supplying an explicit project name is settings.gradle

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/*
* jDocBook, processing of DocBook sources
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/



package org.jboss.gradle.plugins.jdocbook

import org.gradle.api.NamedDomainObjectContainer
Expand All @@ -6,53 +32,52 @@ import org.gradle.api.logging.Logger
import org.gradle.api.logging.Logging
import org.gradle.listener.ActionBroadcast
import org.jboss.gradle.plugins.jdocbook.book.Book
import org.gradle.util.ConfigureUtil

/**
* @author Strong Liu
*/
class JDocBookConvention {
Logger log = Logging.getLogger(JDocBookConvention);
final NamedDomainObjectContainer<Book> books;
@Delegate
Book commonBook
Project project
ActionBroadcast<Book> configBookActions = new ActionBroadcast<Book>();

JDocBookConvention(Project project, NamedDomainObjectContainer<Book> books) {
this.project = project
this.books = books
this.commonBook = new Book("", project)
/**
* if it is a mutil-books project, then we have to merge the info defined in the common book
* area into each book, and also mark the internal common book as abstract
*/
books.all { Book book ->
book.translations += commonBook.translations
book.masterLanguage = commonBook.masterLanguage
book.useRelativeImageUris = commonBook.useRelativeImageUris
book.autoDetectFonts = commonBook.autoDetectFonts
book.useFopFontCache = commonBook.useFopFontCache
book.localeSeparator = commonBook.localeSeparator
book.transformerParameters.putAll(commonBook.transformerParameters)
book.applyStandardInjectionValues = commonBook.applyStandardInjectionValues
book.injectionDateFormat = commonBook.injectionDateFormat
commonBook.formats.each {format ->
book.format(format)
}
commonBook.concrete = false
}

}

/**
* don't know if there is a "more gradle" way to do this, here i'm using listener to configure tasks
* per book, the reason is tasks depend on how book is configured, for example, if a book does not have
* a translation, then it should not has update-po, and render-html-zh-cn
*/
def jdocbook(Closure closure) {
books.configure(closure)
books.all { book -> configBookActions.execute book }
configBookActions.execute commonBook
}
final static Logger log = Logging.getLogger(JDocBookConvention);
final NamedDomainObjectContainer<Book> books;
@Delegate
Book commonBook
Project project
ActionBroadcast<Book> configBookActions = new ActionBroadcast<Book>();

JDocBookConvention(Project project, NamedDomainObjectContainer<Book> books) {
this.project = project
this.books = books
this.commonBook = new Book("", project)
/**
* if it is a mutil-books project, then we have to merge the info defined in the common book
* area into each book, and also mark the internal common book as abstract
*/
books.all { Book book ->
book.translations += commonBook.translations
book.masterLanguage = commonBook.masterLanguage
book.useRelativeImageUris = commonBook.useRelativeImageUris
book.autoDetectFonts = commonBook.autoDetectFonts
book.useFopFontCache = commonBook.useFopFontCache
book.localeSeparator = commonBook.localeSeparator
book.transformerParameters.putAll(commonBook.transformerParameters)
book.applyStandardInjectionValues = commonBook.applyStandardInjectionValues
book.injectionDateFormat = commonBook.injectionDateFormat
commonBook.formats.each {format ->
book.format(format)
}
commonBook.concrete = false
}

}

/**
* don't know if there is a "more gradle" way to do this, here i'm using listener to configure tasks
* per book, the reason is tasks depend on how book is configured, for example, if a book does not have
* a translation, then it should not has update-po, and render-html-zh-cn
*/
def jdocbook(Closure closure) {
books.configure(closure)
books.all { book -> configBookActions.execute book }
configBookActions.execute commonBook
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/*
* jDocBook, processing of DocBook sources
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/



package org.jboss.gradle.plugins.jdocbook;


Expand All @@ -15,20 +41,20 @@ import org.jboss.gradle.plugins.jdocbook.task.CreateTasksPerBookAction
* @author Strong Liu
*/
public class JDocBookPlugin implements Plugin<Project> {
Logger log = Logging.getLogger(JDocBookPlugin);
public static final String STYLES_CONFIG_NAME = "jdocbookStyles";
public static final String DOCBOOK_CONFIG_NAME = "jdocbook";

public void apply(final Project project) {
applyConfiguration(project)
def books = project.container(Book) { name -> new Book(name, project) }
JDocBookConvention convention = new JDocBookConvention(project, books)
project.convention.plugins.put(DOCBOOK_CONFIG_NAME, convention)
convention.configBookActions.add(new CreateTasksPerBookAction(project))
}

private void applyConfiguration(Project project) {
project.configurations.add(DOCBOOK_CONFIG_NAME).setVisible(false).setTransitive(false).setDescription("The DocBook artifact(s) to use.");
project.configurations.add(STYLES_CONFIG_NAME).setVisible(false).setTransitive(true).setDescription("Defines any jDocBook styles artifacts to apply");
}
private static final Logger log = Logging.getLogger(JDocBookPlugin);
public static final String STYLES_CONFIG_NAME = "jdocbookStyles";
public static final String DOCBOOK_CONFIG_NAME = "jdocbook";

public void apply(final Project project) {
applyConfiguration(project)
def books = project.container(Book) { name -> new Book(name, project) }
JDocBookConvention convention = new JDocBookConvention(project, books)
project.convention.plugins.put(DOCBOOK_CONFIG_NAME, convention)
convention.configBookActions.add(new CreateTasksPerBookAction(project))
}

private void applyConfiguration(Project project) {
project.configurations.add(DOCBOOK_CONFIG_NAME).setVisible(false).setTransitive(false).setDescription("The DocBook artifact(s) to use.");
project.configurations.add(STYLES_CONFIG_NAME).setVisible(false).setTransitive(true).setDescription("Defines any jDocBook styles artifacts to apply");
}
}
Loading

0 comments on commit c8e9a58

Please sign in to comment.