From 35ca130fb4c73a789febbc9e715a45caf692cdc5 Mon Sep 17 00:00:00 2001 From: Jens Geyer Date: Tue, 15 Mar 2016 23:04:27 +0200 Subject: [PATCH] THRIFT-3742 haxe php cli support Client: Haxe Patch: Oleksii Prudkyi + minor changes from Jens Geyer . --- lib/haxe/README.md | 1 + .../src/org/apache/thrift/helper/ZigZag.hx | 27 +++- .../org/apache/thrift/protocol/TProtocol.hx | 6 +- .../thrift/protocol/TProtocolDecorator.hx | 8 +- .../apache/thrift/protocol/TProtocolUtil.hx | 140 +++++++++--------- .../thrift/protocol/TRecursionTracker.hx | 32 ++-- .../apache/thrift/transport/TServerSocket.hx | 14 +- .../org/apache/thrift/transport/TSocket.hx | 22 ++- lib/haxe/test/Makefile.am | 15 +- lib/haxe/test/php.hxml | 5 +- test/haxe/Makefile.am | 23 ++- test/haxe/php.hxml | 6 +- test/haxe/src/TestClient.hx | 68 ++++++--- test/haxe/src/TestServer.hx | 2 +- test/haxe/src/TestServerHandler.hx | 16 +- tutorial/haxe/Makefile.am | 22 ++- tutorial/haxe/php.hxml | 5 +- 17 files changed, 262 insertions(+), 150 deletions(-) diff --git a/lib/haxe/README.md b/lib/haxe/README.md index fd4debea64b..2692be9734e 100644 --- a/lib/haxe/README.md +++ b/lib/haxe/README.md @@ -94,6 +94,7 @@ project files in these folders. Current status ======================== - tested with Haxe C++ target +- tested with Haxe PHP target (console, binary protocols) - transports: Socket, HTTP (client only), Stream - protocols: Binary, JSON, Multiplex, Compact - tutorial client and server available diff --git a/lib/haxe/src/org/apache/thrift/helper/ZigZag.hx b/lib/haxe/src/org/apache/thrift/helper/ZigZag.hx index 862060d8d13..6fb2e7b9e92 100644 --- a/lib/haxe/src/org/apache/thrift/helper/ZigZag.hx +++ b/lib/haxe/src/org/apache/thrift/helper/ZigZag.hx @@ -20,6 +20,7 @@ package org.apache.thrift.helper; import haxe.Int64; +import haxe.Int32; class ZigZag { @@ -28,7 +29,15 @@ class ZigZag { * represented compactly as a varint. */ public static function FromInt( n : Int) : UInt { + #if php + + return cast(cast(cast(n,Int32) << 1,Int32) ^ cast(cast(n,Int32) >> 31,Int32),UInt); + + #else + return cast(n << 1,UInt) ^ cast(n >> 31,UInt); + + #end } @@ -36,7 +45,22 @@ class ZigZag { * Convert from zigzag int to int. */ public static function ToInt( n : UInt) : Int { + #if php + + var convertedLong = ToLong(n); + //if overflow return high + if( convertedLong.high != convertedLong.low >> 31 ) { + return convertedLong.high; + } else { + return convertedLong.low; + } + + + #else + return (0x7FFFFFFF & cast(n >> 1,Int)) ^ (-cast(n & 1,Int)); + + #end } @@ -125,4 +149,5 @@ class ZigZag { } #end } - \ No newline at end of file + + \ No newline at end of file diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx index 22e88e44be9..b7f3842d01f 100644 --- a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx +++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx @@ -79,7 +79,7 @@ interface TProtocol { function readString() : String; function readBinary() : Bytes; - // recursion tracking - function IncrementRecursionDepth() : Void; - function DecrementRecursionDepth() : Void; + // recursion tracking + function IncrementRecursionDepth() : Void; + function DecrementRecursionDepth() : Void; } diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx index 22c5dd2507f..769e93cc55e 100644 --- a/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx +++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx @@ -216,11 +216,11 @@ class TProtocolDecorator implements TProtocol return wrapped.readBinary(); } - public function IncrementRecursionDepth() : Void { + public function IncrementRecursionDepth() : Void { return wrapped.IncrementRecursionDepth(); - } + } - public function DecrementRecursionDepth() : Void { + public function DecrementRecursionDepth() : Void { return wrapped.DecrementRecursionDepth(); - } + } } diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx index 71ed4ba36d8..1ec59d2cfa6 100644 --- a/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx +++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx @@ -35,76 +35,76 @@ class TProtocolUtil { * @param type the next value will be intepreted as this TType value. */ public static function skip(prot:TProtocol, type : Int) : Void { - prot.IncrementRecursionDepth(); - try - { - switch (type) { - case TType.BOOL: - prot.readBool(); - - case TType.BYTE: - prot.readByte(); - - case TType.I16: - prot.readI16(); - - case TType.I32: - prot.readI32(); - - case TType.I64: - prot.readI64(); - - case TType.DOUBLE: - prot.readDouble(); - - case TType.STRING: - prot.readBinary(); - - case TType.STRUCT: - prot.readStructBegin(); - while (true) { - var field:TField = prot.readFieldBegin(); - if (field.type == TType.STOP) { - break; - } - skip(prot, field.type); - prot.readFieldEnd(); - } - prot.readStructEnd(); - - case TType.MAP: - var map:TMap = prot.readMapBegin(); - for (i in 0 ... map.size) { - skip(prot, map.keyType); - skip(prot, map.valueType); - } - prot.readMapEnd(); - - case TType.SET: - var set:TSet = prot.readSetBegin(); - for (j in 0 ... set.size) { - skip(prot, set.elemType); - } - prot.readSetEnd(); - - case TType.LIST: - var list:TList = prot.readListBegin(); - for (k in 0 ... list.size) { - skip(prot, list.elemType); - } - prot.readListEnd(); - - default: - trace("Unknown field type ",type," in skipMaxDepth()"); - } - - prot.DecrementRecursionDepth(); - } - catch(e:Dynamic) - { - prot.DecrementRecursionDepth(); - throw e; - } + prot.IncrementRecursionDepth(); + try + { + switch (type) { + case TType.BOOL: + prot.readBool(); + + case TType.BYTE: + prot.readByte(); + + case TType.I16: + prot.readI16(); + + case TType.I32: + prot.readI32(); + + case TType.I64: + prot.readI64(); + + case TType.DOUBLE: + prot.readDouble(); + + case TType.STRING: + prot.readBinary(); + + case TType.STRUCT: + prot.readStructBegin(); + while (true) { + var field:TField = prot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + skip(prot, field.type); + prot.readFieldEnd(); + } + prot.readStructEnd(); + + case TType.MAP: + var map:TMap = prot.readMapBegin(); + for (i in 0 ... map.size) { + skip(prot, map.keyType); + skip(prot, map.valueType); + } + prot.readMapEnd(); + + case TType.SET: + var set:TSet = prot.readSetBegin(); + for (j in 0 ... set.size) { + skip(prot, set.elemType); + } + prot.readSetEnd(); + + case TType.LIST: + var list:TList = prot.readListBegin(); + for (k in 0 ... list.size) { + skip(prot, list.elemType); + } + prot.readListEnd(); + + default: + trace("Unknown field type ",type," in skipMaxDepth()"); + } + + prot.DecrementRecursionDepth(); + } + catch(e:Dynamic) + { + prot.DecrementRecursionDepth(); + throw e; + } } } diff --git a/lib/haxe/src/org/apache/thrift/protocol/TRecursionTracker.hx b/lib/haxe/src/org/apache/thrift/protocol/TRecursionTracker.hx index b882cf21fee..cf0211b39ab 100644 --- a/lib/haxe/src/org/apache/thrift/protocol/TRecursionTracker.hx +++ b/lib/haxe/src/org/apache/thrift/protocol/TRecursionTracker.hx @@ -24,25 +24,25 @@ import org.apache.thrift.*; class TRecursionTracker { - // default - private static inline var DEFAULT_RECURSION_DEPTH : Int = 64; + // default + private static inline var DEFAULT_RECURSION_DEPTH : Int = 64; - // limit and actual value - public var recursionLimit : Int = DEFAULT_RECURSION_DEPTH; + // limit and actual value + public var recursionLimit : Int = DEFAULT_RECURSION_DEPTH; private var recursionDepth : Int = 0; - public function IncrementRecursionDepth() : Void - { - if (recursionDepth < recursionLimit) - ++recursionDepth; - else - throw new TProtocolException(TProtocolException.DEPTH_LIMIT, "Depth limit exceeded"); - } - - public function DecrementRecursionDepth() : Void - { - --recursionDepth; - } + public function IncrementRecursionDepth() : Void + { + if (recursionDepth < recursionLimit) + ++recursionDepth; + else + throw new TProtocolException(TProtocolException.DEPTH_LIMIT, "Depth limit exceeded"); + } + + public function DecrementRecursionDepth() : Void + { + --recursionDepth; + } } diff --git a/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx index 586a8b6bf5d..4badb2a1f1c 100644 --- a/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx +++ b/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx @@ -39,26 +39,22 @@ class TServerSocket extends TServerTransport { // Underlying server with socket private var _socket : Socket= null; - // Port to listen on - private var _port : Int = 0; - // Timeout for client sockets from accept - private var _clientTimeout : Float = 0; + private var _clientTimeout : Float = 5; // Whether or not to wrap new TSocket connections in buffers private var _useBufferedSockets : Bool = false; - public function new( port : Int, clientTimeout : Float = 0, useBufferedSockets : Bool = false) + public function new(?address : String = 'localhost', port : Int, clientTimeout : Float = 5, useBufferedSockets : Bool = false) { - _port = port; _clientTimeout = clientTimeout; _useBufferedSockets = useBufferedSockets; try { _socket = new Socket(); - _socket.bind( new Host('localhost'), port); + _socket.bind( new Host(address), port); } catch (e : Dynamic) { @@ -74,7 +70,9 @@ class TServerSocket extends TServerTransport { if (_socket != null) { try { + #if !php _socket.listen(1); + #end } catch (e : Dynamic) { @@ -94,7 +92,7 @@ class TServerSocket extends TServerTransport { { var accepted = _socket.accept(); var result = TSocket.fromSocket(accepted); - accepted.setTimeout( _clientTimeout); + result.setTimeout( _clientTimeout); if( _useBufferedSockets) { diff --git a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx index 8aa060865e3..7941ab9fe5f 100644 --- a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx +++ b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx @@ -73,7 +73,7 @@ class TSocket extends TTransport { private var output : Output = null; #end - private static inline var DEFAULT_TIMEOUT = 5.0; + private var timeout : Float = 30; private var obuffer : BytesOutput = new BytesOutput(); private var ioCallback : TException->Void = null; @@ -92,7 +92,8 @@ class TSocket extends TTransport { #if ! (flash || js) // used by TSocketServer public static function fromSocket( socket : Socket) : TSocket { - var result = new TSocket("",0); + var socketHost = socket.host(); + var result = new TSocket(socketHost.host.toString(), socketHost.port); result.assignSocket(socket); return result; } @@ -240,7 +241,7 @@ class TSocket extends TTransport { } catch (e : TException) { - trace('TException $e'); + trace('TException $e, message : ${e.errorMsg}'); if(ioCallback != null) { ioCallback(e); } @@ -270,11 +271,17 @@ class TSocket extends TTransport { var socket = new Socket(); socket.connect(host, port); + #elseif php + var socket = new Socket(); + socket.connect(host, port); + socket.setBlocking(true); + socket.setTimeout(timeout); + #else var socket = new Socket(); socket.setBlocking(true); socket.setFastSend(true); - socket.setTimeout( DEFAULT_TIMEOUT); + socket.setTimeout(timeout); socket.connect(host, port); #end @@ -301,4 +308,11 @@ class TSocket extends TTransport { #end } + public function setTimeout( timeout : Float ) : Void { + if(isOpen()) { + socket.setTimeout(timeout); + } + this.timeout = timeout; + } + } diff --git a/lib/haxe/test/Makefile.am b/lib/haxe/test/Makefile.am index 7d29f8166b0..5c638d4aa3f 100644 --- a/lib/haxe/test/Makefile.am +++ b/lib/haxe/test/Makefile.am @@ -24,6 +24,7 @@ AGGR = $(top_srcdir)/contrib/async-test/aggr.thrift BENCHMARK = $(top_srcdir)/lib/rb/benchmark/Benchmark.thrift BIN_CPP = bin/Main-debug +BIN_PHP = bin/php/Main-debug.php gen-haxe/thrift/test/ThriftTest.hx: $(THRIFTTEST) $(THRIFTCMD) $(THRIFTTEST) @@ -34,7 +35,7 @@ gen-haxe/thrift/test/Aggr.hx: $(AGGR) gen-haxe/thrift/test/BenchmarkService.hx: $(BENCHMARK) $(THRIFTCMD) $(BENCHMARK) -all-local: $(BIN_CPP) +all-local: $(BIN_CPP) $(BIN_PHP) $(BIN_CPP): \ src/*.hx \ @@ -44,6 +45,14 @@ $(BIN_CPP): \ gen-haxe/thrift/test/BenchmarkService.hx $(HAXE) --cwd . cpp.hxml +$(BIN_PHP): \ + src/*.hx \ + ../src/org/apache/thrift/**/*.hx \ + gen-haxe/thrift/test/ThriftTest.hx \ + gen-haxe/thrift/test/Aggr.hx \ + gen-haxe/thrift/test/BenchmarkService.hx + $(HAXE) --cwd . php.hxml + #TODO: other haxe targets # $(HAXE) --cwd . csharp @@ -51,15 +60,15 @@ $(BIN_CPP): \ # $(HAXE) --cwd . java # $(HAXE) --cwd . javascript # $(HAXE) --cwd . neko -# $(HAXE) --cwd . php # $(HAXE) --cwd . python # needs Haxe 3.2.0 clean-local: $(RM) -r gen-haxe bin -check: $(BIN_CPP) +check: $(BIN_CPP) $(BIN_PHP) $(BIN_CPP) + php -f $(BIN_PHP) EXTRA_DIST = \ src \ diff --git a/lib/haxe/test/php.hxml b/lib/haxe/test/php.hxml index b86e64c3982..14f2b2d0102 100644 --- a/lib/haxe/test/php.hxml +++ b/lib/haxe/test/php.hxml @@ -26,7 +26,8 @@ -main Main #PHP target --php bin/Test.php +-php bin/php/ +--php-front Main-debug.php #Add debug information -debug @@ -35,4 +36,4 @@ #"-dce no" : do not remove unused code #"-dce std" : remove unused code in the std lib (default) #"-dce full" : remove all unused code --dce full \ No newline at end of file +-dce full diff --git a/test/haxe/Makefile.am b/test/haxe/Makefile.am index 37ccfc38931..6094452f9c3 100644 --- a/test/haxe/Makefile.am +++ b/test/haxe/Makefile.am @@ -22,11 +22,12 @@ THRIFTCMD = $(THRIFT) --gen haxe -r THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift BIN_CPP = bin/Main-debug +BIN_PHP = bin/php/Main-debug.php gen-haxe/thrift/test/ThriftTest.hx: $(THRIFTTEST) $(THRIFTCMD) $(THRIFTTEST) -all-local: $(BIN_CPP) +all-local: $(BIN_CPP) $(BIN_PHP) $(BIN_CPP): \ src/*.hx \ @@ -34,6 +35,14 @@ $(BIN_CPP): \ gen-haxe/thrift/test/ThriftTest.hx $(HAXE) --cwd . cpp.hxml +$(BIN_PHP): \ + src/*.hx \ + ../../lib/haxe/src/org/apache/thrift/**/*.hx \ + gen-haxe/thrift/test/ThriftTest.hx + $(HAXE) --cwd . php.hxml + + + #TODO: other haxe targets # $(HAXE) --cwd . csharp @@ -41,19 +50,27 @@ $(BIN_CPP): \ # $(HAXE) --cwd . java # $(HAXE) --cwd . javascript # $(HAXE) --cwd . neko -# $(HAXE) --cwd . php # $(HAXE) --cwd . python # needs Haxe 3.2.0 clean-local: $(RM) -r gen-haxe bin -check: $(BIN_CPP) +check: check_cpp check_php + +check_cpp: $(BIN_CPP) timeout 10 $(BIN_CPP) server & sleep 1 $(BIN_CPP) client sleep 10 +check_php: $(BIN_PHP) + timeout 10 php -f $(BIN_PHP) server & + sleep 1 + php -f $(BIN_PHP) client + sleep 10 + + EXTRA_DIST = \ src \ cpp.hxml \ diff --git a/test/haxe/php.hxml b/test/haxe/php.hxml index 1eaac8b2b94..96518984330 100644 --- a/test/haxe/php.hxml +++ b/test/haxe/php.hxml @@ -26,7 +26,9 @@ -main Main #PHP target --php bin/Tutorial.php +-php bin/php/ +--php-front Main-debug.php + #Add debug information -debug @@ -35,4 +37,4 @@ #"-dce no" : do not remove unused code #"-dce std" : remove unused code in the std lib (default) #"-dce full" : remove all unused code --dce full \ No newline at end of file +-dce full diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx index 5c0de7c7650..ee1f0194048 100644 --- a/test/haxe/src/TestClient.hx +++ b/test/haxe/src/TestClient.hx @@ -43,6 +43,8 @@ import cpp.vm.Thread; import thrift.test.*; // generated code +using StringTools; + class TestResults { private var successCnt : Int = 0; private var errorCnt : Int = 0; @@ -102,7 +104,7 @@ class TestResults { if ( errorCnt > 0) { trace('==========================='); - trace('FAILED TESTS: $failedTests'); + trace('FAILED TESTS: $failedTests'); } trace('==========================='); } @@ -118,20 +120,15 @@ class TestClient { { var difft = Timer.stamp(); - if( args.numThreads > 1) { - var threads = new List(); - for( test in 0 ... args.numThreads) { - threads.add( StartThread( args)); - } - exitCode = 0; - for( thread in threads) { - exitCode |= Thread.readMessage(true); - } + if ( args.numThreads > 1) { + #if cpp + exitCode = MultiThreadClient(args); + #else + trace('Threads not supported/implemented for this platform.'); + exitCode = SingleThreadClient(args); + #end } else { - var rslt = new TestResults(true); - RunClient(args,rslt); - rslt.PrintSummary(); - exitCode = rslt.CalculateExitCode(); + exitCode = SingleThreadClient(args); } difft = Math.round( 1000 * (Timer.stamp() - difft)) / 1000; @@ -154,6 +151,31 @@ class TestClient { } + public static function SingleThreadClient(args : Arguments) : Int + { + var rslt = new TestResults(true); + RunClient(args,rslt); + rslt.PrintSummary(); + return rslt.CalculateExitCode(); + } + + + #if cpp + public static function MultiThreadClient(args : Arguments) : Int + { + var threads = new List(); + for( test in 0 ... args.numThreads) { + threads.add( StartThread( args)); + } + var exitCode : Int = 0; + for( thread in threads) { + exitCode |= Thread.readMessage(true); + } + return exitCode; + } + #end + + #if cpp private static function StartThread(args : Arguments) : Thread { var thread = Thread.create( function() : Void { @@ -179,6 +201,7 @@ class TestClient { thread.sendMessage(Thread.current()); return thread; } + #end public static function RunClient(args : Arguments, rslt : TestResults) @@ -297,8 +320,9 @@ class TestClient { rslt.Expect( c32 == c64, "Int64Map Test #30"); rslt.Expect( '$ksum64' == '$ksum32', '$ksum64 == $ksum32 Test #31'); - var s32 = map32.toString(); - var s64 = map64.toString(); + //compare without spaces because differ in php and cpp + var s32 = map32.toString().replace(' ', ''); + var s64 = map64.toString().replace(' ', ''); rslt.Expect( s32 == s64, "Int64Map.toString(): " + ' ("$s32" == "$s64") Test #32'); map32.remove( 42); @@ -322,8 +346,8 @@ class TestClient { // core module unit tests public static function ModuleUnitTests( args : Arguments, rslt : TestResults) : Void { - #if debug - + #if debug + try { BitConverter.UnitTest(); rslt.Expect( true, 'BitConverter.UnitTest Test #100'); @@ -339,8 +363,8 @@ class TestClient { catch( e : Dynamic) { rslt.Expect( false, 'ZigZag.UnitTest: $e Test #101'); } - - #end + + #end } @@ -464,11 +488,11 @@ class TestClient { trace('testBool(${true})'); var b = client.testBool(true); trace(' = $b'); - rslt.Expect(b, '$b == "${true}"'); + rslt.Expect(b, '$b == "${true}"'); trace('testBool(${false})'); b = client.testBool(false); trace(' = $b'); - rslt.Expect( ! b, '$b == "${false}"'); + rslt.Expect( ! b, '$b == "${false}"'); trace('testString("Test")'); var s = client.testString("Test"); diff --git a/test/haxe/src/TestServer.hx b/test/haxe/src/TestServer.hx index bff5a47abc9..8f4604a6e50 100644 --- a/test/haxe/src/TestServer.hx +++ b/test/haxe/src/TestServer.hx @@ -106,7 +106,7 @@ class TestServer } catch (x : TException) { - trace('$x ${x.errorID} ${x.errorMsg}'); + trace('$x ${x.errorID} ${x.errorMsg}'); } catch (x : Dynamic) { diff --git a/test/haxe/src/TestServerHandler.hx b/test/haxe/src/TestServerHandler.hx index 74a8805d430..9fba1360b61 100644 --- a/test/haxe/src/TestServerHandler.hx +++ b/test/haxe/src/TestServerHandler.hx @@ -51,14 +51,14 @@ class TestServerHandler implements ThriftTest { trace("testVoid()"); } - /** - * Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' - * @param bool thing - the bool data to print - * @return bool - returns the bool 'thing' - * - * @param thing - */ - public function testBool(thing : Bool) : Bool + /** + * Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false' + * @param bool thing - the bool data to print + * @return bool - returns the bool 'thing' + * + * @param thing + */ + public function testBool(thing : Bool) : Bool { trace('testBool($thing)'); return thing; diff --git a/tutorial/haxe/Makefile.am b/tutorial/haxe/Makefile.am index c3c5204f7db..139bccb6628 100644 --- a/tutorial/haxe/Makefile.am +++ b/tutorial/haxe/Makefile.am @@ -18,11 +18,13 @@ # THRIFT = $(top_builddir)/compiler/cpp/thrift +BIN_PHP = bin/php/Main-debug.php + gen-haxe/tutorial/calculator.hx gen-haxe/shared/shared_service.hx: $(top_srcdir)/tutorial/tutorial.thrift $(THRIFT) --gen haxe -r $< -all-local: bin/Main-debug +all-local: bin/Main-debug $(BIN_PHP) check: gen-haxe/tutorial/calculator.hx @@ -32,18 +34,36 @@ bin/Main-debug: \ gen-haxe/tutorial/calculator.hx $(HAXE) --cwd . cpp.hxml +$(BIN_PHP): \ + src/*.hx \ + ../../lib/haxe/src/org/apache/thrift/**/*.hx \ + gen-haxe/tutorial/calculator.hx + $(HAXE) --cwd . php.hxml + tutorialserver: all bin/Main-debug server +tutorialserver_php: all + php -f $(BIN_PHP) server + tutorialclient: all bin/Main-debug +tutorialclient_php: all + php -f $(BIN_PHP) + tutorialsecureserver: all bin/Main-debug server secure +tutorialsecureserver_php: all + php -f $(BIN_PHP) server secure + tutorialsecureclient: all bin/Main-debug secure +tutorialsecureclient_php: all + php -f $(BIN_PHP) secure + clean-local: $(RM) -r gen-haxe bin diff --git a/tutorial/haxe/php.hxml b/tutorial/haxe/php.hxml index 1eaac8b2b94..c2f68878e13 100644 --- a/tutorial/haxe/php.hxml +++ b/tutorial/haxe/php.hxml @@ -26,7 +26,8 @@ -main Main #PHP target --php bin/Tutorial.php +-php bin/php/ +--php-front Main-debug.php #Add debug information -debug @@ -35,4 +36,4 @@ #"-dce no" : do not remove unused code #"-dce std" : remove unused code in the std lib (default) #"-dce full" : remove all unused code --dce full \ No newline at end of file +-dce full