Skip to content
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

Corrected issue with WixHeat HarvestType Out parameter #1055

Closed
robertmuehsig opened this issue Jul 14, 2016 · 17 comments
Closed

Corrected issue with WixHeat HarvestType Out parameter #1055

robertmuehsig opened this issue Jul 14, 2016 · 17 comments
Labels
Milestone

Comments

@robertmuehsig
Copy link
Contributor

robertmuehsig commented Jul 14, 2016

What You Are Seeing?

HarvestType issue

When I use the WixHeat sample:

Task("Demo-HarvestType")
    .Does(() =>
{
    var harvestFiles =  Directory("./");
    var filePath = File("cake.wxs");
    WiXHeat(harvestFiles, filePath, new HeatSettings { HarvestType = WiXHarvestType.Dir });
});

// ========================================
// Demo-HarvestType
// ========================================
// Executing task: Demo-HarvestType
// An error occured when executing task 'Demo-HarvestType'.
// Error: Incorrect harvest type for input.
// Parameter name: harvestTarget
// PS D:\Temp\CAKE> $

failing default heatSettings

When I use "default" HeatSettings:

Task("Demo-NoSettings")
    .Does(() =>
{
    var harvestFiles =  Directory("./");
    var filePath = File("cake.wxs");
    WiXHeat(harvestFiles, filePath);
});

It will fail with:

// ========================================
// Demo-NoSettings
// ========================================
// Executing task: Demo-NoSettings
// heat.exe : error HEAT0319 : The '-out' or '-o' parameter must specify a file path.
// An error occured when executing task 'Demo-NoSettings'.
// Error: Heat: Process returned an error (exit code 319).

What is Expected?

For the HarvestType issue: "Correct" binding?

And the given "resultfile" should appear as a -out / -o parameter for heat.exe. I can do a workaround via the ArgumentCustomization, but this will "break" when someone fixes the root cause.

What version of Cake are you using?

0.14.0

Are you running on a 32 or 64 bit system?

64bit

What environment are you running on? Windows? Linux? Mac?

Windows

Are you running on a CI Server? If so, which one?

No

How Did You Get This To Happen? (Steps to Reproduce)

#tool "nuget:?package=WiX.Toolset"

// ========================================
// Demo-HarvestType
// ========================================
// Executing task: Demo-HarvestType
// An error occured when executing task 'Demo-HarvestType'.
// Error: Incorrect harvest type for input.
// Parameter name: harvestTarget
// PS D:\Temp\CAKE> $

Task("Demo-HarvestType")
    .Does(() =>
{
    var harvestFiles =  Directory("./");
    var filePath = File("cake.wxs");
    WiXHeat(harvestFiles, filePath, new HeatSettings { HarvestType = WiXHarvestType.Dir });
});


// ========================================
// Demo-NoSettings
// ========================================
// Executing task: Demo-NoSettings
// heat.exe : error HEAT0319 : The '-out' or '-o' parameter must specify a file path.
// An error occured when executing task 'Demo-NoSettings'.
// Error: Heat: Process returned an error (exit code 319).
Task("Demo-NoSettings")
    .Does(() =>
{
    var harvestFiles =  Directory("./");
    var filePath = File("cake.wxs");
    WiXHeat(harvestFiles, filePath);
});


RunTarget("Demo-NoSettings");

Output Log

(see above)

@RLittlesII
Copy link
Contributor

@robertmuehsig It looks like its converting the Directory("./") to a string and using the wrong Run overload. I'll look into this tonight.

@devlead
Copy link
Member

devlead commented Jul 14, 2016

@robertmuehsig to test @RLittlesII theory you could try changing var harvestFiles = Directory("./"); to DirectoryPath harvestFiles = Directory("./")

@gep13
Copy link
Member

gep13 commented Jul 19, 2016

@robertmuehsig did you see @devlead comment above? Are you in a position to test this?

@robertmuehsig
Copy link
Contributor Author

Woops - sorry - I found a workaround. Will try to look at it this week.

@gep13
Copy link
Member

gep13 commented Jul 19, 2016

@robertmuehsig that would be great, thank you!

Would you also be able to document the workaround? Also, do you think that this is still an issue? Or can this be closed?

@robertmuehsig
Copy link
Contributor Author

The workaround is not cake related (and not very elegant). I "solved" it with a nasty pre build event and invoke heat.exe from there.
But I still would say that the actual issue is still there - at least the documentation might be missleading.

@gep13
Copy link
Member

gep13 commented Jul 19, 2016

@RLittlesII did you get anywhere when you were looking into this?

@RLittlesII
Copy link
Contributor

@gep13 been sick. I'll dig into root cause as soon as I am able.

@devlead
Copy link
Member

devlead commented Jul 19, 2016

@RLittlesII no worries get well soon!

@gep13
Copy link
Member

gep13 commented Jul 19, 2016

@RLittlesII said...
been sick. I'll dig into root cause as soon as I am able.

Not a problem, hope you feel better soon!

@RLittlesII
Copy link
Contributor

@gep13 I am able to reproduce this issue.
@devlead I have verified my theory based on your recommendation.
This gist shows the results between two different executions.
Can you suggest a better way for me to handle the return from the Directory("./") call? I didn't realize that it would convert it to a string.

@robertmuehsig can you confirm that this resolves your issue?

@robertmuehsig
Copy link
Contributor Author

Even when I change "var" to "DirectoryPath" I get the same error message. I even do the MakeAbsolute(filePath).FullPath dance, but it seems the second parameter will not pop up as -out parameter.

// ========================================
// Demo-NoSettings
// ========================================
// heat.exe : error HEAT0319 : The '-out' or '-o' parameter must specify a file path.
// An error occured when executing task 'Demo-NoSettings'.
// Error: Heat: Process returned an error (exit code 319).
Task("Demo-NoSettings")
    .Does(() =>
{
    DirectoryPath harvestFiles =  Directory("./");
    var filePath = File("cake.wxs");
    WiXHeat(harvestFiles, MakeAbsolute(filePath).FullPath);
});


RunTarget("Demo-NoSettings");

@devlead
Copy link
Member

devlead commented Jul 22, 2016

.FullPath property is a string, does it work if you drop that part?

@robertmuehsig
Copy link
Contributor Author

Nope - same error.

@RLittlesII
Copy link
Contributor

I'll take a deeper look into this and see if I can provide an effective solution.

@RLittlesII
Copy link
Contributor

@devlead What I have noticed is, if I use var harvestDirectory = Directory("./src"); it resolves correctly, but var harvestDirectory = Directory("./"); heat returns an error "heat.exe : error HEAT0001 : startIndex cannot be larger than length of string. Parameter name: startIndex". Both return a type of ConvertableDirectoryPath. ./ shows this from the diagnostic output
Executing: "C:/Program Files (x86)/WiX Toolset v3.10/bin/heat.exe" dir "" -out C:/Users/RLITTLES/Source/Repos/Xamarin.MobileWorld/Wix.Directory.wxs". DirectoryPath("./") doesn't return a valid string.

@gep13 I reworked the code to have the Alias accept the WiXHarvestType directly. This will fix the first issue. The second issue was a result of the first. Passing in the WiXHarvestType from the alias, I am now allowing heat.exe to determine if it has the correct inputs, rather than cake trying to do that job. Now if the HarvestType doesn't match the input type heat will throw the exception itself.

@gep13
Copy link
Member

gep13 commented Jul 28, 2016

@RLittlesII said...
@gep13 I reworked the code to have the Alias accept the WiXHarvestType directly. This will fix the first issue. The second issue was a result of the first.

Sounds good to me!

@gep13 gep13 added the Bug label Jul 28, 2016
@gep13 gep13 modified the milestone: v0.15.2 Jul 28, 2016
@gep13 gep13 changed the title WixHeat: HarvestType Out parameter issue Corrected issue with WixHeat HarvestType Out parameter Jul 28, 2016
@gep13 gep13 closed this as completed Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants