]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/lib/java/gradle/publishing.gradle
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / thrift / lib / java / gradle / publishing.gradle
CommitLineData
f67539c2
TL
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20// Following Gradle best practices to keep build logic organized
21
22// ----------------------------------------------------------------------------
23// Installation subtasks, not used currently, we use "make install/fast"
24task installDist(type: Copy, group: 'Install') {
25 description = "Copy Thrift JAR and dependencies into $installPath location"
26
27 destinationDir = file(installPath)
28
29 from jar
30 from configurations.compile
31}
32
33task installJavadoc(type: Copy, group: 'Install', dependsOn: javadoc) {
34 description = "Install Thrift JavaDoc into $installJavadocPath location"
35
36 destinationDir = file(installJavadocPath)
37
38 from javadoc.destinationDir
39}
40
41// This is not needed by Gradle builds but the remaining Ant builds seem to
42// need access to the generated test classes for Thrift unit tests so we
43// assist them to use it this way.
44task copyDependencies(type: Copy, group: 'Build') {
45 description = 'Copy runtime dependencies in a common location for other Ant based projects'
46 project.assemble.dependsOn it
47
48 destinationDir = file("$buildDir/deps")
49 from configurations.testRuntime
50 // exclude some very specific unit test dependencies
51 exclude '**/junit*.jar', '**/mockito*.jar', '**/hamcrest*.jar'
52}
53
54// ----------------------------------------------------------------------------
55// Allow this configuration to be shared between install and uploadArchives tasks
56def configurePom(pom) {
57 pom.project {
58 name 'Apache Thrift'
59 description 'Thrift is a software framework for scalable cross-language services development.'
60 packaging 'jar'
61 url 'http://thrift.apache.org'
62
63 scm {
64 url 'https://github.com/apache/thrift'
65 connection 'scm:git:https://github.com/apache/thrift.git'
66 developerConnection 'scm:git:git@github.com:apache/thrift.git'
67 }
68
69 licenses {
70 license {
71 name 'The Apache Software License, Version 2.0'
72 url "${project.license}"
73 distribution 'repo'
74 }
75 }
76
77 developers {
78 developer {
79 id 'dev'
80 name 'Apache Thrift Developers'
81 email 'dev@thrift.apache.org'
82 }
83 }
84 }
85
86 pom.whenConfigured {
87 // Fixup the scope for servlet-api to be 'provided' instead of 'compile'
88 dependencies.find { dep -> dep.groupId == 'javax.servlet' && dep.artifactId == 'servlet-api' }.with {
89 // it.optional = true
90 it.scope = 'provided'
91 }
92 }
93}
94
95install {
96 repositories.mavenInstaller {
97 configurePom(pom)
98 }
99}
100
101uploadArchives {
102 dependsOn test // make sure we run unit tests when publishing
103 repositories.mavenDeployer {
104 // signPom will silently do nothing when no signing information is provided
105 beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
106 repository(url: project.mavenRepositoryUrl) {
107 if (project.hasProperty('mavenUser') && project.hasProperty('mavenPassword')) {
108 authentication(userName: mavenUser, password: mavenPassword)
109 }
110 }
111 configurePom(pom)
112 }
113}
114
115// Signing configuration, optional, only when release and uploadArchives is activated
116signing {
117 required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") }
118 sign configurations.archives
119}