xp-forge / lambda

AWS Lambda for the XP Framework
3 stars 0 forks source link

Unique given sources #5

Closed thekid closed 3 years ago

thekid commented 3 years ago

This pull request uniques the source files and directories given on the command line to prevent adding them to the ZIP file twice. The problem is only visible in the file size and in the output, ZIP file readers will ignore duplicate entries when extracting.

In the following examples, the user has supplied the src directory, although the packaging command already includes it!

Before

$ xp lambda package Greet.class.php src
 => [1/5] Greet.class.php                                                 1
 => [2/5] src/main/php/xp/lambda/TestLambda.class.php                    23
 => [3/5] src/main/php/xp/lambda/TestLambda.class.php                    23
 => [4/5] mework/zip/src/main/php/io/archive/zip/ZipIterator.class.php  534
 => [5/5] class.pth

Wrote 572,174 bytes

After

$ xp lambda package Greet.class.php src
[+] Creating function.zip (compression: GZ)
 => [1/4] Greet.class.php                                                 1
 => [2/4] src/main/php/xp/lambda/TestLambda.class.php                    23
 => [3/4] mework/zip/src/main/php/io/archive/zip/ZipIterator.class.php  534
 => [4/4] class.pth

Wrote 562,537 bytes
thekid commented 3 years ago

Released in https://github.com/xp-forge/lambda/releases/tag/v1.0.0