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

Introducing .NET version of css-layout using P/Invoke #220

Closed
wants to merge 12 commits into from
Closed

Introducing .NET version of css-layout using P/Invoke #220

wants to merge 12 commits into from

Conversation

mattpodwysocki
Copy link
Contributor

This version of the css-layout project includes support for .NET projects. Up in the air is how many configurations of .NET projects we allow for, such as Portable Class Libraries, Universal Windows Platform, .NET Core, etc. Still needs integration with Buck.

@ghost
Copy link

ghost commented Sep 20, 2016

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks!

@ghost
Copy link

ghost commented Sep 20, 2016

@mattpodwysocki updated the pull request - view changes

Copy link
Contributor

@emilsjolander emilsjolander left a comment

Choose a reason for hiding this comment

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

Could you remove the non-native version and its code dependencies. You don't need to mirror the java version which has a an interface backed by both a java implementation and a native implementation, that is being removed very soon.

@@ -0,0 +1,265 @@
## Ignore Visual Studio temporary files, build results, and
Copy link
Contributor

@emilsjolander emilsjolander Sep 20, 2016

Choose a reason for hiding this comment

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

please mirror this in a corresponding .hgignore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emilsjolander ok, will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -6,3 +6,6 @@
/.buckd
/lib/gtest/googletest-*/
/gentest/test.html

# Visual studio code
Copy link
Contributor

Choose a reason for hiding this comment

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

Please mirror this in .hgignore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,206 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems annoying to maintain. Can we make this use the same .h file as the C version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emilsjolander we could if you want pragma comments for checking if Windows, sure

Copy link
Contributor

Choose a reason for hiding this comment

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

Or some macro magic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

perfect!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emilsjolander removed as per request

@@ -0,0 +1,12 @@
namespace Facebook.CSSLayout
{
public class CSSCachedMeasurement
Copy link
Contributor

Choose a reason for hiding this comment

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

This class should not be needed as it is not part of the public api

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emilsjolander removed as per request

namespace Facebook.CSSLayout
{
public class CSSLayout
{
Copy link
Contributor

Choose a reason for hiding this comment

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

This class should not be needed as it is handled in the C code.

@@ -0,0 +1,8 @@
namespace Facebook.CSSLayout
{
public class CSSLayoutContext
Copy link
Contributor

Choose a reason for hiding this comment

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

This class should not be needed as the C version does not have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emilsjolander is the intent then not to implement the regular CSSNode class and only implement the native class?

Copy link
Contributor

Choose a reason for hiding this comment

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

yup!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@emilsjolander removed as per request

@ghost
Copy link

ghost commented Sep 20, 2016

@mattpodwysocki updated the pull request - view changes

@ghost
Copy link

ghost commented Sep 21, 2016

@mattpodwysocki updated the pull request - view changes

@facebook-github-bot
Copy link
Contributor

@mattpodwysocki updated the pull request - view changes

@facebook-github-bot
Copy link
Contributor

@mattpodwysocki updated the pull request - view changes

@ghost ghost added the CLA Signed label Sep 21, 2016
@ghost
Copy link

ghost commented Sep 21, 2016

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@emilsjolander
Copy link
Contributor

Everything is looking great. Thanks for being so responsive! Only thing I see missing is integrating this with buck. You can find more info on building csharp with buck here https://buckbuild.com/rule/csharp_library.html

@ghost
Copy link

ghost commented Sep 21, 2016

@mattpodwysocki updated the pull request - view changes

@ghost ghost added the CLA Signed label Sep 21, 2016
@emilsjolander
Copy link
Contributor

I chatted with @mattpodwysocki and there are a couple things that are blocking proper buck support for this so we will skip getting this working on this pull request and instead we plan on fixing this afterwards.

@ghost ghost added the CLA Signed label Sep 22, 2016
@ghost
Copy link

ghost commented Sep 22, 2016

@mattpodwysocki updated the pull request - view changes

@emilsjolander
Copy link
Contributor

Looking great! Thanks for the super quick response times. I'll try to merge this today.

@ghost
Copy link

ghost commented Sep 22, 2016

Thanks for importing. If you are a Facebook employee, you can view this diff on Phabricator.

@ghost ghost added the CLA Signed label Sep 22, 2016
ghost pushed a commit that referenced this pull request Sep 22, 2016
Summary:
This version of the css-layout project includes support for .NET projects.  Up in the air is how many configurations of .NET projects we allow for, such as Portable Class Libraries, Universal Windows Platform, .NET Core, etc.  Still needs integration with Buck.
Closes #220

Reviewed By: lucasr

Differential Revision: D3909367

Pulled By: emilsjolander

fbshipit-source-id: aaaa9c4ff2d3452649f256c3268cf873cf33a0b9
@langpavel
Copy link

Can you clarify goodness? It's nothing in code, only confused me more..

@emilsjolander
Copy link
Contributor

Pavel, what are you referring to?
On Thu, 22 Sep 2016 at 19:09, Pavel Lang [email protected] wrote:

Can you clarify goodness? It's nothing in code, only confused me more..


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#220 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABdIpDEqTbY277VyS-UPE37U0lrukASCks5qszTKgaJpZM4KB_sA
.

@Daniel15
Copy link
Member

Daniel15 commented Oct 4, 2016

The C stuff looks a bit Windows-specific; it would be good to get a build working on Linux too so this could be used on .NET Core or on Mono 😄

@@ -0,0 +1,265 @@
## Ignore Visual Studio temporary files, build results, and
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if .hgignore could just be a symlink to .gitignore?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah probably

{
public class CSSLayoutContext
{
public MeasureOutput measureOutput { get; } = new MeasureOutput();
Copy link
Member

@Daniel15 Daniel15 Oct 4, 2016

Choose a reason for hiding this comment

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

Uppercase first character of property name (measureOutput -> MeasureOutput)?

{
if (_isDisposed)
{
throw new ObjectDisposedException("CSSNode");
Copy link
Member

@Daniel15 Daniel15 Oct 4, 2016

Choose a reason for hiding this comment

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

nameof(CSSNode) assuming you're using C# 6.0 😄

CheckDisposed();
Native.CSSNodeStyleSetFlex(_cssNode, value);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

All these properties feel like a lot of boilerplate, I wonder if they could be autogenerated?

{
private const string DllName = "CSSLayout.dll";

[DllImport(DllName)]
Copy link
Member

Choose a reason for hiding this comment

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

I think this should omit the .dll suffix so it could potentially work on Linux in the future.

@emilsjolander
Copy link
Contributor

@Daniel15 Feel free to open a pull request with further platform support 👍

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants