aboutsummaryrefslogtreecommitdiff
path: root/protoc-artifacts/build.gradle
blob: de93cb02bf006f3c85c4da92d15c3138e8c919db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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()
  }
  dependencies {
    classpath 'com.google.gradle:osdetector-gradle-plugin:1.2.1'
  }
}

repositories {
  mavenCentral()
}

signing {
  required false
  sign configurations.archives
}

def artifactFile = 'target/protoc.exe' as File

task buildProtoc(type: Exec) {
  commandLine 'bash', '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'
}