8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Android Studioのbuild.gradleでgitのrevision hashを得る

Posted at
  • Android Studioから起動するgradleプロセスの $PWD は project root ではない
  • Gradleの String#execute() は複数のコマンドに対応していない
  • Gradleの command parser を介さないように Array#execute で「cdしてgitを呼ぶ」を実現する
def revisionHash = ["sh",  "-c",  "cd ${project.rootDir} ; git rev-parse --short HEAD"].execute().in.text.trim()
8
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?