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

Function to remove Compile elems missing files #1078

Merged
merged 1 commit into from
Jan 18, 2016

Conversation

bentayloruk
Copy link
Contributor

As well as keeping project files in sync, I also need to be able to remove Compile nodes from a project, where the Include attribute points to a file that is missing from disk. This is useful when I have two projects including the same files, and I delete a bunch of them from the 'master' project I happen to be working on.

This PR adds two functions. RemoveCompileNodesWithMissingFiles is intended for build script use and removeCompileNodesWithMissingFiles exists for testing purposes, because unlike the former, it does not write to the file system. I noticed this convention elsewhere in FAKE, but I'm not sure if it is considered idiomatic. Let me know.

There is currently a single test that works. I'm going to try this on a real example tomorrow too. However, wanted to get it up for discussion.

@bentayloruk
Copy link
Contributor Author

I'll have a look at this failure tomorrow.

@bentayloruk
Copy link
Contributor Author

This works locally. I've reviewed it and think it's likely to be an x-plat path comparison issue in the test. Will push potential fix shortly.

@bentayloruk
Copy link
Contributor Author

OK. So I was correct and it fixed the x-plat path issue. However, I also added another check for a file in sub-folder and that bailed, because the include path of Folder\FolderFile2.cs in the csproj is a Windows style path. Need to find out if a csproj with Include paths like this works x-plat...

@bentayloruk
Copy link
Contributor Author

Time for a 🍺! 😉

I'm going to test this with a couple of real-world solutions now. Will leave as WIP and update when happy here.

@forki
Copy link
Member

forki commented Jan 17, 2016

Yes please let me know when it's ready
On Jan 17, 2016 1:33 PM, "Ben Taylor" notifications@github.com wrote:

Time for a [image: 🍺]! [image: 😉]

I'm going to test this with a couple of real-world solutions now. Will
leave as WIP and update when happy here.


Reply to this email directly or view it on GitHub
#1078 (comment).

@bentayloruk
Copy link
Contributor Author

I've failed to test this in the real-world yet. If I copy over the build binaries to my project and run it, I get this error, which is very odd, as the switch looks valid to me:

FsiEvaluationSession could not be created.

error FS0243: Unrecognized option: '-g+'

Build failed.
Error:
Error while creating a fsi session.
InnerException:
Error creating evaluation session: StopProcessing
  "{Exception =
  Error
    ((243, "Unrecognized option: '-g+'"),
     commandLineArgs (0,0--0,80) IsSynthetic=false);
 Phase = Parameter;}"

If I try and build the FAKE Nuget with the CreateNuget target, instead of just copying over the bin, I get this error on the SourceLink step.

Finished Target: GenerateDocs
Starting Target: SourceLink (==> GenerateDocs)
Running build failed.
Error:
System.Exception: unable to load proj file `C:\Build\FAKE\src\app\FAKE\FAKE.fsproj` with properties: [("Configuration", "Release")], error Could not l
oad file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
 The system cannot find the file specified.
   at SourceLink.VsBuild.Project-Load-Static@22.Invoke(String message) in C:\projects\sourcelink\SourceLink\VsProj.fs:line 22
   at SourceLink.VsBuild.Project.Load.Static(String proj, IEnumerable`1 globalProps) in C:\projects\sourcelink\SourceLink\VsProj.fs:line 22
   at SourceLink.VsBuild.Project.LoadRelease.Static(String proj) in C:\projects\sourcelink\SourceLink\VsProj.fs:line 23
   at FSI_0001.Build.clo@192-14.Invoke(String f)
   at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc`2 action, IEnumerable`1 source)
   at FSI_0001.Build.clo@190-13.Invoke(Unit _arg8)
   at Fake.TargetHelper.runSingleTarget(TargetTemplate`1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483

What is the "best" way to build FAKE locally and test as a Nuget on a real project? My plan was to use CreateNuget and then add it as a dir source in paket.

@forki
Copy link
Member

forki commented Jan 17, 2016

Just run it without the sourcelink target
On Jan 17, 2016 5:04 PM, "Ben Taylor" notifications@github.com wrote:

I've failed to test this in the real-world yet. If I copy over the build
binaries to my project and run it, I get this error, which is very odd, as
the switch looks valid to me:

FsiEvaluationSession could not be created.

error FS0243: Unrecognized option: '-g+'

Build failed.
Error:
Error while creating a fsi session.
InnerException:
Error creating evaluation session: StopProcessing
"{Exception =
Error
((243, "Unrecognized option: '-g+'"),
commandLineArgs (0,0--0,80) IsSynthetic=false);
Phase = Parameter;}"

C:\Build\Enticify>build.bat 2007 > build.log
FsiEvaluationSession could not be created.

If I try and build the FAKE Nuget with the CreateNuget target, instead of
just copying over the bin, I get this error on the SourceLink step.

Finished Target: GenerateDocs
Starting Target: SourceLink (==> GenerateDocs)
Running build failed.
Error:
System.Exception: unable to load proj file C:\Build\FAKE\src\app\FAKE\FAKE.fsproj with properties: [("Configuration", "Release")], error Could not l
oad file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
at SourceLink.VsBuild.Project-Load-Static@22.Invoke(String message) in C:\projects\sourcelink\SourceLink\VsProj.fs:line 22
at SourceLink.VsBuild.Project.Load.Static(String proj, IEnumerable1 globalProps) in C:\projects\sourcelink\SourceLink\VsProj.fs:line 22 at SourceLink.VsBuild.Project.LoadRelease.Static(String proj) in C:\projects\sourcelink\SourceLink\VsProj.fs:line 23 at FSI_0001.Build.clo@192-14.Invoke(String f) at Microsoft.FSharp.Collections.SeqModule.Iterate[T](FSharpFunc2 action, IEnumerable1 source) at FSI_0001.Build.clo@190-13.Invoke(Unit _arg8) at Fake.TargetHelper.runSingleTarget(TargetTemplate1 target) in C:\code\fake\src\app\FakeLib\TargetHelper.fs:line 483

What is the "best" way to build FAKE locally and test as a Nuget on a real
project? My plan was to use CreateNuget and then add it as a dir source
in paket.


Reply to this email directly or view it on GitHub
#1078 (comment).

@bentayloruk
Copy link
Contributor Author

Will do. I was letting my make all the things work OCD get the better of me 😁.

@forki
Copy link
Member

forki commented Jan 17, 2016

Yeah but sourcelinks checking against master and your pr isn't merged to
master yet => there will always be a diff
On Jan 17, 2016 11:03 PM, "Ben Taylor" notifications@github.com wrote:

Will do. I was letting my make all the things work OCD get the better
of me [image: 😁].


Reply to this email directly or view it on GitHub
#1078 (comment).

@bentayloruk
Copy link
Contributor Author

Understood. Thanks.

As well as keeping project files in sync, I also need to be able to remove compile nodes from a project, where the Include attribute points to a file that is missing.  This is useful when I have two projects including the same files, and I delete a bunch of them from the 'master' project I happen to be working on.

This PR adds two functions.  RemoveCompileNodesWithMissingFiles is intended for build script use and removeCompileNodesWithMissingFiles exists for testing purposes, because unlike the former, it does not write to the file system.  I noticed this convention elsewhere in FAKE, but I'm not sure if it is considered idiomatic.  Let me know.
@bentayloruk
Copy link
Contributor Author

Built and tested as a nuget with my solution. It worked first time on my solution and happily fixed 8 slave projects, that contained 46 broken Compile Includes. So, works for me! Rebased against this mornings updates. 😜

@bentayloruk bentayloruk changed the title WIP function to remove Compile elems missing files Function to remove Compile elems missing files Jan 18, 2016
forki added a commit that referenced this pull request Jan 18, 2016
Function to remove Compile elems missing files
@forki forki merged commit c956409 into fsprojects:master Jan 18, 2016
@bentayloruk bentayloruk deleted the remove-missing-includes branch January 18, 2016 10:39
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.

2 participants