mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:12:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
	
		
			657 B
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
	
		
			657 B
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
| #!/usr/bin/env python3
 | |
| 
 | |
| import subprocess
 | |
| import sys
 | |
| 
 | |
| short_hash = subprocess.check_output(['git', 'rev-parse', '--short=8', 'HEAD']).decode().strip()
 | |
| if subprocess.check_output(['git', 'status', '--porcelain=v2']) and short_hash:
 | |
|     short_hash += "-modified"
 | |
| 
 | |
| if not short_hash:
 | |
|     short_hash = "unknown"
 | |
| 
 | |
| with open(sys.argv[1], 'w') as f:
 | |
|     f.write(fr'''/*
 | |
|  * Automatically generated by Kernel/generate_version_header.py
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| #include <AK/StringView.h>
 | |
| 
 | |
| namespace Kernel {{
 | |
| 
 | |
| constexpr unsigned SERENITY_MAJOR_REVISION = 1;
 | |
| constexpr unsigned SERENITY_MINOR_REVISION = 0;
 | |
| constexpr StringView SERENITY_VERSION = "{short_hash}"sv;
 | |
| 
 | |
| }}
 | |
| ''')
 | 
