blob: 91f456add166e46726c5ae5a860bd8536bb89263 [file] [log] [blame]
Alex Volanis7004a612018-01-24 10:30:13 -05001/*
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
Jiayu Liu5b158382022-05-12 00:20:37 +080030 from configurations.implementation
Alex Volanis7004a612018-01-24 10:30:13 -050031}
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
Jiayu Liu5b158382022-05-12 00:20:37 +080041java {
42 withJavadocJar()
43 withSourcesJar()
Alex Volanis7004a612018-01-24 10:30:13 -050044}
45
Jiayu Liu5b158382022-05-12 00:20:37 +080046publishing {
47 publications {
48 mavenJava(MavenPublication) {
49 artifactId = "libthrift"
50 // explicitly set 3 jars because calling "from components.java" will include shadow jar which isn't what we want
51 artifact jar
52 artifact sourcesJar
53 artifact javadocJar
54 pom {
55 name = 'Apache Thrift'
56 description = 'Thrift is a software framework for scalable cross-language services development.'
57 url = 'http://thrift.apache.org'
58 licenses {
59 license {
60 name = 'The Apache Software License, Version 2.0'
61 url = "${project.license}"
62 distribution = 'repo'
63 }
64 }
65 developers {
66 developer {
67 id = 'dev'
68 name = 'Apache Thrift Developers'
69 email = 'dev@thrift.apache.org'
70 }
71 }
72 scm {
73 url = 'https://github.com/apache/thrift'
74 connection = 'scm:git:https://github.com/apache/thrift.git'
75 developerConnection = 'scm:git:git@github.com:apache/thrift.git'
76 }
Alex Volanis7004a612018-01-24 10:30:13 -050077 }
78 }
79 }
Jiayu Liu5b158382022-05-12 00:20:37 +080080 repositories {
81 maven {
82 url = mavenRepositoryUrl
83 if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword")) {
84 credentials {
85 username = mavenUser
86 password = mavenPassword
87 }
Jens Geyere254b212021-02-24 20:39:24 +010088 }
Alex Volanis7004a612018-01-24 10:30:13 -050089 }
90 }
91}
92
Jiayu Liu5b158382022-05-12 00:20:37 +080093// Signing configuration, optional, only when release and publish is activated
Alex Volanis7004a612018-01-24 10:30:13 -050094signing {
Jiayu Liu5b158382022-05-12 00:20:37 +080095 required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("publish") }
96 sign publishing.publications.mavenJava
97}
98
99javadoc {
100 if(JavaVersion.current().isJava9Compatible()) {
101 options.addBooleanOption('html5', true)
102 }
Alex Volanis7004a612018-01-24 10:30:13 -0500103}