THRIFT-4746: changes for publishing java library to maven; fix java debug vs. release build with cmake

This commit is contained in:
James E. King III 2019-01-22 09:22:04 -05:00
parent 0c93bb6903
commit 98f379ece1
9 changed files with 39 additions and 22 deletions

View File

@ -123,6 +123,12 @@ jobs:
- script: build/docker/run.sh
env:
- JOB="CMake"
- BUILD_ARG="-DCMAKE_BUILD_TYPE=Debug"
- script: build/docker/run.sh
env:
- JOB="CMake"
- BUILD_ARG="-DCMAKE_BUILD_TYPE=Release"
# C++ specific options: compiler plug-in, threading model
- script: build/docker/run.sh

View File

@ -18,6 +18,7 @@
#
if(ANDROID)
set(THRIFT_AAR outputs/aar/thrift-debug.aar outputs/aar/thrift-release.aar)
add_custom_command(
OUTPUT ${THRIFT_AAR}
@ -27,7 +28,7 @@ if(ANDROID)
)
add_custom_target(thrift_aar ALL DEPENDS ${THRIFT_AAR})
else(ANDROID)
else()
if(IS_ABSOLUTE "${LIB_INSTALL_DIR}")
set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
@ -41,11 +42,16 @@ else(ANDROID)
set(JAVA_DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}/java")
endif()
set(PRELEASE "true")
if (CMAKE_BUILD_TYPE MATCHES DEBUG)
set(PRELEASE "false")
endif ()
add_custom_target(ThriftJava ALL
COMMENT "Building Java library using Gradle Wrapper"
COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} assemble
--console=plain --no-daemon
-Prelease=true
-Prelease=${PRELEASE}
-Pthrift.version=${thrift_VERSION}
"-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@ -56,7 +62,7 @@ else(ANDROID)
COMMENT "Publishing Java Library to Apache Maven staging"
COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} clean uploadArchives
--console=plain --no-daemon
-Prelease=true
-Prelease=${PRELEASE}
-Pthrift.version=${thrift_VERSION}
"-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@ -78,10 +84,11 @@ else(ANDROID)
add_test(NAME JavaTest
COMMAND ${GRADLEW_EXECUTABLE} ${GRADLE_OPTS} test
--console=plain --no-daemon
-Prelease=true
-Prelease=${PRELEASE}
-Pthrift.version=${thrift_VERSION}
"-Pbuild.dir=${CMAKE_CURRENT_BINARY_DIR}/build"
"-Pthrift.compiler=${THRIFT_COMPILER}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
endif(ANDROID)
endif()

View File

@ -138,11 +138,15 @@ properties to it.
mavenUser=meMyselfAndI
mavenPassword=MySuperAwesomeSecretPassword
NOTE: If you do not have a secring.gpg file, see the
[gradle signing docs](https://docs.gradle.org/current/userguide/signing_plugin.html)
for instructions on how to generate it.
It is also possible to manually publish using the Gradle build directly.
With the key information and credentials in place the following will generate
if needed the build artifacts and proceed to publish the results.
./gradlew -Prelease=true -Pthrift.version=0.11.0 uploadArchives
./gradlew -Prelease=true uploadArchives
It is also possible to override the target repository for the Maven Publication
by using a Gradle property, for example you can publish signed JAR files to your

View File

@ -20,13 +20,14 @@
// Using the legacy plugin classpath for Clover so it can be loaded optionally
buildscript {
repositories {
mavenCentral()
google()
jcenter()
gradlePluginPortal()
}
dependencies {
classpath 'com.bmuschko:gradle-clover-plugin:2.2.0'
classpath 'com.bmuschko:gradle-clover-plugin:2.2.1'
}
}
@ -34,7 +35,7 @@ plugins {
id 'java'
id 'maven'
id 'signing'
id 'com.github.johnrengelman.shadow' version '2.0.2'
id 'com.github.johnrengelman.shadow' version '4.0.4'
}
description = 'Apache Thrift Java Library'
@ -44,12 +45,10 @@ defaultTasks 'build'
// Version components for this project
group = property('thrift.groupid')
// Drop the -dev suffix, we use the SNAPSHOT suffix for non-release versions
def parsedVersion = property('thrift.version').toString().replace('-dev', '')
if (Boolean.parseBoolean(project.release)) {
version = parsedVersion
version = property('thrift.version')
} else {
version = parsedVersion + '-SNAPSHOT'
version = property('thrift.version') + '-SNAPSHOT'
}
// Keeping the rest of the build logic in functional named scripts for clarity

View File

@ -3,7 +3,7 @@
# the properties to minimize the changes in the dependencies.
thrift.version=1.0.0
thrift.groupid=org.apache.thrift
release=true
release=false
# Local Install paths
install.path=/usr/local/lib
@ -25,9 +25,9 @@ maven-repository-url=https://repository.apache.org/service/local/staging/deploy/
maven-repository-id=apache.releases.https
# Dependency versions
httpclient.version=4.4.1
httpclient.version=4.5.6
httpcore.version=4.4.1
slf4j.version=1.7.12
slf4j.version=1.7.25
servlet.version=2.5
junit.version=4.12
mockito.version=1.9.5

View File

@ -61,9 +61,9 @@ def configurePom(pom) {
url 'http://thrift.apache.org'
scm {
url 'https://github.com/apache/thrift.git'
url 'https://github.com/apache/thrift'
connection 'scm:git:https://github.com/apache/thrift.git'
developerConnection 'scm:git:https://github.com/apache/thrift.git'
developerConnection 'scm:git:git@github.com:apache/thrift.git'
}
licenses {

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip

View File

@ -120,7 +120,7 @@ ArgResults _parseArgs(List<String> args) {
'compact': 'TCompactProtocol',
'json': 'TJsonProtocol'
});
parser.addFlag('verbose', defaultsTo: false);
parser.addFlag('verbose', defaultsTo: true);
ArgResults results;
try {

View File

@ -562,7 +562,7 @@
{
"name": "dart",
"client": {
"timeout": 15,
"timeout": 20,
"transports": [
"buffered",
"framed",
@ -578,8 +578,9 @@
],
"command": [
"dart",
"--enable-asserts",
"test_client/bin/main.dart"
"--checked",
"test_client/bin/main.dart",
"--verbose"
]
},
"workdir": "dart"