Skip to content

Commit

Permalink
[Generator] Refactor Format Type methods into TypeManager class (#19331)
Browse files Browse the repository at this point in the history
First take at refactoring parts of the Generator:

1. RemoveArity() is now a string extension method with a test
2. FormatType, FormatTypeUsedIn, and part of PrimitiveType methods have
been moved into the TypeManager class.
3. TypeManager now has access to BindingTouch (similar to the other
Manager classes) so that it may call methods from NamespaceManager,
which also had to be made into a public property of BindingTouch vs
being passed through the Generator constructor.

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
  • Loading branch information
4 people committed Nov 1, 2023
1 parent 8908fa1 commit b4da429
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 221 deletions.
6 changes: 4 additions & 2 deletions src/bgen/BindingTouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ public class BindingTouch : IDisposable {

public MetadataLoadContext? universe;
public TypeManager? typeManager;
NamespaceManager? namespaceManager;
public TypeManager TypeManager => typeManager!;
public Frameworks? Frameworks;
public AttributeManager? AttributeManager;
public NamespaceManager NamespaceManager => namespaceManager!;
bool disposedValue;
readonly Dictionary<System.Type, Type> ikvm_type_lookup = new Dictionary<System.Type, Type> ();
internal Dictionary<System.Type, Type> IKVMTypeLookup {
Expand Down Expand Up @@ -535,13 +537,13 @@ int Main3 (string [] args)
strong_dictionaries.Add (t);
}

var nsManager = new NamespaceManager (
namespaceManager ??= new NamespaceManager (
this,
ns ?? firstApiDefinitionName,
skipSystemDrawing
);

var g = new Generator (this, nsManager, public_mode, external, debug, types.ToArray (), strong_dictionaries.ToArray ()) {
var g = new Generator (this, public_mode, external, debug, types.ToArray (), strong_dictionaries.ToArray ()) {
BaseDir = basedir ?? tmpdir,
ZeroCopyStrings = zero_copy,
InlineSelectors = inline_selectors ?? (CurrentPlatform != PlatformName.MacOSX),
Expand Down

5 comments on commit b4da429

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: b4da42958d6cb586f27ab597a1a6b02f4c9fb378 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

💻 [CI Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent
Hash: [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: b4da42958d6cb586f27ab597a1a6b02f4c9fb378 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: simulator tests

0 tests crashed, 1 tests failed, 234 tests passed.

Failures

❌ monotouch tests

1 tests failed, 40 tests passed.
  • monotouch-test/tvOS - simulator/Debug (managed static registrar) [dotnet]: Crashed

Html Report (VSDrops) Download

Successes

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 6 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: b4da42958d6cb586f27ab597a1a6b02f4c9fb378 [CI build]

Please sign in to comment.