colindembovsky / cols-agent-tasks

Colin's ALM Corner Custom Build Tasks
MIT License
83 stars 67 forks source link

VersionAssemblies - Prefix for replacements cannot end in space #124

Closed dcleaver closed 5 years ago

dcleaver commented 5 years ago

In VersionAssemblies, the Prefix for Replacements field cannot end in a space character.

For example, I want to update versionCode in build.gradle which looks like:

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
    }
...

Reproduction Steps

Custom Regex Replace Pattern: "versionCode 1" Prefix for Replacements: "versionCode " (<-- note space character on end)

Expected Result

versionCode 1 is replaced with versionCode 2

Actual Result

versionCode 1 is replaced with versionCode2

I have tried a number of escape characters, but they just end up being inserted verbatim.

I suspect VSTS fields cannot end in a space character.

colindembovsky commented 5 years ago

Hi @dcleaver you are correct - Azure DevOps will trim off trailing spaces. Have you considered using ReplaceTokens and tokenizing rather than using VersionAssemblies?