blob: ce0db75d7a04d388c32d6ea8431409c54de3d22b [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 {
40 srcDir 'test'
41 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 }
Alex Volanis7004a612018-01-24 10:30:13 -050063 // options.compilerArgs.addAll('-Xlint:unchecked')
64}
65
66// ----------------------------------------------------------------------------
67// Jar packaging details
68processResources {
69 into('META-INF') {
70 from "$thriftRoot/LICENSE"
71 from "$thriftRoot/NOTICE"
72 rename('(.+)', '$1.txt')
73 }
74}
75
76jar {
77 project.test.dependsOn it
78 manifest {
79 attributes([
80 "Implementation-Version": "${project.version}",
Mark Raynsford22671db2020-10-21 20:01:40 +000081 "Automatic-Module-Name": "${project.group}",
Alex Volanis7004a612018-01-24 10:30:13 -050082 "Bundle-ManifestVersion": "2",
83 "Bundle-SymbolicName": "${project.group}",
84 "Bundle-Name": "Apache Thrift",
85 "Bundle-Version": "${project.version}",
86 "Bundle-Description": "Apache Thrift library",
87 "Bundle-License": "${project.license}",
88 "Bundle-ActivationPolicy": "lazy",
Antonio García-Domínguez32f54662021-04-18 18:13:10 +010089 "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 -050090 "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"
91 ])
92 }
93}