123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- import org.apache.tools.ant.taskdefs.condition.Os
- apply plugin: 'com.android.library'
- apply plugin: 'com.github.dcendents.android-maven'
- apply plugin: 'com.jfrog.bintray'
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- android {
- compileSdkVersion 23
- buildToolsVersion "23.0.3"
- defaultConfig {
- minSdkVersion 15
- targetSdkVersion 22
- versionCode 1
- versionName "1.0"
- proguardFiles 'proguard-rules.pro'
- consumerProguardFiles 'proguard-rules.pro'
- }
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- res.srcDirs = ['res']
- jni.srcDirs = []
- jniLibs.srcDirs = ['libs']
- }
- }
- // Call external ndk-build(.cmd) script to build the native code
- task ndkBuild(type: Exec) {
- def ndkDirProperty = properties.getProperty('ndk.dir')
- def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''
- def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
- commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath,
- '-j', Runtime.runtime.availableProcessors()
- }
- tasks.withType(JavaCompile) {
- compileTask -> compileTask.dependsOn ndkBuild
- }
- // Cleanup task to remove previously generated binaries
- task ndkClean(type: Exec) {
- def ndkDirProperty = properties.getProperty('ndk.dir')
- def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''
- def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
- commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath, 'clean'
- }
- tasks.withType(Delete) {
- cleanTask -> cleanTask.dependsOn ndkClean
- }
- }
- dependencies {
- compile fileTree(dir: 'libs', include: ['*.jar'])
- }
- // Settings for uploading module AAR to Bintray for library distribution
- task sourcesJar(type: Jar) {
- from android.sourceSets.main.java.srcDirs
- classifier = 'sources'
- }
- task javadoc(type: Javadoc) {
- failOnError = false
- source = android.sourceSets.main.java.srcDirs
- classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
- options {
- links "http://docs.oracle.com/javase/7/docs/api/"
- linksOffline "http://d.android.com/reference","${android.sdkDirectory}/docs/reference"
- }
- }
- task javadocJar(type: Jar, dependsOn: javadoc) {
- classifier = 'javadoc'
- from javadoc.destinationDir
- }
- artifacts {
- archives javadocJar
- archives sourcesJar
- }
- install {
- repositories.mavenInstaller {
- pom.project {
- name = 'tess-two'
- packaging = 'aar'
- groupId = 'com.rmtheis'
- artifactId = 'tess-two'
- developers {
- developer {
- id = 'rmtheis'
- name = 'Robert Theis'
- email = '[email protected]'
- }
- }
- licenses {
- license {
- name = 'The Apache Software License, Version 2.0'
- url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution = 'repo'
- }
- }
- scm {
- url 'https://github.com/rmtheis/tess-two'
- }
- }
- }
- }
- bintray {
- user = properties.getProperty("bintray.user")
- key = properties.getProperty("bintray.apikey")
- configurations = ['archives']
- pkg {
- repo = 'maven'
- name = 'tess-two'
- userOrg = user
- publish = true
- }
- }
|