Support building on Windows
Protoc should be in PATH and the project properties protobuf.include and
protobuf.libs should be set. For example:
gradlew build -Pprotobuf.include=C:\path\to\protobuf-3.0.0-alpha-2\src ^
-Pprotobuf.libs=C:\path\to\protobuf-3.0.0-alpha-2\vsprojects\Release
When running more than once, it is probably more convenient to create
%HOMEDRIVE%%HOMEPATH%\.gradle\gradle.properties with contents like:
protobuf.include=C:\\path\\to\\protobuf-3.0.0-alpha-2\\src
protobuf.libs=C:\\path\\to\\protobuf-3.0.0-alpha-2\\vsprojects\\Release
diff --git a/build.gradle b/build.gradle
index cfbf0ab..cf0914e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,5 @@
+import org.apache.tools.ant.taskdefs.condition.Os
+
subprojects {
apply plugin: "java"
apply plugin: "maven"
@@ -51,6 +53,16 @@
}
alpnboot_package_name = 'org.mortbay.jetty.alpn:alpn-boot:' + alpnboot_version
+
+ def exeSuffix = Os.isFamily(Os.FAMILY_WINDOWS) ? ".exe" : ""
+ // The split is to workaround everything after the colon in C:\ being
+ // removed due to a bug in the protobuf plugin.
+ // https://github.com/aantono/gradle-plugin-protobuf/issues/23
+ def splitRootDir = rootDir
+ if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ splitRootDir = splitRootDir.getPath().split(":", 2)[1]
+ }
+ javaPluginPath = "$splitRootDir/compiler/build/binaries/java_pluginExecutable/java_plugin$exeSuffix"
}
dependencies {