Skip to content

Commit

Permalink
[cs] Add support for lib loading on no_root and erase_generics
Browse files Browse the repository at this point in the history
  • Loading branch information
waneck committed Mar 15, 2015
1 parent 67d74cd commit d10880b
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 4 deletions.
7 changes: 6 additions & 1 deletion gencs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3261,7 +3261,12 @@ let configure gen =
| _ :: _ when not erase_generics -> "_" ^ string_of_int (List.length c.cl_params)
| _ -> ""
in
let path = (fst c.cl_path, snd c.cl_path ^ extra) in
let pack = match c.cl_path with
| ([], _) when no_root && is_hxgen (TClassDecl c) ->
["haxe";"root"]
| (p,_) -> p
in
let path = (pack, snd c.cl_path ^ extra) in
ignore (List.find (function (_,_,_,lookup) ->
is_some (lookup path)) haxe_libs);
c.cl_extern <- true;
Expand Down
7 changes: 5 additions & 2 deletions tests/RunCi.hx
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,11 @@ class RunCi {
runExe("bin/Main-Debug.exe", args);

changeDirectory(miscDir + "csTwoLibs");
runCommand("haxe", ["compile.hxml"]);
runExe("bin/main/bin/Main.exe");
for (i in 1...5)
{
runCommand("haxe", ['compile-$i.hxml']);
runExe("bin/main/bin/Main.exe");
}

case Flash9:
setupFlashPlayerDebugger();
Expand Down
3 changes: 2 additions & 1 deletion tests/misc/csTwoLibs/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ class Main
public static function main()
{
var asm = cs.system.reflection.Assembly.LoadFile(sys.FileSystem.fullPath("bin/lib1/bin/lib1.dll"));
var tp:Dynamic = asm.GetType("Lib1");
var name = #if no_root "haxe.root.Lib1" #else "Lib1" #end;
var tp:Dynamic = asm.GetType(name);
var obj = tp.test();
trace(obj);
for (field in Reflect.fields(obj))
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions tests/misc/csTwoLibs/compile-2.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cs.Boot
-dce no
-cs bin/haxeboot
-D no_root
--next
-net-lib bin/haxeboot/bin/haxeboot.dll
-dce no
-D dll_import
-D no_root
Lib1
-cs bin/lib1
--next
-net-lib bin/haxeboot/bin/haxeboot.dll
-dce no
-D dll_import
-D no_root
-main Main
-cs bin/main
18 changes: 18 additions & 0 deletions tests/misc/csTwoLibs/compile-3.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cs.Boot
-dce no
-cs bin/haxeboot
-D erase_generics
--next
-net-lib bin/haxeboot/bin/haxeboot.dll
-dce no
-D dll_import
-D erase_generics
Lib1
-cs bin/lib1
--next
-net-lib bin/haxeboot/bin/haxeboot.dll
-dce no
-D dll_import
-D erase_generics
-main Main
-cs bin/main
21 changes: 21 additions & 0 deletions tests/misc/csTwoLibs/compile-4.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cs.Boot
-dce no
-cs bin/haxeboot
-D erase_generics
-D no_root
--next
-net-lib bin/haxeboot/bin/haxeboot.dll
-dce no
-D dll_import
-D erase_generics
-D no_root
Lib1
-cs bin/lib1
--next
-net-lib bin/haxeboot/bin/haxeboot.dll
-dce no
-D dll_import
-D erase_generics
-D no_root
-main Main
-cs bin/main

0 comments on commit d10880b

Please sign in to comment.