box icon indicating copy to clipboard operation
box copied to clipboard

Cannot exclude binary file from compaction with auto-discovery

Open danepowell opened this issue 3 years ago • 2 comments

Bug report

Question Answer
Box version 3.13.0
PHP version 7.4
Platform with version Ubuntu
Github Repo -

I'd like to use auto-discovery to build my phar and use the PHP compactor, but there's a single PHP file that needs to be added without any compaction. It seems like this isn't possible.

The file I'm trying to exclude from compaction is src/Foo/Bar/FooBar.php

box.json.dist
{
   "compactors": [
       "KevinGH\\Box\\Compactor\\Json",
       "KevinGH\\Box\\Compactor\\Php"
   ],
   "directories": [
       "app",
       "config"
   ],
   "directories-bin": [
       "src/Foo/Bar"
   ],
   "main": "bin/something",
   "output": "something",
   "git-version": "package_version",
   "compression": "GZ",
   "force-autodiscovery": true
}

The note in configuration.md leads me to believe that this is caused by the binary file getting added a second time in non-binary mode:

Warning: binary files are added before regular files. As a result if a file is found in both regular files and binary files, the regular file will take precedence

Is there some way to exclude this file during auto-discovery so that it stays binary / uncompacted, or is it simply not possible to add binary files using auto-discovery?

danepowell avatar Sep 27 '21 22:09 danepowell

Not that I'm aware, but it makes me wonder why this [the quote you put] is happening. It may be for historic reasons or maybe there is something else. Might be worth checking as I can see the behaviour you wish as more desirable.

theofidry avatar Sep 28 '21 20:09 theofidry

Sorry a bit late to the reply. Since changing this would be a BC break, I'll add it to the Box5 milestone.

If anyone has the problem meanwhile, you unfortunately will have to do without auto-discovery.

theofidry avatar Feb 03 '23 22:02 theofidry