Rename Regexp group to Uppercase using CopySpec copy and rename


(Fernando Dunn) #1

I’m using the CopySpec to copy and rename built files such (e.g., MyApp-litebeta-release.apk, MyApp-litebeta-debug-unaligned.apk, MyApp-liteprod-release.apk, etc). I have a portion of the file that I want to be uppercase and my inexperience in coding and Gradle is preventing me from figuring this one out on my own. Can anyone shed some light on how I can accomplish this?

My code:

from 'build/apk', 'build/proguard'
    include '**/*debug*.apk','**/*release.apk', '**/mapping.txt'
    // Add version to APK and remove 'unaligned'
    rename ~/(BusyMe).*(lite|pro)(beta|prod)-(debug|release).*(\.apk)/, '$1$2-v' + versionName + '-$3-$4$5'
    into 'deploy/v' + versionName

Actual Results:

MyApplite-v1.5-beta-release.apk

Desired Results:

MyAppLite-v1.5-Beta-RELEASE.apk
MyAppLite-v1.5-Beta-DEBUG.apk
MyAppPro-v1.5-Prod-RELEASE.apk
...

(Fernando Dunn) #2

Nevermind (I think). I see that I can do multiple rename actions in the task, so I will probably just keep renaming debug -> DEBUG and release -> RELEASE and etc. If anyone has a simpler method, I’d love to learn.