gobanos / cargo-aoc

437 stars 47 forks source link

Fix running from subdir in workspace #77

Open jmerdich opened 2 years ago

jmerdich commented 2 years ago

When run in a subdir within a workspace, the following error appears:

error: current package believes it's in a workspace when it's not:
current:   C:\Users\jmerdich\workspace\aoc\2021\target\aoc\aoc-autobuild\Cargo.toml
workspace: C:\Users\jmerdich\workspace\aoc\Cargo.toml

this may be fixable by adding `2021\target\aoc\aoc-autobuild` to the `workspace.members` array of the manifest located at: C:\Users\jmerdich\workspace\aoc\Cargo.toml
Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.

Tweak the templates so cargo knows the autogenerated projects are not meant for the workspace. Running in the root of a workspace is still not supported.

jmerdich commented 2 years ago

Mostly fixes #53

jmerdich commented 2 years ago

After trying this for a bit, there's instability resulting from the shared target/aoc/completed.json that is read/written during the build (race condition between multiple years). Fixing this might require always passing the year in to aoc_main!{} unless I can improve my proc-macro-fu.