Skip to content

Exclude patterns don't work when Include uses a recursive glob on OS X #970

Closed

Description

@rainersigwald
  <ItemGroup>
    <ProjectWithoutConfiguration Include="bin/**/*proj" Exclude="bin\Bootstrap\testpackage.nuproj;src\**" />
  </ItemGroup>

  <Target Name="BuildAndTest">
    <Message Text="Items: @(Projectwithoutconfiguration) " Importance="High" />
  </Target>

from the root of the MSBuild repo emits a list that contains testpackage.nuproj. If the Include pattern is bin/Bootstrap/*proj or bin/Bootstrap/**/*proj, the Exclude works as expected, so the critical piece seems to be that there is a recursive ** glob and that it gets expanded during the consideration of include.

Possibly a regression from lazy evaluation?

Activity

  1. rainersigwald commented on Aug 26, 2016

    @rainersigwald
    MemberAuthor

    cc @brthor: the only workaround I can see right now is to not use a recursive glob.

  2. brthor commented on Aug 26, 2016

    @brthor

    @rainersigwald

    I appreciate the workaround, but it is simply not possible for migration unless we evaluate the glob at migration time, in which case we are not really doing a true migration of the project.

    For the moment this will just remain a bug for migrated apps on OSX. We can direct users to clean before building to prevent inadvertent includes.

  3. cdmihai commented on Aug 26, 2016

    @cdmihai
    Contributor

    It is most likely the optimization of not exploding globs twice via the new feature in FileMatcher to accept globs to ignore.

    Before this, it worked because both include and exclude would explode globs, and those exploded strings would match just because they were produced by the same code.

    Now, the FileMatcher does a few string comparisons to reason whether to visit certain files or directories. All those string equality checks need to be probably replaced with more intelligent comparers that reason about different directory separators, os based case sensitivity, trailing slashes, etc

  4. cdmihai commented on Sep 9, 2016

    @cdmihai
    Contributor

    #978 appears to have fixed this issue. I tried reproing it on osx but the recursive excludes / includes worked fine (tests also confirm this). Only caveat for now is that excludes work with backslashes only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions