aboutsummaryrefslogtreecommitdiffhomepage
path: root/protoc-artifacts
diff options
context:
space:
mode:
authorGravatar zhangkun83 <zhangkun@google.com>2015-03-25 16:07:50 -0700
committerGravatar zhangkun83 <zhangkun@google.com>2015-03-25 16:07:50 -0700
commit488162db1e59f74f7b5f094aa87fdd4a324dc3c0 (patch)
treed9548de70b12194899378b9cf30031e5071dec7c /protoc-artifacts
parent82524fe5aaa66e7a36285c25321afd79f7a98680 (diff)
Gradle script to publish protoc binaries
Diffstat (limited to 'protoc-artifacts')
-rwxr-xr-xprotoc-artifacts/build-protoc.sh8
-rw-r--r--protoc-artifacts/build.gradle110
-rw-r--r--protoc-artifacts/settings.gradle1
3 files changed, 119 insertions, 0 deletions
diff --git a/protoc-artifacts/build-protoc.sh b/protoc-artifacts/build-protoc.sh
new file mode 100755
index 00000000..137c5d63
--- /dev/null
+++ b/protoc-artifacts/build-protoc.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# Override the default value set in configure.ac that has '-g' which produces
+# huge binary.
+export CXXFLAGS=-DNDEBUG
+
+cd $(dirname "$0")/.. && ./configure --disable-shared && make &&
+ cd src && (strip protoc || strip protoc.exe)
diff --git a/protoc-artifacts/build.gradle b/protoc-artifacts/build.gradle
index 5af087a9..b44844fa 100644
--- a/protoc-artifacts/build.gradle
+++ b/protoc-artifacts/build.gradle
@@ -1,3 +1,113 @@
+apply plugin: 'maven'
+apply plugin: 'java'
+apply plugin: 'osdetector'
+apply plugin: 'signing'
+
+description = 'Pre-compiled protoc (protobuf compiler) artifacts'
+
+group = 'com.google.protobuf'
+version = '3.0.0-alpha-3-pre'
+
+buildscript {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ }
+ dependencies {
+ classpath 'com.google.gradle:osdetector-gradle-plugin:0.1.0-SNAPSHOT'
+ }
+}
+
+repositories {
+ mavenCentral()
+ mavenLocal()
+}
+
+signing {
+ sign configurations.archives
+}
+
+def artifactFile = 'target/protoc.exe' as File
+
+task buildProtoc(type: Exec) {
+ commandLine './build-protoc.sh'
+}
+
+task prepareArtifact(type: Copy, dependsOn: buildProtoc) {
+ from '../src/' as File
+ into artifactFile.parent
+ include 'protoc', 'protoc.exe'
+ rename 'protoc', 'protoc.exe'
+}
+
+artifacts {
+ archives(artifactFile) {
+ classifier osdetector.classifier
+ type "exe"
+ extension "exe"
+ builtBy prepareArtifact
+ }
+}
+
+uploadArchives.repositories.mavenDeployer {
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+
+ repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
+ if (rootProject.hasProperty("ossrhUsername")
+ && rootProject.hasProperty("ossrhPassword")) {
+ authentication(userName: ossrhUsername, password: ossrhPassword)
+ }
+ }
+
+ snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
+ if (rootProject.hasProperty("ossrhUsername")
+ && rootProject.hasProperty("ossrhPassword")) {
+ authentication(userName: ossrhUsername, password: ossrhPassword)
+ }
+ }
+}
+
+[
+ install.repositories.mavenInstaller,
+ uploadArchives.repositories.mavenDeployer,
+]*.pom*.whenConfigured { pom ->
+ pom.project {
+ name "$project.group:$project.name"
+ description project.description
+ url 'https://github.com/google/protobuf'
+
+ scm {
+ connection 'scm:svn:https://github.com/google/protobuf.git'
+ developerConnection 'scm:svn:git@github.com:google/protobuf.git'
+ url 'https://github.com/google/protobuf'
+ }
+
+ licenses {
+ license {
+ name 'BSD 3-Clause'
+ url 'http://opensource.org/licenses/BSD-3-Clause'
+ }
+ }
+
+ developers {
+ developer {
+ id "com.google.protobuf"
+ name "Protobuf Contributors"
+ email "protobuf@googlegroups.com"
+ url "https://github.com/google/protobuf"
+ organization = "Google, Inc."
+ organizationUrl "https://www.google.com"
+ }
+ }
+ }
+}
+
+// Exe files are skipped by Maven by default. Override it.
+[
+ install.repositories.mavenInstaller,
+ uploadArchives.repositories.mavenDeployer,
+]*.addFilter('all') {artifact, file -> true}
+
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
diff --git a/protoc-artifacts/settings.gradle b/protoc-artifacts/settings.gradle
new file mode 100644
index 00000000..2a18bb00
--- /dev/null
+++ b/protoc-artifacts/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'protoc'