Replace `npm run get-version` with JSON parser gradle function (#849)

* Replace npm run get-version with JSON parser from groovy
This commit is contained in:
David Howell 2017-02-15 22:05:20 +10:30 committed by Nabil Hachicha
parent 6108e358e2
commit 9eb575252f
1 changed files with 9 additions and 1 deletions

View File

@ -66,9 +66,17 @@ String getAppId () {
apply from: 'analytics.gradle'
import groovy.json.JsonSlurper
def getNpmVersion() {
def inputFile = new File(buildscript.sourceFile.getParent() + "/../package.json")
def packageJson = new JsonSlurper().parseText(inputFile.text)
return packageJson["version"]
}
task send(type: SendAnalyticsTask) {
applicationId = getAppId()
version = "npm --silent run get-version".execute(null, projectDir).text.trim()
version = getNpmVersion().trim()
}
preBuild.dependsOn send