Hi Kaptain,

and thanks very much for the reply.

I am as much a newbie to groovy as I am to gradle, so obvious
alternatives such as what you provided do not automatically jump to
mind.
And it is enough to go on with. Thanks very much. Yet, it would be
helpful to see if the original cause of my problem can be solved,
if for no other reason as my further education in gradle, and to be
able to better cope with the situation in the future, or if perhaps
there is no such viable alternative next time.

Here is the information regarding what I am trying to call, and how;

The ant task:
definition: http://subclipse.tigris.org/svnant/svn.html#info
source: 
http://subclipse.tigris.org/source/browse/*checkout*/subclipse/trunk/svnant/src/main/org/tigris/subversion/svnant/commands/Info.java?revision=4108&content-type=text/plain

A reduced version of the gradle script:


/*
*  print any required properties to stout, and setup any type def's
required for custom ant tasks etc
*/
task checkArgs () {

  if (getProject().properties['forceBuild']==null)
  getProject().setProperty('forceBuild', 'false')

  ant.taskdef(resource: 'org/tigris/subversion/svnant/svnantlib.xml') {
                        classpath {
                                        fileset(dir: "${depends_svnant}", 
includes: 'lib/**/*.jar')
                        }
        }
}





/*
* Here we check if the current working directory is old, and if so, we
know we need to update before building
* We do this by checking the difference in revision between the
working dir, and the repo head revision
*/
task prepareBuildProcess(dependsOn: [checkArgs]){

                println "Checking path: ${workspaceRoot}/.svn\n"
                if (new File("${workspaceRoot}/.svn").isDirectory()){
                        // there is the possibility that no changes have 
occurred since the
last build.
                        // if this is the case, do not proceed. Log the reason 
why!
                        println "Trunk exists! Testing trunk for changes."
                        def lastVersion
                        new 
File("${workspaceRoot}/${product}/src/META-INF/MANIFEST.MF").eachLine
{ line ->
                                if ((matcher = line =~ 
/[Ii]mplementation-[Vv]ersion:\s*(.*)/)) {
                                        lastVersion = matcher[0][1].trim()
                                }
                        }
                        
                        println "last version: " + lastVersion
                        
                        println "getting svn repo info, using details 
username=${svn_user}
password=${svn_pass}"
                        ant.svn(javahl: 'false', svnkit: 'false', 
username:"${svn_user}",
password: "${svn_pass}"){
        info(target: "${workspaceRoot}", propPrefix: 'svnInfoWorking',
verbose: 'true')
        info(target: "${svn_repo_root}/${product}/${project_branch}",
propPrefix: 'svnInfoRepo', verbose: 'true')

        println "Revision is: " +
ant.getProject().properties['svnInfoWorking.rev']
        println "\nGet of revision doesn't work yet, problems with
svnant from gradle. So we at the moment simply always build the
trunk\n"
        // here, instead, we should be doing a comparison to see if
svnInfoWorking.rev = svnInfoRepo.rev are the same
        // not simply assigning isBuildRequired to true
        isBuildRequired = true

                                if (forceBuild =='true'){
                                        isBuildRequired = true;
                                        println "Build forced .... commencing"
                                }
                        }
                }
                else{
                        println "building the trunk\n\n"
                        isFullCheckoutRequired = true
                        isBuildRequired = true          
                }

}


task intro(dependsOn: [prepareBuildProcess]) << {

  println 'now in intro'
}








On 12 January 2011 08:15, TheKaptain <[email protected]> wrote:
>
> If you could provide your build script definition for this task, I might be
> able to help you out. In the meantime, consider this alternative from Mr.
> Haki which uses plain Groovy to parse out the revision from svn:
> http://mrhaki.blogspot.com/2010/10/gradle-goodness-parse-output-from-exec.html
> --
> View this message in context: 
> http://gradle.1045684.n5.nabble.com/can-t-find-or-extract-properties-from-svnant-info-function-in-gradle-tp3335388p3337340.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to