mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-11-04 04:39:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			794 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			794 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
import groovy.json.JsonSlurper
 | 
						|
import org.apache.tools.ant.filters.ReplaceTokens
 | 
						|
 | 
						|
 | 
						|
def detailedVersionString = "0.0.0-unknown-SNAPSHOT"
 | 
						|
def cliMajorVersion = "0.15.0" // base default cli major version
 | 
						|
 | 
						|
task readJsonData {
 | 
						|
  def inputFile = file("${rootProject.buildDir}/version.json")
 | 
						|
 | 
						|
  if (inputFile.exists()) {
 | 
						|
    def jsonSlurper = new JsonSlurper()
 | 
						|
    def data = jsonSlurper.parse(inputFile)
 | 
						|
 | 
						|
    detailedVersionString = data.fullVersion
 | 
						|
    cliMajorVersion = data.cliMajorVersion
 | 
						|
    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)
 | 
						|
}
 |