Repository: pantsbuild/pants

Issue:
Resources no longer works with source files beginning with a '.'
#### Repro
BUILD file:
```
jvm_binary(
    name='bin',
    dependencies=[
        ':hidden',
        ':visible',
    ],
)

resources(
    name='hidden',
    sources=['.myHiddenFile.txt'],
)

resources(
    name='visible',
    sources=['myVisibleFile.txt'],
)
```
Otherwise int he folder, just those 2 text files, a simple `pants.ini` with just the pants version set, and the pants executable.

Run: `./pants bundle ./::` and then `tar -tf dist/.bin-bundle/libs/.hidden-0.jar` and `tar -tf dist/.bin-bundle/libs/.visible-0.jar`:

In 1.3.0.dev13 & 1.3.0.dev14, you get:
```
$ tar -tf dist/.bin-bundle/libs/.hidden-0.jar
META-INF/
META-INF/MANIFEST.MF
.myHiddenFile.txt
$ tar -tf dist/.bin-bundle/libs/.visible-0.jar 
META-INF/
META-INF/MANIFEST.MF
myVisibleFile.txt
```

In 1.3.0.dev15, dev16, dev17, dev18, dev19, you get:
```
$ tar -tf dist/.bin-bundle/libs/.hidden-0.jar 
META-INF/
META-INF/MANIFEST.MF
$ tar -tf dist/.bin-bundle/libs/.visible-0.jar
META-INF/
META-INF/MANIFEST.MF
myVisibleFile.txt
```



Discussion:
@bhmiller currently in the v2 engine all hidden files are ignored by default. I believe a quick fix should be to drop an explicit whitelist entry in your `pants.ini` like so:

```
pants_ignore: +['!.myHiddenFile.txt']
```

but you'd have to know all of the hidden filenames to whitelist in advance or add them as you go along, which might be suboptimal.
I think we can change the default to ignore hidden directories, but not hidden files.
ok - thanks for the work around. will give it a try.
@kwlzn why the silent behavior change? It seems unfortunate to just change this behavior without a transition period. Or did I miss some warning somewhere telling me not to do that?
@copumpkin this is a part of shipping the v2 engine as a default in 1.3.0, which is still under active development noted by the version suffix (e.g. `1.3.0.dev18`). dev releases don't carry strong guarantees around behavior changes outside of public API deprecations - and we rely on the testing period for dev releases to catch bugs like this before cutting the 1.3.0 rcs (e.g. `1.3.0rc0`) and ultimately the release (`1.3.0`).

so, if you want stability here you should be tracking stable releases vs dev releases. current stable releases are `1.2.x` now until `1.3.0` goes out.

Oh, sure, I just got the impression from your wording that it was an intentional change that would make it to 1.3.0 final. If this behavior is just an artifact of being a dev release, then that makes sense.
I think we'll likely fix this either by moving to only ignore hidden directories by default, or by adding an option to use the `.gitignore` file, and then using that.

Resolving patch:
diff --git a/src/python/pants/option/global_options.py b/src/python/pants/option/global_options.py
--- a/src/python/pants/option/global_options.py
+++ b/src/python/pants/option/global_options.py
@@ -169,15 +169,15 @@ def register_options(cls, register):
     # e.g. '/dist/'
     rel_distdir = '/{}/'.format(os.path.relpath(register.bootstrap.pants_distdir, get_buildroot()))
     register('--ignore-patterns', advanced=True, type=list, fromfile=True,
-             default=['.*', rel_distdir, 'bower_components', 'node_modules', '*.egg-info'],
+             default=['.*/', rel_distdir, 'bower_components/', 'node_modules/', '*.egg-info/'],
              removal_version='1.3.0.dev0', removal_hint='Use --build-ignore instead.',
              mutually_exclusive_group='build_ignore', help='See help for --build-ignore.')
     register('--build-ignore', advanced=True, type=list, fromfile=True,
-             default=['.*', rel_distdir, 'bower_components', 'node_modules', '*.egg-info'],
+             default=['.*/', rel_distdir, 'bower_components/', 'node_modules/', '*.egg-info/'],
              help='Paths to ignore when identifying BUILD files. '
                   'This does not affect any other filesystem operations. '
                   'Patterns use the gitignore pattern syntax (https://git-scm.com/docs/gitignore).')
-    register('--pants-ignore', advanced=True, type=list, fromfile=True, default=['.*', rel_distdir],
+    register('--pants-ignore', advanced=True, type=list, fromfile=True, default=['.*/', rel_distdir],
              help='Paths to ignore for all filesystem operations performed by pants '
                   '(e.g. BUILD file scanning, glob matching, etc). '
                   'Patterns use the gitignore syntax (https://git-scm.com/docs/gitignore). '


Test patch:
diff --git a/tests/python/pants_test/option/test_options_integration.py b/tests/python/pants_test/option/test_options_integration.py
--- a/tests/python/pants_test/option/test_options_integration.py
+++ b/tests/python/pants_test/option/test_options_integration.py
@@ -288,7 +288,7 @@ def test_pants_ignore_option(self):
                                   '--no-colors',
                                   'options'])
       self.assert_success(pants_run)
-      self.assertIn("pants_ignore = ['.*', '/dist/', 'some/random/dir'] (from CONFIG)",
+      self.assertIn("pants_ignore = ['.*/', '/dist/', 'some/random/dir'] (from CONFIG)",
                     pants_run.stdout_data)
 
   @ensure_engine
@@ -305,5 +305,5 @@ def test_pants_ignore_option_non_default_dist_dir(self):
                                   '--no-colors',
                                   'options'])
       self.assert_success(pants_run)
-      self.assertIn("pants_ignore = ['.*', '/some/other/dist/dir/', 'some/random/dir'] (from CONFIG)",
+      self.assertIn("pants_ignore = ['.*/', '/some/other/dist/dir/', 'some/random/dir'] (from CONFIG)",
                     pants_run.stdout_data)