mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Merge pull request #12 from NativeScript/plamen5kov/enable_tgz_versioning
Plamen5kov/enable tgz versioning
This commit is contained in:
@@ -5,7 +5,8 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
|
||||
// classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
|
||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import groovy.json.JsonSlurper //used to parse package.json
|
||||
import groovy.json.JsonBuilder
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
@@ -57,6 +61,16 @@ task cleanDistDir (type: Delete) {
|
||||
delete "../dist/"
|
||||
}
|
||||
|
||||
task fixVersion << {
|
||||
if(project.hasProperty("PACKAGE_VERSION")) {
|
||||
def inputFile = new File("./package.json")
|
||||
def json = new JsonSlurper().parseText(inputFile.text)
|
||||
json.version = json.version + "-" + PACKAGE_VERSION
|
||||
def jb = new JsonBuilder(json);
|
||||
inputFile.text = JsonOutput.prettyPrint(jb.toString())
|
||||
}
|
||||
}
|
||||
|
||||
task copyAar << {
|
||||
copy {
|
||||
from "../package.json"
|
||||
@@ -68,6 +82,15 @@ task copyAar << {
|
||||
}
|
||||
}
|
||||
|
||||
task revertPackageJson (type: Exec) {
|
||||
if(isWinOs) {
|
||||
commandLine "cmd", "/c", "git", "checkout", "--", "../package.json"
|
||||
}
|
||||
else {
|
||||
commandLine "git", "checkout", "--", "../package.json"
|
||||
}
|
||||
}
|
||||
|
||||
task packFramework (type: Exec) {
|
||||
workingDir "../dist"
|
||||
|
||||
@@ -79,6 +102,9 @@ task packFramework (type: Exec) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
assembleRelease.dependsOn(cleanDistDir)
|
||||
copyAar.dependsOn(assembleRelease)
|
||||
packFramework.dependsOn(copyAar)
|
||||
fixVersion.dependsOn(assembleRelease)
|
||||
copyAar.dependsOn(fixVersion)
|
||||
revertPackageJson.dependsOn(copyAar)
|
||||
packFramework.dependsOn(revertPackageJson)
|
||||
|
||||
Reference in New Issue
Block a user