Skip to content

Commit

Permalink
Add gradle task to generate git revision
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu committed Mar 3, 2016
1 parent b6b7223 commit 54f180a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
15 changes: 13 additions & 2 deletions azure-android-client-authentication/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ uploadArchives {
}
}

task versionInfo(type:Exec){
commandLine 'git rev-parse HEAD'.split()
ext.versionfile = new File("${projectDir}/.gitrevision")
standardOutput = new ByteArrayOutputStream()

doLast {
versionfile.text = standardOutput.toString()
}
}

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
Expand All @@ -96,12 +106,13 @@ task javadoc(type: Javadoc) {
options.encoding = 'UTF-8'
}

task javadocJar(type: Jar, dependsOn: javadoc) {
task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives javadocJar
archives sourcesJar
archives javadocJar
archives file: file("${projectDir}/.gitrevision")
}
13 changes: 12 additions & 1 deletion azure-client-authentication/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ test {
}
}

task versionInfo(type:Exec){
commandLine 'git rev-parse HEAD'.split()
ext.versionfile = new File("${projectDir}/.gitrevision")
standardOutput = new ByteArrayOutputStream()

doLast {
versionfile.text = standardOutput.toString()
}
}

javadoc {
options.encoding = 'UTF-8'
}
Expand All @@ -78,14 +88,15 @@ task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
archives file: file("${projectDir}/.gitrevision")
}

test {
Expand Down
13 changes: 12 additions & 1 deletion azure-client-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ test {
}
}

task versionInfo(type:Exec){
commandLine 'git rev-parse HEAD'.split()
ext.versionfile = new File("${projectDir}/.gitrevision")
standardOutput = new ByteArrayOutputStream()

doLast {
versionfile.text = standardOutput.toString()
}
}

javadoc {
options.encoding = 'UTF-8'
}
Expand All @@ -78,14 +88,15 @@ task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
archives file: file("${projectDir}/.gitrevision")
}

test {
Expand Down
13 changes: 12 additions & 1 deletion client-runtime/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ test {
}
}

task versionInfo(type:Exec){
commandLine 'git rev-parse HEAD'.split()
ext.versionfile = new File("${projectDir}/.gitrevision")
standardOutput = new ByteArrayOutputStream()

doLast {
versionfile.text = standardOutput.toString()
}
}

javadoc {
options.encoding = 'UTF-8'
}
Expand All @@ -87,14 +97,15 @@ task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
task javadocJar(type: Jar, dependsOn: [javadoc, versionInfo]) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
archives file: file("${projectDir}/.gitrevision")
}

test {
Expand Down

0 comments on commit 54f180a

Please sign in to comment.