Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CGRPCZlib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.homepage = 'https://www.grpc.io'
s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' }

s.source = { :git => 'https://github.com/grpc/grpc-swift.git', :tag => s.version }
s.source = { :git => "https://github.com/grpc/grpc-swift.git", :tag => s.version }

s.swift_version = '5.0'
s.ios.deployment_target = '10.0'
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,22 @@ To install these plugins, just copy the two executables (`protoc-gen-swift` and
that is part of your `PATH` environment variable. Alternatively the full path to
the plugins can be specified when using `protoc`.

Alternatively, you can get the latest precompiled version of the plugins by adding
the following line to your `Podfile`:

```ruby
pod 'gRPC-Swift-Plugins'
```

The plugins are available in the `Pods/gRPC-Swift-Plugins/` folder afterwards.

## Examples

gRPC Swift has a number of tutorials and examples available. They are split
across two directorys:
across two directories:

- [`/Sources/Examples`][examples-in-source] contains examples which do not
require additional depenedencies and may be built using the Swift Package
require additional dependencies and may be built using the Swift Package
Manager.
- [`/Examples`][examples-out-of-source] contains examples which rely on
external dependencies or may not be built by the Swift Package Manager (such
Expand All @@ -138,7 +147,7 @@ Some of the examples are accompanied by tutorials, including:

## Documentation

The `docs` directory contains documenation, including:
The `docs` directory contains documentation, including:

- Options for the `protoc` plugin in [`docs/plugin.md`][docs-plugin]
- How to configure TLS in [`docs/tls.md`][docs-tls]
Expand Down
2 changes: 1 addition & 1 deletion gRPC-Swift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.homepage = 'https://www.grpc.io'
s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' }

s.source = { :git => 'https://github.com/grpc/grpc-swift.git', :tag => s.version }
s.source = { :git => "https://github.com/grpc/grpc-swift.git", :tag => s.version }

s.swift_version = '5.0'
s.ios.deployment_target = '10.0'
Expand Down
65 changes: 41 additions & 24 deletions scripts/build_podspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ def __init__(self, name, version='s.version.to_s', use_verbatim_version=True):
self.use_verbatim_version = use_verbatim_version

def as_podspec(self):
indent=' '

if self.use_verbatim_version:
return " s.dependency '%s', %s\n" % (self.name, self.version)
return indent + "s.dependency '%s', %s\n" % (self.name, self.version)

return " s.dependency '%s', '%s'\n" % (self.name, self.version)
return indent + "s.dependency '%s', '%s'\n" % (self.name, self.version)

class Pod:
def __init__(self, name, module_name, version, description, dependencies=None):
def __init__(self, name, module_name, version, description, dependencies=None, is_plugins_pod=False):
self.name = name
self.module_name = module_name
self.version = version
self.is_plugins_pod = is_plugins_pod

if dependencies is None:
dependencies = []
Expand All @@ -75,26 +78,30 @@ def as_podspec(self):
print('Building Podspec for %s' % self.name)
print('-----------------------------------------------------------')

indent=' '

podspec = "Pod::Spec.new do |s|\n\n"
podspec += " s.name = '%s'\n" % self.name
podspec += " s.module_name = '%s'\n" % self.module_name
podspec += " s.version = '%s'\n" % self.version
podspec += " s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }\n"
podspec += " s.summary = '%s'\n" % self.description
podspec += " s.homepage = 'https://www.grpc.io'\n"
podspec += " s.authors = { 'The gRPC contributors' => \'grpc-packages@google.com' }\n\n"

podspec += " s.source = { :git => 'https://github.com/grpc/grpc-swift.git', :tag => s.version }\n\n"

podspec += " s.swift_version = '5.0'\n"

podspec += " s.ios.deployment_target = '10.0'\n"
podspec += " s.osx.deployment_target = '10.12'\n"
podspec += " s.tvos.deployment_target = '10.0'\n"

podspec += " s.source_files = 'Sources/%s/**/*.{swift,c,h}'\n" % (self.module_name)

podspec += "\n" if len(self.dependencies) > 0 else ""
podspec += indent + "s.name = '%s'\n" % self.name
if not self.is_plugins_pod:
podspec += indent + "s.module_name = '%s'\n" % self.module_name
podspec += indent + "s.version = '%s'\n" % self.version
podspec += indent + "s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }\n"
podspec += indent + "s.summary = '%s'\n" % self.description
podspec += indent + "s.homepage = 'https://www.grpc.io'\n"
podspec += indent + "s.authors = { 'The gRPC contributors' => \'grpc-packages@google.com' }\n\n"

if self.is_plugins_pod:
podspec += indent + "s.source = { :http => \"https://github.com/grpc/grpc-swift/releases/download/#{s.version}/protoc-grpc-swift-plugins-#{s.version}.zip\"}\n\n"
podspec += indent + "s.preserve_paths = '*'\n"
else:
podspec += indent + "s.source = { :git => \"https://github.com/grpc/grpc-swift.git\", :tag => s.version }\n\n"
podspec += indent + "s.swift_version = '5.0'\n"
podspec += indent + "s.ios.deployment_target = '10.0'\n"
podspec += indent + "s.osx.deployment_target = '10.12'\n"
podspec += indent + "s.tvos.deployment_target = '10.0'\n"
podspec += indent + "s.source_files = 'Sources/%s/**/*.{swift,c,h}'\n" % (self.module_name)

podspec += "\n" if len(self.dependencies) > 0 else ""

for dep in self.dependencies:
podspec += dep.as_podspec()
Expand Down Expand Up @@ -135,10 +142,20 @@ def build_pods(self):
'Swift gRPC code generator plugin and runtime library',
get_grpc_deps()
)

grpc_plugins_pod = Pod(
'gRPC-Swift-Plugins',
'',
self.version,
'Swift gRPC code generator plugin binaries',
[],
is_plugins_pod=True
)

grpc_pod.add_dependency(Dependency('CGRPCZlib'))
grpc_pod.add_dependency(Dependency(cgrpczlib_pod.name))
grpc_plugins_pod.add_dependency(Dependency(grpc_pod.name))

self.pods += [cgrpczlib_pod, grpc_pod]
self.pods += [cgrpczlib_pod, grpc_pod, grpc_plugins_pod]

def go(self):
self.build_pods()
Expand Down