1/* 2 * Copyright (c) Facebook, Inc. and its affiliates. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17plugins { 18 id 'com.android.library' version '8.1.2' 19 id 'maven-publish' 20 id 'com.vanniktech.maven.publish' version '0.25.3' 21} 22 23repositories { 24 google() 25 mavenCentral() 26} 27 28android { 29 compileSdk 34 30 ndkVersion '27.1.12297006' 31 32 externalNativeBuild { 33 cmake { 34 path 'CMakeLists.txt' 35 } 36 } 37 38 defaultConfig { 39 minSdkVersion 21 40 targetSdkVersion 34 41 buildConfigField "boolean", "IS_INTERNAL_BUILD", 'true' 42 namespace "com.facebook.fbjni" 43 44 sourceSets { 45 main { 46 java.srcDir 'java' 47 } 48 } 49 50 ndk { 51 abiFilters 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a' 52 } 53 54 externalNativeBuild { 55 cmake { 56 arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_shared', '-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON' 57 targets 'fbjni' 58 version '3.22.1' 59 } 60 } 61 62 buildFeatures { 63 buildConfig true 64 prefabPublishing true 65 } 66 67 compileOptions { 68 sourceCompatibility JavaVersion.VERSION_1_8 69 targetCompatibility JavaVersion.VERSION_1_8 70 } 71 72 prefab { 73 fbjni { 74 headers 'cxx/' 75 } 76 } 77 } 78} 79 80 81dependencies { 82 compileOnly 'com.google.code.findbugs:jsr305:3.0.2' 83 implementation 'com.facebook.soloader:nativeloader:0.10.5' 84} 85 86task headersJar(type: Jar) { 87 archiveClassifier.set('headers') 88 from("$rootDir/cxx/") { 89 include '**/*.h' 90 } 91} 92 93publishing { 94 publications { 95 withType(MavenPublication).configureEach { 96 artifact(headersJar) 97 } 98 } 99} 100