THRIFT-2905 Cocoa compiler should have option to produce "modern" Objective-C Client: Cocoa (ObjectiveC & Swift) Author: Kevin Wooten <[email protected]>
This closes #539 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/56e5b9b0 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/56e5b9b0 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/56e5b9b0 Branch: refs/heads/master Commit: 56e5b9b01b5a033306d583cd2aec07a0dda3c9f5 Parents: 983bf7d Author: Jens Geyer <[email protected]> Authored: Fri Oct 9 22:01:55 2015 +0200 Committer: Jens Geyer <[email protected]> Committed: Fri Oct 9 22:01:55 2015 +0200 ---------------------------------------------------------------------- Thrift.podspec | 18 + compiler/cpp/CMakeLists.txt | 1 + compiler/cpp/Makefile.am | 1 + compiler/cpp/compiler.vcxproj | 1 + compiler/cpp/compiler.vcxproj.filters | 3 + compiler/cpp/src/generate/t_cocoa_generator.cc | 1666 ++++++++------ compiler/cpp/src/generate/t_swift_generator.cc | 2145 ++++++++++++++++++ lib/cocoa/src/TApplicationError.h | 55 + lib/cocoa/src/TApplicationError.m | 231 ++ lib/cocoa/src/TApplicationException.h | 49 - lib/cocoa/src/TApplicationException.m | 146 -- lib/cocoa/src/TBaseClient.h | 9 +- lib/cocoa/src/TBaseClient.m | 41 +- lib/cocoa/src/TBinary.swift | 122 + lib/cocoa/src/TEnum.swift | 31 + lib/cocoa/src/TError.h | 23 + lib/cocoa/src/TError.m | 23 + lib/cocoa/src/TException.h | 34 - lib/cocoa/src/TException.m | 65 - lib/cocoa/src/TList.swift | 148 ++ lib/cocoa/src/TMap.swift | 158 ++ lib/cocoa/src/TObjective-C.h | 72 - lib/cocoa/src/TProcessor.h | 10 +- lib/cocoa/src/TProcessorFactory.h | 8 +- lib/cocoa/src/TProtocol.swift | 190 ++ lib/cocoa/src/TSerializable.swift | 178 ++ lib/cocoa/src/TSet.swift | 161 ++ lib/cocoa/src/TSharedProcessorFactory.h | 9 +- lib/cocoa/src/TSharedProcessorFactory.m | 29 +- lib/cocoa/src/TStruct.swift | 31 + lib/cocoa/src/protocol/TBase.h | 13 +- lib/cocoa/src/protocol/TBinaryProtocol.h | 32 +- lib/cocoa/src/protocol/TBinaryProtocol.m | 766 ++++--- lib/cocoa/src/protocol/TCompactProtocol.h | 12 +- lib/cocoa/src/protocol/TCompactProtocol.m | 1038 ++++++--- lib/cocoa/src/protocol/TMultiplexedProtocol.h | 17 +- lib/cocoa/src/protocol/TMultiplexedProtocol.m | 65 +- lib/cocoa/src/protocol/TProtocol.h | 170 +- lib/cocoa/src/protocol/TProtocolDecorator.h | 12 +- lib/cocoa/src/protocol/TProtocolDecorator.m | 273 ++- lib/cocoa/src/protocol/TProtocolError.h | 76 + lib/cocoa/src/protocol/TProtocolError.m | 33 + lib/cocoa/src/protocol/TProtocolException.h | 25 - lib/cocoa/src/protocol/TProtocolException.m | 23 - lib/cocoa/src/protocol/TProtocolFactory.h | 9 +- lib/cocoa/src/protocol/TProtocolUtil.h | 12 +- lib/cocoa/src/protocol/TProtocolUtil.m | 197 +- lib/cocoa/src/server/TSocketServer.h | 24 +- lib/cocoa/src/server/TSocketServer.m | 193 +- lib/cocoa/src/transport/TAsyncTransport.h | 23 +- lib/cocoa/src/transport/TFramedTransport.h | 12 +- lib/cocoa/src/transport/TFramedTransport.m | 219 +- lib/cocoa/src/transport/THTTPClient.h | 42 - lib/cocoa/src/transport/THTTPClient.m | 161 -- lib/cocoa/src/transport/THTTPSessionTransport.h | 47 + lib/cocoa/src/transport/THTTPSessionTransport.m | 268 +++ lib/cocoa/src/transport/THTTPTransport.h | 39 + lib/cocoa/src/transport/THTTPTransport.m | 182 ++ lib/cocoa/src/transport/TMemoryBuffer.h | 20 +- lib/cocoa/src/transport/TMemoryBuffer.m | 115 +- .../src/transport/TNSFileHandleTransport.h | 17 +- .../src/transport/TNSFileHandleTransport.m | 99 +- lib/cocoa/src/transport/TNSStreamTransport.h | 21 +- lib/cocoa/src/transport/TNSStreamTransport.m | 141 +- lib/cocoa/src/transport/TSSLSocketClient.h | 40 - lib/cocoa/src/transport/TSSLSocketClient.m | 261 --- lib/cocoa/src/transport/TSSLSocketException.h | 29 - lib/cocoa/src/transport/TSSLSocketException.m | 42 - lib/cocoa/src/transport/TSSLSocketTransport.h | 37 + lib/cocoa/src/transport/TSSLSocketTransport.m | 304 +++ .../src/transport/TSSLSocketTransportError.h | 30 + .../src/transport/TSSLSocketTransportError.m | 23 + lib/cocoa/src/transport/TSocketClient.h | 36 - lib/cocoa/src/transport/TSocketClient.m | 87 - lib/cocoa/src/transport/TSocketTransport.h | 34 + lib/cocoa/src/transport/TSocketTransport.m | 73 + lib/cocoa/src/transport/TTransport.h | 36 +- lib/cocoa/src/transport/TTransportError.h | 43 + lib/cocoa/src/transport/TTransportError.m | 27 + lib/cocoa/src/transport/TTransportException.h | 30 - lib/cocoa/src/transport/TTransportException.m | 44 - 81 files changed, 7993 insertions(+), 3237 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/56e5b9b0/Thrift.podspec ---------------------------------------------------------------------- diff --git a/Thrift.podspec b/Thrift.podspec new file mode 100644 index 0000000..39d3780 --- /dev/null +++ b/Thrift.podspec @@ -0,0 +1,18 @@ +Pod::Spec.new do |s| + s.name = "Thrift" + s.version = "1.0.0" + s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC." + s.description = <<-DESC +The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages. + DESC + s.homepage = "http://thrift.apache.org" + s.license = { :type => 'Apache License, Version 2.0', :url => 'https://raw.github.com/apache/thrift/thrift-0.9.0/LICENSE' } + s.author = { "The Apache Software Foundation" => "[email protected]" } + s.requires_arc = true + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.8' + s.ios.framework = 'CFNetwork' + s.osx.framework = 'CoreServices' + s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-1.0.0" } + s.source_files = 'lib/cocoa/src/**/*.{h,m,swift}' +end \ No newline at end of file http://git-wip-us.apache.org/repos/asf/thrift/blob/56e5b9b0/compiler/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt index 2d0c3f0..94b3c19 100644 --- a/compiler/cpp/CMakeLists.txt +++ b/compiler/cpp/CMakeLists.txt @@ -109,6 +109,7 @@ THRIFT_ADD_COMPILER(perl "Enable compiler for Perl" ON) THRIFT_ADD_COMPILER(php "Enable compiler for PHP" ON) THRIFT_ADD_COMPILER(erl "Enable compiler for Erlang" ON) THRIFT_ADD_COMPILER(cocoa "Enable compiler for Cocoa Objective-C" ON) +THRIFT_ADD_COMPILER(swift "Enable compiler for Cocoa Swift" ON) THRIFT_ADD_COMPILER(st "Enable compiler for Smalltalk" ON) THRIFT_ADD_COMPILER(ocaml "Enable compiler for OCaml" ON) THRIFT_ADD_COMPILER(hs "Enable compiler for Haskell" ON) http://git-wip-us.apache.org/repos/asf/thrift/blob/56e5b9b0/compiler/cpp/Makefile.am ---------------------------------------------------------------------- diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am index 2aa6913..427062c 100644 --- a/compiler/cpp/Makefile.am +++ b/compiler/cpp/Makefile.am @@ -83,6 +83,7 @@ thrift_SOURCES += src/generate/t_c_glib_generator.cc \ src/generate/t_php_generator.cc \ src/generate/t_erl_generator.cc \ src/generate/t_cocoa_generator.cc \ + src/generate/t_swift_generator.cc \ src/generate/t_st_generator.cc \ src/generate/t_ocaml_generator.cc \ src/generate/t_hs_generator.cc \ http://git-wip-us.apache.org/repos/asf/thrift/blob/56e5b9b0/compiler/cpp/compiler.vcxproj ---------------------------------------------------------------------- diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj index bc1215f..fbd41ad 100644 --- a/compiler/cpp/compiler.vcxproj +++ b/compiler/cpp/compiler.vcxproj @@ -78,6 +78,7 @@ <ClCompile Include="src\generate\t_py_generator.cc" /> <ClCompile Include="src\generate\t_rb_generator.cc" /> <ClCompile Include="src\generate\t_st_generator.cc" /> + <ClCompile Include="src\generate\t_swift_generator.cc" /> <ClCompile Include="src\generate\t_xsd_generator.cc" /> <ClCompile Include="src\main.cc" /> <ClCompile Include="src\md5.c" /> http://git-wip-us.apache.org/repos/asf/thrift/blob/56e5b9b0/compiler/cpp/compiler.vcxproj.filters ---------------------------------------------------------------------- diff --git a/compiler/cpp/compiler.vcxproj.filters b/compiler/cpp/compiler.vcxproj.filters index 5126019..6e41afb 100644 --- a/compiler/cpp/compiler.vcxproj.filters +++ b/compiler/cpp/compiler.vcxproj.filters @@ -165,6 +165,9 @@ <ClCompile Include="src\generate\t_st_generator.cc"> <Filter>generate</Filter> </ClCompile> + <ClCompile Include="src\generate\t_swift_generator.cc"> + <Filter>generate</Filter> + </ClCompile> <ClCompile Include="src\generate\t_xsd_generator.cc"> <Filter>generate</Filter> </ClCompile>
