diff options
Diffstat (limited to '')
14 files changed, 1089 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/lib/java/gradle.properties b/src/jaegertracing/thrift/lib/java/gradle.properties new file mode 100644 index 000000000..081165910 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle.properties @@ -0,0 +1,34 @@ +# This file is shared currently between this Gradle build and the +# Ant builds for fd303 and JavaScript. Keep the dotted notation for +# the properties to minimize the changes in the dependencies. +thrift.version=0.13.0 +thrift.groupid=org.apache.thrift +release=false + +# Local Install paths +install.path=/usr/local/lib +install.javadoc.path=/usr/local/lib + +# Test execution properties +testPort=9090 + +# Test with Clover Code coverage (disabled by default) +cloverEnabled=false + +# Maven dependency download locations +mvn.repo=http://repo1.maven.org/maven2 +apache.repo=https://repository.apache.org/content/repositories/releases + +# Apache Maven publish +license=http://www.apache.org/licenses/LICENSE-2.0.txt +maven-repository-url=https://repository.apache.org/service/local/staging/deploy/maven2 +maven-repository-id=apache.releases.https + +# Dependency versions +httpclient.version=4.5.6 +httpcore.version=4.4.1 +slf4j.version=1.7.25 +servlet.version=2.5 +junit.version=4.12 +mockito.version=1.9.5 +javax.annotation.version=1.3.2 diff --git a/src/jaegertracing/thrift/lib/java/gradle/additionalArtifacts.gradle b/src/jaegertracing/thrift/lib/java/gradle/additionalArtifacts.gradle new file mode 100644 index 000000000..201469da1 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/additionalArtifacts.gradle @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +task sourcesJar(type: Jar, group: 'Build') { + description = 'Assembles a jar archive containing the main Java sources.' + + classifier 'sources' + from sourceSets.main.allSource +} + +task javadocJar(type: Jar, dependsOn: javadoc, group: 'Build') { + description = 'Assembles a jar archive containing the JavaDoc.' + + classifier 'javadoc' + from javadoc.destinationDir +} + +artifacts { + archives sourcesJar + archives javadocJar +} + diff --git a/src/jaegertracing/thrift/lib/java/gradle/cloverCoverage.gradle b/src/jaegertracing/thrift/lib/java/gradle/cloverCoverage.gradle new file mode 100644 index 000000000..cef0e79b1 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/cloverCoverage.gradle @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// Keep this as an optional feature for now, disabled by default +if (Boolean.parseBoolean(project.cloverEnabled)) { + apply plugin: 'com.bmuschko.clover' + + dependencies { + clover 'org.openclover:clover:4.2.+' + } + + clover { + + testIncludes = ['**/Test*.java'] + // Exclude the generated test code from code coverage + testExcludes = ['thrift/test/Test*.java'] + + compiler { + encoding = 'UTF-8' + debug = true + } + + report { + html = true + pdf = true + } + } + + build.dependsOn cloverGenerateReport +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/codeQualityChecks.gradle b/src/jaegertracing/thrift/lib/java/gradle/codeQualityChecks.gradle new file mode 100644 index 000000000..1ff1c297d --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/codeQualityChecks.gradle @@ -0,0 +1,39 @@ + +// ================================================================= +// Configure the Gradle code quality plugins here. +// + +apply plugin: 'findbugs' + +findbugs { + ignoreFailures = true + toolVersion = '3.0.1' + sourceSets = [ sourceSets.main ] + effort = 'max' + reportLevel = 'low' + excludeFilter = file('code_quality_tools/findbugs-filter.xml') +} + +tasks.withType(FindBugs) { + reports { + text.enabled = false + html.enabled = true + xml.enabled = false + } +} + +apply plugin: 'pmd' + +pmd { + ignoreFailures = true + toolVersion = '6.0.0' + sourceSets = [ sourceSets.main ] + ruleSets = [ 'java-basic' ] +} + +tasks.withType(Pmd) { + reports { + html.enabled = true + xml.enabled = false + } +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/environment.gradle b/src/jaegertracing/thrift/lib/java/gradle/environment.gradle new file mode 100644 index 000000000..45fa63a17 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/environment.gradle @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// Override the build directory if CMake is used (allows for out-of-tree-builds) +if (hasProperty('build.dir')) { + buildDir = file(property('build.dir')) +} + +// In order to remain compatible with other Ant based builds in the system +// we convert the gradle.properties into DSL friendly camelCased properties +ext.installPath = property('install.path') +ext.installJavadocPath = property('install.javadoc.path') + +ext.thriftRoot = file('../..') + +if (hasProperty('thrift.compiler')) { + ext.thriftCompiler = property('thrift.compiler') +} else { + ext.thriftCompiler = "$thriftRoot/compiler/cpp/thrift" +} + +ext.mvnRepo = property('mvn.repo') +ext.apacheRepo = property('apache.repo') +ext.mavenRepositoryUrl = property('maven-repository-url') + +// Versions used in this project +ext.httpclientVersion = property('httpclient.version') +ext.httpcoreVersion = property('httpcore.version') +ext.servletVersion = property('servlet.version') +ext.slf4jVersion = property('slf4j.version') +ext.junitVersion = property('junit.version') +ext.mockitoVersion = property('mockito.version') +ext.javaxAnnotationVersion = property('javax.annotation.version') + +// In this section you declare where to find the dependencies of your project +repositories { + maven { + name 'Maven Central Repository' + url mvnRepo + } + maven { + name 'Apache Maven Repository' + url apacheRepo + } +} + +dependencies { + compile "org.slf4j:slf4j-api:${slf4jVersion}" + compile "org.apache.httpcomponents:httpclient:${httpclientVersion}" + compile "org.apache.httpcomponents:httpcore:${httpcoreVersion}" + compile "javax.servlet:servlet-api:${servletVersion}" + compile "javax.annotation:javax.annotation-api:${javaxAnnotationVersion}" + + testCompile "junit:junit:${junitVersion}" + testCompile "org.mockito:mockito-all:${mockitoVersion}" + testRuntime "org.slf4j:slf4j-log4j12:${slf4jVersion}" +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/functionalTests.gradle b/src/jaegertracing/thrift/lib/java/gradle/functionalTests.gradle new file mode 100644 index 000000000..c420d122c --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/functionalTests.gradle @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// ---------------------------------------------------------------------------- +// Functional testing harness creation. This helps run the cross-check tests. +// The Makefile precross target invokes the shadowJar task and the tests.json +// code is changed to call runclient or runserver as needed. + +// ---------------------------------------------------------------------------- +// Cross Test sources are separated in their own sourceSet +// +sourceSets { + crossTest { + java { + srcDir 'test' + include '**/test/TestClient.java' + include '**/test/TestServer.java' + include '**/test/TestNonblockingServer.java' + } + } +} + +configurations { + crossTestCompile { extendsFrom testCompile } + crossTestRuntime { extendsFrom crossTestCompile, testRuntime } +} + +dependencies { + crossTestCompile sourceSets.main.output + crossTestCompile sourceSets.test.output +} + +// I am using shadow plugin to make a self contained functional test Uber JAR that +// eliminates startup problems with wrapping the cross-check harness in Gradle. +// This is used by the runner scripts as the single classpath entry which +// allows the process to be as lightweight as it can. +shadowJar { + description = 'Assemble a test JAR file for cross-check execution' + // make sure the runners are created when this runs + dependsOn 'generateRunnerScriptForClient', 'generateRunnerScriptForServer', 'generateRunnerScriptForNonblockingServer' + + baseName = 'functionalTest' + destinationDir = file("$buildDir/functionalTestJar") + classifier = null + + // We do not need a version number for this internal jar + version = null + + // Bundle the complete set of unit test classes including generated code + // and the runtime dependencies in one JAR to expedite execution. + from sourceSets.test.output + from sourceSets.crossTest.output + configurations = [project.configurations.testRuntime] +} + +// Common script runner configuration elements +def scriptExt = '' +def execExt = '' +def scriptHead = '#!/bin/bash' +def args = '$*' + +// Although this is marked internal it is an available and stable interface +if (org.gradle.internal.os.OperatingSystem.current().windows) { + scriptExt = '.bat' + execExt = '.exe' + scriptHead = '@echo off' + args = '%*' +} + +// The Java executable to use with the runner scripts +def javaExe = file("${System.getProperty('java.home')}/bin/java${execExt}").canonicalPath +// The common Uber jar path +def jarPath = shadowJar.archivePath.canonicalPath +def trustStore = file('test/.truststore').canonicalPath +def keyStore = file('test/.keystore').canonicalPath + +task generateRunnerScriptForClient(group: 'Build') { + description = 'Generate a runner script for cross-check tests with TestClient' + + def clientFile = file("$buildDir/runclient${scriptExt}") + + def runClientText = """\ +${scriptHead} + +"${javaExe}" -cp "$jarPath" "-Djavax.net.ssl.trustStore=$trustStore" -Djavax.net.ssl.trustStorePassword=thrift org.apache.thrift.test.TestClient $args +""" + inputs.property 'runClientText', runClientText + outputs.file clientFile + + doLast { + clientFile.parentFile.mkdirs() + clientFile.text = runClientText + clientFile.setExecutable(true, false) + } +} + +task generateRunnerScriptForServer(group: 'Build') { + description = 'Generate a runner script for cross-check tests with TestServer' + + def serverFile = file("$buildDir/runserver${scriptExt}") + + def runServerText = """\ +${scriptHead} + +"${javaExe}" -cp "$jarPath" "-Djavax.net.ssl.keyStore=$keyStore" -Djavax.net.ssl.keyStorePassword=thrift org.apache.thrift.test.TestServer $args +""" + + inputs.property 'runServerText', runServerText + outputs.file serverFile + + doLast { + serverFile.parentFile.mkdirs() + serverFile.text = runServerText + serverFile.setExecutable(true, false) + } +} + +task generateRunnerScriptForNonblockingServer(group: 'Build') { + description = 'Generate a runner script for cross-check tests with TestNonblockingServer' + + def serverFile = file("$buildDir/runnonblockingserver${scriptExt}") + + def runServerText = """\ +${scriptHead} + +"${javaExe}" -cp "$jarPath" "-Djavax.net.ssl.keyStore=$keyStore" -Djavax.net.ssl.keyStorePassword=thrift org.apache.thrift.test.TestNonblockingServer $args +""" + + inputs.property 'runServerText', runServerText + outputs.file serverFile + + doLast { + serverFile.parentFile.mkdirs() + serverFile.text = runServerText + serverFile.setExecutable(true, false) + } +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/generateTestThrift.gradle b/src/jaegertracing/thrift/lib/java/gradle/generateTestThrift.gradle new file mode 100644 index 000000000..121bf537d --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/generateTestThrift.gradle @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// Generated code locations for Unit tests +ext.genSrc = file("$buildDir/gen-java") +ext.genBeanSrc = file("$buildDir/gen-javabean") +ext.genReuseSrc = file("$buildDir/gen-javareuse") +ext.genFullCamelSrc = file("$buildDir/gen-fullcamel") +ext.genUnsafeSrc = file("$buildDir/gen-unsafe") + +// Add the generated code directories to the test source set +sourceSets { + test.java.srcDirs genSrc, genBeanSrc, genReuseSrc, genFullCamelSrc, genUnsafeSrc +} + +// ---------------------------------------------------------------------------- +// Code generation for Unit Testing + +// A callable closure to make this easier +ext.thriftCompile = { Task task, String thriftFileName, String generator = 'java', File outputDir = genSrc -> + def thriftFile = file("$thriftRoot/test/$thriftFileName") + assert thriftFile.exists() + + task.inputs.file thriftFile + task.outputs.dir outputDir + + task.doLast { + outputDir.mkdirs() + def result = exec { + executable file(thriftCompiler) + args '--gen', generator + args '-out', outputDir + args thriftFile + standardOutput = task.outputBuffer + errorOutput = task.outputBuffer + ignoreExitValue = true + } + if (result.exitValue != 0) { + // Only show the Thrift compiler output on failures, cuts down on noise! + println task.outputBuffer.toString() + result.rethrowFailure() + } + } +} + +task generate(group: 'Build') { + description = 'Generate all unit test Thrift sources' + compileTestJava.dependsOn it +} + +task generateJava(group: 'Build') { + description = 'Generate the thrift gen-java source' + generate.dependsOn it + + ext.outputBuffer = new ByteArrayOutputStream() + + thriftCompile(it, 'ThriftTest.thrift') + thriftCompile(it, 'JavaTypes.thrift') + thriftCompile(it, 'DebugProtoTest.thrift') + thriftCompile(it, 'DoubleConstantsTest.thrift') + thriftCompile(it, 'OptionalRequiredTest.thrift') + thriftCompile(it, 'ManyOptionals.thrift') + thriftCompile(it, 'JavaDeepCopyTest.thrift') + thriftCompile(it, 'EnumContainersTest.thrift') + thriftCompile(it, 'JavaBinaryDefault.thrift') +} + +task generateBeanJava(group: 'Build') { + description = 'Generate the thrift gen-javabean source' + generate.dependsOn it + + ext.outputBuffer = new ByteArrayOutputStream() + + thriftCompile(it, 'JavaBeansTest.thrift', 'java:beans,nocamel', genBeanSrc) +} + +task generateReuseJava(group: 'Build') { + description = 'Generate the thrift gen-javareuse source' + generate.dependsOn it + + ext.outputBuffer = new ByteArrayOutputStream() + + thriftCompile(it, 'FullCamelTest.thrift', 'java:fullcamel', genFullCamelSrc) +} + +task generateFullCamelJava(group: 'Build') { + description = 'Generate the thrift gen-fullcamel source' + generate.dependsOn it + + ext.outputBuffer = new ByteArrayOutputStream() + + thriftCompile(it, 'ReuseObjects.thrift', 'java:reuse-objects', genReuseSrc) +} + +task generateUnsafeBinariesJava(group: 'Build') { + description = 'Generate the thrift gen-unsafebinaries source' + generate.dependsOn it + + ext.outputBuffer = new ByteArrayOutputStream() + + thriftCompile(it, 'UnsafeTypes.thrift', 'java:unsafe_binaries', genUnsafeSrc) +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/publishing.gradle b/src/jaegertracing/thrift/lib/java/gradle/publishing.gradle new file mode 100644 index 000000000..029bff93d --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/publishing.gradle @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// ---------------------------------------------------------------------------- +// Installation subtasks, not used currently, we use "make install/fast" +task installDist(type: Copy, group: 'Install') { + description = "Copy Thrift JAR and dependencies into $installPath location" + + destinationDir = file(installPath) + + from jar + from configurations.compile +} + +task installJavadoc(type: Copy, group: 'Install', dependsOn: javadoc) { + description = "Install Thrift JavaDoc into $installJavadocPath location" + + destinationDir = file(installJavadocPath) + + from javadoc.destinationDir +} + +// This is not needed by Gradle builds but the remaining Ant builds seem to +// need access to the generated test classes for Thrift unit tests so we +// assist them to use it this way. +task copyDependencies(type: Copy, group: 'Build') { + description = 'Copy runtime dependencies in a common location for other Ant based projects' + project.assemble.dependsOn it + + destinationDir = file("$buildDir/deps") + from configurations.testRuntime + // exclude some very specific unit test dependencies + exclude '**/junit*.jar', '**/mockito*.jar', '**/hamcrest*.jar' +} + +// ---------------------------------------------------------------------------- +// Allow this configuration to be shared between install and uploadArchives tasks +def configurePom(pom) { + pom.project { + name 'Apache Thrift' + description 'Thrift is a software framework for scalable cross-language services development.' + packaging 'jar' + url 'http://thrift.apache.org' + + scm { + url 'https://github.com/apache/thrift' + connection 'scm:git:https://github.com/apache/thrift.git' + developerConnection 'scm:git:git@github.com:apache/thrift.git' + } + + licenses { + license { + name 'The Apache Software License, Version 2.0' + url "${project.license}" + distribution 'repo' + } + } + + developers { + developer { + id 'dev' + name 'Apache Thrift Developers' + email 'dev@thrift.apache.org' + } + } + } + + pom.whenConfigured { + // Fixup the scope for servlet-api to be 'provided' instead of 'compile' + dependencies.find { dep -> dep.groupId == 'javax.servlet' && dep.artifactId == 'servlet-api' }.with { + // it.optional = true + it.scope = 'provided' + } + } +} + +install { + repositories.mavenInstaller { + configurePom(pom) + } +} + +uploadArchives { + dependsOn test // make sure we run unit tests when publishing + repositories.mavenDeployer { + // signPom will silently do nothing when no signing information is provided + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + repository(url: project.mavenRepositoryUrl) { + if (project.hasProperty('mavenUser') && project.hasProperty('mavenPassword')) { + authentication(userName: mavenUser, password: mavenPassword) + } + } + configurePom(pom) + } +} + +// Signing configuration, optional, only when release and uploadArchives is activated +signing { + required { !version.endsWith("SNAPSHOT") && gradle.taskGraph.hasTask("uploadArchives") } + sign configurations.archives +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/sourceConfiguration.gradle b/src/jaegertracing/thrift/lib/java/gradle/sourceConfiguration.gradle new file mode 100644 index 000000000..8dd0331f7 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/sourceConfiguration.gradle @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// ---------------------------------------------------------------------------- +// source sets for main and test sources +sourceSets { + main { + java { + srcDir 'src' + } + } + test { + java { + srcDir 'test' + // see functionalTests.gradle for these files + exclude '**/test/TestClient.java' + exclude '**/test/TestServer.java' + exclude '**/test/TestNonblockingServer.java' + } + resources { + srcDir 'test' + include 'log4j.properties' + } + } +} + +// ---------------------------------------------------------------------------- +// Compiler configuration details + +sourceCompatibility = '1.8' +targetCompatibility = '1.8' + +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' + options.debug = true + options.deprecation = true + // options.compilerArgs.addAll('-Xlint:unchecked') +} + +// ---------------------------------------------------------------------------- +// Jar packaging details +processResources { + into('META-INF') { + from "$thriftRoot/LICENSE" + from "$thriftRoot/NOTICE" + rename('(.+)', '$1.txt') + } +} + +jar { + project.test.dependsOn it + manifest { + attributes([ + "Implementation-Version": "${project.version}", + "Bundle-ManifestVersion": "2", + "Bundle-SymbolicName": "${project.group}", + "Bundle-Name": "Apache Thrift", + "Bundle-Version": "${project.version}", + "Bundle-Description": "Apache Thrift library", + "Bundle-License": "${project.license}", + "Bundle-ActivationPolicy": "lazy", + "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}\"", + "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" + ]) + } +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/unitTests.gradle b/src/jaegertracing/thrift/lib/java/gradle/unitTests.gradle new file mode 100644 index 000000000..61f2fbdeb --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/unitTests.gradle @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +// Following Gradle best practices to keep build logic organized + +// Bundle the test classes in a JAR for other Ant based builds +task testJar(type: Jar, group: 'Build') { + description = 'Assembles a jar archive containing the test classes.' + project.test.dependsOn it + + classifier 'test' + from sourceSets.test.output +} + +// ---------------------------------------------------------------------------- +// Unit test tasks and configurations + +// Help the up to date algorithm to make these tests done +ext.markTaskDone = { task -> + def buildFile = file("$buildDir/${task.name}.flag") + task.inputs.files task.classpath + task.outputs.file buildFile + task.doLast { + buildFile.text = 'Passed!' + } +} + +task deprecatedEqualityTest(type: JavaExec, group: 'Verification') { + description = 'Run the non-JUnit test suite ' + classpath = sourceSets.test.runtimeClasspath + main 'org.apache.thrift.test.EqualityTest' + markTaskDone(it) +} + +task deprecatedJavaBeansTest(type: JavaExec, group: 'Verification') { + description = 'Run the non-JUnit test suite ' + classpath = sourceSets.test.runtimeClasspath + main 'org.apache.thrift.test.JavaBeansTest' + markTaskDone(it) +} + +// Main Unit Test task configuration +test { + description="Run the full test suite" + dependsOn deprecatedEqualityTest, deprecatedJavaBeansTest + + // Allow repeating tests even after successful execution + if (project.hasProperty('rerunTests')) { + outputs.upToDateWhen { false } + } + + include '**/Test*.class' + exclude '**/Test*\$*.class' + + maxHeapSize = '512m' + forkEvery = 1 + + systemProperties = [ + 'build.test': "${compileTestJava.destinationDir}", + 'test.port': "${testPort}", + 'javax.net.ssl.trustStore': "${projectDir}/test/.truststore", + 'javax.net.ssl.trustStorePassword': 'thrift', + 'javax.net.ssl.keyStore': "${projectDir}/test/.keystore", + 'javax.net.ssl.keyStorePassword': 'thrift' + ] +} diff --git a/src/jaegertracing/thrift/lib/java/gradle/wrapper/gradle-wrapper.jar b/src/jaegertracing/thrift/lib/java/gradle/wrapper/gradle-wrapper.jar Binary files differnew file mode 100644 index 000000000..5c2d1cf01 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/wrapper/gradle-wrapper.jar diff --git a/src/jaegertracing/thrift/lib/java/gradle/wrapper/gradle-wrapper.properties b/src/jaegertracing/thrift/lib/java/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..7c4388a92 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/src/jaegertracing/thrift/lib/java/gradlew b/src/jaegertracing/thrift/lib/java/gradlew new file mode 100755 index 000000000..83f2acfdc --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/src/jaegertracing/thrift/lib/java/gradlew.bat b/src/jaegertracing/thrift/lib/java/gradlew.bat new file mode 100644 index 000000000..9618d8d96 --- /dev/null +++ b/src/jaegertracing/thrift/lib/java/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega |