Jelajahi Sumber

Merge pull request #164 from grpc/plugins-to-main

Move protoc-gen-swiftgrpc plugin to main Sources directory.
Tim Burks 7 tahun lalu
induk
melakukan
73fc104dfb

+ 2 - 3
.travis.yml

@@ -41,6 +41,5 @@ script:
   - export PATH=.:$HOME/local/bin:$PATH
   - export LD_LIBRARY_PATH=$HOME/local/lib
   - make test
-  - cd Plugin
-  - make test
-  - cd ..
+  - make test-plugin
+  - make test-examples

+ 12 - 3
Makefile

@@ -2,15 +2,24 @@
 CFLAGS = -Xcc -ISources/BoringSSL/include
 
 all:
-	swift package generate-xcodeproj
 	swift build -v $(CFLAGS)
+	cp .build/debug/protoc-gen-swift .
+	cp .build/debug/protoc-gen-swiftgrpc .
 	
-test:
-	swift build -v $(CFLAGS)
+project:
+	swift package generate-xcodeproj
+
+test:	all
 	swift test -v $(CFLAGS)
+
+test-examples:
 	cd Examples/Echo/PackageManager; make test
 	cd Examples/Simple/PackageManager; make
 
+test-plugin:
+	protoc Examples/Echo/echo.proto --proto_path=Examples/Echo --plugin=.build/debug/protoc-gen-swiftgrpc --swiftgrpc_out=/tmp --swiftgrpc_opt=TestStubs=true
+	diff /tmp/echo.grpc.swift Examples/Echo/Generated/echo.grpc.swift
+
 clean:
 	rm -rf Packages
 	rm -rf .build

+ 2 - 1
Package.swift

@@ -22,7 +22,8 @@ let package = Package(
            dependencies: ["CgRPC"]),
     Target(name: "CgRPC",
            dependencies: ["BoringSSL"]),
-    Target(name: "RootsEncoder")
+    Target(name: "RootsEncoder"),
+    Target(name: "protoc-gen-swiftgrpc")
   ],
   dependencies: [
     .Package(url: "https://github.com/Zewo/zlib.git", majorVersion: 0, minor: 4),

+ 0 - 25
Plugin/Package.swift

@@ -1,25 +0,0 @@
-/*
- * Copyright 2017, gRPC Authors All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import PackageDescription
-
-let package = Package(
-  name: "SwiftGRPCPlugin",
-  targets: [
-    Target(name: "protoc-gen-swiftgrpc"),
-  ],
-  dependencies: [
-    .Package(url: "https://github.com/apple/swift-protobuf.git", Version(1, 0, 2)),
-  ])

+ 1 - 1
README.md

@@ -49,7 +49,7 @@ generate the necessary support code.
 Binary releases of `protoc`, the Protocol Buffer Compiler, are
 available on [GitHub](https://github.com/google/protobuf/releases).
 
-To build the plugins, run `make` in the [Plugin](Plugin) directory.
+To build the plugins, run `make` in the main directory.
 This uses the Swift Package Manager to build both of the necessary
 plugins: `protoc-gen-swift`, which generates Protocol Buffer support code
 and `protoc-gen-swiftgrpc`, which generates gRPC interface code.

+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/Generator-Client.swift → Sources/protoc-gen-swiftgrpc/Generator-Client.swift


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/Generator-Names.swift → Sources/protoc-gen-swiftgrpc/Generator-Names.swift


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/Generator-Server.swift → Sources/protoc-gen-swiftgrpc/Generator-Server.swift


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/Generator.swift → Sources/protoc-gen-swiftgrpc/Generator.swift


+ 0 - 0
Plugin/README.md → Sources/protoc-gen-swiftgrpc/README.md


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/StreamingType.swift → Sources/protoc-gen-swiftgrpc/StreamingType.swift


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/io.swift → Sources/protoc-gen-swiftgrpc/io.swift


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/main.swift → Sources/protoc-gen-swiftgrpc/main.swift


+ 0 - 0
Plugin/Sources/protoc-gen-swiftgrpc/options.swift → Sources/protoc-gen-swiftgrpc/options.swift