Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle #649

Merged
merged 6 commits into from
Mar 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Gradle
Gradle support to make ease of import in Android Java projects.
  • Loading branch information
luncliff committed Feb 11, 2018
commit 4df4752b63e6dca32ad279d35c58601e39f665c0
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
.vscode/

*.iml
.idea/
.externalNativeBuild/
.gradle/
gradle/
gradlew*
local.properties
build/

bin/
/_CPack_Packages
/CMakeScripts
Expand Down
111 changes: 111 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// General gradle arguments for root project
buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

allprojects {
repositories {
google()
jcenter()
}
}

// Output: Shared library (.so) for Android
apply plugin: 'com.android.library'

android {
compileSdkVersion 24 // Android 7.0

// External Native build
// - Use existing CMakeList.txt
// - Give path to CMake. This gradle file should be
// neighbor of the top level cmake
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}

// Target ABI
// - This option controls target platform of module
// - The platform might be limited by compiler's support
// some can work with Clang(default), but some can work only with GCC...
// if bad, both toolchains might not support it
splits {
abi {
// Be general, as it can...
enable true
universalApk true
// We can specify platforms, like...
// reset()
// include "x86", "x86_64", "armeabi-v7a", "arm64-v8a"
}
}

defaultConfig {
minSdkVersion 21 // Android 5.0+
targetSdkVersion 24 // Follow Compile SDK
versionCode 16 // Follow release count
versionName "4.1.0" // Follow Official version
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

// - Specify Android STL
// - Additional flags
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
"-DBUILD_SHARED=true"
cppFlags "-std=c++14"
}
}
}

sourceSets{
// gradle assemble
main.setRoot('./')
main {
manifest.srcFile 'support/AndroidManifest.xml'
}
}
// // Custom SourceSet for JNI adapter
// // - Source path/directory for Gradle
// sourceSets {
// // gradle assemble
// main.setRoot('droid/main')
// // main {
// // manifest.srcFile 'droid/main/AndroidManifest.xml'
// // java.srcDirs = ['droid/main/java']
// // jniLibs.srcDirs = ['droid/main/jniLibs']
// // res.srcDirs = ['droid/main/res']
// // assets.srcDirs = ['droid/main/assets']
// // }
// // gradle connectedAndroidTest
// androidTest.setRoot('droid/androidTest')
// // androidTest {
// // java.srcDir 'droid/androidTest/java'
// // }
// // If ABI includes `armeabi-v7a`, the following directory MUST exists.
// // Notice that the path is relative to `build.gradle` file
// // `droid/main/jniLibs/armeabi-v7a`
// // `libs/armeabi-v7a`
// // The library files in there will be installed automatically
// main.jniLibs.srcDirs = ['droid/main/jniLibs', 'libs']
// androidTest.jniLibs.srcDirs = ['droid/main/jniLibs', 'libs']
// }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:24.+' // Follow target SDK
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
1 change: 1 addition & 0 deletions support/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest package="fmt" />