ndmitchell / weeder

Detect dead exports or package imports
BSD 3-Clause "New" or "Revised" License
124 stars 8 forks source link

main executable is marked as a weed #29

Closed hanjoosten closed 6 years ago

hanjoosten commented 6 years ago

After running weeder on my project (Ampersand), it warns that the main executable is redundant. I firmly believe it is not 😁

This is the output:

PS C:\Users\hjo20125\Git\Ampersand> weeder . --build
weeder : ampersand-3.9.1: unregistering (components added: exe:ampersand, test:ampersand-test, test:regression-test)
At line:1 char:1
+ weeder . --build
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ampersand-3.9.1...egression-test):String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

ampersand-3.9.1: configure (lib + exe + test)
Configuring ampersand-3.9.1...
ampersand-3.9.1: build (lib + exe + test)
Static files unchanged, no need to update src/Ampersand/Prototype/StaticFiles_Generated.hs
Preprocessing library ampersand-3.9.1...
[  9 of 112] Compiling Ampersand.Basics.BuildInfo_Generated ( src\Ampersand\Basics\BuildInfo_Generated.hs, .stack-work\dist\ca59d0ab\build\Ampersand\Basics\BuildInfo_Generated.o )
Preprocessing executable 'ampersand' for ampersand-3.9.1...
Linking .stack-work\dist\ca59d0ab\build\ampersand\ampersand.exe ...
Preprocessing test suite 'ampersand-test' for ampersand-3.9.1...
Linking .stack-work\dist\ca59d0ab\build\ampersand-test\ampersand-test.exe ...
Preprocessing test suite 'regression-test' for ampersand-3.9.1...
Linking .stack-work\dist\ca59d0ab\build\regression-test\regression-test.exe ...
ampersand-3.9.1: copy/register
Installing library in
C:\Users\hjo20125\Git\Ampersand\.stack-work\install\4938d489\lib\x86_64-windows-ghc-8.0.2\ampersand-3.9.1-9OW4IxuilJN65tElRslO2z
Installing executable(s) in
C:\Users\hjo20125\Git\Ampersand\.stack-work\install\4938d489\bin
Registering ampersand-3.9.1...
ampersand-3.9.1: Test running disabled by --no-run-tests flag.
Completed 2 action(s).
= Package ampersand =

== Section exe:ampersand ==
Module not compiled
* Main.hs
Redundant build-depends entry
* ampersand
* base

PS C:\Users\hjo20125\Git\Ampersand> 
hanjoosten commented 6 years ago

This project uses a custom build-type. could that have anything to do with this?

hanjoosten commented 6 years ago

This build was from the developement branch, commit 3b328c6f5e2ca4f33ad94e23a232a6faf2c9b103

ndmitchell commented 6 years ago

Thanks, I can reproduce - will have an explore later tonight.

ndmitchell commented 6 years ago

The issue is that you are using Windows, where the ampersand (due to the name of the project) and Ampersand (due to the root module) directories clash, so their contents are merged, and the equality check I was doing for filename was insufficient. I've just pushed a patch to give a platform-specific equality which does the right thing, and on your project, I now see no weeds.

ndmitchell commented 6 years ago

I've also released weeder 0.1.11 with the fix included.

hanjoosten commented 6 years ago

Thanx! works as a charm! I like the way you solved this. You are a great Haskeller!