Skip to content
Snippets Groups Projects
Commit bcb91d87 authored by Lennart Goedhart's avatar Lennart Goedhart
Browse files

More grade release automation work for #15

parent 6adea8b9
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="640gAndroidUploader" external.system.module.version="0.2.0" type="JAVA_MODULE" version="4"> <module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="640gAndroidUploader" external.system.module.version="0.2.1" type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle"> <facet type="android-gradle" name="Android-Gradle">
<configuration> <configuration>
...@@ -106,6 +106,8 @@ ...@@ -106,6 +106,8 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/reports" />
<excludeFolder url="file://$MODULE_DIR$/build/test-results" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" /> <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
......
...@@ -4,14 +4,25 @@ plugins { ...@@ -4,14 +4,25 @@ plugins {
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
def gitVersion() {
def process = ['sh', '-c', 'git tag -l | grep -c ".*" -'].execute().text.trim()
return process.toInteger() + 1
}
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion "23.0.3" buildToolsVersion "23.0.3"
applicationVariants.all { variant ->
variant.resValue "string", "versionName", variant.versionName
}
defaultConfig { defaultConfig {
applicationId "info.nightscout.android" applicationId "info.nightscout.android"
minSdkVersion 15 minSdkVersion 15
targetSdkVersion 21 targetSdkVersion 21
versionName project.properties['version']
versionCode gitVersion()
} }
buildTypes { buildTypes {
...@@ -28,8 +39,59 @@ android { ...@@ -28,8 +39,59 @@ android {
} }
} }
task signRelease << {
def command = [
'jarsigner',
'-verbose',
'-sigalg',
'SHA1withRSA',
'-digestalg',
'SHA1',
'-keystore',
'/Users/lgoedhart/keystores/nightscout_android.jks',
'app/build/outputs/apk/app-release-unsigned.apk',
'nightscoutandroidkey'
]
def proc = new ProcessBuilder(command)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectInput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start()
proc.waitFor()
if (0 != proc.exitValue()) {
throw new RuntimeException("Could not sign APK.")
}
}
task zipalignRelease << {
def command = [
'/Users/lgoedhart/Library/Android/sdk/build-tools/23.0.3/zipalign',
'-v',
'4',
'app/build/outputs/apk/app-release-unsigned.apk',
'app/build/outputs/apk/640g-android-uploader.apk'
]
def proc = new ProcessBuilder(command)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.redirectInput(ProcessBuilder.Redirect.INHERIT)
.redirectError(ProcessBuilder.Redirect.INHERIT)
.start()
proc.waitFor()
if (0 != proc.exitValue()) {
throw new RuntimeException("Could not align APK.")
}
}
release { release {
tagTemplate = 'v${version}' tagTemplate = 'v${version}'
buildTasks = ['assembleRelease']
afterReleaseBuild.dependsOn 'signRelease', 'zipalignRelease'
} }
dependencies { dependencies {
......
version=0.2.1 version=0.2.0-SNAPSHOT
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.nightscout.android" package="info.nightscout.android"
android:versionCode="1" >
android:versionName="@string/version" >
<uses-sdk <uses-sdk
android:maxSdkVersion="21" android:maxSdkVersion="21"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
<string name="eula_title">Disclaimer</string> <string name="eula_title">Disclaimer</string>
<string name="eula_accept">Accept</string> <string name="eula_accept">Accept</string>
<string name="eula_refuse">Refuse</string> <string name="eula_refuse">Refuse</string>
<string name="version">0.2.0</string>
<style name="ButtonText"> <style name="ButtonText">
<item name="android:layout_width">fill_parent</item> <item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
......
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<PreferenceCategory android:title="App Version"> <PreferenceCategory android:title="App Version">
<Preference <Preference
android:key="version" android:key="version"
android:title="@string/version" /> android:title="@string/versionName" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="Debug"> <PreferenceCategory android:title="Debug">
<ListPreference <ListPreference
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment