| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  | import groovy.json.JsonSlurper | 
					
						
							|  |  |  | import org.apache.tools.ant.filters.ReplaceTokens | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  | def detailedVersionString = "0.0.0-unknown-SNAPSHOT" | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  | task readJsonData { | 
					
						
							|  |  |  |   def inputFile = file("${rootProject.buildDir}/version.json") | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  |   if (inputFile.exists()) { | 
					
						
							|  |  |  |     def jsonSlurper = new JsonSlurper() | 
					
						
							|  |  |  |     def data = jsonSlurper.parse(inputFile) | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  |     detailedVersionString = data.fullVersion | 
					
						
							|  |  |  |     version = data.javaVersion | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     println "JSON file not found: ${inputFile.path}" | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  | processResources { | 
					
						
							|  |  |  |   filter(ReplaceTokens, tokens:[fullVersion: detailedVersionString]) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-09-08 23:36:15 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-10 22:43:31 +05:30
										 |  |  | task printVersionDetails() { | 
					
						
							|  |  |  |   println("fullVersion=" + detailedVersionString) | 
					
						
							|  |  |  |   println("version=" +  version) | 
					
						
							|  |  |  | } |