-
Notifications
You must be signed in to change notification settings - Fork 468
/
build.gradle
113 lines (105 loc) · 3.49 KB
/
build.gradle
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
111
112
113
plugins {
id 'maven-publish'
id 'signing'
}
group = 'io.github.pseudomuto'
publishing {
publications {
maven(MavenPublication) {
groupId = 'io.github.pseudomuto'
artifactId = rootProject.name
version = System.getenv("GITHUB_REF_NAME")
// Strip "v" from version number
if (version.startsWith("v")) {
version = version.substring(1)
}
pom {
name = groupId + ':' + rootProject.name
description = 'This is a documentation generator plugin for the Google Protocol Buffers compiler (protoc). The plugin can generate HTML, JSON, DocBook, and Markdown documentation from comments in your .proto files.'
url = 'https://github.com/pseudomuto/protoc-gen-doc'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/pseudomuto/protoc-gen-doc/blob/master/LICENSE.md'
}
}
developers {
developer {
id = 'pseudomuto'
name = 'David Muto'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:[email protected]:pseudomuto/protoc-gen-doc.git'
developerConnection = 'scm:git:[email protected]:pseudomuto/protoc-gen-doc.git'
url = 'https://github.com/pseudomuto/protoc-gen-doc'
}
}
//linux 64 arm
artifact("$buildDir/dist/protoc-gen-doc_linux_arm64") {
classifier 'linux-aarch_64'
extension 'exe'
}
//linux 64 intel
artifact("$buildDir/dist/protoc-gen-doc_linux_amd64") {
classifier 'linux-x86_64'
extension 'exe'
}
//mac 64 arm
artifact("$buildDir/dist/protoc-gen-doc_darwin_arm64") {
classifier 'osx-aarch_64'
extension 'exe'
}
//mac 64 intel
artifact("$buildDir/dist/protoc-gen-doc_darwin_amd64") {
classifier 'osx-x86_64'
extension 'exe'
}
//windows 64 arm
artifact("$buildDir/dist/protoc-gen-doc_windows_arm64") {
classifier 'windows-aarch_64'
extension 'exe'
}
//windows 64 intel
artifact("$buildDir/dist/protoc-gen-doc_windows_amd64") {
classifier 'windows-x86_64'
extension 'exe'
}
}
}
repositories {
maven {
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
signing {
def signingKey = project.getProperty('signingKey')
def signingPassword = project.getProperty('signingPassword')
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
// A strange issue with signing meant that only the first files (with the same name) got signed.
// To workaround this, rename all executables to include architecture.
tasks.register('flattenDistDirectory', Copy) {
from("$projectDir/dist") {
include "**/protoc-gen-doc"
include "**/protoc-gen-doc.exe"
eachFile { file ->
file.name = file.relativePath.parent.lastName
file.relativePath = new RelativePath(true, file.relativePath.segments.drop(1))
}
includeEmptyDirs = false
}
into "$buildDir/dist"
}
publish.dependsOn flattenDistDirectory
signMavenPublication.mustRunAfter flattenDistDirectory