Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 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" |
| 24 | task 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 Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 30 | from configurations.implementation |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | task 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 Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 41 | java { |
| 42 | withJavadocJar() |
| 43 | withSourcesJar() |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 44 | } |
| 45 | |
Artemy | 774b824 | 2023-07-05 10:43:57 +0300 | [diff] [blame] | 46 | // skip shadow jar from publishing. Workaround for https://github.com/johnrengelman/shadow/issues/651 |
| 47 | components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { |
| 48 | skip() |
| 49 | } |
| 50 | |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 51 | publishing { |
| 52 | publications { |
| 53 | mavenJava(MavenPublication) { |
| 54 | artifactId = "libthrift" |
Artemy | 774b824 | 2023-07-05 10:43:57 +0300 | [diff] [blame] | 55 | from components.java |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 56 | 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 Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 79 | } |
| 80 | } |
| 81 | } |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 82 | repositories { |
| 83 | maven { |
| 84 | url = mavenRepositoryUrl |
| 85 | if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword")) { |
| 86 | credentials { |
| 87 | username = mavenUser |
| 88 | password = mavenPassword |
| 89 | } |
Jens Geyer | e254b21 | 2021-02-24 20:39:24 +0100 | [diff] [blame] | 90 | } |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 95 | // Signing configuration, optional, only when release and publish is activated |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 96 | signing { |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 97 | required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("publish") } |
| 98 | sign publishing.publications.mavenJava |
| 99 | } |
| 100 | |
| 101 | javadoc { |
| 102 | if(JavaVersion.current().isJava9Compatible()) { |
| 103 | options.addBooleanOption('html5', true) |
| 104 | } |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 105 | } |