Browse Source

Merge pull request #4143 from andyli/version

Let `haxe -version` output version_extra too.
Simon Krajewski 10 years ago
parent
commit
7a8734aaa1
3 changed files with 4 additions and 10 deletions
  1. 1 1
      Makefile
  2. 0 6
      Makefile.win
  3. 3 3
      main.ml

+ 1 - 1
Makefile

@@ -61,7 +61,7 @@ else
 endif
 endif
 
 
 ifneq ($(ADD_REVISION),0)
 ifneq ($(ADD_REVISION),0)
-	VERSION_EXTRA="let version_extra = Some \" (git build $(shell git rev-parse --abbrev-ref HEAD) @ $(shell git describe --always)) \""
+	VERSION_EXTRA="let version_extra = Some \"(git build $(shell git rev-parse --abbrev-ref HEAD) @ $(shell git rev-parse --short HEAD))\""
 else
 else
 	VERSION_EXTRA="let version_extra = None"
 	VERSION_EXTRA="let version_extra = None"
 endif
 endif

+ 0 - 6
Makefile.win

@@ -5,12 +5,6 @@ EXTENSION=.exe
 
 
 OCAMLOPT=ocamlopt.opt
 OCAMLOPT=ocamlopt.opt
 
 
-ifneq ($(ADD_REVISION),0)
-	VERSION_EXTRA=let version_extra = Some " (git build $(shell git rev-parse --abbrev-ref HEAD) @ $(shell git describe --always)) "
-else
-	VERSION_EXTRA=let version_extra = None
-endif
-
 kill:
 kill:
 	-@taskkill /F /IM haxe.exe
 	-@taskkill /F /IM haxe.exe
 
 

+ 3 - 3
main.ml

@@ -96,7 +96,7 @@ let is_debug_run() =
 	try Sys.getenv "HAXEDEBUG" = "1" with _ -> false
 	try Sys.getenv "HAXEDEBUG" = "1" with _ -> false
 
 
 let s_version =
 let s_version =
-	Printf.sprintf "%d.%d.%d" version_major version_minor version_revision
+	Printf.sprintf "%d.%d.%d%s" version_major version_minor version_revision (match Version.version_extra with None -> "" | Some v -> " " ^ v)
 
 
 let format msg p =
 let format msg p =
 	if p = Ast.null_pos then
 	if p = Ast.null_pos then
@@ -978,8 +978,8 @@ and do_connect host port args =
 
 
 and init ctx =
 and init ctx =
 	let usage = Printf.sprintf
 	let usage = Printf.sprintf
-		"Haxe Compiler %s %s- (C)2005-2015 Haxe Foundation\n Usage : haxe%s -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]\n Options :"
-		s_version (match Version.version_extra with None -> "" | Some v -> v) (if Sys.os_type = "Win32" then ".exe" else "")
+		"Haxe Compiler %s - (C)2005-2015 Haxe Foundation\n Usage : haxe%s -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]\n Options :"
+		s_version (if Sys.os_type = "Win32" then ".exe" else "")
 	in
 	in
 	let com = ctx.com in
 	let com = ctx.com in
 	let classes = ref [([],"Std")] in
 	let classes = ref [([],"Std")] in