Skip to content

Commit

Permalink
setting contrib.secret is obsolete, generate build date with gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
mtotschnig committed Feb 18, 2014
1 parent 4463cef commit 7166ce3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Gradle
------
```
cd MyExpenses
#need to figure out how to migrate this from Ant to Gradle
cp template/app.properties res/raw/
export ANDROID_HOME={sdk-dir}
gradle build
```
Expand Down
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
repositories {
mavenCentral()
Expand Down Expand Up @@ -35,4 +37,13 @@ android {
abortOnError false
}
}

def getDate() {
def date = new Date()
def formattedDate = date.format('yyyyMMdd-HHmm')
return formattedDate
}
task copyTask(type: Copy) {
from 'template/app.properties'
into 'res/raw'
filter(ReplaceTokens, tokens: ["build.date": getDate()])
}
2 changes: 0 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
-->
<property file="ant.properties" />
<property name="contrib.secret" value="RANDOM_SECRET"/>
<property name="rev" value="4"/>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
Expand Down Expand Up @@ -97,7 +96,6 @@
overwrite="true" encoding="utf-8">
<filterset>
<filter token="build.date" value="${DSTAMP}-${TSTAMP}"/>
<filter token="contrib.secret" value="${contrib.secret}"/>
</filterset>
</copy>
</target>
Expand Down
1 change: 0 additions & 1 deletion template/app.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
build.date = @build.date@
contrib.secret = @contrib.secret@

0 comments on commit 7166ce3

Please sign in to comment.