简体   繁体   中英

How to show git-describe in React Native app?

I generally like to automatically bake-in the results of a git describe --always --dirty in any website, app, etc I am developing so that I can easily trace behaviors. Right now, I can't figure out a way to get this in a React Native app.

I am using Android, but am certainly looking for a solution to both Android and iOS.

I found a way using a mix of other existing answers:

  1. Call git-describe during the build to access from gradle
  2. Call PackageManager to access the gradle config from Java
  3. Then use a React NativeModule in Java to access from JS

Update (3 years later): Here's a minimal diff that shows how to implement in Android.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM