Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I wanted to put my solutions from 2022 into the same repository as this year so I adapted the repository to be able to include both. It's clear by #22 and #77 that I'm not alone. I was surprised to come back over here and see #77 so recently added but I think this is a much more elegant and general solution. If you want to see it in action, take a look at my AOC repo.
Each year lives in its own
./<year>/
subdirectory. They're different packages specified in./Cargo.toml
as members in a workspace since was how I could get cargo to not freak out about the code structure. Running things within the./<year>/
directory is the same as before since it's a separate package. For running things in the repository root directory, I've reworked the,/src/template/
code use theAOC_YEAR
environment variable to determine what year to run commands as. To that end I've added new cargo aliases forget-year
andset-year
which check and set this variable.Most of the "new" stuff in the PR is actually just a slightly modified version of the existing repository. In order to set up a new year, there's a directory
./year_template/
which just contains the repository files with the year numbers shaved off. To that end, I also added a cargo aliasnew-year
for use in the repository root directory. This command (1) copies the contents of./year_template/
into a folder for the new year, (2) swaps the year numbers, (3) runs theset-year
command, and (4) adds the new year as a workspace member to./Cargo.toml
.Testing code with this new framework got annoying so I also added a cargo alias
try
specifically for that.The Downsides:
./.cargo/config.toml
. I have no idea how this interacts with the repository secrets, star tracker, benchmarking table, etc if at all since I don't use those features.I don't know if this is the direction we might want to go with this repository but if nothing else there are some pieces of this like the
try
command that could be useful.