blob: 5c26fdced431cd53a953b6ca379cb83c05a0daae [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
Artemy774b8242023-07-05 10:43:57 +030046// skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651
47components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
48 skip()
49}
50
Jiayu Liu5b158382022-05-12 00:20:37 +080051publishing {
52 publications {
53 mavenJava(MavenPublication) {
54 artifactId = "libthrift"
Artemy774b8242023-07-05 10:43:57 +030055 from components.java
Jiayu Liu5b158382022-05-12 00:20:37 +080056 pom {
57 name = 'Apache Thrift'
58 description = 'Thrift is a software framework for scalable cross-language services development.'
59 url = 'http://thrift.apache.org'
60 licenses {
61 license {
62 name = 'The Apache Software License, Version 2.0'
63 url = "${project.license}"
64 distribution = 'repo'
65 }
66 }
67 developers {
68 developer {
69 id = 'dev'
70 name = 'Apache Thrift Developers'
71 email = 'dev@thrift.apache.org'
72 }
73 }
74 scm {
75 url = 'https://github.com/apache/thrift'
76 connection = 'scm:git:https://github.com/apache/thrift.git'
77 developerConnection = 'scm:git:git@github.com:apache/thrift.git'
78 }
Alex Volanis7004a612018-01-24 10:30:13 -050079 }
80 }
81 }
Jiayu Liu5b158382022-05-12 00:20:37 +080082 repositories {
83 maven {
84 url = mavenRepositoryUrl
85 if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword")) {
86 credentials {
87 username = mavenUser
88 password = mavenPassword
89 }
Jens Geyere254b212021-02-24 20:39:24 +010090 }
Alex Volanis7004a612018-01-24 10:30:13 -050091 }
92 }
93}
94
Jiayu Liu5b158382022-05-12 00:20:37 +080095// Signing configuration, optional, only when release and publish is activated
Alex Volanis7004a612018-01-24 10:30:13 -050096signing {
Jiayu Liu5b158382022-05-12 00:20:37 +080097 required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("publish") }
98 sign publishing.publications.mavenJava
99}
100
101javadoc {
102 if(JavaVersion.current().isJava9Compatible()) {
103 options.addBooleanOption('html5', true)
104 }
Alex Volanis7004a612018-01-24 10:30:13 -0500105}