This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GnuMake extends DefaultTask { | |
@Input | |
@Optional | |
List<String> targets | |
@Input | |
@Optional | |
Map<String,Object> flags = [:] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FOR THE IMPATIENT: Final solution at the end | |
// Classic Ivy style to publish to Bintray. | |
// This requires the package to be pre-created, possibly by manual process on website | |
// or via call such as https://github.com/ysb33r/Gradle/blob/master/buildSrc/src/main/groovy/BintrayPackage.groovy | |
uploadArchives { | |
repositories { | |
ivy { | |
url 'http://api.bintray.com/ysb33r/grysb33r/gnumake-gradle-plugin/0.0.3' | |
credentials { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the task | |
// The declare the task and adds a body that will be executed everytime the tasks is executed | |
// Variables pushed in as configuration can be referenced here | |
// | |
// This simple tasks will write a text file containing a list of files | |
// in a source set. It will also only update the output file, if at least one | |
// source file has changed. | |
task myTask << { | |
outputs.file.singleFile.withWriter { out -> | |
inputs.sourceFiles.each { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- ============================================================================ | |
(C) Copyright Schalk W. Cronjé 2013 | |
This code snippet is licensed under the Apache License 2.0 | |
See http://www.apache.org/licenses/LICENSE-2.0 for license details | |
============================================================================ --> | |
<xsl:transform | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@GrabResolver( name='grysb33r', root='http://dl.bintray.com/ysb33r/grysb33r' ), | |
@Grab( 'org.ysb33r.groovy:groovy-vfs:0.2' ), | |
@Grab( 'commons-httpclient:commons-httpclient:3.1') | |
]) | |
import org.ysb33r.groovy.dsl.vfs.VFS | |
// This will download the compressed archive from Sourceforge and unpack it to a local directory | |
new VFS() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def partitions=6 | |
def testResults | |
def buildResult | |
def staticAnalysisResult | |
def smokeTestResult | |
def performanceResult | |
def buildFlow= { buildResult= build( 'BUILDER' ) } | |
def performanceFlow= { performanceResult = build('PERFORMANCE')} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assumuing that the build flow tracks another job's SVN revision | |
// Get the SVN URLs and revisions | |
def svn=build.getAction(hudson.scm.RevisionParameterAction.class) | |
svn.revisions.each { | |
println it.SVNURL | |
println it.revision | |
} | |
// Get the Build number of the job being tracked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Uses a single Groovy template and multiple sets of text input files. | |
// It generates a set of Groovy source files using the content of the text input files to set tokens within the | |
// template file. | |
task generateGroovySources( type : Copy ) { | |
from 'examples', { | |
include '*.txt' | |
} | |
into "${buildDir}/generated-src" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a workaround for the Grain plugin for Gradle | |
// It generates the Grain build into a subproject if one runs grainInstall | |
// It also elimnates the current way Grain drops stuff all over your build area. | |
// IN reality the Grain plugin needs a rewrite, but this is a workaround for now. | |
plugins { | |
id "com.sysgears.grain" version "0.2.3" | |
} | |
grain { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given that you have kicked off a build according to the DSL syntax | |
def results = build('RUN_THIS_JOB') | |
// Get out the name of the job again | |
println results.name | |
// Get the build ID | |
println results.id | |
// Get the build URL |