mandrean / cw-optimizoor

A blazingly fast compiling & optimization tool for CosmWasm smart contracts.
MIT License
50 stars 6 forks source link

Support single contract repos #35

Open pacmanifold opened 1 year ago

pacmanifold commented 1 year ago

@mandrean I found this today and it has already improved my life quality significantly. Thank you 🙏

But I ran into some issues when trying to compile "single contract repos" since they usually don't contain a contracts folder. Currently when running cargo cw-optimizoor in a single contract repo it results in

Error: No CW contracts found. Exiting.

To reproduce run:

cargo generate --git https://github.com/CosmWasm/cw-template.git --name cw-test-project
cd cw-test-project
cargo cw-optimizoor

This PR solves this problem by only filtering the workspace members if the workspace is virtual. Does this seem like a reasonable to you?

pacmanifold commented 1 year ago

I guess two other ideas (maybe more solid?) could be:

  1. To check for usage of cosmwasm_std::entry_point in the workspace members to determine which are CosmWasm contracts
  2. Or to require a setting in the Cargo.toml file specifying which members should be optimized
mandrean commented 1 year ago

Hey @pacmanifold! Always happy to hear user-stories like that 😄

Thanks for the contribution. I think it makes sense, with the caveat that there surely exists many projects that aren't virtual but still have a contracts/ folder. So we need to make sure we're not introducing a breaking change for existing users