Skip to content

Use defined project intermediate directory if it exists #333

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 6 commits into from
Jan 16, 2015

Conversation

bdhess
Copy link
Contributor

@bdhess bdhess commented Jan 3, 2015

Fixes #332

@gep13
Copy link
Member

gep13 commented Jan 3, 2015

@SimonCropp when you have a second, can you take a look at this one? Thanks!

@grufffta
Copy link
Contributor

grufffta commented Jan 5, 2015

I think you have deleted some code that checks if the ProjectDir (now IntermediateOutputPath) is null and tracks the temporary file. In the tests a Mock is used so the variables are not set.

Think it should be

void CreateTempAssemblyInfo(CachedVersion semanticVersion, Config configuration)
        {
            var assemblyInfoBuilder = new AssemblyInfoBuilder
                                      {
                                          CachedVersion = semanticVersion
                                      };
            var assemblyInfo = assemblyInfoBuilder.GetAssemblyInfoText(configuration);

            string tempFileName, tempDir;
            if (string.IsNullOrEmpty(IntermediateOutputPath) || string.IsNullOrWhiteSpace(IntermediateOutputPath))
            {
                tempDir = TempFileTracker.TempPath;
                tempFileName = string.Format("AssemblyInfo_{0}_{1}.g.cs", Path.GetFileNameWithoutExtension(ProjectFile), Path.GetRandomFileName());
            }
            else
            {
                tempDir = Path.Combine(IntermediateOutputPath, "obj", Configuration);
                Directory.CreateDirectory(tempDir);
                tempFileName = string.Format("GitVersionTaskAssemblyInfo.g.cs");
            }

            AssemblyInfoTempFilePath = Path.Combine(tempDir, tempFileName);
            File.WriteAllText(AssemblyInfoTempFilePath, assemblyInfo);
        }

Thanks
Gareth

@SimonCropp
Copy link
Contributor

echoing the comment by @grufffta . @bdhess was that intentional?

@bdhess
Copy link
Contributor Author

bdhess commented Jan 12, 2015

Sorry about that, and for the delay getting back to this.
@grufffta @SimonCropp - ready for another look? The build appears to be clean now. And thanks!

@JakeGinnivan
Copy link
Contributor

This looks ok to me, but looks like a breaking change. @SimonCropp thoughts?

@SimonCropp
Copy link
Contributor

Yeah in the strict sense this is breaking change

@JakeGinnivan
Copy link
Contributor

Do we care?

Should we take this into v3 which has the config changes and other breaking stuff. Or just merge and put into next minor release?

@SimonCropp
Copy link
Contributor

i think next minor is OK. i doubt many people are using the task on its own. and even if they do it will fail at buid time

JakeGinnivan added a commit that referenced this pull request Jan 16, 2015
Use defined project intermediate directory if it exists
@JakeGinnivan JakeGinnivan merged commit 74a36ee into GitTools:master Jan 16, 2015
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.

Defined project intermediate directory is not respected
5 participants