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 | // Using the legacy plugin classpath for Clover so it can be loaded optionally |
| 21 | buildscript { |
Christopher Tubbs | ebfa771 | 2021-02-04 14:13:24 -0500 | [diff] [blame] | 22 | // strictly enforce the minimum version of Java required to build and fail fast |
| 23 | if (JavaVersion.current() < JavaVersion.VERSION_1_8) { |
| 24 | throw new GradleException("The java version used is ${JavaVersion.current()}, but must be at least ${JavaVersion.VERSION_1_8}") |
| 25 | } |
| 26 | |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 27 | repositories { |
James E. King III | 98f379e | 2019-01-22 09:22:04 -0500 | [diff] [blame] | 28 | mavenCentral() |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 29 | google() |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 30 | gradlePluginPortal() |
| 31 | } |
| 32 | |
| 33 | dependencies { |
James E. King III | 98f379e | 2019-01-22 09:22:04 -0500 | [diff] [blame] | 34 | classpath 'com.bmuschko:gradle-clover-plugin:2.2.1' |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 35 | } |
| 36 | } |
| 37 | |
| 38 | plugins { |
Jiayu Liu | eac5103 | 2022-03-11 04:55:13 +0100 | [diff] [blame] | 39 | id 'java-library' |
Jiayu Liu | 5b15838 | 2022-05-12 00:20:37 +0800 | [diff] [blame] | 40 | id 'maven-publish' |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 41 | id 'signing' |
Jiayu Liu | c4e96c7 | 2022-05-19 03:03:07 +0800 | [diff] [blame] | 42 | id 'pmd' |
Jiayu Liu | be73a57 | 2023-04-14 11:02:43 +0800 | [diff] [blame] | 43 | id 'com.github.johnrengelman.shadow' version '8.1.1' |
Jiayu Liu | 649dcfd | 2022-02-21 23:18:50 +0800 | [diff] [blame] | 44 | id "com.github.spotbugs" version "4.7.1" |
dependabot[bot] | 1287f23 | 2023-04-27 09:15:31 +0800 | [diff] [blame^] | 45 | id "com.diffplug.spotless" version "6.18.0" |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | description = 'Apache Thrift Java Library' |
| 49 | |
| 50 | defaultTasks 'build' |
| 51 | |
| 52 | // Version components for this project |
| 53 | group = property('thrift.groupid') |
| 54 | |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 55 | if (Boolean.parseBoolean(project.release)) { |
James E. King III | 98f379e | 2019-01-22 09:22:04 -0500 | [diff] [blame] | 56 | version = property('thrift.version') |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 57 | } else { |
James E. King III | 98f379e | 2019-01-22 09:22:04 -0500 | [diff] [blame] | 58 | version = property('thrift.version') + '-SNAPSHOT' |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | // Keeping the rest of the build logic in functional named scripts for clarity |
| 62 | apply from: 'gradle/environment.gradle' |
| 63 | apply from: 'gradle/sourceConfiguration.gradle' |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 64 | apply from: 'gradle/generateTestThrift.gradle' |
| 65 | apply from: 'gradle/unitTests.gradle' |
| 66 | apply from: 'gradle/cloverCoverage.gradle' |
| 67 | apply from: 'gradle/functionalTests.gradle' |
| 68 | apply from: 'gradle/publishing.gradle' |
| 69 | apply from: 'gradle/codeQualityChecks.gradle' |