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:
parent
6108e358e2
commit
9eb575252f
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue