String computeGradleUUID ( String content ) { try { MessageDigest md = MessageDigest . getInstance ( MD5_ALGORITHM ) ; md . reset ( ) ; byte [ ] bytes = content . trim ( ) . toLowerCase ( Locale . US ) . getBytes ( "UTF-8" ) ; md . update ( bytes , 0 , bytes . length ) ; return byteArrayToHexString ( md . digest ( ) ) ; } catch ( NoSuchAlgorithmException e ) { // Impossible throw new IllegalArgumentException ( "unknown algorithm " + MD5_ALGORITHM , e ) ; } catch ( UnsupportedEncodingException e ) { // Impossible except with IBM :) throw new IllegalArgumentException ( "unknown charset UTF-8" , e ) ; } }
Compute gradle uuid for artifacts .