-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/old template #69
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems easier👍 will this make it impossible to run earlier years without manually converting to this new setup?
Yes, unfortunately
…________________________________
From: Sebastian Lyng Johansen ***@***.***>
Sent: Thursday, November 28, 2024 4:09:21 PM
To: seblj/cargo-aoc ***@***.***>
Cc: Sivert Johansen ***@***.***>; Author ***@***.***>
Subject: Re: [seblj/cargo-aoc] Feat/old template (PR #69)
@seblj approved this pull request.
Seems easier👍 will this make it impossible to run earlier years without manually converting to this new setup?
—
Reply to this email directly, view it on GitHub<#69 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AI5H2YASIFVDKXXMNN6VFHL2C4W2DAVCNFSM6AAAAABSVJRAWOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDINRYGQYTGOJVHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
:( I guess it should be pretty simple to create a script to convert it? |
Sure, its possible, the only issue would be if you have any dependencies. It could be tricky to figure out which day users which dependency, but you could of course copy all dependencies (if any) to all days
…________________________________
From: Sebastian Lyng Johansen ***@***.***>
Sent: Thursday, November 28, 2024 4:35:48 PM
To: seblj/cargo-aoc ***@***.***>
Cc: Sivert Johansen ***@***.***>; Author ***@***.***>
Subject: Re: [seblj/cargo-aoc] Feat/old template (PR #69)
:( I guess it should be pretty simple to create a script to convert it?
—
Reply to this email directly, view it on GitHub<#69 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AI5H2YHLDXY2YJM33LKQMID2C4Z5JAVCNFSM6AAAAABSVJRAWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBWGM4DCMZUGM>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Makes sense👍 fine by me, I'll just create a script to convert if I ever need it It makes the code here a bit easier it seems like, so let's just do it |
src/setup.rs
Outdated
format!("{dir}/main.rs"), | ||
) | ||
.await?; | ||
tokio::fs::copy(format!("{template_dir}/template.rs"), format!("{year}/{day}/main.rs")).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be tokio::fs::copy(format!("{template_dir}/template.rs"), format!("{year}/{day}/src/main.rs")).await?;
Notice the src
before main.rs
. Because, now it looks like this:
![image](https://private-user-images.githubusercontent.com/5160701/390909050-ef451e02-c12d-44dd-b5f8-8a9358ed9d86.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NjcwMzksIm5iZiI6MTczOTQ2NjczOSwicGF0aCI6Ii81MTYwNzAxLzM5MDkwOTA1MC1lZjQ1MWUwMi1jMTJkLTQ0ZGQtYjVmOC04YTkzNThlZDlkODYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMTcxMjE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTMzNmZjN2U0Nzk1MjY3YWIyNjVmZjA2MzA2N2VlY2VjNjNlMGZmYmQwYzU3YjgzNDJmZWQ1OTAwZmMxNTZjOCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.CuOXQQSOJQjY8jM0svHN5tLrrlcHZy99A8XxhlQ1X_I)
Where the main.rs
contains this:
fn main() {
println!("Hello, world!");
}
Also; what do you feel about formatting the template file as well according to how we have formatted the rest of this codebase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do that
I took my freedom to just update the PR description with a very simple and naive script to help with migration |
Idk if I used it incorrectly but ./script 2023 did not work for me 🤪. What do you think of this script #!/bin/bash
TARGET=$1
cd $TARGET
deps=($(cargo tree -e normal --depth 1 -q | grep -E '├──|└──' | awk '{print $2}'))
for folder in ./*; do
if [[ $(basename "$folder") == day_* ]]; then
found=()
main="${folder}/main.rs"
for dep in "${deps[@]}"; do
if grep -q "$dep" "$main"; then
found+=("$dep")
fi
done
mv $folder temp
cargo new $folder -q
cp temp/main.rs "${folder}/src/main.rs"
cd $folder
for dep in "${found[@]}"; do
cargo add $dep -q
done
cd ..
rm -r temp
fi
done
rm Cargo.* |
Didn't try it myself yet, but it looks great😎 |
😎👊
…________________________________
From: Sebastian Lyng Johansen ***@***.***>
Sent: Friday, November 29, 2024 11:43:17 AM
To: seblj/cargo-aoc ***@***.***>
Cc: Sivert Johansen ***@***.***>; Author ***@***.***>
Subject: Re: [seblj/cargo-aoc] Feat/old template (PR #69)
Didn't try it myself yet, but it looks great😎
—
Reply to this email directly, view it on GitHub<#69 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AI5H2YG3RMN7J4RGEEW5HFL2DBAMLAVCNFSM6AAAAABSVJRAWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBXGU2DKNRYGY>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Un-reviewable PR? 😄
fix #68
setup, run, tally, and bench needed to be updated.
Very simple script
aoc-migration
that seems to work okay:Run with:
aoc-migration <target>