blob: 97ce1b9a2c293089d0f59558d3b50afada923120 [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
Alex Volanis7004a612018-01-24 10:30:13 -050021// ----------------------------------------------------------------------------
22// Compiler configuration details
23
Christopher Tubbsebfa7712021-02-04 14:13:24 -050024// These two properties are still needed on JDK8, and possibly used directly by
25// plugins. However, the '--release' option added below makes these two
26// properties redundant when building with JDK9 or later.
Beluga Behr99f673a2018-12-30 22:10:00 -050027sourceCompatibility = '1.8'
28targetCompatibility = '1.8'
Alex Volanis7004a612018-01-24 10:30:13 -050029
30tasks.withType(JavaCompile) {
31 options.encoding = 'UTF-8'
32 options.debug = true
33 options.deprecation = true
Christopher Tubbsebfa7712021-02-04 14:13:24 -050034 // the following is to build with Java 8 specifications, even when building with JDK9 or later
35 if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
36 options.compilerArgs.addAll(['--release', '8'])
37 }
Jiayu Liu6bdefc42022-04-19 00:50:35 +080038 options.compilerArgs.addAll([
39 '-Werror',
40 '-Xlint:deprecation',
41 '-Xlint:cast',
42 '-Xlint:empty',
43 '-Xlint:fallthrough',
44 '-Xlint:finally',
45 '-Xlint:overrides',
46 // we can't enable -Xlint:unchecked just yet
47 ])
Alex Volanis7004a612018-01-24 10:30:13 -050048}
49
50// ----------------------------------------------------------------------------
51// Jar packaging details
52processResources {
53 into('META-INF') {
54 from "$thriftRoot/LICENSE"
55 from "$thriftRoot/NOTICE"
56 rename('(.+)', '$1.txt')
57 }
58}
59
60jar {
61 project.test.dependsOn it
62 manifest {
63 attributes([
64 "Implementation-Version": "${project.version}",
Mark Raynsford22671db2020-10-21 20:01:40 +000065 "Automatic-Module-Name": "${project.group}",
Alex Volanis7004a612018-01-24 10:30:13 -050066 "Bundle-ManifestVersion": "2",
67 "Bundle-SymbolicName": "${project.group}",
68 "Bundle-Name": "Apache Thrift",
69 "Bundle-Version": "${project.version}",
70 "Bundle-Description": "Apache Thrift library",
71 "Bundle-License": "${project.license}",
72 "Bundle-ActivationPolicy": "lazy",
Jiayu Liu5b158382022-05-12 00:20:37 +080073 "Export-Package": "${project.group}.async;uses:=\"${project.group}.protocol,${project.group}.transport,org.slf4j,${project.group}\";version=\"${archiveVersion}\",${project.group}.protocol;uses:=\"${project.group}.transport,${project.group},${project.group}.scheme\";version=\"${archiveVersion}\",${project.group}.server;uses:=\"${project.group}.transport,${project.group}.protocol,${project.group},org.slf4j,javax.servlet,javax.servlet.http\";version=\"${archiveVersion}\",${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=\"${archiveVersion}\",${project.group};uses:=\"${project.group}.protocol,${project.group}.async,${project.group}.server,${project.group}.transport,org.slf4j,org.apache.log4j,${project.group}.scheme\";version=\"${archiveVersion}\",${project.group}.meta_data;uses:=\"${project.group}\";version=\"${archiveVersion}\",${project.group}.scheme;uses:=\"${project.group}.protocol,${project.group}\";version=\"${archiveVersion}\",${project.group}.annotation;version=\"${archiveVersion}\"",
Alex Volanis7004a612018-01-24 10:30:13 -050074 "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"
75 ])
76 }
77}