Merged in SwiftGrpcSupport (pull request #3)

SwiftGrpcSupport
This commit is contained in:
Michael Pivato
2020-04-29 09:45:16 +00:00
10 changed files with 55 additions and 20 deletions

3
.gitignore vendored
View File

@@ -19,4 +19,5 @@
build
__pycache__
Pods
Pods
CarControlleriOS/**/car

View File

@@ -6,7 +6,6 @@ target 'CarController' do
use_frameworks!
# Pods for CarController
pod 'SwiftGRPC'
pod 'gRPC-Swift', '1.0.0-alpha.11'
pod 'SwiftyZeroMQ5'
pod 'SwiftProtobuf', '~> 1.0'
end

View File

@@ -0,0 +1,16 @@
configurations{
swift {
canBeConsumed = false
canBeResolved = true
}
}
dependencies {
swift project(path: ':protobuf', configuration: 'swift')
}
task copySwiftCode(type: Copy, dependsOn: configurations.swift) {
// Copy python protobuf code from proto project.
from zipTree(configurations.swift.asPath)
into './CarController/CarController'
}

Binary file not shown.

29
gradlew vendored
View File

@@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
@@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

3
gradlew.bat vendored
View File

@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

View File

@@ -12,17 +12,28 @@ configurations {
canBeResolved = false
canBeConsumed = true
}
// For Swift Codegen
swift {
canBeConsumed = true
canBeResolved = false
}
}
protobuf {
protoc { artifact = 'com.google.protobuf:protoc:3.11.0' }
plugins {
swift {
path = "$projectDir/grpc_plugins/protoc-gen-swift"
}
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.28.1' // CURRENT_GRPC_VERSION
}
grpc_python {
path = "$projectDir/grpc_plugins/grpc_python_plugin_1.28.1-${osdetector.classifier}"
}
grpc_swift {
path = "$projectDir/grpc_plugins/protoc-gen-grpc-swift-$osdetector.classifier"
}
}
generateProtoTasks {
all().each { task ->
@@ -32,12 +43,16 @@ protobuf {
python {}
}
task.plugins {
swift{}
grpc { // Options added to --grpc_out
option 'lite'
}
grpc_python {
outputSubDir = 'python'
}
grpc_swift {
outputSubDir = 'swift'
}
}
}
}
@@ -47,8 +62,13 @@ task packPythonGrpc(type: Zip, dependsOn: protobuf.generateProtoTasks.all()) {
from protobuf.generatedFilesBaseDir + '/main/python'
}
task packSwiftGrpc(type: Zip, dependsOn: protobuf.generateProtoTasks.all()) {
from protobuf.generatedFilesBaseDir + '/main/swift'
}
artifacts {
python(packPythonGrpc)
swift(packSwiftGrpc)
}
dependencies {

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,5 @@
include ':app'
include ':protobuf'
include 'car'
include 'CarControlleriOS'
rootProject.name='CarController'