-
Notifications
You must be signed in to change notification settings - Fork 4k
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(core): add fsharp init-template #1912
Conversation
@costleya can you please take a look here? |
If F# has any additional or different prerequisites compared to C#, please enumerate them and ping me by adding Doug-AWS to the comment. Here is what I have for C#: .NET standard 2.0 compatible implementation:
|
@@ -0,0 +1,4 @@ | |||
{ | |||
"app": "dotnet src/HelloCdk/bin/Debug/netcoreapp2.1/HelloCdk.dll" |
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.
I'm going to change the C# cdk.json template to:
"app": "dotnet run --project HelloCdk/HelloCdk.csproj"
To eliminate the need to remember to recompile the application every time before you run "cdk *". Feel free to make this change now, or I can make it when I update the C# one.
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.
I'll update it after the C# one.
Do you have an opinion on my comments at the beginning regarding the solution not referencing the project and the project not referencing the project files? They're not very useful in their current state, happy to update those as well.
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.
Thanks for calling this out.
The C# template adds the project after generation using the add-project.hook.ts. I see you copied this file, but did not update it for the F# template. Try changing the "dotnet add" command to point to the fsproj, and see if it works. I added the comments to the lines that need to change.
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.
This still doesn't address the missing project files in the project file (HelloCdk.[c|f]sproj),
could add the logic to the add-project.hook.ts
file in another PR.
Also, dotnet restore
is not automatically done in all IDEs so it could be added as another post template init logic like we do with npm and maven.
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.
I'm confused about what is missing. The add-project hook calls dotnet add
. If there are additional resources missing for F# on the project level, then you can either add those references into the template, or you can take care of it in the/a hook.
The dotnet restore
is definitely something that could be added.
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.
@costleya My bad, forgot they changed it in the last version of the framework, you don't need to add files to project now. It's directory based now.
Happy to add the dotnet restore
bit in a separate PR to not pollute this one.
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.
Sounds like a plan.
packages/aws-cdk/lib/init-templates/app/fsharp/add-project.hook.ts
Outdated
Show resolved
Hide resolved
packages/aws-cdk/lib/init-templates/app/fsharp/add-project.hook.ts
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,4 @@ | |||
{ | |||
"app": "dotnet src/HelloCdk/bin/Debug/netcoreapp2.1/HelloCdk.dll" |
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.
Thanks for calling this out.
The C# template adds the project after generation using the add-project.hook.ts. I see you copied this file, but did not update it for the F# template. Try changing the "dotnet add" command to point to the fsproj, and see if it works. I added the comments to the lines that need to change.
Add F# init-template to the cli.
I followed the C# patterns, however, the solution file (.sln) doesn't reference the project file (.[cd|fs]proj) which in return doesn't reference the project files. That makes them quite unusable out of the box.
The proposed solutions would be
dotnet add
commands.Happy to create an issue and submit another PR to address it.
Pull Request Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.