Skip to content
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

Add multi targeting to projects #17

Merged
merged 5 commits into from
Sep 20, 2024
Merged

Add multi targeting to projects #17

merged 5 commits into from
Sep 20, 2024

Conversation

cwensley
Copy link
Contributor

@cwensley cwensley commented Aug 26, 2024

  • Support compiling with WinForms in .NET 7 on Mac
  • Add VS debug targets for Rhino 8 netfx/netcore
  • Include launch.json/tasks.json for VS Code to make it easier to start debugging on Mac
  • Remove VS for Mac build
  • Adds a target to build .yak packages for Rhino 7 and Rhino 8 if specified.

Fixes #16

- Support compiling with WinForms in .NET 7 on Mac
- Add VS debug targets for Rhino 8 netfx/netcore
- Include launch.json/tasks.json for VS Code to make it easier to start debugging on Mac
- Remove VS for Mac build
Copy link
Contributor

@clicketyclackety clicketyclackety left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other Questions

  1. Any reason not to include a settings.json
{
        "dotnet.defaultSolution": "MySolutionName.sln"
}
  1. Should we include a build netfx task?
  2. When using dotnet new rhinocommand --help I see quite a few options. -lang and -type would be good to include possible options as I wasn't sure what options were available until I entered a wrong value by running dotnet new rhinocommand -lang --help the same way --version is done --version <6|7|8> would be great
  3. I like -sample, awesome to find that! I'll include that in the guide
  4. Everything else I've tried works.
  5. Everything builds on both platforms (Besides ZooManager on mac)

Comment on lines +103 to +104
<Exec Command="&quot;$(YakExecutable)&quot; spec" WorkingDirectory="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />
<Exec Command="&quot;$(YakExecutable)&quot; build" WorkingDirectory="$(OutputPath)" Condition="$(BuildYakPackage) == 'True'" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The yak building, is like magic @cwensley. I like it a lot!

One issue I have is that SPEC is always run. So if you create a manifest.yml in your build directory, spec will still run and your manifest is ignored. I think if there is a manifest.yml besides the .csproj, it should use that and not run yak spec. Happy to discuss this.

Now, mucking around I do see that it works like the nuget build in that it takes info from the assembly. Which is actually awesome. And really removes the need for a manifest.yml!

If I change these csproj attributes it reflects in the manifest, which is part of yak spec neat.
I think it would be really good to make sure these always exist in the .csproj and are documented like so.

    <Version>4.0.0</Version> <!-- Specifies Assembly & Yak Version -->
    <Company>Yakult</Company> <!-- Specifies Yak Authors -->
    <Description>Well. It's yakky!</Description> <!-- Specifies Assembly & Yak Description -->

Now, the tricky attributes...

  • Guid (Can be obtained from assembly)
  • Icon (Is not obtained from assembly)
  • Keywords (Is not obtained from assembly)

I'm sure these can be gleamed from the assembly as well. But I don't think they are
Yak Code

Possibly we should add a YouTrack to gleam these attributes as well. But that's another problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I had thoughts of supporting a custom manifest.yml. Ideally this target can be added to a separate nuget package perhaps "RhinoYakPackage" so we can simplify the projects and also have a better "out of the box" experience. I initially thought of adding to RhinoCommon nuget package but that wouldn't work with older rhino versions (e.g. if you want to target RhinoCommon 8.0 for example).

"program": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe",
"targetArchitecture": "x86_64",
},
"args": [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love it if Grasshopper opens when I debug a GH Plugin

Suggested change
"args": [],
"osx": {
"args": ["-runscript=Grasshopper"],
},
"windows": {
"args": ["/runscript=\"Grasshopper\""],
},

I'm quite sure the args is correct, but I've never used an osx/windows condition? Would the above work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These args should be added to the existing "osx" and "windows" sections, not create new ones just for args. Yes it should work, though I think on Windows it should be "/runscript=_Grasshopper", and macOS "-runscript=_Grasshopper", with underscores so it is language agnostic. This should also be applied to the VBGrasshopper template too.

@cwensley
Copy link
Contributor Author

cwensley commented Sep 4, 2024

Other Questions

  1. Any reason not to include a settings.json
{
        "dotnet.defaultSolution": "MySolutionName.sln"
}

We don't include a .sln file, and the C# VSCode extension automatically will pick up the .csproj and/or .sln and recent builds even generates a .sln for you.

  1. Should we include a build netfx task?

Why build netfx? It already builds all tfm's, net45, net48, net7.0 if specified. Do you mean a launch.json config with netfx on Windows? If so, yes we could to match what we have in the VS launchSettings.json.

  1. When using dotnet new rhinocommand --help I see quite a few options. -lang and -type would be good to include possible options as I wasn't sure what options were available until I entered a wrong value by running dotnet new rhinocommand -lang --help the same way --version is done --version <6|7|8> would be great

-lang and -type are built-in to dotnet new (you will see it in the "Options" section when using --help). I'm not sure we can add any additional help text to it.

  1. I like -sample, awesome to find that! I'll include that in the guide

👍

  1. Everything else I've tried works.

Yay!

  1. Everything builds on both platforms (Besides ZooManager on Mac)

Yep, Zoo is Windows only currently.

- Move Assembly/Yak properties to their own PropertyGroup
- Add netfx/netcore launch targets for VS Code on Windows
- Add Yak and VSCode options to Visual Studio project wizards
- UseWinForms is default on for GH projects
@cwensley cwensley merged commit 2c7f7cf into main Sep 20, 2024
2 checks passed
@cwensley cwensley deleted the curtis/rhino8-updates branch September 20, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants