Build numbers: major.minor.revision

后端 未结 7 2011
一向
一向 2020-12-22 17:47

How would you write a build.xml file, using neither custom code nor external dependencies (such as a shell script), that:

  • Generates a build number
7条回答
  •  情深已故
    2020-12-22 18:20

    This solution does increment minor or revision number automatically if a compile or a dist target has been selected. The incrementation can be switched off if one of the following properties has been set:

    • -Dno.increment.minor=true
    • -Dno.increment.revision=true

    If the property inc.major has been set, then the major number will be incremented and the other both values will be set to zero. The SHA-1 checksum is being calculated by the textual representation of the version file.

    By the way: If would have been allowed, you could create your own ant task in java script, which is included in JDK 6.

    Now here's the ant file

    
    
    
        
    
        
            
                
                
                
            
        
    
        
            
                
                
                
            
        
    
        
            
            
            
                
                
                
            
            
        
    
        
            
            
        
    
        
            
        
    
        
            
                
                
                Version: ${major.number}.${minor.number}.${build.number}
                SHA1: ${sha1.number}
            
        
    
        
    
        
    
    
    

提交回复
热议问题