marinofelipe / swift-package-info

Swift CLI tool that provides information about a Swift Package
MIT License
75 stars 7 forks source link

Results polluted by previous runs #17

Closed MontakOleg closed 3 years ago

MontakOleg commented 3 years ago

Hey again, @marinofelipe 👋

I noticed that several runs on different projects affects results.

For example: swift-package-info --for https://github.com/ReactiveX/RxSwift --product RxCocoa EmptyApp size on disk: 2.6MB App with RxCocoa size on disk: 4.3MB Increase: 1.6 MB

swift-package-info --for https://github.com/ReactiveX/RxSwift --product RxSwift EmptyApp size on disk: 4.3MB App with RxSwift size on disk: 4.3MB Increase: Zero KB

(in example we use same project with different products, but same right for different repos too)

This is because each run reuse same directory for EmptyApp:

Cloning empty app

Running Shell command

fatal: destination path 'swift-package-info' already exists and is not an empty directory.

Finished Shell command
marinofelipe commented 3 years ago

Hey @MontakOleg , thanks again, it's nice to have you contributing so much 😄 . Which version are you using? This should be fixed from latest release 🤔 .

The empty app is cloned into a temporary directory that shouldn't leave trails nor impact other measurements.

This is the result I get when running on v 1.0.5, on command after the other:

swift-package-info --for https://github.com/ReactiveX/RxSwift --product RxCocoa

Identified Swift Package:
Repository URL: https://github.com/ReactiveX/RxSwift
Version: Undefined
Product: RxCocoa

Invalid version: Undefined

Using latest found tag instead: 6.1.0

[7/7] Reseting and cleaning up empty app...

+------------------------------------------------+
|               Swift Package Info               |
|                                                |
|                 RxCocoa, 6.1.0                 |
+--------------+---------------------------------+
| Provider     | Results                         |
+--------------+---------------------------------+
| Binary Size  | Binary size increases by 1,6 MB |
| Platforms    | System default                  |
| Dependencies | No third-party dependencies :)  |
+--------------+---------------------------------+
> Total of 3 providers used.

swift-package-info --for https://github.com/ReactiveX/RxSwift --product RxSwift

Identified Swift Package:
Repository URL: https://github.com/ReactiveX/RxSwift
Version: Undefined
Product: RxSwift

Invalid version: Undefined

Using latest found tag instead: 6.1.0

[7/7] Reseting and cleaning up empty app...

+------------------------------------------------+
|               Swift Package Info               |
|                                                |
|                 RxSwift, 6.1.0                 |
+--------------+---------------------------------+
| Provider     | Results                         |
+--------------+---------------------------------+
| Binary Size  | Binary size increases by 963 KB |
| Platforms    | System default                  |
| Dependencies | No third-party dependencies :)  |
+--------------+---------------------------------+
> Total of 3 providers used.
MontakOleg commented 3 years ago

I use version 1.0.5 installed by mint:

➜  swift-package-info (main) ✗ mint install marinofelipe/swift-package-info
🌱 Finding latest version of swift-package-info
🌱 Cloning swift-package-info 1.0.5
🌱 Resolving package
🌱 Building package
🌱 Installed swift-package-info 1.0.5
🌱 Linked swift-package-info 1.0.5 to /usr/local/bin
➜  swift-package-info (main) ✗ swift-package-info --for https://github.com/ReactiveX/RxSwift --product RxCocoa

Identified Swift Package:
Repository URL: https://github.com/ReactiveX/RxSwift
Version: Undefined
Product: RxCocoa

Invalid version: Undefined

Using latest found tag instead: 6.1.0

[6/6] Calculating updated binary size...
+------------------------------------------------+
|               Swift Package Info               |
|                                                |
|                 RxCocoa, 6.1.0                 |
+--------------+---------------------------------+
| Provider     | Results                         |
+--------------+---------------------------------+
| Binary Size  | Binary size increases by 1,6 MB |
| Platforms    | System default                  |
| Dependencies | No third-party dependencies :)  |
+--------------+---------------------------------+
> Total of 3 providers used.

➜  swift-package-info (main) ✗ swift-package-info --for https://github.com/ReactiveX/RxSwift --product RxSwift

Identified Swift Package:
Repository URL: https://github.com/ReactiveX/RxSwift
Version: Undefined
Product: RxSwift

Invalid version: Undefined

Using latest found tag instead: 6.1.0

[6/6] Calculating updated binary size...
+-------------------------------------------------+
|               Swift Package Info                |
|                                                 |
|                 RxSwift, 6.1.0                  |
+--------------+----------------------------------+
| Provider     | Results                          |
+--------------+----------------------------------+
| Binary Size  | Binary size increases by Zero KB |
| Platforms    | System default                   |
| Dependencies | No third-party dependencies :)   |
+--------------+----------------------------------+
> Total of 3 providers used.

Your output contains: [7/7] Reseting and cleaning up empty app... step, which missing in my output. Looks like this step was removed in https://github.com/marinofelipe/swift-package-info/commit/045a08fe0d17b142af3fc63f6fee8c1e7a9007c3.

The empty app is cloned into a temporary directory that shouldn't leave trails nor impact other measurements.

As I can see fileManager.temporaryDirectory point to same directory each run (/var/folders/gz/k5y4mzt57vl1ppy0n_4qtdw80000gn/T in my case)

marinofelipe commented 3 years ago

Ohhh, good catch. I wasn't testing on latest version 🙈 . I can now definitely reproduce the same behavior. Cool, I'll look into the PR you opened up 👍 .