How to conditionally set arg value of exec task?

后端 未结 2 1578
后悔当初
后悔当初 2020-12-19 02:42

I\'ve got an ant build script which I should modify. Specifically I should make a subversion checkout conditional: currently only the trunk gets checked out, the new version

2条回答
  •  不思量自难忘°
    2020-12-19 03:40

    You could define a wrapper target which depends on two other targets - one of which does trunk checkout, the other of which does branch checkout - and each of which is conditional on existence of your optional branch property.

    You could further abstract the exec call into a macrodef to which you pass the trunk or branch url.

    For example:

    
    
        
    
        
            
        
    
        
            
        
    
        
            
            
                
            
        
    
    
    

    Output with no branch property defined:

    do-svn-trunk-checkout:
         [echo] svn-url=http://t01/svn/java/trunk
    
    do-svn-branch-checkout:
    
    do-svn-checkout:
    

    Output with branch property defined:

    do-svn-trunk-checkout:
    
    do-svn-branch-checkout:
         [echo] svn-url=http://t01/svn/hlfg/HLFG/java/branch/mybranch
    
    do-svn-checkout:
    

提交回复
热议问题