Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@badcel
Copy link
Contributor

@badcel badcel commented Apr 28, 2025

To enable easy debugging of GirCore libraries, the msbuild property "GirCoreSource" can be set to a path where the GirCore source is located.

If this property is set the GirCore package references will be replaced by project references which point to the local GirCore source.

@badcel
Copy link
Contributor Author

badcel commented Apr 28, 2025

@cameronwhite: This would be the first solution that I could figure out to easily switch between package and project references. The code is not complete and only done for libadwaita. Additionally I purposely left the path to my local GirCore source inside Directory.Build.props to show you how it could look like if configured for local source use.

This should result in project references be used (which breaks the build as no source is available under the given path). If you remove the path from the tag the package reference should be used instead, including CentralPackageManagement.

This approach creates one target file for each GirCore package. Each project which wants to have a certain GirCore package must import this target.

An alternative would be to define the code of the targets file in each csproj file.

I don't know what I like better but I think this shows the idea best as it deduplicates code but adds a little complexity to the build as the ProjectReference and PackageReference tags are hidden inside custom targets.

Additionally I added Directory.Build.props, Directory.Packages.props, and the new target file to the Solution Items solution folder which is just my preference to be able to easily reach those files without accessing the file system if Rider is in the "SolutionView". I can of course remove it if you prefer.

@cameronwhite
Copy link
Member

Thanks for looking into this!
I'm pretty happy with the approach - I like that it doesn't add much complexity to the individual .csproj files and the package version is still managed in Directory.Packages.Props like the other packages

No problem with adding extra items to the Solution Items folder 👍

@badcel
Copy link
Contributor Author

badcel commented Apr 29, 2025

I wonder if the name of the targets file should be AddReferenceGirCoreAdw1.target ("target" instead of "targets" and a little more expressive)?

And the target inside would match the filename?

@cameronwhite
Copy link
Member

Yeah the target filename sounds better to me 👍
Does the target name show up anywhere in the UI for IDEs? If so then matching the filename sounds reasonable

@badcel badcel force-pushed the support-custom-gircore-source branch from a7ecc43 to c020197 Compare April 29, 2025 19:13
@badcel
Copy link
Contributor Author

badcel commented Apr 29, 2025

I just saw that you only reference 4 packages from GirCore: adwaita, Gtk, GObject-2.0.Integration, PaingoCairo-1.0

But you are using some implicit dependencies which get pulled into the project from the nugets like: Gdk and GLib. For this to work with project references those would need to be added explicitly. Is this OK for you?

@cameronwhite
Copy link
Member

I think that's okay to make the dependencies more explicit 👍

@badcel badcel force-pushed the support-custom-gircore-source branch 3 times, most recently from 3e4ada3 to 7ddf2c4 Compare May 2, 2025 19:49
To enable easy debugging of GirCore libraries, the msbuild property "GirCoreSource" can be set to a path where the GirCore source is located.

If this property is set the GirCore package references will be replaced by project references which point to the local GirCore source.
@badcel badcel force-pushed the support-custom-gircore-source branch from 7ddf2c4 to 242c190 Compare May 2, 2025 19:50
@badcel badcel marked this pull request as ready for review May 2, 2025 19:51
@badcel
Copy link
Contributor Author

badcel commented May 2, 2025

The usage of targets made more problems than it helped. The files now got even simpler and just define package / project references as project properties. So the files got renamed to reflect this change.

What do you think?

Remark: In Rider I could not fluently switch from the nuget packages to the local repository. I had to do a manual compile on the commandline first (dotnet build). I don't know if this is perhaps a bug in Rider? Afterwards it works in Rider, too.

@cameronwhite
Copy link
Member

Thanks, I'm good with the updated approach! Agreed that seems a bit simpler. 👍
We'd still need to add all the implicit dependencies, correct?

@badcel
Copy link
Contributor Author

badcel commented May 5, 2025

No it looks like it is not needed. When I added all implicit dependencies the errors went away in the source files of rider. But compiling on the command line and in rider failed nevertheless.

Afterwards I removed all the target stuff and it worked without defining all dependencies.

So I removed it again as it was quite a bit of files and a lot of changes.

From my point of view you could test if this PR works for you.

@cameronwhite
Copy link
Member

Thanks! I've tested building against my local copy of gir.core and it worked well for me, so I think this should be good to merge 🎉

@cameronwhite cameronwhite merged commit f606a46 into PintaProject:master May 6, 2025
6 checks passed
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