Page MenuHomePhabricator

csharp: Revamp dotnet support
AcceptedPublic

Authored by lauromoura on Thu, Aug 22, 8:28 PM.

Details

Summary

Instead of building with a patched meson version, make use of custom
targets and generated csproj files so we can used upstream meson
normally.

This avoids digging into "non official" dotnet stuff like calling
the CSC.dll directly that the patched meson tried to do.

To enable, run meson with -Ddotnet=true.

Regarding source file dependencies, Meson has a limitation[1]
about generated artifacts being placed in subdirectories.

In order to correctly track these generated artifacts for dotnet, we
generated them in the same folder as the csproj file through
dotnet build -o.

Instead of installing the dll like we do for mono, a nupkg is generated
and installed in the same folder as the dll would be
(<prefix>/lib/x86_64-linux-gnu/efl-mono-1)

To avoid messing around with Nupkg caches, we reference the source
project for the library directly instead of the nupkg when building the
test suite.

[1] https://github.com/mesonbuild/meson/issues/2320

Fixes T8168

Diff Detail

Repository
rEFL core/efl
Branch
move_owned_binding
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 13221
Build 9384: arc lint + arc unit
lauromoura created this revision.Thu, Aug 22, 8:28 PM
lauromoura requested review of this revision.Thu, Aug 22, 8:28 PM

Tentative patch. Added DO_NOT_MERGE while we get feedback from @woohyun and @Jaehyun_Cho regarding this dotnet change.

Any chance we get this in for 1.23?

@lauromoura
After applying this patch, it seems that efl_sharp.dll is not installed.
efl_sharp.dll is created in efl/core/efl/build/src/bindings/mono/efl_sharp.dll but it is not installed in /usr/local/...

lauromoura updated this revision to Diff 24893.Tue, Sep 10, 7:50 AM

Updated, now installing both the nupkg and the dll.

I thought about generating and installing the nupkg but it seems referencing the DLL directly in the csproj like the code below would be enough.

<ItemGroup>
  <Reference Include="Assembly">
          <HintPath>/opt/efl-mono/lib/x86_64-linux-gnu/efl-mono-1/efl_sharp.dll</HintPath>
  </Reference>
</ItemGroup>
Jaehyun_Cho accepted this revision.Tue, Sep 10, 9:28 PM

@lauromoura
I cannot find a proper way to install Efl.Csharp.1.23.0.nupkg on Visual Studio Code on Ubuntu.
But that .nupkg can be installed Visual Studio on Windows.

Since .nupkg is alternative to .dll on Visual Studio on Windows, I think generating and installing .nupkg is also meaningful.
(although it seems that creating .nupkg in lib directory doesn't help Visual Studio)

I think the current version of this patch is good enough :)

This revision is now accepted and ready to land.Tue, Sep 10, 9:28 PM

I added DO_NOT_MERGE as we are in freeze and this is quite a big change in the build files.

@lauromoura
I cannot find a proper way to install Efl.Csharp.1.23.0.nupkg on Visual Studio Code on Ubuntu.
But that .nupkg can be installed Visual Studio on Windows.

Is it working on windows? (It's been a long time since I last tested there)

Since .nupkg is alternative to .dll on Visual Studio on Windows, I think generating and installing .nupkg is also meaningful.
(although it seems that creating .nupkg in lib directory doesn't help Visual Studio)

We could create another task specific for nupkg to check if the package is properly created, documented, tested etc.

I think the current version of this patch is good enough :)

Nice. Waiting for @bu5hm4n comments on the meson side (no hurry, as this will be after the freeze)