implement android import, update android project and build for release

This commit is contained in:
2018-09-30 13:42:17 +02:00
parent 413311e56e
commit 0ec8435357
9 changed files with 321 additions and 22 deletions

View File

@@ -1,21 +1,49 @@
buildscript {
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "gradle.plugin.com.gladed.gradle.androidgitversion:gradle-android-git-version:0.4.5"
}
}
apply plugin: 'android'
allprojects {
repositories {
google() // and here
jcenter()
}
}
apply plugin: "com.android.application"
apply plugin: "com.gladed.androidgitversion"
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def sdkDir = properties.getProperty("sdk.dir")
def classpath = "build/intermediates/classes/debug:" + sdkDir + "/platforms/android-26/android.jar"
def activity = "com.omixlab.panopainter.MainActivity"
def outpath = "src/main/cpp"
def ver_branch = "git rev-parse --abbrev-ref HEAD".execute().text.trim()
def ver_hash = "git log --pretty=format:%h -n 1".execute().text.trim()
def ver_count = Integer.parseInt("git rev-list --count HEAD".execute().text.trim())
def ver_tag = "git describe --tags --abbrev=0".execute().text.trim()
android {
compileSdkVersion 19
buildToolsVersion '25.0.0'
compileSdkVersion 26
android.buildToolsVersion "28.0.3"
defaultConfig {
applicationId = 'com.omigamedev'
minSdkVersion 9
targetSdkVersion 19
applicationId = 'com.omixlab.panopainter'
minSdkVersion 19
targetSdkVersion 26
versionCode ver_count
versionName "${ver_tag}.${ver_count}"
// This block is different from the one you use to link Gradle
// to your CMake or ndk-build script.
externalNativeBuild {
@@ -27,11 +55,11 @@ android {
//cFlags "-D_EXAMPLE_C_FLAG1", "-D_EXAMPLE_C_FLAG2"
// Sets a flag to enable format macro constants for the C++ compiler.
//cppFlags "-D__STDC_FORMAT_MACROS"
arguments '-DANDROID_PLATFORM=android-19',
'-DANDROID_TOOLCHAIN=clang',
'-DANDROID_STL=gnustl_static',
'-DCMAKE_BUILD_TYPE=Release',
'-DANDROID_ARM_NEON=TRUE'
arguments '-DANDROID_TOOLCHAIN=clang',
//'-DANDROID_PLATFORM=android-19',
'-DANDROID_STL=gnustl_static',
'-DCMAKE_BUILD_TYPE=Release',
'-DANDROID_ARM_NEON=TRUE'
}
}
ndk {
@@ -52,10 +80,20 @@ android {
// }
// }
signingConfigs {
release {
storeFile file("ppkey.jks")
storePassword "om4r@Pano#Painter_2018"
keyAlias "PanoPainter"
keyPassword "om4r@Pano#Painter_2018"
}
}
buildTypes {
release {
minifyEnabled false
proguardFile getDefaultProguardFile('proguard-android.txt')
signingConfig signingConfigs.release
}
}
@@ -80,3 +118,13 @@ task generateVersioning(type: Exec) {
commandLine 'python', 'scripts/pre-build.py', 'release'
}
copyFiles.dependsOn(generateVersioning)
task generateJavaH(type: Exec) {
workingDir "$projectDir"
commandLine 'javah', "-jni", "-force", "-cp", "$classpath", "-d", "$outpath", "$activity"
}
generateVersioning.dependsOn(generateJavaH)
repositories {
google()
}