[JIRA] (JENKINS-58351) buildType is used incorrectly for visual studio builds

9 views
Skip to first unread message

dennis.cappendijk@siemens.com (JIRA)

unread,
Jul 5, 2019, 4:27:02 AM7/5/19
to jenkinsc...@googlegroups.com
Dennis Cappendijk updated an issue
 
Jenkins / Bug JENKINS-58351
buildType is used incorrectly for visual studio builds
Change By: Dennis Cappendijk
Summary: buildType is used incorrectly for windows visual studio builds
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

dennis.cappendijk@siemens.com (JIRA)

unread,
Jul 5, 2019, 4:27:02 AM7/5/19
to jenkinsc...@googlegroups.com
Dennis Cappendijk updated an issue
I have created a Jenkins pipeline that covers both windows and linux.

However it appears that cmakeBuild does not use buildType correctly for
windows. visual studio

For Linux is correctly adds -DCMAKE_BUILD_TYPE=Debug or Release in the configure step

However for windows the CMAKE_BUILD_TYPE variable is ignored:
{code:java}
17:47:24    Manually-specified variables were not used by the project:
17:47:24  
17:47:24      CMAKE_BUILD_TYPE
{code}
And subsequently in the --build step, the --config is unused. Resulting in a Debug-by-default build on windows.

--config Debug or
-  - - config Release (depending on buildType should be added to the --build phase for windows (and CMAKE_BUILD_TYPE should not be used for windows visual studio generator )

 

The current workaround to this is adding --config Debug/Release explicitly in the steps:
{code:java}
steps: [[args: '--config Debug', withCmake: true]]
{code}
Which of course is less than ideal if the buildType property is available.

dennis.cappendijk@siemens.com (JIRA)

unread,
Jul 5, 2019, 4:28:02 AM7/5/19
to jenkinsc...@googlegroups.com
Dennis Cappendijk commented on Bug JENKINS-58351
 
Re: buildType is used incorrectly for visual studio builds

Adapted ticket title and description to better reflect the issue, thanks Martin Weber

dennis.cappendijk@siemens.com (JIRA)

unread,
Jul 5, 2019, 4:29:02 AM7/5/19
to jenkinsc...@googlegroups.com
Dennis Cappendijk updated an issue
Change By: Dennis Cappendijk
I have created a Jenkins pipeline that covers both windows and linux.

However it appears that cmakeBuild does not use buildType correctly for visual studio


For Linux is correctly adds -DCMAKE_BUILD_TYPE=Debug or Release in the configure step

However for windows the CMAKE_BUILD_TYPE variable is ignored:
{code:java}
17:47:24    Manually-specified variables were not used by the project:
17:47:24  
17:47:24      CMAKE_BUILD_TYPE
{code}
And subsequently in the --build step, the --config is unused. Resulting in a Debug-by-default build on windows with the visual studio generator .

--config Debug or- -config Release (depending on buildType should be added to the --build phase for windows (and CMAKE_BUILD_TYPE should not be used for visual studio generator)


 

The current workaround to this is adding --config Debug/Release explicitly in the steps:
{code:java}
steps: [[args: '--config Debug', withCmake: true]]
{code}
Which of course is less than ideal if the buildType property is available.

fifteenknots505@gmail.com (JIRA)

unread,
Jul 5, 2019, 4:48:02 PM7/5/19
to jenkinsc...@googlegroups.com
Martin Weber commented on Bug JENKINS-58351
 
Re: buildType is used incorrectly for visual studio builds

Would it be possible to add this as an improvement to the plugin? Ie, when a visual studio generator is set to the generator property use config instead of CMAKE_BUILD_TYPE or would this be too custom?

I do not think an implementation will be easy, and if so, be of much use.

Remember, users may enter an arbritrary value for the build type (this is because users may define custom build-types in their CMakeLists.txt). Therefore, it is not possible to define a mapping of <custom build type> (in effect with the Makefiles generator on linux) to --config <whatever VS build needs> (in effect with the VS  generator on windows) in the plugin. Of course, the plugin could offer a way to define that mapping in its UI to solve the problem. But such an UI would be confusing to users and the pipeline UI is text based; making the cmakeBuild invocation code nearly unreadable if someone uses the snippet generator.

Apart the mapping problem,  my other concerns on implementing the improvement are

  1. It  would require to build up a knowledge base that tracks
    1. which generator needs the CMAKE_BUILD_TYPE variable at script generation time,
    2. which generator needs an extra option to specify the build-type at build time and what the name of the option is.
  2. Maintenance effort of that knowledge base (Permanent maintenance is required in case cmake comes with new generators).

Another obstacle: Users may specify an empty value for the generator, leaving the generator choice to cmake, depending on the OS your code is build on. Could be solved by an extra knowledge base that tracks cmake's default generator choice. Until a problem with a future revision of cmake that  switches to a different default generator, which again could be solved  by a permanently maintained knowledge base.

Citations:

Chuck Berry: Too much monkey business.

Kevlin Henney: Except for the problem of too many layers of indirection

Reply all
Reply to author
Forward
0 new messages