Project

General

Profile

Bug #10252

gradle version includes trailing / char in branch name

Added by Constantin Asofiei about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Constantin Asofiei about 1 year ago

When the branch is bound like this:

checkout of branch: bzr+ssh://ca@localhost:2224/opt/secure/code/p2j_repo/p2j/active/4602a/

./gradlew buildVersion returns this string:

Product version: 4.0.0_p2j_10235a/_16016

Note how the trailing '/' char is included, which makes some ant tasks which require the version to not parse it properly.

ChatGPT says that this solves the issue :

def m = outstr =~ /(?m)^\s*checkout of branch:.*\/(?<reponame>[^\/]+)\/(active\/(?<branch>[^\/\s]+)\/?$|trunk\s*\/?$)/

and it looks like it does:

4.0.0_p2j_10235a_16016

Hynek: can you review the above, as author of the original regex:

def m = outstr =~ /(?m)^\s*checkout of branch:(.*((\/(?<reponame>.+)\/(active\/(?<branch>.*$)|trunk\s*$))))/

#2 Updated by Hynek Cihlar about 1 year ago

The regular expression looks good.

#3 Updated by Constantin Asofiei about 1 year ago

  • Status changed from New to Closed
  • Assignee set to Constantin Asofiei
  • % Done changed from 0 to 100

Created task branch 10252a from trunk rev 16026.

Rev 16027 fixes buildVersion in build.gradle when the branch folder ends with a '/' char.

Branch 10252a was merged to trunk rev 16027.

#5 Updated by Roger Borrello about 1 year ago

Note that all these formats can come back from bzr info, and the buildVersion could not handle them all:

            // bzr info may yield many formats:
            //     Internal on devsrv01 (all contain a URI + "/code/p2j_repo/<repo>"):
            //        /home/<user>/secure/code/p2j_repo/<repo>/trunk or
            //        /home/<user>/secure/code/p2j_repo/<repo>/active/<branch> or
            //        S:/code/p2j_repo/<repo>/trunk or
            //        S:/code/p2j_repo/<repo>/active/<branch>
            //        bzr+ssh://<user>@localhost:2224/opt/secure/code/p2j_repo/<repo>/trunk
            //        bzr+ssh://<user>@localhost:2224/opt/secure/code/p2j_repo/<repo>/active/<branch>
            //     External on xfer.goldencode.com (all formats lead to "/opt/fwd", which is repo=p2j):
            //        sftp://<user>@xfer.goldencode.com/opt/fwd/trunk/ or
            //        sftp://<user>@xfer.goldencode.com/opt/fwd/<branch>

Branch 7133a had changes to handle them reviewed in #7133-57. The gist of the review is there was too much dependency on the GCD internal directory structure. Of course we are looking at repositories where code is stored, so I'm not sure how to approach it without involving the repository directory structure, so I shelved the branch.

Also available in: Atom PDF