mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-10-31 10:49:00 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			686 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			686 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
| import groovy.json.JsonSlurper
 | |
| import org.apache.tools.ant.filters.ReplaceTokens
 | |
| 
 | |
| 
 | |
| def detailedVersionString = "0.0.0-unknown-SNAPSHOT"
 | |
| 
 | |
| task readJsonData {
 | |
|   def inputFile = file("${rootProject.buildDir}/version.json")
 | |
| 
 | |
|   if (inputFile.exists()) {
 | |
|     def jsonSlurper = new JsonSlurper()
 | |
|     def data = jsonSlurper.parse(inputFile)
 | |
| 
 | |
|     detailedVersionString = data.fullVersion
 | |
|     version = data.javaVersion
 | |
|   } else {
 | |
|     println "JSON file not found: ${inputFile.path}"
 | |
|   }
 | |
| }
 | |
| 
 | |
| processResources {
 | |
|   filter(ReplaceTokens, tokens:[fullVersion: detailedVersionString])
 | |
| }
 | |
| 
 | |
| task printVersionDetails() {
 | |
|   println("fullVersion=" + detailedVersionString)
 | |
|   println("version=" +  version)
 | |
| }
 | 
