blob: b45fdc80338eb3c60c8561fcc667efb6b8258b87 [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// source sets for main and test sources
24sourceSets {
25 main {
26 java {
27 srcDir 'src'
28 }
29 }
30 test {
31 java {
32 srcDir 'test'
33 // see functionalTests.gradle for these files
34 exclude '**/test/TestClient.java'
35 exclude '**/test/TestServer.java'
36 exclude '**/test/TestNonblockingServer.java'
pengzhouhu6e4c5812019-10-21 22:21:11 +080037 exclude '**/test/TestTServletServer.java'
Alex Volanis7004a612018-01-24 10:30:13 -050038 }
39 resources {
Jiayu Liu1eb361a2022-02-21 13:36:44 +010040 srcDir 'test/resources'
Alex Volanis7004a612018-01-24 10:30:13 -050041 include 'log4j.properties'
42 }
43 }
44}
45
46// ----------------------------------------------------------------------------
47// Compiler configuration details
48
Christopher Tubbsebfa7712021-02-04 14:13:24 -050049// These two properties are still needed on JDK8, and possibly used directly by
50// plugins. However, the '--release' option added below makes these two
51// properties redundant when building with JDK9 or later.
Beluga Behr99f673a2018-12-30 22:10:00 -050052sourceCompatibility = '1.8'
53targetCompatibility = '1.8'
Alex Volanis7004a612018-01-24 10:30:13 -050054
55tasks.withType(JavaCompile) {
56 options.encoding = 'UTF-8'
57 options.debug = true
58 options.deprecation = true
Christopher Tubbsebfa7712021-02-04 14:13:24 -050059 // the following is to build with Java 8 specifications, even when building with JDK9 or later
60 if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
61 options.compilerArgs.addAll(['--release', '8'])
62 }
Jiayu Liu6bdefc42022-04-19 00:50:35 +080063 options.compilerArgs.addAll([
64 '-Werror',
65 '-Xlint:deprecation',
66 '-Xlint:cast',
67 '-Xlint:empty',
68 '-Xlint:fallthrough',
69 '-Xlint:finally',
70 '-Xlint:overrides',
71 // we can't enable -Xlint:unchecked just yet
72 ])
Alex Volanis7004a612018-01-24 10:30:13 -050073}
74
75// ----------------------------------------------------------------------------
76// Jar packaging details
77processResources {
78 into('META-INF') {
79 from "$thriftRoot/LICENSE"
80 from "$thriftRoot/NOTICE"
81 rename('(.+)', '$1.txt')
82 }
83}
84
85jar {
86 project.test.dependsOn it
87 manifest {
88 attributes([
89 "Implementation-Version": "${project.version}",
Mark Raynsford22671db2020-10-21 20:01:40 +000090 "Automatic-Module-Name": "${project.group}",
Alex Volanis7004a612018-01-24 10:30:13 -050091 "Bundle-ManifestVersion": "2",
92 "Bundle-SymbolicName": "${project.group}",
93 "Bundle-Name": "Apache Thrift",
94 "Bundle-Version": "${project.version}",
95 "Bundle-Description": "Apache Thrift library",
96 "Bundle-License": "${project.license}",
97 "Bundle-ActivationPolicy": "lazy",
Antonio García-Domínguez32f54662021-04-18 18:13:10 +010098 "Export-Package": "${project.group}.async;uses:=\"${project.group}.protocol,${project.group}.transport,org.slf4j,${project.group}\";version=\"${version}\",${project.group}.protocol;uses:=\"${project.group}.transport,${project.group},${project.group}.scheme\";version=\"${version}\",${project.group}.server;uses:=\"${project.group}.transport,${project.group}.protocol,${project.group},org.slf4j,javax.servlet,javax.servlet.http\";version=\"${version}\",${project.group}.transport;uses:=\"${project.group}.protocol,${project.group},org.apache.http.client,org.apache.http.params,org.apache.http.entity,org.apache.http.client.methods,org.apache.http,org.slf4j,javax.net.ssl,javax.net,javax.security.sasl,javax.security.auth.callback\";version=\"${version}\",${project.group};uses:=\"${project.group}.protocol,${project.group}.async,${project.group}.server,${project.group}.transport,org.slf4j,org.apache.log4j,${project.group}.scheme\";version=\"${version}\",${project.group}.meta_data;uses:=\"${project.group}\";version=\"${version}\",${project.group}.scheme;uses:=\"${project.group}.protocol,${project.group}\";version=\"${version}\",${project.group}.annotation;version=\"${version}\"",
Alex Volanis7004a612018-01-24 10:30:13 -050099 "Import-Package": "javax.net,javax.net.ssl,javax.security.auth.callback,javax.security.sasl,javax.servlet;resolution:=optional,javax.servlet.http;resolution:=optional,org.slf4j;resolution:=optional;version=\"[1.4,2)\",org.apache.http.client;resolution:=optional,org.apache.http.params;resolution:=optional,org.apache.http.entity;resolution:=optional,org.apache.http.client.methods;resolution:=optional,org.apache.http;resolution:=optional"
100 ])
101 }
102}