Skip to content

Fix GitVersionTask on Linux #1177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2017
Merged

Fix GitVersionTask on Linux #1177

merged 1 commit into from
May 14, 2017

Conversation

ermshiperete
Copy link
Contributor

The additional import statement introduced in #1163 causes failure
on Linux when a project tries to use the GitVersionTask. It seems
that Mono can't cope with an empty Project attribute in the
Import element. Additionally there seems to be a bug at least in
Mono 3.x in that it requires the argument in Exists to be passed
in quotes.

This change fixes these two problems and allows to use the
GitVersionTask again on Linux.

I'd appreciate if a Beta-12 with this fix could be released soon.

Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. I only have a couple of questions I would appreciate to have answered. 😃 It would be good to have the Travis build green as well. I haven't looked at why it's failing.

@@ -9,6 +9,7 @@
<GitVersionPath Condition="'$(GitVersionPath)' == ''">$(MSBuildProjectDirectory)</GitVersionPath>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == '' And Exists('$(MSBuildProjectDirectory)\GitVersionTask.targets')">$(SolutionDir)\GitVersionTask.targets</GitVersionCustomizeTargetFile>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == '' And '$(SolutionDir)' != '' And Exists('$(SolutionDir)\GitVersionTask.targets')">$(SolutionDir)\GitVersionTask.targets</GitVersionCustomizeTargetFile>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == ''">*Undefined*</GitVersionCustomizeTargetFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen *Undefined* used as a placeholder in MSBuild before. Won't an empty element initialise the property to an empty string?

@@ -9,6 +9,7 @@
<GitVersionPath Condition="'$(GitVersionPath)' == ''">$(MSBuildProjectDirectory)</GitVersionPath>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == '' And Exists('$(MSBuildProjectDirectory)\GitVersionTask.targets')">$(SolutionDir)\GitVersionTask.targets</GitVersionCustomizeTargetFile>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == '' And '$(SolutionDir)' != '' And Exists('$(SolutionDir)\GitVersionTask.targets')">$(SolutionDir)\GitVersionTask.targets</GitVersionCustomizeTargetFile>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == ''">*Undefined*</GitVersionCustomizeTargetFile>
<IntermediateOutputPath Condition="$(IntermediateOutputPath) == '' Or $(IntermediateOutputPath) == '*Undefined*'">$(MSBuildProjectDirectory)\obj\$(Configuration)\</IntermediateOutputPath>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see *Undefined* is used here too and I honestly haven't noticed it before. Seems like @SimonCropp added it in ec6e369. Is this normal MSBuild nomenclature?

@@ -9,6 +9,7 @@
<GitVersionPath Condition="'$(GitVersionPath)' == ''">$(MSBuildProjectDirectory)</GitVersionPath>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == '' And Exists('$(MSBuildProjectDirectory)\GitVersionTask.targets')">$(SolutionDir)\GitVersionTask.targets</GitVersionCustomizeTargetFile>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == '' And '$(SolutionDir)' != '' And Exists('$(SolutionDir)\GitVersionTask.targets')">$(SolutionDir)\GitVersionTask.targets</GitVersionCustomizeTargetFile>
<GitVersionCustomizeTargetFile Condition="'$(GitVersionCustomizeTargetFile)' == ''">*Undefined*</GitVersionCustomizeTargetFile>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -39,7 +40,7 @@
TaskName="GitVersionTask.WriteVersionInfoToBuildLog"
AssemblyFile="$(GitVersionTaskLibrary)GitVersionTask.dll" />

<Import Project="$(GitVersionCustomizeTargetFile)" Condition="'$(GitVersionCustomizeTargetFile)' != '' and Exists($(GitVersionCustomizeTargetFile))" />
<Import Project="$(GitVersionCustomizeTargetFile)" Condition="'$(GitVersionCustomizeTargetFile)' != '' and Exists('$(GitVersionCustomizeTargetFile)')" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you have to check for *Undefined* here as well?

@@ -37,7 +38,7 @@
TaskName="GitVersionTask.WriteVersionInfoToBuildLog"
AssemblyFile="$(GitVersionTaskLibrary)GitVersionTask.dll" />

<Import Project="$(GitVersionCustomizeTargetFile)" Condition="'$(GitVersionCustomizeTargetFile)' != '' and Exists($(GitVersionCustomizeTargetFile))" />
<Import Project="$(GitVersionCustomizeTargetFile)" Condition="'$(GitVersionCustomizeTargetFile)' != '' and Exists('$(GitVersionCustomizeTargetFile)')" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you have to check for *Undefined* here as well?

@ermshiperete
Copy link
Contributor Author

The travis build failures don't look like they are related to this change.


Review status: 0 of 2 files reviewed at latest revision, 5 unresolved discussions, some commit checks failed.


src/GitVersionTask/NugetAssets/build/GitVersionTask.targets, line 12 at r1 (raw file):

Previously, asbjornu (Asbjørn Ulsberg) wrote…

I've never seen *Undefined* used as a placeholder in MSBuild before. Won't an empty element initialise the property to an empty string?

You're right. I didn't think that it would work, but it does! Done.


src/GitVersionTask/NugetAssets/build/GitVersionTask.targets, line 13 at r1 (raw file):

Previously, asbjornu (Asbjørn Ulsberg) wrote…

I can see *Undefined* is used here too and I honestly haven't noticed it before. Seems like @SimonCropp added it in ec6e369. Is this normal MSBuild nomenclature?

I've occasionally seen it in Conditions, but I don't know if it will actually ever have this value (unless explicitly set to it 😃 )


src/GitVersionTask/NugetAssets/buildMultiTargeting/GitVersionTask.targets, line 12 at r1 (raw file):

Previously, asbjornu (Asbjørn Ulsberg) wrote…

Same here.

Done.


Comments from Reviewable

The additional import statement introduced in #1163 causes failure
on Linux when a project tries to use the GitVersionTask. It seems
that Mono can't cope with an empty `Project` attribute in the
`Import` element. Additionally there seems to be a bug at least in
Mono 3.x in that it requires the argument in `Exists` to be passed
in quotes.

This change fixes these two problems and allows to use the
GitVersionTask again on Linux.
@JakeGinnivan JakeGinnivan merged commit 35abfc8 into GitTools:master May 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants