From 0515ddb76ee9bc29a076857059e286642c888470 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Mon, 2 Jul 2018 01:05:58 -0700 Subject: [PATCH] Setup fbjni sub-project for maven (#119) Summary: Set up our fbjni sub-project to be published to Maven Central. This removes a bunch of abiFilters that we no longer make use of, too. Closes https://github.com/facebook/Sonar/pull/119 Reviewed By: priteshrnandgaonkar Differential Revision: D8694537 Pulled By: passy fbshipit-source-id: de246fbda99c02856fbc7806b78df2114cb82acb --- android/build.gradle | 20 +++++++++++-------- android/sample/build.gradle | 2 +- .../third-party/DoubleConversion/build.gradle | 4 ---- android/third-party/Folly/build.gradle | 4 ---- android/third-party/LibEvent/build.gradle | 4 ---- android/third-party/OpenSSL/build.gradle | 4 ---- android/third-party/RSocket/build.gradle | 4 ---- android/third-party/glog/build.gradle | 4 ---- libs/easywsclient/build.gradle | 5 ----- libs/fbjni/build.gradle | 13 ++++++++++++ libs/fbjni/gradle.properties | 20 +++++++++++++++++++ settings.gradle | 2 -- xplat/build.gradle | 5 ----- 13 files changed, 46 insertions(+), 45 deletions(-) create mode 100644 libs/fbjni/gradle.properties diff --git a/android/build.gradle b/android/build.gradle index a323f3419..3bee120f6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -195,15 +195,15 @@ android { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true' + ndk { - abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a' - stl 'c++_shared' + abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a' } externalNativeBuild { cmake { - arguments '-DANDROID_TOOLCHAIN=clang' - arguments '-DANDROID_STL=c++_shared' + arguments '-DANDROID_TOOLCHAIN=clang', + '-DANDROID_STL=c++_shared' } } } @@ -236,10 +236,12 @@ android { } dependencies { - implementation project(':fbjni') - implementation deps.soloader compileOnly deps.lithoAnnotations - implementation 'org.glassfish:javax.annotation:10.0-b28' + compileOnly 'org.glassfish:javax.annotation:10.0-b28' + + implementation project(':fbjni') + + implementation deps.soloader implementation deps.guava implementation deps.jsr305 implementation deps.supportAppCompat @@ -253,6 +255,7 @@ android { project.afterEvaluate { preBuild.dependsOn prepareAllLibs +} apply from: rootProject.file('gradle/release.gradle') @@ -260,4 +263,5 @@ task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' } -artifacts.add('archives', sourcesJar)} + +artifacts.add('archives', sourcesJar) diff --git a/android/sample/build.gradle b/android/sample/build.gradle index 6ff674fd7..16d05221a 100644 --- a/android/sample/build.gradle +++ b/android/sample/build.gradle @@ -46,7 +46,7 @@ dependencies { // SoLoader implementation deps.soloader -// For integration with Fresco + // For integration with Fresco implementation deps.lithoFresco // For testing testImplementation deps.lithoTesting diff --git a/android/third-party/DoubleConversion/build.gradle b/android/third-party/DoubleConversion/build.gradle index 9dda53405..b91309b88 100644 --- a/android/third-party/DoubleConversion/build.gradle +++ b/android/third-party/DoubleConversion/build.gradle @@ -8,10 +8,6 @@ android { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true' - ndk { - abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang' diff --git a/android/third-party/Folly/build.gradle b/android/third-party/Folly/build.gradle index a292eafbb..38981c7c2 100644 --- a/android/third-party/Folly/build.gradle +++ b/android/third-party/Folly/build.gradle @@ -8,10 +8,6 @@ android { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true' - ndk { - abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_shared' diff --git a/android/third-party/LibEvent/build.gradle b/android/third-party/LibEvent/build.gradle index 325d52975..fbd796fb5 100644 --- a/android/third-party/LibEvent/build.gradle +++ b/android/third-party/LibEvent/build.gradle @@ -7,10 +7,6 @@ android { defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion - ndk { - abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang' diff --git a/android/third-party/OpenSSL/build.gradle b/android/third-party/OpenSSL/build.gradle index 2fe717883..4973f54da 100644 --- a/android/third-party/OpenSSL/build.gradle +++ b/android/third-party/OpenSSL/build.gradle @@ -7,10 +7,6 @@ android { defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion - ndk { - abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a' - } - externalNativeBuild { ndkBuild { arguments "NDK_APPLICATION_MK:=$projectDir/jni/Application.mk", diff --git a/android/third-party/RSocket/build.gradle b/android/third-party/RSocket/build.gradle index 21f83b739..488db06a5 100644 --- a/android/third-party/RSocket/build.gradle +++ b/android/third-party/RSocket/build.gradle @@ -7,10 +7,6 @@ android { defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion - ndk { - abiFilters 'arm64-v8a', 'x86', 'armeabi-v7a' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang' diff --git a/android/third-party/glog/build.gradle b/android/third-party/glog/build.gradle index 9dda53405..b91309b88 100644 --- a/android/third-party/glog/build.gradle +++ b/android/third-party/glog/build.gradle @@ -8,10 +8,6 @@ android { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true' - ndk { - abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang' diff --git a/libs/easywsclient/build.gradle b/libs/easywsclient/build.gradle index 18878323c..480c784a4 100644 --- a/libs/easywsclient/build.gradle +++ b/libs/easywsclient/build.gradle @@ -7,11 +7,6 @@ android { defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion - - ndk { - abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_shared' diff --git a/libs/fbjni/build.gradle b/libs/fbjni/build.gradle index c2469fefd..3e596708c 100644 --- a/libs/fbjni/build.gradle +++ b/libs/fbjni/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.library' +apply plugin: 'maven' android { compileSdkVersion rootProject.compileSdkVersion @@ -25,3 +26,15 @@ dependencies { compileOnly deps.lithoAnnotations implementation deps.soloader } + +apply from: rootProject.file('gradle/release.gradle') + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} +artifacts.add('archives', sourcesJar) + +tasks.withType(Javadoc).all { + enabled = false +} diff --git a/libs/fbjni/gradle.properties b/libs/fbjni/gradle.properties new file mode 100644 index 000000000..997b70b4c --- /dev/null +++ b/libs/fbjni/gradle.properties @@ -0,0 +1,20 @@ +# +# Copyright 2014-present Facebook, Inc. +# +# 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 +# +# 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. +# + +POM_NAME=SonarFBJNI +POM_DESCRIPTION=Sonar-scoped FBJNI distribution +POM_ARTIFACT_ID=fbjni +POM_PACKAGING=aar diff --git a/settings.gradle b/settings.gradle index 409b707b2..0e9021b57 100644 --- a/settings.gradle +++ b/settings.gradle @@ -21,8 +21,6 @@ include ':libevent' include ':openssl' include ':rsocket' - - project(':fbjni').projectDir = file('libs/fbjni') project(':easywsclient').projectDir = file('libs/easywsclient') project(':sonarcpp').projectDir = file('xplat') diff --git a/xplat/build.gradle b/xplat/build.gradle index 6655250fd..f3f7a05ee 100644 --- a/xplat/build.gradle +++ b/xplat/build.gradle @@ -7,11 +7,6 @@ android { defaultConfig { minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.targetSdkVersion - - ndk { - abiFilters 'arm64-v8a', 'x86' - } - externalNativeBuild { cmake { arguments '-DANDROID_TOOLCHAIN=clang'