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 | // source sets for main and test sources |
| 24 | sourceSets { |
| 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' |
pengzhouhu | 6e4c581 | 2019-10-21 22:21:11 +0800 | [diff] [blame] | 37 | exclude '**/test/TestTServletServer.java' |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 38 | } |
| 39 | resources { |
| 40 | srcDir 'test' |
| 41 | include 'log4j.properties' |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | // ---------------------------------------------------------------------------- |
| 47 | // Compiler configuration details |
| 48 | |
Christopher Tubbs | ebfa771 | 2021-02-04 14:13:24 -0500 | [diff] [blame] | 49 | // 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 Behr | 99f673a | 2018-12-30 22:10:00 -0500 | [diff] [blame] | 52 | sourceCompatibility = '1.8' |
| 53 | targetCompatibility = '1.8' |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 54 | |
| 55 | tasks.withType(JavaCompile) { |
| 56 | options.encoding = 'UTF-8' |
| 57 | options.debug = true |
| 58 | options.deprecation = true |
Christopher Tubbs | ebfa771 | 2021-02-04 14:13:24 -0500 | [diff] [blame] | 59 | // 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 Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 63 | // options.compilerArgs.addAll('-Xlint:unchecked') |
| 64 | } |
| 65 | |
| 66 | // ---------------------------------------------------------------------------- |
| 67 | // Jar packaging details |
| 68 | processResources { |
| 69 | into('META-INF') { |
| 70 | from "$thriftRoot/LICENSE" |
| 71 | from "$thriftRoot/NOTICE" |
| 72 | rename('(.+)', '$1.txt') |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | jar { |
| 77 | project.test.dependsOn it |
| 78 | manifest { |
| 79 | attributes([ |
| 80 | "Implementation-Version": "${project.version}", |
Mark Raynsford | 22671db | 2020-10-21 20:01:40 +0000 | [diff] [blame] | 81 | "Automatic-Module-Name": "${project.group}", |
Alex Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 82 | "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ínguez | 32f5466 | 2021-04-18 18:13:10 +0100 | [diff] [blame] | 89 | "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 Volanis | 7004a61 | 2018-01-24 10:30:13 -0500 | [diff] [blame] | 90 | "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 | } |