Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Add technical documents and improve readme #646

Merged
merged 4 commits into from Apr 10, 2018
Merged

Conversation

chamons
Copy link
Contributor

@chamons chamons commented Apr 6, 2018

Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

From this review it looks quite good to me :) love the internals doc :D

README.md Outdated
Clone this repository and initialize/update submodules as well as solution depends on them.
- Clone this repository
- Initialize/update submodules: `git submodule update --recursive --init`
- Open the solution file `Embeddinator-4000.sln` with Visual Studio or Xamarin Studio
Copy link
Member

Choose a reason for hiding this comment

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

Should we still mention Xamarin Studio? I think we want Visual Studio for Mac instead

Copy link
Contributor

@spouliot spouliot left a comment

Choose a reason for hiding this comment

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

largely minor stuff
some can wait, like making sure d.m.c is up to date before removing content

@@ -0,0 +1,33 @@
## Project Structure

The Embeddinator-4000 project covers a number of platforms (Objective-C, Java, C) and is made up of a number of different components.
Copy link
Contributor

Choose a reason for hiding this comment

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

those are languages, not platforms :)

- **binder** - Android/C backend code
- **build** - Cake build files and projects used primariy for Android/C.
- nuget generation is here as well, and shared by all platforms.
- **docs** - External user facing documentation
Copy link
Contributor

Choose a reason for hiding this comment

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

that need to change, so let's mention it's temporary: user docs -> docs.microsoft.com

- **objcgen** - Makefiles and code for the Objective-C backend
- **packages** - External libraries used, pulled in as nugets, which include:
- Mono.Cecil - Used by Java/C backend
- NUint - Powering unit tests
Copy link
Contributor

Choose a reason for hiding this comment

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

NUnit (typo)

- **support** - Native (Objective-C, Java, and C) headers and files consumed by the generated bindings
- **tests** - Automated test suite described in more detail [here](tests/Tests.md) here.
- **tools** - Developer scripts and internal tooling
- Currently just contains "diff" which generates diffs of the managed test assembly before and after a change
Copy link
Contributor

Choose a reason for hiding this comment

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

not worth mentioning currently
that will be out of date before long
better have a README.md in the directory, that's easier to keep in sync

README.md Outdated
@@ -24,47 +24,42 @@ and Java (Android and regular Java), across Windows, Linux and macOS platforms.

## Getting Started

Check out our [documentation to get started](https://mono.github.io/Embeddinator-4000/)
Check out our [documentation to get started](https://mono.github.io/Embeddinator-4000/).
Copy link
Contributor

Choose a reason for hiding this comment

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

should point to docs.microsoft.com


Code generators by their nature of generating code that will later be compiled can be difficult to trace through and understand.

The Objective-C backend covers a number of different platforms (macOS, iOS, tvOS, etc) and packaging techniques (static library, dylib, frameworks).
Copy link
Contributor

Choose a reason for hiding this comment

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

did we not limit that to frameworks, except for macOS without XM ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I believe so. Let me rewrite to make that clear.

### Flow of Execution

- Executation begins in the [driver](driver.cs) which handles a few tasks:
- Use Mono.Options to parse command line arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

link to Mono.Options ?

- Use Mono.Options to parse command line arguments
- Setup error handling in case of later crashes/exceptions
- In the common "generate" action case, instance an [embedder](embedder.cs) and configure it based on command line arguments
- If compilation is requested then the [driver](driver.cs) invokes Compile () on the [embedder](embedder.cs) post generation
Copy link
Contributor

Choose a reason for hiding this comment

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

Compile ()

- If compilation is requested then the [driver](driver.cs) invokes Compile () on the [embedder](embedder.cs) post generation
- The [embedder](embedder.cs) drives code generation and packaging by:
- Validating settings passed in by [driver](driver.cs) are valid based on platform specific rules
- Use IKVM to load the .NET assembly in question for processing via reflection.
Copy link
Contributor

Choose a reason for hiding this comment

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

link to IKVM

- Each ["processed"](processedtypes.cs) data structure is then "frozen" so that we can cache generated data (such as names) only after no additional changes will occur. Processed types should now be considered effectively immutable.
- Now that we have a hierarchy of ["processed"](processedtypes.cs) data types, we can finally enter the [ObjCGenerator](objcgenerator.cs).
- [SourceWriters](sourcewriter.cs) are created for headers/private headers/implementations to buffer text until it is written to disk and readably handle indentation.
- After writing the standard introduction parts to each file, each assembly is procssed in turn.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo, procssed

- **packages** - External libraries used, pulled in as nugets, which include:
- Mono.Cecil - Used by Java/C backend
- NUint - Powering unit tests
- A large number of Xamarin.Android support libraries used by Java backend
Copy link
Member

Choose a reason for hiding this comment

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

These are mostly for tests, making sure c# can use the support libraries for “embeddinated” code. Is that worth mentioning?

Copy link
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

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

LGTM except for a couple of typos.

- This [postprocessor](objcgenerator-postprocessor.cs) analyzes each catagory looking for items that will cause trouble later in generation\compilation or produce suboptimal bindings:
- Names that will produce identical selectors or shadow important pre-existing Objective-C selectors
- Duplication detection is done via the [Type Mapper](TypeMapper.cs).
- [Operator Overloads](OperatorOverloads.cs) can often be exposed in more friendly names that `op_Addition` and are renamed where possible. Where both "friendly" named and operator methods exist, we expose only one copy.
Copy link
Member

Choose a reason for hiding this comment

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

typo: that => than.

- Special post processing occurs in some target types, frameworks for example, and may involve moving files / lipo / etc


### Areas for improvements (Update this docuemnt if fixed)
Copy link
Member

Choose a reason for hiding this comment

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

typo: docuemnt

@chamons chamons merged commit 6017d8b into mono:master Apr 10, 2018
@chamons chamons deleted the tech_docs branch April 10, 2018 19:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants