mfkl / libvlc-nuget

NuGet packaging setup for LibVLC
GNU Lesser General Public License v2.1
61 stars 10 forks source link

Allow to selectively copy plugins #4

Closed jeremyVignelles closed 6 years ago

jeremyVignelles commented 6 years ago

With this feature, you can select which plugins gets copied/not copied (see README). 🎉

The use of batching requires that we use a Task for that, that executes before build. As a side effect, Visual Studio doesn't show the libvlc folder in the solution folder anymore! 🎉 again!

mfkl commented 6 years ago

As a side effect, Visual Studio doesn't show the libvlc folder in the solution folder anymore!

Now I'm wondering. Is that a good thing or not?

jeremyVignelles commented 6 years ago

As a side effect, Visual Studio doesn't show the libvlc folder in the solution folder anymore!

Now I'm wondering. Is that a good thing or not?

I think it is:

We don't really have the choice anyway: batching is a powerful feature that would be hard to replace in a pure-msbuild way.

Anyway, I updated my branch based on your comments, I'm waiting for your review 😄

mfkl commented 6 years ago

So what's the status for this? Is it ready on your side?

You include everything by default right? hrtf etc

jeremyVignelles commented 6 years ago

It's not ready : I will split win32/64 selections and explain how to do accordingly. Including other files in the nuget package is out of scope of this PR, and you are welcome to do that ( and I will rebase my work on top of that, and include the other things by default when needed)

jeremyVignelles commented 6 years ago

Finished adding files to the package (lua, locales and hrtfs). Don't know what languages is, so I didn't include it.

for me, it's ready for a merge :)

mfkl commented 6 years ago

Built a nuget with your branch and added the following lines to my sample project's csproj:

  <VlcWindowsX64ExcludeFiles Include="plugins/gui/libqt_plugin.dll" />
  <VlcWindowsX64ExcludeFiles Include="plugins/lua" />
  <VlcWindowsX86ExcludeFiles Include="@(VlcWindowsX64ExcludeFiles)" />

Everything still gets copied. What am I missing here?

jeremyVignelles commented 6 years ago

Did you do that in an ItemGroup? did you build a new version or did you forget to remove the cache?

mfkl commented 6 years ago

Did you do that in an ItemGroup?

Yes.

did you build a new version or did you forget to remove the cache?

New alpha version.

I guess you don't have this issue..

jeremyVignelles commented 6 years ago

I have to check again, but as far as I remember, I didn't have that issue

jeremyVignelles commented 6 years ago

For lua, you need to select files, not the directory IIRC. Try appending /%2A%2A

jeremyVignelles commented 6 years ago

Folder separator must always be the same. Since I have no control over what is generated with globbing (**gets expanded to a\b\c), I decided to use \ everywhere, until this issue is resolved : https://github.com/Microsoft/msbuild/issues/1024

You cannot select a folder with include or exclude, use \%2A at the end to select all its files or \%2A%2A to select recursively all the files at any level under.

Sorry for the lack of testing, it should be better now, but you are welcome to check twice ;)

mfkl commented 6 years ago

Thanks for your edits. It works here. 2 remarks:

jeremyVignelles commented 6 years ago

You can perfectly use both strategy. in fact, that's what you're doing when you're just using Exclude : there is a default include.

Printing a message could be done, but requires me to add temp items steps in the .targets. Is that really something useful? If I remember correctly, if you increase msbuild verbosity, you can have the full list of what gets copied (including your own project's DLL)

mfkl commented 6 years ago

Is that really something useful?

Yes, I definitely think it would be.

It's informative for people who just added the nuget along with C# bindings, are not familiar with libvlc and did not read the docs. It would print something like VLC plugins included: 412 / VLC plugins excluded: 2 in the VS console, which suggests you can actually configure that. Maybe even print a link to your cherry-pick readme page.

Passing /v:diag to msbuild does the trick, although it makes the output unreadable if you include most plugins as it prints the names of the plugin dlls instead of just the count. Maybe we could do something with https://docs.microsoft.com/en-us/visualstudio/msbuild/build-loggers later on. That can wait though.

mfkl commented 6 years ago

https://www.nuget.org/packages/VideoLAN.LibVLC.Windows/3.0.0-alpha3