├── .gitignore ├── BUILDING.md ├── CODEOWNERS ├── CONTRIBUTING.md ├── Constants.cs.in ├── DylibBinder ├── CheckInventory.cs ├── DBAssociatedType.cs ├── DBFunc.cs ├── DBGenericParameter.cs ├── DBInnerTypes.cs ├── DBModule.cs ├── DBParameter.cs ├── DBProperty.cs ├── DBTopLevel.cs ├── DBTypeDeclaration.cs ├── DylibBinder.csproj ├── DylibBinderOptions.cs ├── DylibBinderReflector.cs ├── Enums.cs ├── IgnoreList.txt ├── InnerX.cs ├── Makefile ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── README.md ├── SortedSetExtensions.cs ├── StringExtensions.cs ├── SwiftTypeToString.cs └── XmlGenerator.cs ├── Dynamo ├── CodeElementCollection.cs ├── CodeWriter.cs ├── CommaListElementCollection.cs ├── DecoratedCodeElementCollection.cs ├── DelegatedCommaListElementCollection.cs ├── DelegatedSimpleElement.cs ├── Dynamo.CSLang │ ├── CSArgument.cs │ ├── CSArray1D.cs │ ├── CSAssignment.cs │ ├── CSAttribute.cs │ ├── CSBaseExpression.cs │ ├── CSBinaryExpression.cs │ ├── CSBinding.cs │ ├── CSClass.cs │ ├── CSCodeBlock.cs │ ├── CSComment.cs │ ├── CSConditionalCompilation.cs │ ├── CSConstant.cs │ ├── CSDelegateTypeDecl.cs │ ├── CSEnum.cs │ ├── CSFieldDeclaration.cs │ ├── CSFile.cs │ ├── CSFileBasic.cs │ ├── CSFixed.cs │ ├── CSForEach.cs │ ├── CSFunctionCall.cs │ ├── CSGenericConstraint.cs │ ├── CSGenericTypeDeclaration.cs │ ├── CSIdentifier.cs │ ├── CSIfElse.cs │ ├── CSIndexExpression.cs │ ├── CSInheritance.cs │ ├── CSInitializer.cs │ ├── CSInject.cs │ ├── CSInterface.cs │ ├── CSLambda.cs │ ├── CSLine.cs │ ├── CSMethod.cs │ ├── CSNamespace.cs │ ├── CSParameter.cs │ ├── CSParenthesisExpression.cs │ ├── CSProperty.cs │ ├── CSReturn.cs │ ├── CSShortCircuit.cs │ ├── CSTernary.cs │ ├── CSThrow.cs │ ├── CSTryCatch.cs │ ├── CSType.cs │ ├── CSUnaryExpression.cs │ ├── CSUsing.cs │ ├── Enums.cs │ ├── ICSExpression.cs │ ├── ICSLineable.cs │ ├── ICSStatement.cs │ └── ICSTopLevelDeclaration.cs ├── Dynamo.SwiftLang │ ├── Enums.cs │ ├── ISLExpr.cs │ ├── ISLLineable.cs │ ├── ISLStatement.cs │ ├── SLAddressOf.cs │ ├── SLArgument.cs │ ├── SLAsExpr.cs │ ├── SLAttribute.cs │ ├── SLBaseExpr.cs │ ├── SLBinaryExpr.cs │ ├── SLBinding.cs │ ├── SLClass.cs │ ├── SLClosure.cs │ ├── SLClosureCall.cs │ ├── SLCodeBlock.cs │ ├── SLCommaListExpr.cs │ ├── SLComment.cs │ ├── SLConditionalCompilation.cs │ ├── SLConstant.cs │ ├── SLDeclaration.cs │ ├── SLDoCatch.cs │ ├── SLFile.cs │ ├── SLFunc.cs │ ├── SLFunctionCall.cs │ ├── SLGenericConstraint.cs │ ├── SLGenericTypeDeclaration.cs │ ├── SLIdentifier.cs │ ├── SLIfElse.cs │ ├── SLImport.cs │ ├── SLInheritance.cs │ ├── SLInject.cs │ ├── SLLetMatch.cs │ ├── SLLine.cs │ ├── SLLineableOperator.cs │ ├── SLNameTypePair.cs │ ├── SLNamedClosureCall.cs │ ├── SLParameter.cs │ ├── SLParameterList.cs │ ├── SLParenthesisExpression.cs │ ├── SLPostBang.cs │ ├── SLProperty.cs │ ├── SLReturn.cs │ ├── SLSubscript.cs │ ├── SLSubscriptExpr.cs │ ├── SLSwitch.cs │ ├── SLThrow.cs │ ├── SLTryBang.cs │ ├── SLTupleExpr.cs │ ├── SLType.cs │ ├── SLUnaryExpr.cs │ └── SLVariadicExpr.cs ├── Dynamo.csproj ├── Dynamo.sln ├── Exceptions.cs ├── Extensions.cs ├── ICodeElement.cs ├── ICodeElementSet.cs ├── ICodeWriter.cs ├── LabeledCodeElementCollection.cs ├── LineCodeElementCollection.cs ├── Properties │ └── AssemblyInfo.cs ├── SimpleElement.cs ├── SimpleLineElement.cs └── WriteEventArgs.cs ├── ISSUE_TEMPLATE.md ├── LICENSE ├── Make.config ├── Makefile ├── NuGet.config ├── Pack-Man ├── .gitignore ├── BuildInfo.cake ├── FilesToCopy.cake ├── README.md ├── build.cake └── build.sh ├── QUICKSTART.md ├── README.md ├── SECURITY.MD ├── SwiftReflector ├── .gitignore ├── CSKeywords.cs ├── CompilationSettings.cs ├── CompilationTarget.cs ├── CompilationTargetCollection.cs ├── CustomSwiftCompiler.cs ├── Demangling │ ├── ContextAttribute.cs │ ├── Decomposer.cs │ ├── Enums.cs │ ├── MatchRule.cs │ ├── Node.cs │ ├── RuleRunner.cs │ ├── Swift4Demangler.cs │ ├── Swift4NodeToTLDefinition.cs │ ├── Swift5Demangler.cs │ ├── Swift5NodeToTLDefinition.cs │ └── TLDefinition.cs ├── Enums.cs ├── ErrorHandling.cs ├── ExceptionTools │ ├── ErrorHelper.cs │ └── RuntimeException.cs ├── Extensions.cs ├── FrameworkRepresentation.cs ├── FunctionDeclarationWrapperFinder.cs ├── FunctionReferenceCodeMap.cs ├── GenericReferenceRenamer.cs ├── Homonyms.cs ├── IOUtils │ ├── Directories.cs │ ├── DisposableTempDirectory.cs │ ├── ExecAndCollect.cs │ ├── IFileProvider.cs │ ├── IStreamProvider.cs │ ├── IXElementConvertible.cs │ ├── InfoPList.cs │ ├── OffsetStream.cs │ ├── PLItemEnums.cs │ ├── PLItems.cs │ ├── PosixHelpers.cs │ ├── ReliablePath.cs │ ├── TempDirectoryFilenameProvider.cs │ ├── TempDirectoryStreamProvider.cs │ └── TempDirectorySwiftClassFileProvider.cs ├── Importing │ ├── BindingImporter.cs │ ├── CSMethodComparator.cs │ ├── MemberImporter.cs │ ├── PatternMatch.cs │ ├── TypeAggregator.MacOS.cs │ ├── TypeAggregator.cs │ └── TypeAggregator.iOS.cs ├── Inventory │ ├── ClassContents.cs │ ├── ClassInventory.cs │ ├── FunctionInventory.cs │ ├── Inventory.cs │ ├── ModuleContents.cs │ ├── ModuleInventory.cs │ ├── OverloadInventory.cs │ ├── PropertyContents.cs │ ├── PropertyInventory.cs │ ├── ProtocolContents.cs │ ├── ProtocolInventory.cs │ ├── VariableContents.cs │ ├── VariableInventory.cs │ └── WitnessInventory.cs ├── MachOHawley.cs ├── MachOHelpers.cs ├── MarshalEngine.cs ├── MarshalEngineCSafeSwiftToCSharp.cs ├── MarshalEngineSwiftToCSharp.cs ├── MethodWrapping.cs ├── ModuleMapper.cs ├── Naming │ ├── CSSafeNaming.cs │ ├── ScopedNaming.cs │ └── SequentialNamer.cs ├── NewClassCompiler.cs ├── NominalStructTypeDescriptor.cs ├── ObjCProtocolCompiler.cs ├── OverrideBuilder.cs ├── PatToGenericMap.cs ├── Properties │ └── AssemblyInfo.cs ├── ProtocolMethodMatcher.cs ├── PunyCode.cs ├── ReflectorError.cs ├── StringSlice.cs ├── SwiftClassName.cs ├── SwiftCompilerLocation.cs ├── SwiftInterfaceReflector │ ├── IModuleLoader.cs │ ├── ObjCSelectorFactory.cs │ ├── ParseException.cs │ ├── SwiftInterfaceReflector.cs │ └── SyntaxDesugaringParser.cs ├── SwiftName.cs ├── SwiftReflector.csproj ├── SwiftType.cs ├── SwiftXmlReflection │ ├── AssociatedTypeDeclaration.cs │ ├── AttributeDeclaration.cs │ ├── BaseConstraint.cs │ ├── BaseDeclaration.cs │ ├── ClassDeclaration.cs │ ├── EnumDeclaration.cs │ ├── EnumElement.cs │ ├── Enums.cs │ ├── ExtensionDeclaration.cs │ ├── ExtensionMethods.cs │ ├── FunctionDeclaration.cs │ ├── GenericDeclaration.cs │ ├── GenericDeclarationCollection.cs │ ├── GenericReferenceAssociatedTypeProtocol.cs │ ├── Inheritance.cs │ ├── Member.cs │ ├── ModuleDeclaration.cs │ ├── OperatorDeclaration.cs │ ├── ParameterItem.cs │ ├── PropertyDeclaration.cs │ ├── ProtocolDeclaration.cs │ ├── Reflector.cs │ ├── ShamDeclaration.cs │ ├── StructDeclaration.cs │ ├── SubscriptDeclaration.cs │ ├── TypeAliasDeclaration.cs │ ├── TypeAliasFolder.cs │ ├── TypeDeclaration.cs │ ├── TypeSpec.cs │ ├── TypeSpecParser.cs │ ├── TypeSpecToken.cs │ └── TypeSpecTokenizer.cs ├── TopLevelFunctionCompiler.cs ├── TypeMapping │ ├── Entity.cs │ ├── ModuleDatabase.cs │ ├── NetParam.cs │ ├── NetTypeBundle.cs │ ├── SwiftTypeToSLType.cs │ ├── TypeDatabase.cs │ ├── TypeMapper.cs │ └── TypeSpecToSLType.cs ├── UnicodeMapper.cs ├── VTableDetails.cs ├── ValueWitnessTable.cs ├── Visitors.cs ├── WrappingCompiler.cs └── XmlToTLFunctionMapper.cs ├── SwiftRuntimeLibrary.Mac ├── .gitignore └── SwiftRuntimeLibrary.Mac.csproj ├── SwiftRuntimeLibrary.iOS ├── .gitignore └── SwiftRuntimeLibrary.iOS.csproj ├── SwiftRuntimeLibrary ├── BaseAssociatedTypeProxy.cs ├── BaseProxy.cs ├── BlindSwiftClosureRepresentation.cs ├── Enums.cs ├── EveryProtocol.cs ├── Exceptions.cs ├── ExistentialContainers.cs ├── ICustomStringConvertible.cs ├── ISwiftComparable.cs ├── ISwiftEquatable.cs ├── ISwiftError.cs ├── ISwiftHashable.cs ├── ISwiftIteratorProtocol.cs ├── ISwiftObject.cs ├── ISwiftValueType.cs ├── Makefile ├── Properties │ └── AssemblyInfo.cs ├── RuntimeDebugging.cs ├── SwiftAnyObject.cs ├── SwiftArray.cs ├── SwiftCharacter.cs ├── SwiftClosureRepresentation.cs ├── SwiftComparableProxy.cs ├── SwiftCore.cs ├── SwiftDate.cs ├── SwiftDictionary.cs ├── SwiftDotNetCapsule.cs ├── SwiftEnumMapper.cs ├── SwiftEnumRawValueAttribute.cs ├── SwiftEquatableProxy.cs ├── SwiftError.cs ├── SwiftException.cs ├── SwiftFoundationConstants.cs ├── SwiftHashableProxy.cs ├── SwiftHasher.cs ├── SwiftIteratorProtocolProxy.cs ├── SwiftMarshal │ ├── BlindClosureMapper.cs │ ├── DynamicLib.cs │ ├── Extensions.cs │ ├── ImportedTypeCache.cs │ ├── Memory.cs │ ├── NominalSizeSet.cs │ ├── StringMemory.cs │ ├── StructMarshal.cs │ ├── SwiftAssociatedTypeDescriptor.cs │ ├── SwiftClassObject.cs │ ├── SwiftEnumBackingTypeAttribute.cs │ ├── SwiftEnumTypeAttribute.cs │ ├── SwiftExternalProtocolDefinition.cs │ ├── SwiftNativeObjectAttribute.cs │ ├── SwiftNominalTypeAttribute.cs │ ├── SwiftNominalTypeDescriptor.cs │ ├── SwiftProtocolConformanceDescriptor.cs │ ├── SwiftProtocolConstraintAttribute.cs │ ├── SwiftProtocolTypeAttribute.cs │ ├── SwiftProtocolWitnessTable.cs │ ├── SwiftStandardMetatypes.cs │ ├── SwiftStructAttribute.cs │ ├── SwiftThrowsAttribute.cs │ ├── SwiftTupleMap.cs │ ├── SwiftTypeNameAttribute.cs │ └── SwiftValueWitnessTable.cs ├── SwiftMetatype.cs ├── SwiftNativeInstance.cs ├── SwiftNativeObject.cs ├── SwiftNativeValueType.cs ├── SwiftObjectRegistry.cs ├── SwiftOptional.cs ├── SwiftRuntimeException.cs ├── SwiftRuntimeLibrary.csproj ├── SwiftSet.cs ├── SwiftString.cs ├── SwiftTypeRegistry.cs ├── UnsafeMutablePointer.cs ├── UnsafeMutableRawBufferPointer.cs ├── UnsafePointer.cs ├── UnsafeRawBufferPointer.cs ├── UnsafeRawPointer.cs ├── XamProxyTypeAttribute.cs └── XamTrivialSwiftObject.cs ├── SwiftVersion.mk ├── binding-tools-for-swift ├── bindings └── SwiftCore.xml ├── common.mk ├── devops └── automation │ ├── Makefile │ ├── README.md │ ├── add-commit-comment.sh │ ├── add-commit-status.sh │ ├── azure-pipelines.yml │ ├── build-package.sh │ ├── build.sh │ ├── productsign.sh │ ├── provision-deps.sh │ ├── run-tests.sh │ └── system-dependencies.sh ├── docs ├── ClosureModeling.md ├── FunctionalOutline.md ├── FutureIdeas.md ├── HandBindingSwift.md ├── LibraryEvolution.md ├── Mapping_Swift_Metadata_to_C#_Types.md ├── ObjectModeling.md ├── Protocol-Binding.md ├── Protocol_Handling.md ├── Runtime-Public-API.md ├── Swift-ObjC-ABI.md ├── Unicode-Mapping.md ├── ValueTypeModeling.md └── XMLReflection.md ├── leaktest ├── .gitignore ├── Makefile ├── README.md ├── leak-at-exit.c ├── leaktest ├── leaktest.cs └── leaktest.csproj ├── msbuild ├── .gitignore ├── Makefile ├── nuget │ ├── .gitignore │ ├── Binding.Tools.For.Swift.nuspec │ ├── Tasks │ │ ├── Binding.Tools.For.Swift.Tasks.csproj │ │ ├── FindBindingToolsForSwift.cs │ │ ├── PostProcessSwiftTask.cs │ │ ├── ProcessUtils.cs │ │ ├── SwiftStdLibTool.cs │ │ └── SwiftTask.cs │ └── build │ │ ├── binding-tools-for-swift-app.targets │ │ ├── binding-tools-for-swift-lib.targets │ │ ├── binding-tools-for-swift.props │ │ └── binding-tools-for-swift.targets └── tests │ ├── .gitignore │ ├── NuGet.config │ ├── csharp │ ├── ios │ │ ├── app │ │ │ ├── AppDelegate.cs │ │ │ ├── Assets.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ │ └── Contents.json │ │ │ ├── Entitlements.plist │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ ├── Main.cs │ │ │ ├── Main.storyboard │ │ │ ├── ViewController.cs │ │ │ ├── ViewController.designer.cs │ │ │ ├── sample-app-ios.csproj │ │ │ └── sample-app-ios.sln │ │ └── lib │ │ │ ├── ApiDefinition.cs │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ ├── Structs.cs │ │ │ ├── sample-ios.csproj │ │ │ └── sample-ios.sln │ └── mac │ │ ├── app │ │ ├── AppDelegate.cs │ │ ├── Entitlements.plist │ │ ├── Info.plist │ │ ├── Main.cs │ │ ├── Main.storyboard │ │ ├── ViewController.cs │ │ ├── ViewController.designer.cs │ │ ├── sample-app-xm.csproj │ │ └── sample-app-xm.sln │ │ └── lib │ │ ├── ApiDefinition.cs │ │ ├── StructsAndEnums.cs │ │ ├── sample-xm.csproj │ │ └── sample-xm.sln │ └── swift │ ├── .gitignore │ ├── Package.swift │ ├── Sources │ ├── testHigherLib │ │ └── testHigherLib.swift │ └── testLib │ │ └── testLib.swift │ └── testLib.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ ├── testHigherLib_Info.plist │ ├── testLib_Info.plist │ └── xcshareddata │ └── xcschemes │ ├── testLib-Package.xcscheme │ └── xcschememanagement.plist ├── plist-swifty ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── plist-swifty.csproj ├── samples ├── README.md ├── euler │ ├── BuildUniversal.sh │ ├── EulerPhone │ │ ├── EulerPhone.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── EulerPhone │ │ │ ├── Euler.swift │ │ │ ├── EulerPhone.h │ │ │ └── Info.plist │ ├── EulerPhoneApp │ │ ├── EulerPhoneApp.sln │ │ └── EulerPhoneApp │ │ │ ├── AppDelegate.cs │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ │ ├── Entitlements.plist │ │ │ ├── EulerPhoneApp.csproj │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ ├── Main.cs │ │ │ ├── Main.storyboard │ │ │ ├── ViewController.cs │ │ │ └── ViewController.designer.cs │ ├── Makefile │ └── README.md ├── foreach │ ├── Main.cs │ ├── Makefile │ └── foreach.swift ├── helloswift │ ├── Main.cs │ ├── Makefile │ └── hello.swift ├── helloworld │ ├── Main.cs │ ├── Makefile │ └── swiftsrc │ │ ├── Makefile │ │ └── hello.swift ├── piglatin │ ├── .gitignore │ ├── Makefile │ ├── PigLatin │ │ ├── PigLatin.sln │ │ └── PigLatin │ │ │ ├── AppDelegate.cs │ │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon1024.png │ │ │ │ ├── Icon120.png │ │ │ │ ├── Icon152.png │ │ │ │ ├── Icon167.png │ │ │ │ ├── Icon180.png │ │ │ │ ├── Icon20.png │ │ │ │ ├── Icon29.png │ │ │ │ ├── Icon40.png │ │ │ │ ├── Icon58.png │ │ │ │ ├── Icon60.png │ │ │ │ ├── Icon76.png │ │ │ │ ├── Icon80.png │ │ │ │ └── Icon87.png │ │ │ ├── Entitlements.plist │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ ├── Main.cs │ │ │ ├── Main.storyboard │ │ │ ├── MainViewController.cs │ │ │ ├── MainViewController.designer.cs │ │ │ ├── PigLatin.csproj │ │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ │ ├── Resources │ │ │ └── LaunchScreen.xib │ │ │ └── SceneDelegate.cs │ └── SwiftPigLatinLibrary │ │ └── SwiftPigLatinLibrary │ │ ├── Info.plist │ │ └── SwiftIgPay.swift ├── propertybag │ ├── Main.cs │ ├── Makefile │ └── propertybag.swift ├── sampler │ ├── Main.cs │ ├── Makefile │ └── Sampler.swift └── sandwiches │ ├── Makefile │ ├── SandwichesMain.cs │ └── sandwiches.swift ├── stconfig.sh ├── swift-copy-libs ├── Program.cs ├── swift-copy-libs ├── swift-copy-libs-packaged └── swift-copy-libs.csproj ├── swiftglue ├── .gitignore ├── IteratorHelpers.swift ├── Makefile ├── anyhelpers.swift ├── arrayhelpers.swift ├── bufferhelpers.swift ├── closurehelpers.swift ├── comparablehelpers.swift ├── datehelpers.swift ├── dictionaryhelpers.swift ├── dotnetcapsule.swift ├── equatablehelpers.swift ├── everyprotocol.swift ├── hasherhelpers.swift ├── module.map ├── optionalhelpers.swift ├── pointerhelpers.swift ├── registeraccess.c ├── registeraccess.h ├── sethelpers.swift ├── stringconvertible.swift ├── stringglue.swift ├── swiftenumerror.swift ├── trivialswiftobject.swift └── typecachekey.swift ├── swiftinterfaceparser ├── .gitignore ├── Makefile └── SwiftInterface.g4 ├── tests ├── 3rd-party │ ├── .gitignore │ ├── AEXML │ │ └── Makefile │ ├── Charts │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── ComplimentaryGradientView │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── DateTimePicker │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Dollar │ │ └── Makefile │ ├── DynamicColor │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Euler-Modified │ │ ├── Makefile │ │ └── failed-build.log │ ├── Euler │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Eureka │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── FaceAware │ │ ├── Makefile │ │ └── README.txt │ ├── Hue │ │ ├── Makefile │ │ └── failed-build.log │ ├── Instructions │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── JTAppleCalendar │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Macaw │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Makefile │ ├── Makefile.inc │ ├── Makefile.template │ ├── Material │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── NMessenger │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Neon │ │ ├── Makefile │ │ └── README.txt │ ├── PROJECTS.md │ ├── Persei │ │ ├── Makefile │ │ └── README.txt │ ├── Popover │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Presentation │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Presentr │ │ ├── Makefile │ │ └── README.txt │ ├── Preview-Transition │ │ ├── Makefile │ │ └── failed-build.log │ ├── PullToRefresh │ │ ├── Makefile │ │ └── failed-build.log │ ├── README.md │ ├── SCLAlertView-Swift │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Scrollable-GraphView │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── Spring │ │ ├── Makefile │ │ └── README.txt │ ├── Stellar │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── SwiftLocation │ │ └── Makefile │ ├── SwiftMessages │ │ ├── Makefile │ │ └── README.txt │ ├── XLActionController │ │ ├── Makefile │ │ └── README.txt │ ├── circle-menu │ │ ├── Makefile │ │ └── failed-build.log │ ├── clone-repository.sh │ ├── create-test.sh │ ├── expanding-collection │ │ ├── Makefile │ │ └── failed-build.log │ ├── folding-cell │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log │ ├── lottie-ios │ │ └── Makefile │ ├── make-fat-framework.sh │ ├── paper-switch │ │ └── Makefile │ ├── reel-search │ │ ├── Makefile │ │ └── README.txt │ └── youtube-iOS │ │ ├── Makefile │ │ ├── README.txt │ │ └── failed-build.log └── tom-swifty-test │ ├── .gitignore │ ├── CommandLineTests │ ├── OutputTests.cs │ └── SwiftyOptionsTests.cs │ ├── Compiler.cs │ ├── DisposableTempFile.cs │ ├── DylibBinderTests │ └── ReferenceStructTests.cs │ ├── Extensions.cs │ ├── MachOTests.cs │ ├── Makefile │ ├── PosixUtilsTests.cs │ ├── SwiftReflector │ ├── ARCTests.cs │ ├── ArrayTests.cs │ ├── BindingImportTests.cs │ ├── BufferPointerTests.cs │ ├── CharacterTests.cs │ ├── ClangTargetTests.cs │ ├── ClassWrapTests.cs │ ├── ClosureTests.cs │ ├── ComparableTests.cs │ ├── CompilationTargetTests.cs │ ├── ConstructorTests.cs │ ├── DecomposerTests.cs │ ├── DictionaryTests.cs │ ├── DynamicSelfTests.cs │ ├── EnumTests.cs │ ├── EquatableTests.cs │ ├── ExceptionTests.cs │ ├── ExpermimentalTests.cs │ ├── ExtensionTests.cs │ ├── GenericFunctionTests.cs │ ├── GenericStructTests.cs │ ├── HomonymTests.cs │ ├── InnerEnumTests.cs │ ├── LinkageTests.cs │ ├── MetatypeTests.cs │ ├── NSObjectTests.cs │ ├── NewClassCompilerTests.cs │ ├── OperatorTests.cs │ ├── OverrideTests.cs │ ├── PropertyWrapTests.cs │ ├── ProtocolConformanceTests.cs │ ├── ProtocolListTests.cs │ ├── ProtocolTests.cs │ ├── ProtowitnessTest.cs │ ├── SetTests.cs │ ├── Swift4DemanglerTests.cs │ ├── SwiftHasherTests.cs │ ├── SwiftMethodWrapTests.cs │ ├── SwiftModuleFinderTests.cs │ ├── SwiftNameTests.cs │ ├── SwiftOptionalTypeTests.cs │ ├── SwiftTypeAttributeNameTests.cs │ ├── SwiftTypeRegistryTests.cs │ ├── TupleTests.cs │ ├── TypeDatabaseTests.cs │ ├── UnicodeMappingTests.cs │ ├── UnicodeTests.cs │ └── Utils.cs │ ├── SwiftRuntimeLibrary.Mac.dll.config.in │ ├── SwiftRuntimeLibraryTests │ ├── SwiftArrayTests.cs │ ├── SwiftDateTests.cs │ └── SwiftObjectRegistryTests.cs │ ├── TestRunning.cs │ ├── XmlReflectionTests │ ├── ComparatorTests.cs │ ├── DynamicXmlTests.cs │ ├── GenerativeTests.cs │ ├── StaticXmlTests.cs │ ├── SwiftInterfaceParserTests.cs │ ├── TypeAliasTests.cs │ ├── TypeSpecParserTests.cs │ ├── XmlComparator.cs │ └── XmlToTLFMappingTests.cs │ ├── devicetests │ └── .gitignore │ ├── devicetestsbin │ └── generatecsproj │ ├── dynamo │ ├── SimpleClassTests.cs │ ├── SwiftLangTests.cs │ └── Utils.cs │ ├── tom-swifty-test.csproj │ └── tomswiftydevicetests │ ├── .gitignore │ ├── find-device.csharp │ ├── iphone │ ├── AppDelegate.cs │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Entitlements.plist │ ├── ITomTest.cs │ ├── Info.plist │ ├── LaunchScreen.storyboard │ ├── Main.cs │ ├── Main.storyboard │ ├── TcpWriter.cs │ ├── TomTestRunner.cs │ ├── ViewController.cs │ ├── ViewController.designer.cs │ ├── tomswiftydevicetests.sln │ └── tomswiftydeviceteststemplate.csproj │ ├── runtests.sh │ └── tomswiftydevicetests.sln ├── tom-swifty.sln ├── tom-swifty ├── Extensions.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SwiftyOptions.cs └── tom-swifty.csproj ├── tools ├── dora ├── make-framework ├── metadataforall ├── metadatafordylib └── symbolicator │ ├── Program.cs │ ├── SwiftCoreConstants.cs │ ├── SymbolicatorInfoAttribute.cs │ ├── XamGlueConstants.cs │ ├── swift-demangle-lib.sh │ ├── symbolicator.csproj │ └── tools.cs ├── type-o-matic ├── FileSymbolPair.cs ├── Program.cs ├── TypeOMaticOptions.cs └── type-o-matic.csproj └── update_module_list.csharp /.gitignore: -------------------------------------------------------------------------------- 1 | apple 2 | bin 3 | obj 4 | Make.config.inc 5 | SwiftToolchain-* 6 | Constants.cs 7 | *.csproj.user 8 | stconfig.inc 9 | devicetests-build 10 | packages 11 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Binding Tools For Swift Code Owners File 2 | # 3 | # GitHub uses this file to determine who to assign for reviews 4 | # on pull requests. Please keep this file alphabetically sorted. 5 | # 6 | # References: 7 | # 8 | # https://github.com/blog/2392-introducing-code-owners 9 | # https://help.github.com/articles/about-codeowners 10 | 11 | * @stephen-hawley @chamons 12 | 13 | /devops/automation @rolfbjarne @tj-devel709 14 | /tests/tom-swifty-test/CommandLineTests/ @mandel-macaque 15 | /tom-swifty/SwiftyOptions.cs @mandel-macaque 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to 4 | agree to a Contributor License Agreement (CLA) declaring that you have the right to, 5 | and actually do, grant us the rights to use your contribution. For details, visit 6 | [https://cla.microsoft.com](https://cla.microsoft.com). 7 | 8 | When you submit a pull request, a CLA-bot will automatically determine whether you need 9 | to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the 10 | instructions provided by the bot. You will only need to do this once across all repositories using our CLA. 11 | 12 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 13 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 14 | or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 15 | -------------------------------------------------------------------------------- /Constants.cs.in: -------------------------------------------------------------------------------- 1 | static class Constants { 2 | public const string Version = "@VERSION@"; 3 | public const string Branch = "@BRANCH@"; 4 | public const string Hash = "@HASH@"; 5 | } 6 | -------------------------------------------------------------------------------- /DylibBinder/DBInnerTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SwiftReflector; 4 | using SwiftReflector.Inventory; 5 | using SwiftRuntimeLibrary; 6 | 7 | namespace DylibBinder { 8 | internal class DBInnerTypes { 9 | public List InnerTypeCollection { get; } = new List (); 10 | 11 | public DBInnerTypes (SwiftClassName swiftClassName) 12 | { 13 | Exceptions.ThrowOnNull (swiftClassName, nameof (swiftClassName)); 14 | var name = swiftClassName.ToFullyQualifiedName (); 15 | if (DBTypeDeclarations.InnerXDictionary.TryGetValue (name, out List innerTypeList)) { 16 | foreach (var innerType in innerTypeList) { 17 | InnerTypeCollection.Add (new DBTypeDeclaration (innerType)); 18 | } 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /DylibBinder/DBModule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SwiftReflector; 4 | using SwiftReflector.Inventory; 5 | using SwiftRuntimeLibrary; 6 | 7 | namespace DylibBinder { 8 | internal class DBModule { 9 | public string Name { get; set; } 10 | public DBTypeDeclarations TypeDeclarations { get; set; } 11 | public DBFuncs GlobalFuncs { get; set; } 12 | 13 | public DBModule (ModuleInventory mi, SwiftName module, string ignoreListPath) 14 | { 15 | Exceptions.ThrowOnNull (mi, nameof (mi)); 16 | Name = Exceptions.ThrowOnNull (module.Name, nameof (module.Name)); 17 | TypeDeclarations = new DBTypeDeclarations (mi, module, ignoreListPath); 18 | GlobalFuncs = new DBFuncs (mi, module); 19 | } 20 | } 21 | 22 | internal class DBModules { 23 | public List ModuleCollection { get; set; } = new List (); 24 | 25 | public DBModules (ModuleInventory mi, string ignoreListPath) 26 | { 27 | Exceptions.ThrowOnNull (mi, nameof (mi)); 28 | foreach (var module in mi.ModuleNames) { 29 | ModuleCollection.Add (new DBModule (mi, module, ignoreListPath)); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DylibBinder/DBTopLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SwiftRuntimeLibrary; 3 | using SwiftReflector.Inventory; 4 | 5 | namespace DylibBinder { 6 | internal class DBTopLevel { 7 | public string SwiftVersion { get; } 8 | public ModuleInventory Mi { get; } 9 | public DBModules Modules { get; } 10 | public DBTypeDeclarations DBTypeDeclarations { get; } 11 | public DBFuncs GlobalFunctions { get; } 12 | 13 | public DBTopLevel (ModuleInventory moduleInventory, string ignoreListPath, string swiftVersion) 14 | { 15 | SwiftVersion = Exceptions.ThrowOnNull (swiftVersion, nameof (swiftVersion)); 16 | Mi = Exceptions.ThrowOnNull (moduleInventory, nameof (moduleInventory)); 17 | Modules = new DBModules (Mi, ignoreListPath); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /DylibBinder/DylibBinder.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net7.0 4 | x86 5 | Exe 6 | false 7 | x86;AnyCPU 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | latest 21 | 22 | 23 | -------------------------------------------------------------------------------- /DylibBinder/DylibBinderReflector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SwiftReflector; 3 | using SwiftReflector.Inventory; 4 | using SwiftRuntimeLibrary; 5 | 6 | namespace DylibBinder { 7 | public class DylibBinderReflector { 8 | public static void Reflect (string dylibPath, string outputPath, string ignoreListPath = null, string swiftVersion = "5.0") 9 | { 10 | var errors = new ErrorHandling (); 11 | var mi = ModuleInventory.FromFile (Exceptions.ThrowOnNull (dylibPath, nameof (dylibPath)), errors); 12 | var dBTopLevel = new DBTopLevel (mi, ignoreListPath, swiftVersion); 13 | XmlGenerator.WriteDBToFile (Exceptions.ThrowOnNull (dBTopLevel, nameof (dBTopLevel)), Exceptions.ThrowOnNull (outputPath, nameof (outputPath))); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DylibBinder/Enums.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace DylibBinder { 3 | internal enum TypeAccessibility { 4 | Public, 5 | Private, 6 | Internal, 7 | Open, 8 | } 9 | 10 | internal enum Storage { 11 | Addressed, 12 | AddressedWithObservers, 13 | AddressedWithTrivialAccessors, 14 | Computed, 15 | ComputedWithMutableAddress, 16 | Inherited, 17 | InheritedWithObservers, 18 | Stored, 19 | StoredWithObservers, 20 | StoredWithTrivialAccessors, 21 | Coroutine, 22 | MutableAddressor, 23 | } 24 | 25 | [Flags] 26 | internal enum ParameterOptions { 27 | None = 0, 28 | IsVariadic = 1 << 0, 29 | HasInstance = 1 << 1, 30 | IsConstructor = 1 << 2, 31 | IsEmptyParameter = 1 << 3, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /DylibBinder/IgnoreList.txt: -------------------------------------------------------------------------------- 1 | // Add TypeDeclaration Names that should be ignored by DylibBinder. (Module Name + Type Name) 2 | // This will also ignore all innerTypes that this TypeDeclaration contains (Swift.String will also ignore Swift.String.Index) 3 | 4 | Swift.String 5 | Swift.Character 6 | Swift.Int8 7 | Swift.UInt8 8 | Swift.Int16 9 | Swift.UInt16 10 | Swift.Int32 11 | Swift.UInt32 12 | Swift.Int64 13 | Swift.UInt64 14 | Swift.Int 15 | Swift.UInt 16 | Swift.Float 17 | Swift.Double 18 | Swift.Bool 19 | Swift.Error 20 | Swift.Array 21 | Swift.Dictionary 22 | Swift.Set 23 | Swift.Optional 24 | Swift.ImplicitlyUnwrappedOptional 25 | Swift.UnsafeMutablePointer 26 | Swift.UnsafePointer 27 | Swift.OpaquePointer 28 | Swift.UnsafeRawBufferPointer 29 | Swift.UnsafeMutableRawBufferPointer 30 | Swift.UnsafeRawPointer 31 | Swift.UnsafeMutableRawPointer 32 | Swift.CustomStringConvertible 33 | Swift.AnyObject 34 | Swift.Any 35 | Swift.Hashable 36 | Swift.Equatable 37 | Swift.Comparable 38 | CoreGraphics.CGFloat 39 | Swift.Hasher 40 | Foundation.Date 41 | Any.Type 42 | -------------------------------------------------------------------------------- /DylibBinder/Makefile: -------------------------------------------------------------------------------- 1 | TOP=.. 2 | 3 | all: build 4 | 5 | build: 6 | msbuild DylibBinder.csproj 7 | 8 | help: 9 | @mono bin/Debug/DylibBinder.exe --help 10 | -------------------------------------------------------------------------------- /DylibBinder/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | 4 | // Information about this assembly is defined by the following attributes. 5 | // Change them to the values specific to your project. 6 | 7 | [assembly: AssemblyTitle ("DylibBinder")] 8 | [assembly: AssemblyDescription ("")] 9 | [assembly: AssemblyConfiguration ("")] 10 | [assembly: AssemblyCompany ("")] 11 | [assembly: AssemblyProduct ("")] 12 | [assembly: AssemblyCopyright ("")] 13 | [assembly: AssemblyTrademark ("")] 14 | [assembly: AssemblyCulture ("")] 15 | 16 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 17 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 18 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 19 | 20 | [assembly: AssemblyVersion ("1.0.0")] 21 | 22 | // The following attributes are used to specify the signing key for the assembly, 23 | // if desired. See the Mono documentation for more information about signing. 24 | 25 | //[assembly: AssemblyDelaySign(false)] 26 | //[assembly: AssemblyKeyFile("")] 27 | -------------------------------------------------------------------------------- /DylibBinder/SwiftTypeToString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Dynamo.SwiftLang; 4 | using SwiftReflector; 5 | using SwiftReflector.TypeMapping; 6 | using SwiftRuntimeLibrary; 7 | 8 | namespace DylibBinder { 9 | internal static class SwiftTypeToString { 10 | public static List TypeDatabasePaths = new List (); 11 | 12 | public static string MapSwiftTypeToString (SwiftType swiftType, string moduleName = null) 13 | { 14 | var slType = MapSwiftTypeToSlType (Exceptions.ThrowOnNull (swiftType, nameof (swiftType))); 15 | var slTypeString = slType.ToString (); 16 | slTypeString = slTypeString.AppendModuleToBit (); 17 | return slTypeString; 18 | } 19 | 20 | public static SLType MapSwiftTypeToSlType (SwiftType swiftType) 21 | { 22 | var typeMapper = new TypeMapper (TypeDatabasePaths); 23 | var swiftTypeToSLType = new SwiftTypeToSLType (typeMapper, true); 24 | var sLImportModules = new SLImportModules (); 25 | return swiftTypeToSLType.MapType (sLImportModules, Exceptions.ThrowOnNull (swiftType, nameof (swiftType))); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Dynamo/DelegatedSimpleElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo { 7 | public abstract class DelegatedSimpleElement : ICodeElement { 8 | #region ICodeElem implementation 9 | 10 | public event EventHandler Begin = (s, e) => { }; 11 | 12 | public event EventHandler End = (s, e) => { }; 13 | 14 | public object BeginWrite (ICodeWriter writer) 15 | { 16 | OnBegin (new WriteEventArgs (writer)); 17 | return null; 18 | } 19 | 20 | protected virtual void OnBegin (WriteEventArgs args) 21 | { 22 | Begin (this, args); 23 | } 24 | 25 | public void Write (ICodeWriter writer, object o) 26 | { 27 | LLWrite (writer, o); 28 | } 29 | 30 | protected abstract void LLWrite (ICodeWriter writer, object o); 31 | 32 | public void EndWrite (ICodeWriter writer, object o) 33 | { 34 | OnEnd (new WriteEventArgs (writer)); 35 | } 36 | 37 | protected virtual void OnEnd (WriteEventArgs args) 38 | { 39 | End.FireInReverse (this, args); 40 | } 41 | 42 | #endregion 43 | } 44 | 45 | public class LineBreak : DelegatedSimpleElement { 46 | protected override void LLWrite (ICodeWriter writer, object o) 47 | { 48 | writer.EndLine (); 49 | writer.BeginNewLine (true); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSArgument.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.CSLang { 5 | public class CSArgument : DelegatedSimpleElement { 6 | public CSArgument (ICSExpression expr) 7 | { 8 | Value = Exceptions.ThrowOnNull (expr, nameof(expr)); 9 | } 10 | 11 | public ICSExpression Value { get; private set; } 12 | 13 | protected override void LLWrite (ICodeWriter writer, object o) 14 | { 15 | Value.WriteAll (writer); 16 | } 17 | } 18 | 19 | public class CSArgumentList : CommaListElementCollection { 20 | 21 | public void Add (ICSExpression expr) 22 | { 23 | Add (new CSArgument (expr)); 24 | } 25 | 26 | public static CSArgumentList FromExpressions (params ICSExpression [] exprs) 27 | { 28 | var al = new CSArgumentList (); 29 | foreach (var ex in exprs) 30 | al.Add (new CSArgument (ex)); 31 | return al; 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSFixed.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Dynamo.CSLang { 8 | public class CSFixedCodeBlock : CSCodeBlock, ICSStatement { 9 | public CSFixedCodeBlock (CSType type, CSIdentifier ident, CSBaseExpression expr, IEnumerable body) 10 | : base (body) 11 | { 12 | Type = Exceptions.ThrowOnNull (type, "type"); 13 | Identifier = Exceptions.ThrowOnNull (ident, "ident"); 14 | Expr = Exceptions.ThrowOnNull (expr, "expr"); 15 | } 16 | 17 | public override void Write (ICodeWriter writer, object o) 18 | { 19 | writer.BeginNewLine (true); 20 | writer.Write ("fixed (", true); 21 | Type.Write (writer, o); 22 | writer.Write (' ', false); 23 | Identifier.Write (writer, o); 24 | writer.Write (" = ", true); 25 | Expr.Write (writer, o); 26 | writer.Write (") ", true); 27 | base.Write (writer, o); 28 | } 29 | 30 | public CSType Type { get; private set; } 31 | public CSIdentifier Identifier { get; private set; } 32 | public CSBaseExpression Expr { get; private set; } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSIdentifier.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using Dynamo; 6 | 7 | namespace Dynamo.CSLang { 8 | public class CSIdentifier : CSBaseExpression { 9 | public CSIdentifier (string name) 10 | { 11 | Name = Exceptions.ThrowOnNull (name, "name"); 12 | } 13 | 14 | public static explicit operator CSIdentifier (string name) 15 | { 16 | return new CSIdentifier (name); 17 | } 18 | 19 | protected override void LLWrite (ICodeWriter writer, object o) 20 | { 21 | writer.Write (Name, false); 22 | } 23 | 24 | public string Name { get; private set; } 25 | 26 | public override string ToString () 27 | { 28 | return Name; 29 | } 30 | 31 | public static CSIdentifier Create (string name) => new CSIdentifier (name); 32 | 33 | static CSIdentifier thisID = new CSIdentifier ("this"); 34 | public static CSIdentifier This { get { return thisID; } } 35 | static CSIdentifier baseID = new CSIdentifier ("base"); 36 | public static CSIdentifier Base { get { return baseID; } } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSInheritance.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.IO; 8 | 9 | namespace Dynamo.CSLang { 10 | public class CSInheritance : CommaListElementCollection { 11 | public CSInheritance (IEnumerable identifiers) 12 | { 13 | if (identifiers != null) 14 | AddRange (identifiers); 15 | } 16 | 17 | public CSInheritance (params string [] identifiers) 18 | : this (identifiers.Select (str => new CSIdentifier (str))) 19 | { 20 | } 21 | 22 | public void Add (Type t) 23 | { 24 | Exceptions.ThrowOnNull (t, "t"); 25 | Add (new CSIdentifier (t.Name)); 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSInject.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.CSLang { 5 | // CSInject is a way to more formalize the notion of code that is just plain easier to 6 | // inject as raw text. It's not strictly necessary, but when you see a CSInject, it will make 7 | // it clear that you're doing something not quite on the up and up. 8 | public class CSInject : CSIdentifier { 9 | public CSInject (string name) 10 | : base (name) 11 | { 12 | } 13 | 14 | public static explicit operator CSInject (string name) 15 | { 16 | return new CSInject (name); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSLine.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using Dynamo; 6 | 7 | namespace Dynamo.CSLang { 8 | public class CSLine : DelegatedSimpleElement, ICSStatement { 9 | public CSLine (ICodeElement contents, bool addSemicolon = true) 10 | { 11 | Contents = Exceptions.ThrowOnNull (contents, nameof(contents)); 12 | if (!(contents is ICSLineable) && addSemicolon) 13 | throw new ArgumentException ("contents must be ILineable", nameof (contents)); 14 | AddSemicolon = addSemicolon; 15 | } 16 | 17 | protected override void LLWrite (ICodeWriter writer, object o) 18 | { 19 | writer.BeginNewLine (true); 20 | Contents.WriteAll (writer); 21 | if (AddSemicolon) 22 | writer.Write (';', false); 23 | writer.EndLine (); 24 | } 25 | 26 | public ICodeElement Contents { get; private set; } 27 | public bool AddSemicolon { get; set; } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSReturn.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.CSLang { 5 | public class CSReturn : DelegatedSimpleElement, ICSExpression, ICSLineable { 6 | public CSReturn (ICSExpression expr) 7 | { 8 | Value = expr; 9 | } 10 | 11 | protected override void LLWrite (ICodeWriter writer, object o) 12 | { 13 | writer.Write ("return ", true); 14 | if (Value != null) 15 | Value.WriteAll (writer); 16 | } 17 | 18 | public ICSExpression Value { get; private set; } 19 | 20 | public static CSLine ReturnLine (ICSExpression expr) 21 | { 22 | return new CSLine (new CSReturn (expr)); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSShortCircuit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace Dynamo.CSLang { 3 | public class CSShortCircuit : DelegatedSimpleElement, ICSLineable { 4 | public CSShortCircuit (CSShortCircuitKind kind) 5 | { 6 | Kind = kind; 7 | } 8 | 9 | public CSShortCircuitKind Kind { get; private set; } 10 | 11 | protected override void LLWrite (ICodeWriter writer, object o) 12 | { 13 | var keyword = Kind == CSShortCircuitKind.Break ? "break" : "continue"; 14 | writer.Write (keyword, false); 15 | } 16 | 17 | public static CSLine ShortCircuit (CSShortCircuitKind kind) 18 | { 19 | return new CSLine (new CSShortCircuit (kind)); 20 | } 21 | 22 | public static CSLine Continue () 23 | { 24 | return ShortCircuit (CSShortCircuitKind.Continue); 25 | } 26 | 27 | public static CSLine Break () 28 | { 29 | return ShortCircuit (CSShortCircuitKind.Break); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/CSTernary.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.CSLang { 7 | public class CSTernary : CSBaseExpression { 8 | public CSTernary (CSBaseExpression predicate, CSBaseExpression onTrue, CSBaseExpression onFalse, bool addParentheses) 9 | { 10 | Predicate = Exceptions.ThrowOnNull (predicate, "predicate"); 11 | OnTrue = Exceptions.ThrowOnNull (onTrue, "onTrue"); 12 | OnFalse = Exceptions.ThrowOnNull (onFalse, "onFalse"); 13 | AddParentheses = addParentheses; 14 | } 15 | public CSBaseExpression Predicate { get; private set; } 16 | public CSBaseExpression OnTrue { get; private set; } 17 | public CSBaseExpression OnFalse { get; private set; } 18 | public bool AddParentheses { get; set; } 19 | 20 | #region implemented abstract members of DelegatedSimpleElem 21 | 22 | protected override void LLWrite (ICodeWriter writer, object o) 23 | { 24 | if (AddParentheses) { 25 | writer.Write ('(', true); 26 | } 27 | Predicate.WriteAll (writer); 28 | writer.Write (" ? ", true); 29 | OnTrue.WriteAll (writer); 30 | writer.Write (" : ", true); 31 | OnFalse.WriteAll (writer); 32 | if (AddParentheses) { 33 | writer.Write (')', true); 34 | } 35 | } 36 | 37 | #endregion 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/ICSExpression.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using Dynamo; 6 | 7 | namespace Dynamo.CSLang { 8 | public interface ICSExpression : ICodeElement { 9 | } 10 | 11 | public interface ICSExpressionList : ICodeElementSet { 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/ICSLineable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.CSLang { 7 | public interface ICSLineable { 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/ICSStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.CSLang { 7 | public interface ICSStatement { 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.CSLang/ICSTopLevelDeclaration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.CSLang { 5 | public interface ICSTopLevelDeclaration : ICodeElement { 6 | } 7 | 8 | public class CSTopLevelDeclations : CodeElementCollection { 9 | public CSTopLevelDeclations (params ICSTopLevelDeclaration [] decls) 10 | : base () 11 | { 12 | AddRange (Exceptions.ThrowOnNull (decls, "decls")); 13 | } 14 | 15 | 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/ISLExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public interface ISLExpr : ICodeElement { 6 | } 7 | 8 | public interface ISLExprList : ICodeElementSet { 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/ISLLineable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public interface ISLLineable { 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/ISLStatement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public interface ISLStatement { 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLAddressOf.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLAddressOf : SLBaseExpr { 6 | public SLAddressOf (SLBaseExpr expr, bool addParens) 7 | { 8 | Expr = Exceptions.ThrowOnNull (expr, nameof(expr)); 9 | AddParens = addParens; 10 | } 11 | 12 | public SLBaseExpr Expr { get; private set; } 13 | public bool AddParens { get; set; } 14 | 15 | #region implemented abstract members of DelegatedSimpleElem 16 | 17 | protected override void LLWrite (ICodeWriter writer, object o) 18 | { 19 | writer.Write ('&', false); 20 | if (AddParens) 21 | writer.Write ('(', false); 22 | Expr.WriteAll (writer); 23 | if (AddParens) 24 | writer.Write (')', false); 25 | } 26 | #endregion 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLArgument.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | using System; 4 | 5 | namespace Dynamo.SwiftLang { 6 | public class SLArgument : DelegatedSimpleElement { 7 | public SLArgument (SLIdentifier ident, SLBaseExpr expr, bool identifierIsRequired = false) 8 | { 9 | Identifier = identifierIsRequired ? Exceptions.ThrowOnNull (ident, nameof(ident)) : ident; 10 | Expr = Exceptions.ThrowOnNull (expr, nameof(expr)); 11 | IdentifierIsRequired = identifierIsRequired; 12 | } 13 | 14 | public SLArgument (string ident, SLBaseExpr expr, bool identifierIsRequired = false) 15 | : this (!String.IsNullOrEmpty (ident) ? new SLIdentifier (ident) : null, expr, identifierIsRequired) 16 | { 17 | } 18 | 19 | protected override void LLWrite (ICodeWriter writer, object o) 20 | { 21 | if (Identifier != null && IdentifierIsRequired) { 22 | Identifier.WriteAll (writer); 23 | writer.Write (": ", true); 24 | } 25 | Expr.WriteAll (writer); 26 | } 27 | 28 | 29 | 30 | public SLIdentifier Identifier { get; private set; } 31 | public SLBaseExpr Expr { get; private set; } 32 | public bool IdentifierIsRequired { get; private set; } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLAsExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLAsExpr : SLBaseExpr { 6 | public SLAsExpr (SLType asType) 7 | { 8 | AsType = Exceptions.ThrowOnNull (asType, nameof (asType)); 9 | } 10 | 11 | public SLType AsType { get; private set; } 12 | 13 | protected override void LLWrite (ICodeWriter writer, object o) 14 | { 15 | writer.Write ("as ", true); 16 | AsType.WriteAll (writer); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLClosure.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLClosure : SLBaseExpr { 6 | public SLClosure (SLType type, SLTupleType parms, CodeElementCollection body, bool throws) 7 | { 8 | OuterBlock = new SLCodeBlock (null); 9 | Parameters = parms; 10 | if (parms != null) { 11 | OuterBlock.Add (parms); 12 | OuterBlock.Add (SimpleElement.Spacer); 13 | if (throws) { 14 | OuterBlock.Add (new SimpleElement ("throws ")); 15 | } 16 | if (type != null) { 17 | Type = type; 18 | OuterBlock.Add (new SimpleElement ("-> ")); 19 | OuterBlock.Add (Type); 20 | OuterBlock.Add (SimpleElement.Spacer); 21 | } 22 | OuterBlock.Add (new SimpleElement ("in ")); 23 | OuterBlock.Add (body); 24 | } 25 | } 26 | 27 | public SLTupleType Parameters { get; private set; } 28 | public SLCodeBlock OuterBlock { get; private set; } 29 | public CodeElementCollection Body { get; private set; } 30 | public SLType Type { get; private set; } 31 | 32 | protected override void LLWrite (ICodeWriter writer, object o) 33 | { 34 | OuterBlock.WriteAll (writer); 35 | } 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLClosureCall.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLClosureCall : SLBaseExpr, ISLLineable { 6 | 7 | public SLClosureCall (SLClosure closure, DelegatedCommaListElemCollection paramList) 8 | { 9 | Closure = Exceptions.ThrowOnNull (closure, "closure"); 10 | Parameters = paramList ?? new DelegatedCommaListElemCollection (SLFunctionCall.WriteElement); 11 | } 12 | 13 | public SLClosure Closure { get; private set; } 14 | public DelegatedCommaListElemCollection Parameters { get; private set; } 15 | 16 | protected override void LLWrite (ICodeWriter writer, object o) 17 | { 18 | Closure.WriteAll (writer); 19 | writer.Write ("(", false); 20 | Parameters.WriteAll (writer); 21 | writer.Write (")", false); 22 | } 23 | 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLCodeBlock.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Dynamo.SwiftLang { 8 | public class SLCodeBlock : DecoratedCodeElementCollection, ISLStatement { 9 | public SLCodeBlock (IEnumerable statements) 10 | : this ("{", "}", statements) 11 | { 12 | } 13 | 14 | public SLCodeBlock (string start, string end, IEnumerable statements) 15 | : base (Exceptions.ThrowOnNull (start, nameof(start)), 16 | Exceptions.ThrowOnNull (end, nameof(end)), 17 | true, true, true) 18 | { 19 | if (statements != null) { 20 | foreach (ICodeElement elem in statements) { 21 | And (elem); 22 | } 23 | } 24 | } 25 | 26 | public SLCodeBlock And (ICodeElement elem) 27 | { 28 | if (!((elem is ISLStatement) || (elem is ISLLineable))) 29 | throw new ArgumentException ("contents must each be an ISLStatement or ISLLineable"); 30 | Add (elem); 31 | return this; 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLCommaListExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | namespace Dynamo.SwiftLang { 9 | public class SLCommaListExpr : SLBaseExpr { 10 | public SLCommaListExpr (params SLBaseExpr [] exprs) 11 | { 12 | Exprs = new List (); 13 | if (exprs != null) 14 | Exprs.AddRange (exprs); 15 | } 16 | 17 | public List Exprs { get; private set; } 18 | 19 | protected override void LLWrite (ICodeWriter writer, object o) 20 | { 21 | bool isFirst = true; 22 | foreach (SLBaseExpr expr in Exprs) { 23 | if (!isFirst) 24 | writer.Write (", ", true); 25 | isFirst = false; 26 | expr.WriteAll (writer); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLComment.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace Dynamo.SwiftLang { 6 | public class SLComment : DelegatedSimpleElement { 7 | public SLComment (string contents, bool onOwnLine) 8 | { 9 | Contents = contents; 10 | OnOwnLine = onOwnLine; 11 | } 12 | 13 | public bool OnOwnLine { get; set; } 14 | public string Contents { get; private set; } 15 | 16 | protected override void LLWrite (ICodeWriter writer, object o) 17 | { 18 | if (OnOwnLine) { 19 | writer.BeginNewLine (true); 20 | } else { 21 | SimpleElement.Spacer.Write (writer, o); 22 | } 23 | writer.Write ("// ", false); 24 | writer.Write (Contents, false); 25 | writer.EndLine (); 26 | } 27 | 28 | public void AttachBefore (ICodeElement item) 29 | { 30 | item.Begin += (s, writeEventArgs) => { 31 | this.WriteAll (writeEventArgs.Writer); 32 | }; 33 | } 34 | 35 | public void AttachAfter (ICodeElement item) 36 | { 37 | item.End += (s, writeEventArgs) => { 38 | this.WriteAll (writeEventArgs.Writer); 39 | }; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLGenericConstraint.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.SwiftLang { 7 | public class SLGenericConstraint : DelegatedSimpleElement { 8 | public SLGenericConstraint (bool isInheritance, SLType firstType, SLType secondType) 9 | { 10 | IsInheritance = isInheritance; 11 | FirstType = Exceptions.ThrowOnNull (firstType, nameof (firstType)); 12 | SecondType = Exceptions.ThrowOnNull (secondType, nameof (secondType)); 13 | } 14 | 15 | public bool IsInheritance { get; private set; } 16 | public SLType FirstType { get; private set; } 17 | public SLType SecondType { get; private set; } 18 | 19 | protected override void LLWrite (ICodeWriter writer, object o) 20 | { 21 | FirstType.Write (writer, o); 22 | writer.Write (String.Format (" {0} ", IsInheritance ? ":" : "=="), true); 23 | SecondType.Write (writer, o); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLIdentifier.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLIdentifier : SLBaseExpr { 6 | public SLIdentifier (string name) 7 | { 8 | Name = Exceptions.ThrowOnNull (name, nameof(name)); 9 | } 10 | 11 | protected override void LLWrite (ICodeWriter writer, object o) 12 | { 13 | writer.Write (Name, false); 14 | } 15 | 16 | public string Name { get; private set; } 17 | 18 | public override string ToString () 19 | { 20 | return Name; 21 | } 22 | 23 | static SLIdentifier anonymousIdentifier = new SLIdentifier ("_"); 24 | public static SLIdentifier Anonymous { get { return anonymousIdentifier; } } 25 | static SLIdentifier superIdentifier = new SLIdentifier ("super"); 26 | public static SLIdentifier Super { get { return superIdentifier; } } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLInheritance.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace Dynamo.SwiftLang { 8 | public class SLInheritance : CommaListElementCollection { 9 | public SLInheritance (IEnumerable identifiers) 10 | { 11 | if (identifiers != null) 12 | AddRange (identifiers); 13 | } 14 | 15 | public SLInheritance (params string [] identifiers) 16 | : this (identifiers.Select (str => new SLIdentifier (str))) 17 | { 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLInject.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLInject : SLIdentifier { 6 | // SLInject is a way to more formalize the notion of code that is just plain easier to 7 | // inject as raw text. It's not strictly necessary, but when you see a CSInject, it will make 8 | // it clear that you're doing something not quite on the up and up. 9 | public SLInject (string name) 10 | : base (name) 11 | { 12 | } 13 | 14 | public static explicit operator SLInject (string name) 15 | { 16 | return new SLInject (name); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLLetMatch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLLetMatch : SLBaseExpr, ISLLineable { 6 | public SLLetMatch (SLIdentifier name, ISLExpr expr) 7 | { 8 | Name = Exceptions.ThrowOnNull (name, nameof (name)); 9 | Expr = expr; 10 | } 11 | 12 | public SLIdentifier Name { get; private set; } 13 | public ISLExpr Expr { get; private set; } 14 | 15 | protected override void LLWrite (ICodeWriter writer, object o) 16 | { 17 | writer.Write ("let ", true); 18 | Name.WriteAll (writer); 19 | if (Expr != null) { 20 | SimpleElement.Spacer.WriteAll (writer); 21 | Expr.WriteAll (writer); 22 | } 23 | } 24 | 25 | public static SLLetMatch LetAs (string name, SLType asType) 26 | { 27 | return new SLLetMatch (new SLIdentifier (name), asType != null ? new SLAsExpr (asType) : null); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLLine.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.SwiftLang { 7 | public class SLLine : DelegatedSimpleElement, ISLStatement { 8 | public SLLine (ISLExpr contents, bool addSemicolon = true) 9 | { 10 | Contents = Exceptions.ThrowOnNull (contents, nameof(contents)); 11 | if (!(contents is ISLLineable) && addSemicolon) 12 | throw new ArgumentException ("contents must be ISLineable and require a semicolon", nameof (contents)); 13 | AddSemicolon = addSemicolon; 14 | } 15 | 16 | protected override void LLWrite (ICodeWriter writer, object o) 17 | { 18 | writer.BeginNewLine (true); 19 | Contents.WriteAll (writer); 20 | if (AddSemicolon) 21 | writer.Write (';', false); 22 | writer.EndLine (); 23 | } 24 | 25 | public ISLExpr Contents { get; private set; } 26 | public bool AddSemicolon { get; private set; } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLLineableOperator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace Dynamo.SwiftLang { 6 | public class SLLineableOperator : SLBaseExpr, ISLLineable { 7 | public SLLineableOperator (SLUnaryExpr unaryExpr) 8 | { 9 | OperatorExpr = Exceptions.ThrowOnNull (unaryExpr, nameof (unaryExpr)); 10 | } 11 | 12 | public SLLineableOperator (SLBinaryExpr binaryExpr) 13 | { 14 | OperatorExpr = Exceptions.ThrowOnNull (binaryExpr, nameof (binaryExpr)); 15 | } 16 | 17 | protected override void LLWrite (ICodeWriter writer, object o) 18 | { 19 | OperatorExpr.WriteAll (writer); 20 | } 21 | 22 | public SLBaseExpr OperatorExpr { get; private set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLNamedClosureCall.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLNamedClosureCall : SLBaseExpr, ISLLineable { 6 | 7 | public SLNamedClosureCall (SLBaseExpr closureExpr, CommaListElementCollection paramList) 8 | { 9 | Closure = Exceptions.ThrowOnNull (closureExpr, "closure"); 10 | Parameters = paramList ?? new CommaListElementCollection (); 11 | } 12 | 13 | public SLBaseExpr Closure { get; private set; } 14 | public CommaListElementCollection Parameters { get; private set; } 15 | 16 | protected override void LLWrite (ICodeWriter writer, object o) 17 | { 18 | Closure.WriteAll (writer); 19 | writer.Write ("(", false); 20 | Parameters.WriteAll (writer); 21 | writer.Write (")", false); 22 | } 23 | 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLParameterList.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Dynamo.SwiftLang { 8 | public class SLParameterList : DelegatedSimpleElement { 9 | public SLParameterList () 10 | { 11 | Parameters = new List (); 12 | } 13 | 14 | public SLParameterList (IEnumerable parameters) 15 | : this () 16 | { 17 | Parameters.AddRange (parameters); 18 | } 19 | 20 | public SLParameterList (params SLParameter[] parameters) 21 | : this () 22 | { 23 | Parameters.AddRange (parameters); 24 | } 25 | 26 | protected override void LLWrite (ICodeWriter writer, object o) 27 | { 28 | writer.Write ('(', true); 29 | for (int i = 0; i < Parameters.Count; i++) { 30 | if (i > 0) { 31 | writer.Write (", ", true); 32 | } 33 | Parameters [i].WriteAll (writer); 34 | } 35 | writer.Write (')', true); 36 | } 37 | 38 | public List Parameters { get; private set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLParenthesisExpression.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace Dynamo.SwiftLang { 6 | public class SLParenthesisExpression : SLBaseExpr { 7 | public SLParenthesisExpression (SLBaseExpr within) 8 | { 9 | Within = Exceptions.ThrowOnNull (within, "within"); 10 | } 11 | 12 | public SLBaseExpr Within { get; private set; } 13 | 14 | protected override void LLWrite (ICodeWriter writer, object o) 15 | { 16 | writer.Write ('(', true); 17 | Within.WriteAll (writer); 18 | writer.Write (')', true); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLPostBang.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.SwiftLang { 7 | public class SLPostBang : SLBaseExpr, ISLLineable { 8 | public SLPostBang (SLBaseExpr expr, bool addParens) 9 | { 10 | Expr = Exceptions.ThrowOnNull (expr, nameof(expr)); 11 | AddParens = addParens; 12 | } 13 | 14 | public SLBaseExpr Expr { get; private set; } 15 | public bool AddParens { get; set; } 16 | 17 | #region implemented abstract members of DelegatedSimpleElem 18 | 19 | protected override void LLWrite (ICodeWriter writer, object o) 20 | { 21 | if (AddParens) 22 | writer.Write ('(', false); 23 | Expr.WriteAll (writer); 24 | if (AddParens) 25 | writer.Write (')', false); 26 | writer.Write ('!', false); 27 | } 28 | 29 | #endregion 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLReturn.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLReturn : DelegatedSimpleElement, ISLExpr, ISLLineable { 6 | public SLReturn (ISLExpr expr) 7 | { 8 | Value = expr; 9 | } 10 | 11 | protected override void LLWrite (ICodeWriter writer, object o) 12 | { 13 | writer.Write ("return ", true); 14 | if (Value != null) 15 | Value.WriteAll (writer); 16 | } 17 | 18 | public ISLExpr Value { get; private set; } 19 | 20 | public static SLLine ReturnLine (ISLExpr expr) 21 | { 22 | return new SLLine (new SLReturn (expr)); 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLSubscriptExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Dynamo.SwiftLang { 8 | public class SLSubscriptExpr : SLBaseExpr { 9 | public SLSubscriptExpr (SLIdentifier ident, CommaListElementCollection paramList) 10 | { 11 | Name = Exceptions.ThrowOnNull (ident, nameof(ident)); 12 | Parameters = Exceptions.ThrowOnNull (paramList, nameof(paramList)); 13 | } 14 | 15 | public SLSubscriptExpr (string identifier, params SLBaseExpr [] parameters) 16 | : this (new SLIdentifier (identifier), new CommaListElementCollection (parameters)) 17 | { 18 | } 19 | 20 | public SLSubscriptExpr (SLIdentifier identifier, IEnumerable parameters) 21 | : this (identifier, new CommaListElementCollection (parameters)) 22 | { 23 | } 24 | 25 | protected override void LLWrite (ICodeWriter writer, object o) 26 | { 27 | Name.WriteAll (writer); 28 | writer.Write ("[", false); 29 | Parameters.WriteAll (writer); 30 | writer.Write ("]", false); 31 | } 32 | 33 | public SLIdentifier Name { get; private set; } 34 | public CommaListElementCollection Parameters { get; private set; } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLThrow.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang 5 | { 6 | public class SLThrow : SLBaseExpr, ISLStatement, ISLLineable 7 | { 8 | public SLThrow (SLBaseExpr expr) 9 | { 10 | Expr = Exceptions.ThrowOnNull (expr, nameof(expr)); 11 | } 12 | 13 | public SLBaseExpr Expr { get; private set; } 14 | 15 | #region implemented abstract members of DelegatedSimpleElem 16 | 17 | protected override void LLWrite (ICodeWriter writer, object o) 18 | { 19 | writer.Write ("throw ", true); 20 | Expr.WriteAll (writer); 21 | } 22 | 23 | #endregion 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLTryBang.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo.SwiftLang { 7 | 8 | public class SLTry : SLBaseExpr, ISLLineable { 9 | public SLTry (SLBaseExpr expr) 10 | : this (expr, false) 11 | { 12 | } 13 | 14 | public SLTry (SLBaseExpr expr, bool isTryBang) 15 | { 16 | Expr = Exceptions.ThrowOnNull (expr, nameof (expr)); 17 | IsTryBang = isTryBang; 18 | } 19 | 20 | public SLBaseExpr Expr { get; private set; } 21 | public bool IsTryBang { get; private set; } 22 | protected override void LLWrite (ICodeWriter writer, object o) 23 | { 24 | string bang = IsTryBang ? "!" : ""; 25 | writer.Write ($"try{bang} ", true); 26 | Expr.WriteAll (writer); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLTupleExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace Dynamo.SwiftLang { 7 | public class SLTupleExpr : SLBaseExpr { 8 | public SLTupleExpr (IEnumerable values) 9 | { 10 | Values = new List (); 11 | Values.AddRange (Exceptions.ThrowOnNull (values, nameof(values))); 12 | } 13 | 14 | public List Values { get; private set; } 15 | 16 | protected override void LLWrite (ICodeWriter writer, object o) 17 | { 18 | writer.Write ('(', true); 19 | for (int i = 0; i < Values.Count; i++) { 20 | if (i > 0) { 21 | writer.Write (", ", true); 22 | } 23 | Values [i].WriteAll (writer); 24 | } 25 | writer.Write (')', true); 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLUnaryExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace Dynamo.SwiftLang { 6 | public class SLUnaryExpr : SLBaseExpr { 7 | public SLUnaryExpr (string op, ISLExpr expr, bool isPrefix) 8 | { 9 | Operation = Exceptions.ThrowOnNull (op, nameof (op)); 10 | Expr = Exceptions.ThrowOnNull (expr, nameof (expr)); 11 | IsPrefix = isPrefix; 12 | } 13 | 14 | protected override void LLWrite (ICodeWriter writer, object o) 15 | { 16 | if (IsPrefix) { 17 | writer.Write (' ', false); 18 | writer.Write (Operation, false); 19 | Expr.WriteAll (writer); 20 | } else { 21 | Expr.WriteAll (writer); 22 | writer.Write (Operation, false); 23 | writer.Write (' ', false); 24 | } 25 | } 26 | 27 | public bool IsPrefix { get; private set; } 28 | public string Operation { get; private set; } 29 | public ISLExpr Expr { get; private set; } 30 | 31 | public static SLUnaryExpr Await (ISLExpr expr) 32 | { 33 | return new SLUnaryExpr ("await ", expr, true); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.SwiftLang/SLVariadicExpr.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace Dynamo.SwiftLang { 5 | public class SLVariadicExpr : SLBaseExpr { 6 | public SLVariadicExpr (DelegatedCommaListElemCollection paramList) 7 | { 8 | Parameters = paramList ?? new DelegatedCommaListElemCollection (WriteElement); 9 | } 10 | 11 | public SLVariadicExpr (params SLBaseExpr [] paramList) 12 | : this (new DelegatedCommaListElemCollection (WriteElement, paramList)) 13 | { 14 | } 15 | 16 | public static void WriteElement (ICodeWriter writer, int i, SLBaseExpr arg) 17 | { 18 | arg.WriteAll (writer); 19 | } 20 | 21 | public DelegatedCommaListElemCollection Parameters { get; private set; } 22 | 23 | protected override void LLWrite (ICodeWriter writer, object o) 24 | { 25 | Parameters.WriteAll (writer); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net7.0 4 | Library 5 | false 6 | false 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Dynamo/Dynamo.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dynamo", "Dynamo.csproj", "{D0E2964B-34C9-4FEE-A638-A10E2E4A0917}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {D0E2964B-34C9-4FEE-A638-A10E2E4A0917}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /Dynamo/Exceptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo { 7 | public class Exceptions { 8 | public static T ThrowOnNull (T o, string name, string message = null) where T : class 9 | { 10 | name = name ?? "::no name supplied::"; 11 | if (o == null) { 12 | if (message == null) 13 | throw new ArgumentNullException (name); 14 | else 15 | throw new ArgumentNullException (name, message); 16 | } 17 | return o; 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Dynamo/ICodeElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo { 7 | public interface ICodeElement { 8 | // these three methods represent the memento pattern. The object returned is only ever used by 9 | // the ICodeElem. 10 | object BeginWrite (ICodeWriter writer); 11 | void Write (ICodeWriter writer, object o); 12 | void EndWrite (ICodeWriter writer, object o); 13 | 14 | // These events seem redundant, but they are intended for use for non-structural code elements 15 | // such as block comments or #region or #if/#else/#endif 16 | 17 | // Begin should be fired by BeginWrite BEFORE anything is written 18 | event EventHandler Begin; 19 | // Note, when you implement End, it should use GetInvocationList and fire in reverse order. 20 | // End should be fired by EndWrite AFTER anything is written 21 | event EventHandler End; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /Dynamo/ICodeElementSet.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace Dynamo { 7 | public interface ICodeElementSet : ICodeElement { 8 | IEnumerable Elements { get; } 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Dynamo/ICodeWriter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo { 7 | public interface ICodeWriter { 8 | void BeginNewLine (bool prependIndents); 9 | void EndLine (); 10 | void Write (char c, bool allowSplit); 11 | void Write (string code, bool allowSplit); 12 | void Indent (); 13 | void Exdent (); 14 | int IndentLevel { get; } 15 | bool IsAtLineStart { get; } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Dynamo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | 7 | // Information about this assembly is defined by the following attributes. 8 | // Change them to the values specific to your project. 9 | 10 | [assembly: AssemblyTitle ("Dynamo")] 11 | [assembly: AssemblyDescription ("")] 12 | [assembly: AssemblyConfiguration ("")] 13 | [assembly: AssemblyCompany ("")] 14 | [assembly: AssemblyProduct ("")] 15 | [assembly: AssemblyCopyright ("steveh")] 16 | [assembly: AssemblyTrademark ("")] 17 | [assembly: AssemblyCulture ("")] 18 | 19 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 20 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 21 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 22 | 23 | [assembly: AssemblyVersion ("1.0.0")] 24 | 25 | // The following attributes are used to specify the signing key for the assembly, 26 | // if desired. See the Mono documentation for more information about signing. 27 | 28 | //[assembly: AssemblyDelaySign(false)] 29 | //[assembly: AssemblyKeyFile("")] 30 | 31 | -------------------------------------------------------------------------------- /Dynamo/WriteEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace Dynamo { 7 | public class WriteEventArgs : EventArgs { 8 | public WriteEventArgs (ICodeWriter writer) 9 | { 10 | if (writer == null) 11 | throw new ArgumentNullException (nameof(writer)); 12 | Writer = writer; 13 | } 14 | 15 | public ICodeWriter Writer { get; private set; } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Microsoft Corporation. 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Pack-Man/.gitignore: -------------------------------------------------------------------------------- 1 | # VSCode folder 2 | .vscode/* 3 | !.vscode/launch.json 4 | 5 | # Build related 6 | tools/** 7 | !tools/packages.config 8 | 9 | binding-tools-for-swift 10 | *.zip 11 | tools 12 | 13 | -------------------------------------------------------------------------------- /SwiftReflector/.gitignore: -------------------------------------------------------------------------------- 1 | Downloaded 2 | SwiftInterfaceReflector/GeneratedParser 3 | 4 | -------------------------------------------------------------------------------- /SwiftReflector/Demangling/ContextAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftReflector.Demangling { 6 | [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] 7 | public class ContextAttribute : Attribute { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SwiftReflector/Demangling/RuleRunner.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | namespace SwiftReflector.Demangling { 9 | public class RuleRunner { 10 | List rules = new List (); 11 | public RuleRunner (IEnumerable rules) 12 | { 13 | this.rules.AddRange (rules); 14 | } 15 | 16 | public SwiftType RunRules(Node node, bool isReference, SwiftName name) 17 | { 18 | var rule = rules.FirstOrDefault (r => r.Matches (node)); 19 | 20 | return rule != null ? rule.Reducer (node, isReference, name) : null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/Directories.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | namespace SwiftReflector.IOUtils { 4 | public static class Directories { 5 | // from https://stackoverflow.com/questions/329355/cannot-delete-directory-with-directory-deletepath-true 6 | public static void DeleteContentsAndSelf (string target_dir) 7 | { 8 | string [] files = Directory.GetFiles (target_dir); 9 | string [] dirs = Directory.GetDirectories (target_dir); 10 | 11 | foreach (string file in files) { 12 | File.SetAttributes (file, FileAttributes.Normal); 13 | File.Delete (file); 14 | } 15 | 16 | foreach (string dir in dirs) { 17 | DeleteContentsAndSelf (dir); 18 | } 19 | 20 | Directory.Delete (target_dir, false); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/IFileProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace SwiftReflector.IOUtils { 5 | public interface IFileProvider { 6 | string ProvideFileFor (T thing); 7 | void NotifyFileDone (T thing, string stm); 8 | } 9 | } 10 | 11 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/IStreamProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.IO; 5 | 6 | namespace SwiftReflector.IOUtils { 7 | public interface IStreamProvider { 8 | Stream ProvideStreamFor (T thing); 9 | void NotifyStreamDone (T thing, Stream stm); 10 | void RemoveStream (T thing, Stream stm); 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/IXElementConvertible.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Xml.Linq; 5 | 6 | namespace SwiftReflector.IOUtils { 7 | public interface IXElementConvertible { 8 | XElement ToXElement (); 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/ReliablePath.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.IO; 5 | using SwiftRuntimeLibrary; 6 | 7 | namespace SwiftReflector.IOUtils { 8 | public class ReliablePath { 9 | public static string GetParentDirectory (string path) 10 | { 11 | Exceptions.ThrowOnNull (path, nameof (path)); 12 | if (path.EndsWith ("/")) { 13 | path = path.Substring (0, path.Length - 1); 14 | } 15 | return Path.GetDirectoryName (path); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/TempDirectoryFilenameProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | 5 | namespace SwiftReflector.IOUtils { 6 | public class TempDirectoryFilenameProvider : TempDirectoryStreamProvider { 7 | 8 | // directoryName can be null 9 | public TempDirectoryFilenameProvider (string directoryName = null, bool prependGuid = true) 10 | : base (directoryName, prependGuid) 11 | { 12 | } 13 | 14 | #region implemented abstract members of TempDirectoryStreamProvider 15 | protected override string FromThing (string thing) 16 | { 17 | return thing; 18 | } 19 | #endregion 20 | 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /SwiftReflector/IOUtils/TempDirectorySwiftClassFileProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftReflector.IOUtils { 7 | public class TempDirectorySwiftClassFileProvider : TempDirectoryStreamProvider { 8 | public TempDirectorySwiftClassFileProvider (string directoryName, bool prependGuid) 9 | : base (directoryName, true) 10 | { 11 | } 12 | 13 | #region implemented abstract members of TempDirectoryStreamProvider 14 | 15 | protected override string FromThing (SwiftClassName thing) 16 | { 17 | return String.Format ("{0}.swift", thing.ToFullyQualifiedName (true).Replace ('.', '-')); 18 | } 19 | 20 | #endregion 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /SwiftReflector/Inventory/Inventory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using SwiftReflector.Demangling; 7 | 8 | 9 | namespace SwiftReflector.Inventory { 10 | public abstract class Inventory { 11 | protected object valuesLock = new object (); 12 | protected Dictionary values = new Dictionary (); 13 | 14 | public IEnumerable Names { get { return values.Keys; } } 15 | public IEnumerable Values { get { return values.Values; } } 16 | 17 | public abstract void Add (TLDefinition tlf, Stream srcStm); 18 | 19 | public bool ContainsName (SwiftName name) 20 | { 21 | lock (valuesLock) { 22 | return values.ContainsKey (name); 23 | } 24 | } 25 | public bool ContainsName (string name) 26 | { 27 | return ContainsName (new SwiftName (name, false)); 28 | } 29 | 30 | public bool TryGetValue (SwiftName name, out T value) 31 | { 32 | lock (valuesLock) { 33 | return values.TryGetValue (name, out value); 34 | } 35 | } 36 | 37 | public bool TryGetValue (string name, out T value) 38 | { 39 | return TryGetValue (new SwiftName (name, false), out value); 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /SwiftReflector/Inventory/ProtocolInventory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.IO; 6 | using SwiftReflector.Demangling; 7 | 8 | namespace SwiftReflector.Inventory { 9 | public class ProtocolInventory : Inventory { 10 | int sizeofMachinePointer; 11 | public ProtocolInventory (int sizeofMachinePointer) 12 | { 13 | this.sizeofMachinePointer = sizeofMachinePointer; 14 | } 15 | 16 | public override void Add (TLDefinition tld, Stream srcStm) 17 | { 18 | lock (valuesLock) { 19 | SwiftName className = ClassInventory.ToClassName (tld); 20 | SwiftClassName formalName = ClassInventory.ToFormalClassName (tld); 21 | ProtocolContents contents = null; 22 | if (!values.TryGetValue (className, out contents)) { 23 | contents = new ProtocolContents (formalName, sizeofMachinePointer); 24 | values.Add (className, contents); 25 | } 26 | contents.Add (tld, srcStm); 27 | } 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /SwiftReflector/Inventory/VariableContents.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | using SwiftReflector.Demangling; 6 | 7 | namespace SwiftReflector.Inventory { 8 | public class VariableContents { 9 | int sizeofMachinePointer; 10 | public VariableContents (SwiftName name, int sizeofMachinePointer) 11 | { 12 | Name = name; 13 | Addressors = new List (); 14 | this.sizeofMachinePointer = sizeofMachinePointer; 15 | } 16 | 17 | public TLVariable Variable { get; set; } 18 | public List Addressors { get; private set; } 19 | public SwiftName Name { get; private set; } 20 | public int SizeofMachinePointer { get { return sizeofMachinePointer; } } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /SwiftReflector/ModuleMapper.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | using SwiftRuntimeLibrary; 6 | 7 | namespace SwiftReflector { 8 | public class ModuleMapper { 9 | Dictionary map = new Dictionary (); 10 | 11 | public ModuleMapper () 12 | { 13 | } 14 | 15 | public bool IsMapped (SwiftName sn) 16 | { 17 | return map.ContainsKey (Exceptions.ThrowOnNull (sn, nameof (sn))); 18 | } 19 | 20 | public SwiftName Map (SwiftName sn) 21 | { 22 | SwiftName mapped = Exceptions.ThrowOnNull (sn, nameof(sn)); 23 | if (map.TryGetValue (sn, out mapped)) 24 | return mapped; 25 | return sn; 26 | } 27 | 28 | public void AddMapping (SwiftName key, SwiftName value) 29 | { 30 | map [Exceptions.ThrowOnNull (key, nameof(key))] = Exceptions.ThrowOnNull (value, nameof(value)); 31 | } 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /SwiftReflector/Naming/SequentialNamer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using SwiftReflector.Demangling; 4 | 5 | #nullable enable 6 | 7 | namespace SwiftReflector.Naming { 8 | public class SequentialNamer { 9 | int current; 10 | string prefix; 11 | 12 | public SequentialNamer (string prefix, int start = 0) 13 | { 14 | this.prefix = prefix; 15 | current = start; 16 | } 17 | 18 | public string SafeName (string name) 19 | { 20 | return CSSafeNaming.SafeIdentifier ($"{prefix}{name}{Interlocked.Increment (ref current)}"); 21 | } 22 | } 23 | 24 | public class PInvokeNamer : SequentialNamer { 25 | public PInvokeNamer (int start = 0) : base ("PI", start) 26 | { 27 | } 28 | 29 | public string SafeName (TLFunction tlf) 30 | { 31 | var module = tlf.Module.Name ?? "NoModule"; 32 | var name = tlf.Name.Name ?? "Anonymous"; 33 | return SafeName ($"_{module}_{name}"); 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /SwiftReflector/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | 7 | // Information about this assembly is defined by the following attributes. 8 | // Change them to the values specific to your project. 9 | 10 | [assembly: AssemblyTitle ("SwiftReflector")] 11 | [assembly: AssemblyDescription ("")] 12 | [assembly: AssemblyConfiguration ("")] 13 | [assembly: AssemblyCompany ("")] 14 | [assembly: AssemblyProduct ("")] 15 | [assembly: AssemblyCopyright ("steveh")] 16 | [assembly: AssemblyTrademark ("")] 17 | [assembly: AssemblyCulture ("")] 18 | 19 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 20 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 21 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 22 | 23 | [assembly: AssemblyVersion ("1.0.0")] 24 | 25 | // The following attributes are used to specify the signing key for the assembly, 26 | // if desired. See the Mono documentation for more information about signing. 27 | 28 | //[assembly: AssemblyDelaySign(false)] 29 | //[assembly: AssemblyKeyFile("")] 30 | 31 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftInterfaceReflector/IModuleLoader.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Linq; 6 | using SwiftReflector.TypeMapping; 7 | 8 | namespace SwiftReflector.SwiftInterfaceReflector { 9 | public interface IModuleLoader { 10 | bool Load (string moduleName, TypeDatabase into); 11 | } 12 | 13 | // this is only useful for tests, really. 14 | public class NoLoadLoader : IModuleLoader { 15 | public NoLoadLoader () 16 | { 17 | } 18 | 19 | public bool Load (string moduleName, TypeDatabase into) 20 | { 21 | if (moduleName == "_Concurrency") 22 | return true; 23 | // only returns true is the module is already loaded 24 | return into.ModuleNames.Contains (moduleName); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftInterfaceReflector/ParseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace SwiftReflector.SwiftInterfaceReflector { 3 | public class ParseException : Exception { 4 | public ParseException () 5 | { 6 | } 7 | 8 | public ParseException (string message) 9 | : base (message) 10 | { 11 | } 12 | 13 | public ParseException (string message, Exception inner) 14 | : base (message, inner) 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftName.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftReflector { 7 | public class SwiftName { 8 | public SwiftName (string name, bool isPunyCode) 9 | { 10 | if (name == null) 11 | throw new ArgumentNullException ("name"); 12 | PunyName = name; 13 | Name = isPunyCode ? name.DePunyCode () : name; 14 | } 15 | 16 | public string Name { get; private set; } 17 | public string PunyName { get; private set; } 18 | public bool HasPunyCode { get { return Name != PunyName; } } 19 | 20 | public override string ToString () 21 | { 22 | return HasPunyCode ? String.Format ("{0} ({1})", Name, PunyName) : Name; 23 | } 24 | 25 | static SwiftName emptyName = new SwiftName ("", false); 26 | public static SwiftName Empty { get { return emptyName; } } 27 | 28 | public override bool Equals (object obj) 29 | { 30 | var other = obj as SwiftName; 31 | if (other == null) 32 | return false; 33 | return (PunyName == other.PunyName) && 34 | (HasPunyCode ? Name == other.Name : true); 35 | } 36 | 37 | public override int GetHashCode () 38 | { 39 | return PunyName.GetHashCode () + 40 | (HasPunyCode ? Name.GetHashCode () : 0); 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftXmlReflection/ClassDeclaration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Collections.Generic; 5 | using Dynamo.CSLang; 6 | 7 | namespace SwiftReflector.SwiftXmlReflection { 8 | public class ClassDeclaration : TypeDeclaration { 9 | public ClassDeclaration () 10 | : base () 11 | { 12 | Kind = TypeKind.Class; 13 | CSharpMethods = new List (); 14 | CSharpProperties = new List (); 15 | } 16 | 17 | protected override TypeDeclaration UnrootedFactory () 18 | { 19 | return new ClassDeclaration (); 20 | } 21 | 22 | // These are strictly for imported members from C# dll's. 23 | // These members should not get serialized. 24 | public bool IsImportedBinding { get; set; } 25 | public List CSharpMethods { get; } 26 | public List CSharpProperties { get; } 27 | } 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftXmlReflection/GenericDeclarationCollection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Xml.Linq; 8 | using SwiftReflector.IOUtils; 9 | 10 | namespace SwiftReflector.SwiftXmlReflection { 11 | public class GenericDeclarationCollection : List, IXElementConvertible { 12 | public GenericDeclarationCollection () 13 | : base () 14 | { 15 | } 16 | 17 | public GenericDeclarationCollection (int capacity) 18 | : base (capacity) 19 | { 20 | } 21 | 22 | public XElement ToXElement () 23 | { 24 | if (Count == 0) 25 | return null; 26 | XElement genparms = new XElement ("genericparameters"); 27 | 28 | foreach (GenericDeclaration decl in this) { 29 | XElement param = new XElement ("param", new XAttribute ("name", decl.Name)); 30 | genparms.Add (param); 31 | } 32 | foreach (GenericDeclaration decl in this) { 33 | if (decl.Constraints.Count > 0) { 34 | foreach (BaseConstraint bc in decl.Constraints) { 35 | XElement bcel = bc.ToXElement (); 36 | if (bcel != null) 37 | genparms.Add (bcel); 38 | } 39 | } 40 | } 41 | return genparms; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftXmlReflection/GenericReferenceAssociatedTypeProtocol.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace SwiftReflector.SwiftXmlReflection { 5 | public class GenericReferenceAssociatedTypeProtocol { 6 | public NamedTypeSpec GenericPart { get; set; } 7 | public ProtocolDeclaration Protocol { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftXmlReflection/Member.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Xml.Linq; 7 | using SwiftReflector.IOUtils; 8 | 9 | namespace SwiftReflector.SwiftXmlReflection { 10 | public abstract class Member : BaseDeclaration, IXElementConvertible { 11 | protected Member () 12 | : base () 13 | { 14 | } 15 | 16 | protected Member (Member other) 17 | : base (other) 18 | { 19 | } 20 | 21 | public bool IsProtocolMember { get { return Parent != null && Parent is ProtocolDeclaration; } } 22 | 23 | #region IXElementConvertible implementation 24 | 25 | public XElement ToXElement () 26 | { 27 | return MakeXElement (); 28 | } 29 | 30 | protected virtual XElement MakeXElement () 31 | { 32 | throw new NotImplementedException (); 33 | } 34 | #endregion 35 | 36 | public abstract bool HasDynamicSelf { 37 | get; 38 | } 39 | 40 | public abstract bool HasDynamicSelfInReturnOnly { 41 | get; 42 | } 43 | 44 | public abstract bool HasDynamicSelfInArguments { 45 | get; 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftXmlReflection/StructDeclaration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace SwiftReflector.SwiftXmlReflection { 5 | public class StructDeclaration : TypeDeclaration { 6 | public StructDeclaration () 7 | { 8 | Kind = TypeKind.Struct; 9 | } 10 | 11 | protected override TypeDeclaration UnrootedFactory () 12 | { 13 | return new StructDeclaration (); 14 | } 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /SwiftReflector/SwiftXmlReflection/SubscriptDeclaration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | namespace SwiftReflector.SwiftXmlReflection { 5 | // this is a pseudo class. 6 | public class SubscriptDeclaration { 7 | public SubscriptDeclaration (FunctionDeclaration getter, FunctionDeclaration setter, FunctionDeclaration materializer) 8 | { 9 | Getter = getter; 10 | Setter = setter; 11 | Materializer = materializer; 12 | } 13 | 14 | public FunctionDeclaration Getter { get; set; } 15 | public FunctionDeclaration Setter { get; set; } 16 | public FunctionDeclaration Materializer { get; set; } 17 | public bool IsAsync => Getter.IsAsync; 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /SwiftReflector/TypeMapping/ModuleDatabase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using SwiftReflector.SwiftXmlReflection; 7 | 8 | namespace SwiftReflector.TypeMapping { 9 | public class ModuleDatabase : Dictionary{ 10 | public ModuleDatabase () 11 | { 12 | Operators = new List (); 13 | TypeAliases = new List (); 14 | } 15 | 16 | public List Operators { get; private set; } 17 | public List TypeAliases { get; private set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SwiftReflector/TypeMapping/NetParam.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using SwiftRuntimeLibrary; 5 | 6 | namespace SwiftReflector.TypeMapping { 7 | public class NetParam { 8 | public NetParam (string name, NetTypeBundle bundle) 9 | { 10 | Name = Exceptions.ThrowOnNull (name, "name"); 11 | Type = bundle; 12 | } 13 | public string Name { get; private set; } 14 | public NetTypeBundle Type { get; private set; } 15 | } 16 | 17 | } 18 | 19 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary.Mac/.gitignore: -------------------------------------------------------------------------------- 1 | GeneratedCode 2 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary.iOS/.gitignore: -------------------------------------------------------------------------------- 1 | GeneratedCode 2 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/BaseProxy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | #nullable enable 7 | 8 | namespace SwiftRuntimeLibrary { 9 | public class BaseProxy { 10 | public BaseProxy (Type interfaceType, EveryProtocol? everyProtocol) 11 | { 12 | InterfaceType = interfaceType; 13 | EveryProtocol = everyProtocol; 14 | } 15 | // be aware that EveryProtocol can be null in the case of the protocol coming from Swift 16 | public EveryProtocol? EveryProtocol { get; private set; } 17 | public Type InterfaceType { get; private set; } 18 | 19 | public virtual ISwiftExistentialContainer ProxyExistentialContainer => null!; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/Exceptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary { 6 | public static class Exceptions { 7 | public static T ThrowOnNull (T o, string name, string message = null) where T : class 8 | { 9 | if (o == null) 10 | ThrowArgumentNull (name, message); 11 | return o; 12 | } 13 | 14 | static void ThrowArgumentNull (string name, string message = null) 15 | { 16 | name = name ?? "::no name supplied::"; 17 | if (message == null) 18 | throw new ArgumentNullException (name); 19 | else 20 | throw new ArgumentNullException (name, message); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/ISwiftError.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary { 6 | public interface ISwiftError { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/ISwiftIteratorProtocol.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | using SwiftRuntimeLibrary; 7 | using SwiftRuntimeLibrary.SwiftMarshal; 8 | #if __IOS__ || __MACOS__ || __TVOS__ || __WATCHOS__ 9 | using ObjCRuntime; 10 | #endif 11 | using System.Reflection; 12 | 13 | namespace SwiftRuntimeLibrary { 14 | [SwiftProtocolType (typeof (SwiftIteratorProtocolProtocol<>), "libswiftCore.dylib", "$sStMp", true)] 15 | [SwiftTypeName ("Swift.IteratorProtocol")] 16 | public interface ISwiftIteratorProtocol { 17 | SwiftOptional Next (); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/ISwiftObject.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace SwiftRuntimeLibrary { 8 | public interface ISwiftObject : IDisposable { 9 | IntPtr SwiftObject { get; } 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/ISwiftValueType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary { 6 | public interface ISwiftValueType : IDisposable { 7 | byte [] SwiftData { get; set; } 8 | } 9 | 10 | public interface ISwiftEnum : ISwiftValueType { 11 | } 12 | 13 | public interface ISwiftStruct : ISwiftValueType { 14 | } 15 | 16 | public enum SwiftValueTypeCtorArgument { 17 | None = 0 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | 7 | // Information about this assembly is defined by the following attributes. 8 | // Change them to the values specific to your project. 9 | 10 | [assembly: AssemblyTitle ("SwiftRuntimeLibrary")] 11 | [assembly: AssemblyDescription ("")] 12 | [assembly: AssemblyConfiguration ("")] 13 | [assembly: AssemblyCompany ("")] 14 | [assembly: AssemblyProduct ("")] 15 | [assembly: AssemblyCopyright ("steveh")] 16 | [assembly: AssemblyTrademark ("")] 17 | [assembly: AssemblyCulture ("")] 18 | 19 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 20 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 21 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 22 | 23 | [assembly: AssemblyVersion ("1.0.0")] 24 | 25 | // The following attributes are used to specify the signing key for the assembly, 26 | // if desired. See the Mono documentation for more information about signing. 27 | 28 | //[assembly: AssemblyDelaySign(false)] 29 | //[assembly: AssemblyKeyFile("")] 30 | 31 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftEnumRawValueAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftRuntimeLibrary { 7 | [AttributeUsage (AttributeTargets.Enum, AllowMultiple = false)] 8 | public sealed class SwiftEnumHasRawValueAttribute : Attribute { 9 | public Type RawValueType { get; private set; } 10 | public SwiftEnumHasRawValueAttribute (Type t) 11 | { 12 | RawValueType = t; 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary { 6 | public class SwiftException : Exception { 7 | public SwiftException (string message, SwiftError error) 8 | : base (message) 9 | { 10 | Error = error; 11 | } 12 | 13 | public SwiftError Error { get; private set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftFoundationConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary { 6 | internal static class SwiftFoundationConstants { 7 | internal const string LibSwiftFoundation = "libswiftFoundation.dylib"; 8 | 9 | // SwiftDate 10 | internal const string SwiftDate_NominalTypeDescriptor = "$s10Foundation4DateVMn"; 11 | internal const string SwiftData_TypeMetadata = "$s10Foundation4DateVN"; 12 | internal const string SwiftDate_MetadataAcessor = "$s10Foundation4DateVMa"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/ImportedTypeCache.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace SwiftRuntimeLibrary.SwiftMarshal { 8 | internal static class ImportedTypeCache { 9 | static Dictionary cache = new Dictionary (); 10 | static object lockObject = new object (); 11 | 12 | public static SwiftMetatype? SwiftMetatypeForType (Type t) 13 | { 14 | SwiftMetatype? result = null; 15 | 16 | lock (lockObject) { 17 | if (cache.TryGetValue (t, out result)) 18 | return result; 19 | #if !TOM_SWIFTY 20 | SwiftMetatype metatype; 21 | if (XamGlueMetadata.GetSwiftType (t, out metatype)) { 22 | result = metatype; 23 | cache.Add (t, result); 24 | } 25 | #endif 26 | } 27 | return result; 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftAssociatedTypeDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace SwiftRuntimeLibrary.SwiftMarshal { 5 | internal enum ProtocolRequirementsKind { 6 | BaseProtocol, 7 | Method, 8 | Init, 9 | Getter, 10 | Setter, 11 | ReadCoroutine, 12 | ModifyCoroutine, 13 | AssociatedTypeAccessFunction, 14 | AssociatedConformanceAccessFunction, 15 | } 16 | 17 | internal struct SwiftAssociatedTypeDescriptor { 18 | IntPtr handle; 19 | public SwiftAssociatedTypeDescriptor (IntPtr handle) 20 | { 21 | this.handle = handle; 22 | } 23 | public IntPtr Handle => handle; 24 | 25 | public ProtocolRequirementsKind Kind { 26 | get { 27 | return (ProtocolRequirementsKind)(Marshal.ReadInt32 (handle) & 0xf); 28 | } 29 | } 30 | 31 | public bool IsValid { 32 | get { 33 | return handle != IntPtr.Zero; 34 | } 35 | } 36 | 37 | public bool IsInstance { 38 | get { 39 | return (Marshal.ReadInt32 (handle) & 0x10) != 0; 40 | } 41 | } 42 | 43 | public IntPtr DefaultImplementation { 44 | get { 45 | var relPtr = handle + sizeof (int); 46 | var ptrVal = Marshal.ReadInt32 (relPtr); 47 | if (ptrVal == 0) 48 | return IntPtr.Zero; 49 | return relPtr + ptrVal; 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftEnumBackingTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary.SwiftMarshal { 6 | [AttributeUsage (AttributeTargets.Enum, AllowMultiple = false)] 7 | public sealed class SwiftEnumBackingTypeAttribute : Attribute { 8 | public SwiftEnumBackingTypeAttribute (Type t) 9 | { 10 | if (t == null) 11 | throw new ArgumentNullException (nameof (t)); 12 | BackingType = t; 13 | } 14 | public Type BackingType { get; private set; } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftEnumTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary.SwiftMarshal { 6 | [AttributeUsage (AttributeTargets.Class | AttributeTargets.Enum, AllowMultiple = false)] 7 | public sealed class SwiftEnumTypeAttribute : SwiftValueTypeAttribute { 8 | public SwiftEnumTypeAttribute (string libraryName, string nominalTypeDescriptor, string metadata, string witnessTable) 9 | : base (libraryName, nominalTypeDescriptor, metadata, witnessTable) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftExternalProtocolDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary.SwiftMarshal { 6 | [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)] 7 | public class SwiftExternalProtocolDefinitionAttribute : Attribute { 8 | public SwiftExternalProtocolDefinitionAttribute (Type adoptingType, string libraryName, string protocolWitnessName) 9 | { 10 | AdoptingType = adoptingType; 11 | LibraryName = libraryName; 12 | ProtocolWitnessName = protocolWitnessName; 13 | } 14 | 15 | public Type AdoptingType { get; private set; } 16 | public string LibraryName { get; private set; } 17 | public string ProtocolWitnessName { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftNativeObjectAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary.SwiftMarshal { 6 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 7 | public class SwiftNativeObjectTagAttribute : Attribute { 8 | public static bool IsSwiftNativeObject (object o) 9 | { 10 | if (o == null) 11 | throw new ArgumentNullException (nameof (o)); 12 | return o.GetType ().GetCustomAttributes (typeof (SwiftNativeObjectTagAttribute), false).Length > 0; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftProtocolConstraintAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary.SwiftMarshal { 6 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] 7 | public class SwiftProtocolConstraintAttribute : Attribute { 8 | public SwiftProtocolConstraintAttribute (Type equivalentInterface, 9 | string libraryName, 10 | string protocolWitnessName) 11 | { 12 | EquivalentInterface = equivalentInterface; 13 | LibraryName = libraryName; 14 | ProtocolWitnessName = protocolWitnessName; 15 | } 16 | 17 | public Type EquivalentInterface { get; private set; } 18 | public string LibraryName { get; private set; } 19 | public string ProtocolWitnessName { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftProtocolWitnessTable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace SwiftRuntimeLibrary.SwiftMarshal { 8 | public struct SwiftProtocolWitnessTable { 9 | 10 | IntPtr handle; 11 | public SwiftProtocolWitnessTable (IntPtr handle) 12 | { 13 | this.handle = handle; 14 | } 15 | 16 | public IntPtr Handle => handle; 17 | 18 | public SwiftProtocolConformanceDescriptor Conformance { 19 | get { 20 | if (handle == IntPtr.Zero) 21 | throw new InvalidOperationException (); 22 | return new SwiftProtocolConformanceDescriptor (Marshal.ReadIntPtr (handle)); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftStructAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftRuntimeLibrary.SwiftMarshal { 7 | [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] 8 | public sealed class SwiftStructAttribute : SwiftValueTypeAttribute { 9 | 10 | public SwiftStructAttribute (string libraryName, string nominalTypeDescriptor, string metadata, string witnessTable) 11 | : base (libraryName, nominalTypeDescriptor, metadata, witnessTable) 12 | { 13 | } 14 | } 15 | 16 | 17 | 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftThrowsAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary.SwiftMarshal { 6 | [AttributeUsage (AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Property, AllowMultiple = false)] 7 | public sealed class SwiftThrowsAttribute : Attribute { 8 | public SwiftThrowsAttribute () 9 | { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftMarshal/SwiftTypeNameAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Reflection; 6 | 7 | namespace SwiftRuntimeLibrary.SwiftMarshal { 8 | [AttributeUsage (AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false)] 9 | public class SwiftTypeNameAttribute : Attribute { 10 | public SwiftTypeNameAttribute (string swiftName) 11 | { 12 | SwiftName = Exceptions.ThrowOnNull (swiftName, nameof (swiftName)); 13 | } 14 | 15 | public string SwiftName { get; private set; } 16 | 17 | public static bool TryGetSwiftName (Type t, out string swiftName) 18 | { 19 | Exceptions.ThrowOnNull (t, nameof (t)); 20 | var attr = t.GetCustomAttribute (); 21 | swiftName = attr != null ? attr.SwiftName : null; 22 | return swiftName != null; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftNativeInstance.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftRuntimeLibrary { 7 | public abstract class SwiftNativeInstance : IDisposable { 8 | ~SwiftNativeInstance () 9 | { 10 | Dispose (false); 11 | } 12 | public void Dispose () 13 | { 14 | Dispose (true); 15 | GC.SuppressFinalize (this); 16 | } 17 | protected abstract void Dispose (bool disposing); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftNativeValueType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using SwiftRuntimeLibrary.SwiftMarshal; 5 | 6 | namespace SwiftRuntimeLibrary { 7 | public abstract class SwiftNativeValueType : SwiftNativeInstance, ISwiftValueType { 8 | protected SwiftNativeValueType () 9 | { 10 | StructMarshal.Marshaler.PrepareValueType (this); 11 | } 12 | 13 | bool disposed; 14 | protected override void Dispose (bool disposing) 15 | { 16 | if (disposed) 17 | return; 18 | disposed = true; 19 | StructMarshal.Marshaler.NominalDestroy (this); 20 | SwiftData = null; 21 | } 22 | 23 | public byte [] SwiftData { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/SwiftRuntimeException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftRuntimeLibrary { 7 | public class SwiftRuntimeException : Exception { 8 | public SwiftRuntimeException (string message) 9 | : base (message) 10 | { 11 | } 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /SwiftRuntimeLibrary/XamProxyTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace SwiftRuntimeLibrary { 7 | [AttributeUsage (AttributeTargets.Field, AllowMultiple = false)] 8 | public class XamProxyTypeAttribute : Attribute { 9 | public XamProxyTypeAttribute (Type proxyType) 10 | { 11 | ProxyType = proxyType; 12 | } 13 | public Type ProxyType { get; private set; } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /SwiftVersion.mk: -------------------------------------------------------------------------------- 1 | # This file contains the information to determine exactly which swift version to use 2 | SWIFT_BRANCH=release/5.3-branch-tomswifty 3 | SWIFT_SCHEME=release/5.3 4 | # this hash should be the most recent in the above branch 5 | SWIFT_HASH=904741b22f503462189fa24a3f1260435554c9ec 6 | -------------------------------------------------------------------------------- /binding-tools-for-swift: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | exec mono "$DIR/lib/binding-tools-for-swift/tom-swifty.exe" "$@" 4 | -------------------------------------------------------------------------------- /devops/automation/Makefile: -------------------------------------------------------------------------------- 1 | all check: 2 | @# SC1091: 3 | @# In build-swift.sh line 6: 4 | @# source SwiftVersion.mk 5 | @# ^-- SC1091: Not following: SwiftVersion.mk was not specified as input (see shellcheck -x). 6 | shellcheck *.sh -e 1091 7 | -------------------------------------------------------------------------------- /devops/automation/build-package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # env var should have been defined by the CI 4 | if test -z "$BTFS_TOP"; then 5 | echo "Variable BTFS_TOP is missing." 6 | exit 1 7 | fi 8 | 9 | cd $BTFS_TOP 10 | WORKSPACE=$(pwd) 11 | 12 | # Use Pack-Man to produce zip package 13 | # and custom directory of Binding Tools for Swift build. 14 | cd "$WORKSPACE/Pack-Man" 15 | # Remove any existing zips 16 | rm -f -- *.zip 17 | ./build.sh 18 | 19 | FILENAME=binding-tools-for-swift-v$(make -C .. print-variable VARIABLE=SOM_PACKAGE_VERSION) 20 | mv "binding-tools-for-swift.zip" "$FILENAME.zip" 21 | echo "Created Pack-Man/$FILENAME.zip" 22 | 23 | PACKAGE_DIR=$WORKSPACE/../package 24 | rm -Rf "$PACKAGE_DIR" 25 | mkdir -p "$PACKAGE_DIR" 26 | cp -- *.zip "$PACKAGE_DIR" 27 | -------------------------------------------------------------------------------- /devops/automation/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | if test -z "$BTFS_TOP"; then 4 | echo "Variable BTFS_TOP is missing." 5 | exit 1 6 | fi 7 | 8 | cd $BTFS_TOP 9 | WORKSPACE=$(pwd) 10 | 11 | dotnet restore tom-swifty.sln --packages packages 12 | cd "$WORKSPACE/plist-swifty" 13 | dotnet build 14 | cd "$WORKSPACE/type-o-matic" 15 | dotnet build 16 | cd "$WORKSPACE/swiftglue" 17 | make generate-swift-bindings 18 | make all -j8 19 | 20 | cd "$WORKSPACE" 21 | dotnet build tom-swifty.sln 22 | -------------------------------------------------------------------------------- /devops/automation/provision-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # env var should have been defined by the CI 4 | if test -z "$BTFS_TOP"; then 5 | echo "Variable BTFS_TOP is missing." 6 | exit 1 7 | fi 8 | 9 | cd $BTFS_TOP 10 | WORKSPACE=$(pwd) 11 | 12 | # make the login keychain the default 13 | security list-keychain -d user -s login.keychain 14 | security default-keychain -d user -s login.keychain 15 | if test -n "${LOGIN_KEYCHAIN_PASSWORD:-}"; then 16 | security unlock-keychain -p "$LOGIN_KEYCHAIN_PASSWORD" login.keychain 17 | fi 18 | security set-keychain-settings -lut 21600 login.keychain 19 | 20 | # Verify dependencies and install if necessary 21 | $WORKSPACE/devops/automation/system-dependencies.sh --provision-all 22 | 23 | xcode-select -p 24 | ls -la /Applications 25 | -------------------------------------------------------------------------------- /devops/automation/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | if test -z "$BTFS_TOP"; then 3 | echo "Variable BTFS_TOP is missing." 4 | exit 1 5 | fi 6 | 7 | echo $SOM_PATH 8 | unset SOM_PATH 9 | cd "$(dirname "${BASH_SOURCE[0]}")/../.." 10 | #WORKSPACE=$(pwd) 11 | 12 | make -C tests/tom-swifty-test 13 | make -C tests/tom-swifty-test run-runtime-library-tests 14 | # Offline until swift 5 smoke clears 15 | #make -C tests/3rd-party 16 | 17 | unset SOM_PATH 18 | -------------------------------------------------------------------------------- /docs/Unicode-Mapping.md: -------------------------------------------------------------------------------- 1 | ## Unicode Mapping 2 | 3 | As Swift allows unicode identifiers in locations that are illegal in C#, there needs to be a mapping betwee the two. 4 | 5 | By default identifiers such as `UD83CUDF4E` are generated, based upon the unicode code points, but those are less than ideal to use. 6 | 7 | By passing the `--unicode-mapping` with an XML file path, custom mappings can be provided. 8 | 9 | ### XML File Format 10 | 11 | ``` 12 | 13 | 14 | 15 | 16 | ``` -------------------------------------------------------------------------------- /leaktest/.gitignore: -------------------------------------------------------------------------------- 1 | *.dylib 2 | 3 | -------------------------------------------------------------------------------- /leaktest/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | msbuild 3 | -------------------------------------------------------------------------------- /leaktest/README.md: -------------------------------------------------------------------------------- 1 | This is a small wrapper around the command-line `leaks` tool that: 2 | 3 | * Sets a few malloc variables before launching the executable that's to be 4 | tested. 5 | * Launches the executable, requests it to wait before exiting (this needs 6 | cooperation from the executable), and then launches `leaks` when the 7 | executable is at the end. 8 | -------------------------------------------------------------------------------- /leaktest/leaktest: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | mono --debug "$(dirname "${BASH_SOURCE[0]}")"/leaktest.exe "$@" 4 | -------------------------------------------------------------------------------- /msbuild/.gitignore: -------------------------------------------------------------------------------- 1 | local-feed 2 | 3 | -------------------------------------------------------------------------------- /msbuild/nuget/.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | obj/ 3 | Sdk.Project.Prototype.Tasks.sln 4 | -------------------------------------------------------------------------------- /msbuild/nuget/Binding.Tools.For.Swift.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | binding-tools-for-swift 5 | 0.1.2 6 | msbuild support for Binding Tools for Swift 7 | chamons 8 | chamons 9 | 10 | https://github.com/xamarin/binding-tools-for-swift 11 | https://github.com/xamarin/binding-tools-for-swift/blob/main/LICENSE 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /msbuild/nuget/build/binding-tools-for-swift.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | true 7 | 8 | 9 | 10 | 11 | 12 | iOS 13 | 14 | 15 | 16 | 17 | ModernXM 18 | 19 | 20 | 21 | 22 | FullXM 23 | 24 | 25 | 26 | 27 | Unknown 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /msbuild/tests/.gitignore: -------------------------------------------------------------------------------- 1 | sample.sln 2 | bin 3 | obj 4 | .vs/ 5 | nuget/ 6 | -------------------------------------------------------------------------------- /msbuild/tests/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/app/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/app/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/app/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using UIKit; 5 | 6 | namespace sampleappios 7 | { 8 | public class Application 9 | { 10 | // This is the main entry point of the application. 11 | static void Main (string[] args) 12 | { 13 | // if you want to use a different Application Delegate class from "AppDelegate" 14 | // you can specify it here. 15 | UIApplication.Main (args, null, "AppDelegate"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/app/ViewController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | using UIKit; 7 | 8 | namespace sampleappios 9 | { 10 | public partial class ViewController : UIViewController 11 | { 12 | protected ViewController (IntPtr handle) : base (handle) 13 | { 14 | // Note: this .ctor should not contain any initialization logic. 15 | } 16 | 17 | public override void ViewDidAppear (bool animated) 18 | { 19 | base.ViewDidAppear (animated); 20 | 21 | var sayer = new TestLib.Sayer (); 22 | UIAlertController alert = new UIAlertController () { 23 | Message = TestHigherLib.TopLevelEntities.SayHello (sayer).ToString () 24 | }; 25 | alert.AddAction (UIAlertAction.Create ("OK", UIAlertActionStyle.Default, null)); 26 | PresentViewController (alert, true, null); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/app/ViewController.designer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | // 5 | // This file has been generated automatically by MonoDevelop to store outlets and 6 | // actions made in the Xcode designer. If it is removed, they will be lost. 7 | // Manual changes to this file may not be handled correctly. 8 | // 9 | using Foundation; 10 | 11 | namespace sampleappios 12 | { 13 | [Register ("ViewController")] 14 | partial class ViewController 15 | { 16 | void ReleaseDesignerOutlets () 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/lib/Structs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace sampleios 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/ios/lib/sample-ios.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-ios", "sample-ios.csproj", "{DD0896F4-9D87-4904-AC65-65309D7C4288}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {DD0896F4-9D87-4904-AC65-65309D7C4288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {DD0896F4-9D87-4904-AC65-65309D7C4288}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {DD0896F4-9D87-4904-AC65-65309D7C4288}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {DD0896F4-9D87-4904-AC65-65309D7C4288}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using AppKit; 5 | using Foundation; 6 | 7 | namespace sampleappxm 8 | { 9 | [Register ("AppDelegate")] 10 | public class AppDelegate : NSApplicationDelegate 11 | { 12 | public AppDelegate () 13 | { 14 | 15 | } 16 | 17 | public override void DidFinishLaunching (NSNotification notification) 18 | { 19 | var sayer = new TestLib.Sayer (); 20 | NSAlert alert = new NSAlert () { 21 | MessageText = TestHigherLib.TopLevelEntities.SayHello (sayer).ToString () 22 | }; 23 | alert.RunModal (); 24 | NSApplication.SharedApplication.Terminate (this); 25 | } 26 | 27 | public override void WillTerminate (NSNotification notification) 28 | { 29 | // Insert code here to tear down your application 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/Info.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | CFBundleName 6 | sample-app-xm 7 | CFBundleIdentifier 8 | com.companyname.sample-app-xm 9 | CFBundleShortVersionString 10 | 1.0 11 | CFBundleVersion 12 | 1 13 | LSMinimumSystemVersion 14 | 10.13 15 | CFBundleDevelopmentRegion 16 | en 17 | CFBundleInfoDictionaryVersion 18 | 6.0 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | NSHumanReadableCopyright 24 | ${AuthorCopyright:HtmlEncode} 25 | NSPrincipalClass 26 | NSApplication 27 | NSMainStoryboardFile 28 | Main 29 | XSAppIconAssets 30 | Assets.xcassets/AppIcon.appiconset 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using AppKit; 5 | 6 | namespace sampleappxm 7 | { 8 | static class MainClass 9 | { 10 | static void Main (string[] args) 11 | { 12 | NSApplication.Init (); 13 | NSApplication.Main (args); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/ViewController.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | using AppKit; 7 | using Foundation; 8 | 9 | namespace sampleappxm 10 | { 11 | public partial class ViewController : NSViewController 12 | { 13 | public ViewController (IntPtr handle) : base (handle) 14 | { 15 | } 16 | 17 | public override void ViewDidLoad () 18 | { 19 | base.ViewDidLoad (); 20 | 21 | // Do any additional setup after loading the view. 22 | } 23 | 24 | public override NSObject RepresentedObject 25 | { 26 | get { 27 | return base.RepresentedObject; 28 | } 29 | set { 30 | base.RepresentedObject = value; 31 | // Update the view, if already loaded. 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/ViewController.designer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | // WARNING 5 | // 6 | // This file has been generated automatically by Xamarin Studio to store outlets and 7 | // actions made in the UI designer. If it is removed, they will be lost. 8 | // Manual changes to this file may not be handled correctly. 9 | // 10 | using Foundation; 11 | 12 | namespace sampleappxm 13 | { 14 | [Register ("ViewController")] 15 | partial class ViewController 16 | { 17 | void ReleaseDesignerOutlets () 18 | { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/app/sample-app-xm.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-app-xm", "sample-app-xm.csproj", "{9FFCAC0A-636A-4658-A561-2051010A0628}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {9FFCAC0A-636A-4658-A561-2051010A0628}.Debug|x86.ActiveCfg = Debug|x86 13 | {9FFCAC0A-636A-4658-A561-2051010A0628}.Debug|x86.Build.0 = Debug|x86 14 | {9FFCAC0A-636A-4658-A561-2051010A0628}.Release|x86.ActiveCfg = Release|x86 15 | {9FFCAC0A-636A-4658-A561-2051010A0628}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/lib/StructsAndEnums.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace samplexm 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /msbuild/tests/csharp/mac/lib/sample-xm.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sample-xm", "sample-xm.csproj", "{888E06EB-45EE-4CD5-B2E0-9C5A1A41E233}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {888E06EB-45EE-4CD5-B2E0-9C5A1A41E233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {888E06EB-45EE-4CD5-B2E0-9C5A1A41E233}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {888E06EB-45EE-4CD5-B2E0-9C5A1A41E233}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {888E06EB-45EE-4CD5-B2E0-9C5A1A41E233}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /msbuild/tests/swift/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | xcuserdata/ 3 | -------------------------------------------------------------------------------- /msbuild/tests/swift/Package.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | // swift-tools-version:4.0 5 | // The swift-tools-version declares the minimum version of Swift required to build this package. 6 | 7 | import PackageDescription 8 | 9 | let package = Package( 10 | name: "testLib", 11 | products: [ 12 | // Products define the executables and libraries produced by a package, and make them visible to other packages. 13 | .library( 14 | name: "testLib", 15 | targets: ["testLib"]), 16 | .library( 17 | name: "testHigherLib", 18 | targets: ["testHigherLib"]), 19 | ], 20 | dependencies: [ 21 | // Dependencies declare other packages that this package depends on. 22 | // .package(url: /* package url */, from: "1.0.0"), 23 | ], 24 | targets: [ 25 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 26 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 27 | .target( 28 | name: "testLib", 29 | dependencies: []), 30 | .target( 31 | name: "testHigherLib", 32 | dependencies: ["testLib"]), 33 | 34 | ] 35 | ) 36 | -------------------------------------------------------------------------------- /msbuild/tests/swift/Sources/testHigherLib/testHigherLib.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | import testLib 5 | 6 | public func SayHello (sayer: Sayer) -> String { 7 | return sayer.talk() 8 | } 9 | -------------------------------------------------------------------------------- /msbuild/tests/swift/Sources/testLib/testLib.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public class Sayer { 5 | 6 | public init () { } 7 | 8 | public func talk () -> String { 9 | return "hello" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /msbuild/tests/swift/testLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /msbuild/tests/swift/testLib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /msbuild/tests/swift/testLib.xcodeproj/testHigherLib_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /msbuild/tests/swift/testLib.xcodeproj/testLib_Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CFBundleDevelopmentRegion 5 | en 6 | CFBundleExecutable 7 | $(EXECUTABLE_NAME) 8 | CFBundleIdentifier 9 | $(PRODUCT_BUNDLE_IDENTIFIER) 10 | CFBundleInfoDictionaryVersion 11 | 6.0 12 | CFBundleName 13 | $(PRODUCT_NAME) 14 | CFBundlePackageType 15 | FMWK 16 | CFBundleShortVersionString 17 | 1.0 18 | CFBundleSignature 19 | ???? 20 | CFBundleVersion 21 | $(CURRENT_PROJECT_VERSION) 22 | NSPrincipalClass 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /msbuild/tests/swift/testLib.xcodeproj/xcshareddata/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SchemeUserState 5 | 6 | testLib-Package.xcscheme 7 | 8 | 9 | SuppressBuildableAutocreation 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /plist-swifty/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | 7 | // Information about this assembly is defined by the following attributes. 8 | // Change them to the values specific to your project. 9 | 10 | [assembly: AssemblyTitle("plist-swifty")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("")] 15 | [assembly: AssemblyCopyright("${AuthorCopyright}")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 20 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 21 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 22 | 23 | [assembly: AssemblyVersion("1.0.0")] 24 | 25 | // The following attributes are used to specify the signing key for the assembly, 26 | // if desired. See the Mono documentation for more information about signing. 27 | 28 | //[assembly: AssemblyDelaySign(false)] 29 | //[assembly: AssemblyKeyFile("")] 30 | -------------------------------------------------------------------------------- /samples/euler/BuildUniversal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Builds the simulator version 4 | xcodebuild -quiet -project EulerPhone/EulerPhone.xcodeproj -configuration Debug -target EulerPhone -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO clean build 5 | 6 | # Builds the iphone version 7 | xcodebuild -quiet -project EulerPhone/EulerPhone.xcodeproj -configuration Debug -target EulerPhone -sdk iphoneos ONLY_ACTIVE_ARCH=NO build 8 | 9 | UNIVERSAL=EulerPhone/build/Debug-universal 10 | rm -rf $UNIVERSAL 11 | mkdir -p $UNIVERSAL 12 | 13 | # Use iphone build as an output template 14 | cp -R $UNIVERSAL/../Debug-iphoneos/EulerPhone.framework $UNIVERSAL 15 | 16 | # Merge the binaries 17 | lipo -create -output $UNIVERSAL/EulerPhone.framework/EulerPhone $UNIVERSAL/../Debug-iphonesimulator/EulerPhone.framework/EulerPhone $UNIVERSAL/../Debug-iphoneos/EulerPhone.framework/EulerPhone 18 | 19 | # Copy the simulator .swiftmodule files to the output 20 | cp $UNIVERSAL/../Debug-iphonesimulator/EulerPhone.framework/Modules/EulerPhone.swiftmodule/* $UNIVERSAL/EulerPhone.framework/Modules/EulerPhone.swiftmodule 21 | 22 | # stage the output framework for running Binding Tools for Swift 23 | cp -r $UNIVERSAL/EulerPhone.framework . 24 | -------------------------------------------------------------------------------- /samples/euler/EulerPhone/EulerPhone.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /samples/euler/EulerPhone/EulerPhone.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/euler/EulerPhone/EulerPhone/EulerPhone.h: -------------------------------------------------------------------------------- 1 | // 2 | // EulerPhone.h 3 | // EulerPhone 4 | // 5 | // Created by Steve Hawley on 6/22/18. 6 | // Copyright (c) Microsoft Corporation. 7 | // Licensed under the MIT License. 8 | // 9 | 10 | //#import 11 | #import 12 | 13 | //! Project version number for EulerPhone. 14 | //FOUNDATION_EXPORT double EulerPhoneVersionNumber; 15 | 16 | //! Project version string for EulerPhone. 17 | //FOUNDATION_EXPORT const unsigned char EulerPhoneVersionString[]; 18 | 19 | // In this header, you should import all the public headers of your framework using statements like #import 20 | 21 | 22 | -------------------------------------------------------------------------------- /samples/euler/EulerPhone/EulerPhone/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/euler/EulerPhoneApp/EulerPhoneApp/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /samples/euler/EulerPhoneApp/EulerPhoneApp/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/euler/EulerPhoneApp/EulerPhoneApp/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using UIKit; 5 | 6 | namespace EulerPhoneApp 7 | { 8 | public class Application 9 | { 10 | // This is the main entry point of the application. 11 | static void Main(string[] args) 12 | { 13 | // if you want to use a different Application Delegate class from "AppDelegate" 14 | // you can specify it here. 15 | UIApplication.Main(args, null, "AppDelegate"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/euler/Makefile: -------------------------------------------------------------------------------- 1 | SWIFT_BIN = /usr/bin 2 | SWIFT_LIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0 3 | 4 | SWIFTC = $(SWIFT_BIN)/swiftc 5 | 6 | BINDINGTOOLSFORSWIFT = mono ../../tom-swifty/bin/Debug/tom-swifty.exe 7 | 8 | BINDINGTOOLSFORSWIFTOUTPUT=tsout 9 | 10 | all: 11 | ./BuildUniversal.sh 12 | install_name_tool -add_rpath @executable_path EulerPhone.framework/EulerPhone 13 | @rm -rf $(BINDINGTOOLSFORSWIFTOUTPUT) 14 | @mkdir $(BINDINGTOOLSFORSWIFTOUTPUT) 15 | $(BINDINGTOOLSFORSWIFT) --swift-bin-path $(SWIFT_BIN) --swift-lib-path $(SWIFT_LIB) --retain-swift-wrappers --type-database-path=../../bindings/ -o $(BINDINGTOOLSFORSWIFTOUTPUT) -C EulerPhone.framework -C ../../swiftglue/bin/Debug/iphone/FinalProduct/XamGlue.framework -module-name EulerPhone 16 | cd EulerPhoneApp/EulerPhoneApp && msbuild 17 | 18 | clean: 19 | cd EulerPhoneApp/EulerPhoneApp && msbuild /t:clean 20 | rm -rf tsout 21 | rm -rf EulerPhone.framework 22 | rm -rf EulerPhone/build 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /samples/foreach/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using Foreach; 6 | 7 | 8 | public class CSForeach { 9 | public static void Main(string[] Args) { 10 | Looper looper = new Looper(); 11 | looper.Foreach(x => Console.WriteLine($"Here's an element: {x}")); 12 | looper.Foreachi((i, x) => Console.WriteLine($"Element at {i} is {x}")); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/foreach/Makefile: -------------------------------------------------------------------------------- 1 | SWIFT_BIN = /usr/bin 2 | SWIFT_LIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift 3 | 4 | SWIFTC = $(SWIFT_BIN)/swiftc 5 | SWIFTARGS = -sdk `xcrun --show-sdk-path` -emit-module -emit-library -enable-library-evolution -emit-module-interface 6 | 7 | 8 | BINDINGTOOLSFORSWIFT=../../binding-tools-for-swift 9 | 10 | OUTPUT_MODULE=Foreach 11 | 12 | libForeach.dylib: *.swift *.cs 13 | @cp ../../lib/binding-tools-for-swift/SwiftRuntimeLibrary.dll . 14 | @cp ../../lib/SwiftInterop/mac/XamGlue.framework/XamGlue . 15 | $(SWIFTC) $(SWIFTARGS) -module-name $(OUTPUT_MODULE) *.swift 16 | $(BINDINGTOOLSFORSWIFT) --swift-bin-path $(SWIFT_BIN) --swift-lib-path $(SWIFT_LIB) --retain-swift-wrappers -o . -C . -module-name $(OUTPUT_MODULE) 17 | @xcrun install_name_tool -change "@rpath/XamGlue.framework/XamGlue" XamGlue libXamWrapping.dylib 18 | mcs -nowarn:CS0169 -lib:../lib -r:SwiftRuntimeLibrary -lib:. *.cs -out:$(OUTPUT_MODULE).exe 19 | 20 | runit: 21 | @LD_LIBRARY_PATH=.:$(SWIFT_GLUE):$(SWIFT_LIB)/macosx mono --arch=64 $(OUTPUT_MODULE).exe 22 | 23 | clean: 24 | @rm -f *.dylib *.swiftmodule *.swiftdoc *.dll *.exe XamGlue LooperForeach.cs 25 | @rm -rf XamWrappingSource x86_64 *.framework XmlReflection bindings 26 | -------------------------------------------------------------------------------- /samples/foreach/foreach.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public class Looper { 5 | private var arr:[Int] = [1, 1, 2, 3, 5, 8, 13, 21, 34, 45] 6 | public init() { } 7 | 8 | public func foreach(f:(Int)->()) { 9 | for i in arr { 10 | f(i) 11 | } 12 | } 13 | public func foreachi(f:(Int, Int)->()) { 14 | for (index, value) in arr.enumerated() { 15 | f(index, value) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/helloswift/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.IO; 6 | using HelloMod; 7 | 8 | namespace Tester { 9 | class MainClass { 10 | public static void Main(string[] args) { 11 | Hello.DoHello(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/helloswift/Makefile: -------------------------------------------------------------------------------- 1 | SWIFT_BIN = /usr/bin 2 | SWIFT_LIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift 3 | 4 | SWIFTC = $(SWIFT_BIN)/swiftc 5 | SWIFTARGS = -sdk `xcrun --show-sdk-path` -emit-module -emit-library -enable-library-evolution -emit-module-interface 6 | 7 | BINDINGTOOLSFORSWIFT=../../binding-tools-for-swift 8 | 9 | OUTPUT_MODULE=HelloMod 10 | 11 | libHello.dylib: *.swift *.cs 12 | @cp ../../lib/SwiftInterop/SwiftRuntimeLibrary.Mac.dll . 13 | @cp ../../lib/SwiftInterop/mac/XamGlue.framework/XamGlue . 14 | $(SWIFTC) $(SWIFTARGS) -module-name $(OUTPUT_MODULE) *.swift 15 | $(BINDINGTOOLSFORSWIFT) --swift-bin-path $(SWIFT_BIN) --swift-lib-path $(SWIFT_LIB) --retain-swift-wrappers -o . -C . -module-name $(OUTPUT_MODULE) 16 | @xcrun install_name_tool -change "@rpath/XamGlue.framework/XamGlue" XamGlue libXamWrapping.dylib 17 | mcs -nowarn:CS0169 -lib:../lib -r:SwiftRuntimeLibrary.Mac -lib:. *.cs -out:$(OUTPUT_MODULE).exe 18 | 19 | runit: 20 | @DYLD_LIBRARY_PATH=.:$(SWIFT_GLUE):$(SWIFT_LIB)/macosx mono --arch=64 $(OUTPUT_MODULE).exe 21 | 22 | clean: 23 | @rm -f *.dylib *.swiftmodule *.swiftdoc *.dll *.exe XamGlue HelloHelloMod.cs 24 | @rm -rf XamWrappingSource x86_64 XmlReflection 25 | -------------------------------------------------------------------------------- /samples/helloswift/hello.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public class Hello { 5 | public init() { } 6 | public static func doHello() { 7 | print("Hello, world."); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /samples/helloworld/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using HelloWorld; 6 | 7 | namespace Hello { 8 | class MainClass { 9 | public static void Main(string[] args) 10 | { 11 | TopLevelEntities.HelloWorld(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/helloworld/Makefile: -------------------------------------------------------------------------------- 1 | SWIFT_BIN = /usr/bin 2 | SWIFT_LIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift 3 | 4 | TOM_SWIFTY = ../../tom-swifty/bin/Debug/tom-swifty.exe 5 | SWIFT_GLUE = ../../swiftglue/bin/Debug/mac/FinalProduct/XamGlue.framework 6 | TOM_SWIFTY_LIB = ../../SwiftRuntimeLibrary.Mac/bin/Debug/ 7 | 8 | all: swift tomswifty csharp 9 | 10 | swift: 11 | $(MAKE) -C swiftsrc 12 | 13 | tomswifty: 14 | mono $(TOM_SWIFTY) --retain-swift-wrappers --swift-bin-path $(SWIFT_BIN) --swift-lib-path $(SWIFT_LIB) -o . -C swiftsrc -C $(SWIFT_GLUE) -module-name HelloWorld 15 | 16 | csharp: *.cs 17 | mcs -nowarn:CS0169 -lib:$(TOM_SWIFTY_LIB) -r:SwiftRuntimeLibrary.Mac -lib:swiftsrc *.cs -out:HelloWorld.exe 18 | clean: 19 | $(MAKE) -C swiftsrc clean 20 | rm -f TopLevelEntitiesHelloWorld.cs 21 | rm -f HelloWorld.exe 22 | rm -rf bindings 23 | 24 | runit: 25 | LD_LIBRARY_PATH=.:swiftsrc:$(TOM_SWIFTY_LIB):$(SWIFT_GLUE) \ 26 | mono HelloWorld.exe 27 | -------------------------------------------------------------------------------- /samples/helloworld/swiftsrc/Makefile: -------------------------------------------------------------------------------- 1 | SWIFT_BIN = /usr/bin 2 | SWIFT_LIB = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0 3 | 4 | SWIFTC = $(SWIFT_BIN)/swiftc 5 | SDK = `xcrun --show-sdk-path` 6 | OUTPUT_MODULE = HelloWorld 7 | 8 | all: libHelloWorld.dylib 9 | 10 | libHelloWorld.dylib: *.swift 11 | $(SWIFTC) -sdk $(SDK) -emit-module -emit-library -enable-library-evolution -emit-module-interface -module-name $(OUTPUT_MODULE) *.swift 12 | clean: 13 | rm -f HelloWorld.swiftdoc 14 | rm -f HelloWorld.swiftmodule 15 | rm -f libHelloWorld.dylib 16 | -------------------------------------------------------------------------------- /samples/helloworld/swiftsrc/hello.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public func helloWorld() 5 | { 6 | print("hello, world."); 7 | } 8 | -------------------------------------------------------------------------------- /samples/piglatin/.gitignore: -------------------------------------------------------------------------------- 1 | SwiftIgPay/build/ 2 | tsout/ 3 | -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xamarin/binding-tools-for-swift/2ab22a380ebc3c952aa032de8108cdcad69651b8/samples/piglatin/PigLatin/PigLatin/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/Main.cs: -------------------------------------------------------------------------------- 1 | using UIKit; 2 | 3 | namespace PigLatin 4 | { 5 | public class Application 6 | { 7 | // This is the main entry point of the application. 8 | static void Main(string[] args) 9 | { 10 | // if you want to use a different Application Delegate class from "AppDelegate" 11 | // you can specify it here. 12 | UIApplication.Main(args, null, "AppDelegate"); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /samples/piglatin/PigLatin/PigLatin/MainViewController.designer.cs: -------------------------------------------------------------------------------- 1 | // WARNING 2 | // 3 | // This file has been generated automatically by Visual Studio to store outlets and 4 | // actions made in the UI designer. If it is removed, they will be lost. 5 | // Manual changes to this file may not be handled correctly. 6 | // 7 | using Foundation; 8 | using System.CodeDom.Compiler; 9 | 10 | namespace PigLatin 11 | { 12 | [Register ("MainViewController")] 13 | partial class MainViewController 14 | { 15 | [Outlet] 16 | UIKit.UITextField InputText { get; set; } 17 | 18 | [Outlet] 19 | UIKit.UITextField OuputText { get; set; } 20 | 21 | [Outlet] 22 | UIKit.UIButton XlateButton { get; set; } 23 | 24 | void ReleaseDesignerOutlets () 25 | { 26 | if (XlateButton != null) { 27 | XlateButton.Dispose (); 28 | XlateButton = null; 29 | } 30 | 31 | if (InputText != null) { 32 | InputText.Dispose (); 33 | InputText = null; 34 | } 35 | 36 | if (OuputText != null) { 37 | OuputText.Dispose (); 38 | OuputText = null; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /samples/piglatin/SwiftPigLatinLibrary/SwiftPigLatinLibrary/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | 22 | 23 | -------------------------------------------------------------------------------- /samples/propertybag/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using Props; 6 | using SwiftRuntimeLibrary; 7 | 8 | namespace Tester { 9 | public class MainClass { 10 | public static void Main(string[] args) 11 | { 12 | PropertyBag props = new PropertyBag(); 13 | props.Add(SwiftString.FromString("healthy"), true); 14 | props.Add(SwiftString.FromString("wealthy"), true); 15 | props.Add(SwiftString.FromString("wise"), false); 16 | foreach (var pair in props.Contents()) { 17 | Console.WriteLine($"{pair.Item1} : {pair.Item2}"); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/propertybag/Makefile: -------------------------------------------------------------------------------- 1 | SWIFT_BIN = /usr/bin 2 | XCODE_DEV = /Applications/Xcode.app/Contents/Developer 3 | SWIFT_LIB = $(XCODE_DEV)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift 4 | 5 | SWIFTC = $(SWIFT_BIN)/swiftc 6 | SWIFTARGS = -sdk `xcrun --show-sdk-path` -emit-module -emit-library -enable-library-evolution -emit-module-interface 7 | 8 | 9 | BINDINGTOOLSFORSWIFT=../../binding-tools-for-swift 10 | 11 | OUTPUT_MODULE=Props 12 | 13 | libPropertyBag.dylib: *.swift 14 | @rm -rf XamWrappingSource armv7 armv7s arm64 x86_64 15 | @cp ../../lib/binding-tools-for-swift/SwiftRuntimeLibrary.dll . 16 | @mkdir -p XamGlue.framework 17 | @cp -r ../../lib/SwiftInterop/mac/XamGlue.framework . 18 | $(SWIFTC) $(SWIFTARGS) -module-name $(OUTPUT_MODULE) *.swift 19 | $(BINDINGTOOLSFORSWIFT) --retain-swift-wrappers --swift-bin-path $(SWIFT_BIN) --swift-lib-path $(SWIFT_LIB) -o . -C . -module-name $(OUTPUT_MODULE) 20 | mcs -nowarn:CS0169 -lib:../lib -r:SwiftRuntimeLibrary -lib:. *.cs -unsafe+ -out:$(OUTPUT_MODULE).exe 21 | 22 | runit: 23 | @DYLD_LIBRARY_PATH=/usr/lib/swift:./XamGlue.framework:. mono --arch=64 $(OUTPUT_MODULE).exe 24 | 25 | clean: 26 | @rm -f *.dylib *.swiftmodule *.swiftdoc *.swiftinterface *.swiftsourceinfo *.dll *.exe XamGlue PropertyBagProps.cs 27 | @rm -rf XamWrappingSource armv7 armv7s arm64 x86_64 bindings XamGlue.framework 28 | -------------------------------------------------------------------------------- /samples/propertybag/propertybag.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | 5 | public class PropertyBag { 6 | private var bag: [String : T] 7 | 8 | public init() { 9 | bag = [String : T]() 10 | } 11 | 12 | public func add(key:String, val: T) { 13 | bag[key] = val 14 | } 15 | 16 | public func contains(key:String) -> Bool { 17 | return bag[key] != nil 18 | } 19 | 20 | public func contents() -> [(String, T)] { 21 | return Array(bag.lazy) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/sampler/Sampler.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public final class AFinalClass { 5 | public static func aStaticMethod() -> Double { return 3.14 } 6 | public static var aStaticProp: Bool = true 7 | 8 | private var _x: Float 9 | 10 | public init(x:Float) { 11 | _x = x; 12 | } 13 | 14 | public var xGetOnly:Float { 15 | get { return _x } 16 | } 17 | 18 | private static var _names:[String] = [ "one", "two", "three" ] 19 | 20 | public subscript(i:Int) -> String { return AFinalClass._names[i]; } 21 | 22 | 23 | public struct AStruct { 24 | 25 | private var _x:AFinalClass 26 | public init(x:AFinalClass) { 27 | _x = x 28 | } 29 | public func getClass() -> AFinalClass 30 | { 31 | return _x; 32 | } 33 | } 34 | } 35 | 36 | public enum Number { 37 | case Integer(Int) 38 | case Real(Double) 39 | } 40 | 41 | -------------------------------------------------------------------------------- /samples/sandwiches/SandwichesMain.cs: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.IO; 4 | using SwiftRuntimeLibrary; 5 | using SwiftRuntimeLibrary.SwiftMarshal; 6 | using System.Runtime.InteropServices; 7 | using Sandwiches; 8 | 9 | namespace SandwichesCSharp 10 | { 11 | 12 | public class WholeWheat : IBread { 13 | public SwiftString Name => (SwiftString)"whole wheat"; 14 | public bool Sliced => true; 15 | } 16 | 17 | public class SharpCheddar : IFilling { 18 | public SwiftString Stuff => (SwiftString)"sharp cheddar"; 19 | } 20 | 21 | public class SandwichesMain 22 | { 23 | public static void Main(string[] args) 24 | { 25 | TopLevelEntities.PrintSandwich (new WholeWheat (), new SharpCheddar ()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/sandwiches/sandwiches.swift: -------------------------------------------------------------------------------- 1 | 2 | public protocol Filling { 3 | var stuff: String { get } 4 | } 5 | 6 | public protocol Bread { 7 | var name: String { get } 8 | var sliced: Bool { get } 9 | } 10 | 11 | public struct Rye : Bread { 12 | public init () { } 13 | public var name:String { 14 | get { return "rye" } 15 | } 16 | public var sliced:Bool { 17 | get { return true } 18 | } 19 | } 20 | 21 | public struct Ham : Filling { 22 | public init () { } 23 | public var stuff: String { 24 | get { return "ham" } 25 | } 26 | } 27 | 28 | public func printSandwich (of: Bread, with: Filling) { 29 | print ("\(with.stuff) on \(of.name)") 30 | } 31 | -------------------------------------------------------------------------------- /swift-copy-libs/swift-copy-libs: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | exec mono --debug "$(dirname "${BASH_SOURCE[0]}")"/bin/Debug/swift-copy-libs.exe "$@" 4 | -------------------------------------------------------------------------------- /swift-copy-libs/swift-copy-libs-packaged: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | exec mono --debug "$(dirname "${BASH_SOURCE[0]}")"/../lib/swift-copy-libs/swift-copy-libs.exe "$@" 4 | -------------------------------------------------------------------------------- /swift-copy-libs/swift-copy-libs.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net7.0 4 | x86 5 | Exe 6 | swiftcopylibs 7 | false 8 | x86;AnyCPU 9 | true 10 | 11 | 12 | 13 | MachOHawley.cs 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /swiftglue/.gitignore: -------------------------------------------------------------------------------- 1 | bindingmetadata.*.swift 2 | -------------------------------------------------------------------------------- /swiftglue/anyhelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public func toAny (result: UnsafeMutablePointer, val: T) { 5 | result.initialize(to: val) 6 | } 7 | 8 | public func fromAny (result: UnsafeMutablePointer, any:Any) { 9 | result.initialize(to: any as! T) 10 | } 11 | -------------------------------------------------------------------------------- /swiftglue/arrayhelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public func arrayNew(capacity: Int) -> [T] { 5 | var a = [T]() 6 | a.reserveCapacity(capacity) 7 | return a 8 | } 9 | 10 | public func arrayCount(a:UnsafeMutablePointer<[T]>) -> Int { 11 | return a.pointee.count 12 | } 13 | 14 | public func arrayGet(retval: UnsafeMutablePointer, a:UnsafeMutablePointer<[T]>, index: Int) { 15 | retval.initialize(to: a.pointee[index]) 16 | } 17 | 18 | public func arraySet(a:UnsafeMutablePointer<[T]>, value: T, index: Int) { 19 | a.pointee[index] = value 20 | } 21 | 22 | public func arrayInsert(a:UnsafeMutablePointer<[T]>, value: T, index: Int) { 23 | a.pointee.insert(value, at: index) 24 | } 25 | 26 | public func arrayClear(a:UnsafeMutablePointer<[T]>) { 27 | a.pointee.removeAll(keepingCapacity: true) 28 | } 29 | 30 | public func arrayRemoveAt(a:UnsafeMutablePointer<[T]>, index: Int) { 31 | a.pointee.remove(at: index) 32 | } 33 | 34 | public func arrayAdd(a:UnsafeMutablePointer<[T]>, thing: T) { 35 | a.pointee.append(thing) 36 | } 37 | 38 | public func arrayCapacity (a:UnsafeMutablePointer<[T]>) -> Int { 39 | return a.pointee.capacity 40 | } 41 | 42 | public func arrayReserveCapacity (a:UnsafeMutablePointer<[T]>, capacity: Int) { 43 | a.pointee.reserveCapacity(capacity) 44 | } 45 | -------------------------------------------------------------------------------- /swiftglue/comparablehelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | internal struct Comparable_xam_vtable 5 | { 6 | internal var func0: (@convention(c)(_: UnsafeRawPointer, _: UnsafeRawPointer) -> Bool)?; 7 | internal var func1: (@convention(c)(_: UnsafeRawPointer, _: UnsafeRawPointer) -> Bool)?; 8 | } 9 | 10 | private var _vtable: Comparable_xam_vtable = Comparable_xam_vtable() 11 | 12 | public func setComparable_xam_vtable(uvt: UnsafeRawPointer) 13 | { 14 | let vt: UnsafePointer = fromIntPtr(ptr: uvt); 15 | _vtable = vt.pointee 16 | } 17 | 18 | 19 | extension EveryProtocol : Comparable 20 | { 21 | public static func < (lhs:EveryProtocol, rhs:EveryProtocol) -> Bool 22 | { 23 | return _vtable.func1!(toIntPtr(value: lhs), toIntPtr(value: rhs)); 24 | } 25 | } 26 | 27 | public func xam_proxy_ComparableOInEqualsEquals(lhs: EveryProtocol, 28 | rhs: EveryProtocol) -> Bool 29 | { 30 | return lhs == rhs 31 | } 32 | 33 | public func xam_proxy_ComparableOInLess(lhs: EveryProtocol, 34 | rhs: EveryProtocol) -> Bool 35 | { 36 | return lhs < rhs 37 | } 38 | 39 | -------------------------------------------------------------------------------- /swiftglue/equatablehelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | private struct Equatable_xam_vtable 5 | { 6 | internal var func0: (@convention(c)(_: UnsafeRawPointer, _: UnsafeRawPointer) -> Bool)? 7 | } 8 | 9 | private var _vtable: Equatable_xam_vtable = Equatable_xam_vtable() 10 | 11 | public func setEquatable_xam_vtable(uvt: UnsafeRawPointer) 12 | { 13 | let vt: UnsafePointer = fromIntPtr(ptr: uvt) 14 | _vtable = vt.pointee 15 | } 16 | 17 | extension EveryProtocol : Equatable 18 | { 19 | public static func ==(lhs:EveryProtocol, rhs:EveryProtocol) -> Bool 20 | { 21 | return _vtable.func0!(toIntPtr(value: lhs), toIntPtr(value: rhs)) 22 | } 23 | } 24 | 25 | public func xam_proxy_EquatableOInEqualsEquals (lhs: EveryProtocol, rhs: EveryProtocol) -> Bool 26 | { 27 | return lhs == rhs 28 | } 29 | 30 | -------------------------------------------------------------------------------- /swiftglue/everyprotocol.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public final class EveryProtocol 5 | { 6 | public init () { } 7 | } 8 | 9 | public func makeEveryProtocol () -> EveryProtocol 10 | { 11 | return EveryProtocol () 12 | } 13 | -------------------------------------------------------------------------------- /swiftglue/hasherhelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public func hasherNew(retval: UnsafeMutablePointer) 5 | { 6 | retval.initialize(to: Hasher()); 7 | } 8 | 9 | public func hasherCombine(this: UnsafeMutablePointer, thing: T0) where T0 : Hashable 10 | { 11 | this.pointee.combine(thing); 12 | } 13 | 14 | public func hasherCombine(this: UnsafeMutablePointer, bytes: UnsafePointer) 15 | { 16 | this.pointee.combine(bytes: bytes.pointee); 17 | } 18 | 19 | public func hasherFinalize(this: UnsafeMutablePointer) -> Int 20 | { 21 | return this.pointee.finalize(); 22 | } 23 | -------------------------------------------------------------------------------- /swiftglue/module.map: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | module RegisterAccess [system] { 4 | header "registeraccess.h" 5 | export * 6 | } 7 | -------------------------------------------------------------------------------- /swiftglue/optionalhelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public func optionalNewNone(retval: UnsafeMutablePointer) 5 | { 6 | retval.pointee = nil 7 | } 8 | 9 | public func optionalNewSome(retval: UnsafeMutablePointer, val: UnsafePointer) 10 | { 11 | retval.pointee = val.pointee 12 | } 13 | 14 | public func optionalHasValue(val: UnsafeMutablePointer) -> Bool 15 | { 16 | return val.pointee != nil 17 | } 18 | 19 | public func optionalCase(val: UnsafeMutablePointer) -> Int 20 | { 21 | return val.pointee == nil ? 0 : 1 22 | } 23 | 24 | public func optionalValue(optval: UnsafeMutablePointer, val: UnsafeMutablePointer) 25 | { 26 | if optval.pointee != nil { 27 | val.pointee = optval.pointee! 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /swiftglue/registeraccess.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | // These are accessors for each supported CPU to get the register arguments. 5 | // These are used because swift puts implicit arguments in registers including 6 | // type metadata and protocol witness tables. 7 | 8 | // supported CPUs: 9 | // __x86_64 10 | // __arm64 11 | // __arm 12 | // i386 13 | // we could probably further distinguish armv7, armv7k, and armv7s, but 14 | // I don't imagine that we'll need the extensions since all we're doing is 15 | // register juggling 16 | 17 | // Yes, the signature here doesn't match the declaration in registeraccess.h 18 | // This is a feature, not a bug. 19 | void *swiftAsmArg0 (void *arg0) 20 | { 21 | return arg0; 22 | } 23 | 24 | void *swiftAsmArg1 (void *arg0, void *arg1) 25 | { 26 | return arg1; 27 | } 28 | 29 | void *swiftAsmArg2 (void *arg0, void *arg1, void *arg2) 30 | { 31 | return arg2; 32 | } 33 | 34 | void *swiftAsmArg3 (void *arg0, void *arg1, void *arg2, void *arg3) 35 | { 36 | return arg3; 37 | } 38 | 39 | #if __x86_64 || __arm64 40 | void swiftSelfArg () 41 | { 42 | #if __x86_64 43 | __asm("mov %r13, %rax"); 44 | #elif __arm64 45 | __asm("mov x0, x20"); 46 | #endif 47 | } 48 | #else 49 | void *swiftSelfArg(void *self) 50 | { 51 | return self; 52 | } 53 | #endif 54 | -------------------------------------------------------------------------------- /swiftglue/registeraccess.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | // 5 | // registeraccess.h 6 | // 7 | 8 | #ifndef CGLUE_EXPORT 9 | #if defined(__cplusplus) 10 | #define CGLUE_EXPORT extern "C" 11 | #else 12 | #define CGLUE_EXPORT extern 13 | #endif 14 | #endif 15 | 16 | CGLUE_EXPORT const void * swiftAsmArg0 (); 17 | CGLUE_EXPORT const void * swiftAsmArg1 (); 18 | CGLUE_EXPORT const void * swiftAsmArg2 (); 19 | CGLUE_EXPORT const void * swiftAsmArg3 (); 20 | CGLUE_EXPORT const void * swiftAsmArg4 (); 21 | CGLUE_EXPORT const void * swiftAsmArg5 (); 22 | CGLUE_EXPORT const void * swiftSelfArg (); 23 | //#import 24 | 25 | -------------------------------------------------------------------------------- /swiftglue/sethelpers.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | import Swift; 5 | 6 | public func newSet(retval: UnsafeMutablePointer>, capacity: Int) 7 | { 8 | if capacity <= 0 { 9 | retval.initialize(to: Set()) 10 | } 11 | else { 12 | retval.initialize(to: Set(minimumCapacity: capacity)) 13 | } 14 | } 15 | 16 | public func setIsEmpty(s: UnsafeMutablePointer>) -> Bool 17 | { 18 | return s.pointee.isEmpty 19 | } 20 | 21 | public func setGetCount(s: UnsafeMutablePointer>) -> Int 22 | { 23 | return s.pointee.count 24 | } 25 | 26 | public func setGetCapacity(s: UnsafeMutablePointer>) -> Int 27 | { 28 | return s.pointee.capacity 29 | } 30 | 31 | public func setContains(s: UnsafeMutablePointer>, e: UnsafePointer) -> Bool 32 | { 33 | return s.pointee.contains(e.pointee) 34 | } 35 | 36 | public func setInsert(retval: UnsafeMutablePointer<(Bool, T)>, s: UnsafeMutablePointer>, e: UnsafePointer) 37 | { 38 | retval.initialize(to: s.pointee.insert(e.pointee)) 39 | } 40 | 41 | public func setRemove(retval: UnsafeMutablePointer, s: UnsafeMutablePointer>, e: UnsafePointer) 42 | { 43 | retval.initialize(to: s.pointee.remove(e.pointee)) 44 | } 45 | -------------------------------------------------------------------------------- /swiftglue/stringconvertible.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | import Swift 5 | 6 | internal struct CustomStringConvertible_xam_vtable { 7 | internal var func0: (@convention(c)(_: UnsafeRawPointer, _: UnsafeRawPointer) -> ())?; 8 | } 9 | 10 | private var _vtable: CustomStringConvertible_xam_vtable = CustomStringConvertible_xam_vtable(); 11 | 12 | public func setConvertible_xam_vtable(uvt: UnsafeRawPointer) 13 | { 14 | let vt: UnsafePointer = fromIntPtr(ptr: uvt); 15 | _vtable = vt.pointee 16 | } 17 | 18 | extension EveryProtocol : CustomStringConvertible 19 | { 20 | public var description : String { 21 | get { 22 | let retval = UnsafeMutablePointer.allocate(capacity: 1) 23 | _vtable.func0!(retval, toIntPtr(value: self)) 24 | let actualRetval = retval.move() 25 | retval.deallocate () 26 | return actualRetval 27 | } 28 | } 29 | } 30 | 31 | public func xamarin_NoneDConvertibleGdescription(retval: UnsafeMutablePointer, this: inout CustomStringConvertible) 32 | { 33 | retval.initialize(to: this.description); 34 | } 35 | -------------------------------------------------------------------------------- /swiftglue/swiftenumerror.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | import Swift 5 | 6 | public enum SwiftEnumError : Error { case undefined } 7 | 8 | public struct DotNetError : Error, CustomStringConvertible { 9 | private var _message : String 10 | public init(message : String, className: String) { 11 | _message = message 12 | self.className = className 13 | } 14 | 15 | public private(set) var className : String 16 | 17 | public var description: String { 18 | get { 19 | return _message; 20 | } 21 | } 22 | } 23 | 24 | public func makeDotNetError(message: UnsafePointer, className: UnsafePointer) -> Error { 25 | return DotNetError(message:message.pointee, className: className.pointee) 26 | } 27 | 28 | public func getErrorDescription(message: UnsafeMutablePointer, error: Error) 29 | { 30 | message.initialize(to: String(describing:error)) 31 | } 32 | 33 | public func errorMetadata () -> Any.Type 34 | { 35 | return Error.self 36 | } 37 | -------------------------------------------------------------------------------- /swiftglue/trivialswiftobject.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | open class XamTrivialSwiftObject { } 5 | -------------------------------------------------------------------------------- /swiftglue/typecachekey.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | public struct TypeCacheKey : Hashable { 5 | internal var _types : [ObjectIdentifier] 6 | public init(types: ObjectIdentifier...) { 7 | _types = types; 8 | } 9 | 10 | public func hash(into hasher:inout Hasher) { 11 | hasher.combine(_types.reduce(0, { $0 &+ $1.hashValue })) 12 | } 13 | } 14 | public func ==(lhs: TypeCacheKey, rhs: TypeCacheKey) -> Bool { 15 | return lhs._types == rhs._types 16 | } 17 | -------------------------------------------------------------------------------- /swiftinterfaceparser/.gitignore: -------------------------------------------------------------------------------- 1 | antlr 2 | JavaParser 3 | CSParser 4 | -------------------------------------------------------------------------------- /tests/3rd-party/.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | *.stamp 4 | repository 5 | build.log 6 | run.log 7 | 8 | -------------------------------------------------------------------------------- /tests/3rd-party/AEXML/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/tadija/AEXML 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=8623e73b193386909566a9ca20203e33a09af142 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME="'AEXML iOS'" 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | FRAMEWORKNAME=AEXML 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/Charts/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Won't build with Xcode 10.2.1 (because Beta) 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Charts/failed-build.log: -------------------------------------------------------------------------------- 1 | Building Charts 2 | Checking out cd1120b004cc6aac40d889fa665c0e495e463b13 for https://github.com/danielgindi/Charts... 3 | HEAD is now at cd1120b0 correct 3.3 to 3.3.0. 4 | Updating submodules for https://github.com/danielgindi/Charts... 5 | Successfully checked out cd1120b004cc6aac40d889fa665c0e495e463b13 for https://github.com/danielgindi/Charts in ./repository. 6 | test -f /usr/local/bin/carthage || brew install carthage || true 7 | cd repository && carthage bootstrap --platform iOS 8 | *** Checking out ios-snapshot-test-case at "6.0.3" 9 | *** Cloning ios-snapshot-test-case 10 | *** xcodebuild output can be found in /var/folders/v6/6vv3v8hd0ld4lp3f4h0gf0wh0000gn/T/carthage-xcodebuild.9CzBAM.log 11 | *** Downloading ios-snapshot-test-case.framework binary at "6.0.3" 12 | *** Skipped installing ios-snapshot-test-case.framework binary due to the error: 13 | "Incompatible Swift version - framework was built with 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3) and the local version is 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)." 14 | 15 | Falling back to building from the source 16 | *** Building scheme "FBSnapshotTestCase iOS" in FBSnapshotTestCase.xcworkspace 17 | cd repository && bundle install 18 | /bin/sh: bundle: command not found 19 | make[1]: *** [prebuild.stamp] Error 127 20 | make: *** [build] Error 2 -------------------------------------------------------------------------------- /tests/3rd-party/ComplimentaryGradientView/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error in wrapping for the type "CGPoints?" 3 | CGPoints is (I think) a typealias for (CGPoint, CGPoint). We try to use the 4 | desugared type name and the swift compiler complains. 5 | https://github.com/xamarin/maccore/issues/1862 6 | -------------------------------------------------------------------------------- /tests/3rd-party/DateTimePicker/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error with AnyObject being treated as a class instead of a Protocol. 3 | This should get fixed as part of https://github.com/xamarin/maccore/issues/1103 4 | -------------------------------------------------------------------------------- /tests/3rd-party/Dollar/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/ankurp/Dollar 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=26b7a50b316961479ac9cbb94db5b4176188e8a8 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | # XCODESCHEME=scheme 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/DynamicColor/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error handling AnyObject requirement in extension wrapping. 3 | https://github.com/xamarin/maccore/issues/1691 4 | -------------------------------------------------------------------------------- /tests/3rd-party/Euler-Modified/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/stephen-hawley/Euler 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=41786b1b45b62986d9b727543a7439017488c7ba 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | # XCODESCHEME=scheme 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | #IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/Euler-Modified/failed-build.log: -------------------------------------------------------------------------------- 1 | ../Makefile.inc:17: This test (Euler) will build/run, but the result is ignored because it's a known failure 2 | Building Euler 3 | Cloning https://github.com/stephen-hawley/Euler into ./repository... 4 | Checking out 41786b1b45b62986d9b727543a7439017488c7ba for https://github.com/stephen-hawley/Euler... 5 | HEAD is now at 41786b1 Organizing for framework. 6 | Updating submodules for https://github.com/stephen-hawley/Euler... 7 | Successfully checked out 41786b1b45b62986d9b727543a7439017488c7ba for https://github.com/stephen-hawley/Euler in ./repository. 8 | [XCODEBUILD/iphoneos] Euler 9 | [XCODEBUILD/iphonesimulator] Euler 10 | [GEN] Euler.framework 11 | [SWIFT-O-MATIC] Euler 12 | 13 | 3 warnings and 2 errors 14 | 15 | warning SM4018: entry __T05Euler003BxaSdfau uses an unsupported swift feature, skipping. 16 | warning SM4018: entry __T05Euler004BABhSdfau uses an unsupported swift feature, skipping. 17 | warning SM4018: entry __T05Euler004qnChSdfau uses an unsupported swift feature, skipping. 18 | error SM0554: Object reference not set to an instance of an object 19 | error SM2000: Failed to wrap module Euler. 20 | make[3]: *** [run-swift-o-matic] Error 1 21 | make[2]: [build] Error 2 (ignored) 22 | -------------------------------------------------------------------------------- /tests/3rd-party/Euler/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Unable to handle inout closures. https://github.com/xamarin/maccore/issues/1870 3 | Can't get generic depth from a tuple type spec. 4 | https://github.com/xamarin/maccore/issues/1871 5 | -------------------------------------------------------------------------------- /tests/3rd-party/Eureka/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-08 2 | Error in TypeSpec parser handling compound constraints. 3 | https://github.com/xamarin/maccore/issues/1711 4 | -------------------------------------------------------------------------------- /tests/3rd-party/FaceAware/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Unable to find type Attachable https://github.com/xamarin/maccore/issues/1712 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Hue/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/hyperoslo/Hue 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=49c81b73b0d6e98db0ce8cfff50ca9f19ee9e54c 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=Hue-iOS 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | FRAMEWORKNAME=Hue 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/Instructions/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Main project won't build - no iOS developer cert 3 | -------------------------------------------------------------------------------- /tests/3rd-party/JTAppleCalendar/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Problem with AnyObject 3 | https://github.com/xamarin/maccore/issues/1103 4 | -------------------------------------------------------------------------------- /tests/3rd-party/Macaw/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/exyte/Macaw 5 | NAME:=$(shell basename $(REPO)) 6 | # master requires Xcode 10, so grab a hash from the swift_4.0.x branch 7 | HASH=916240f118690cfdab278095c7f606358a6a000e 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=Macaw iOS 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | FRAMEWORKNAME=Macaw 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | IGNORED=1 23 | # Changing IGNORED? Consider updating the README.txt file and any Git issues 24 | # referenced therein. 25 | 26 | # These variables must be set before including Makefile.inc 27 | # 28 | 29 | include ../Makefile.inc 30 | 31 | # Standard targets: build, run 32 | # If the project does not need customization, we can forward to the default implementation of these targets. 33 | build-local: default-build 34 | run-local: default-run 35 | -------------------------------------------------------------------------------- /tests/3rd-party/Macaw/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Problem with Self, associated types 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | ALL_TESTS:=$(shell ls -1 */Makefile | sed 's_/.*__') 4 | IGNORED_TESTS:=$(shell grep -l ^IGNORED=1$$ */Makefile | sed 's_/.*__') 5 | WORKING_TESTS=$(shell grep -L ^IGNORED=1$$ */Makefile | sed 's_/.*__') 6 | 7 | BUILD_LOG_NAME?=build.log 8 | RUN_LOG_NAME?=run.log 9 | 10 | # Main targets: 11 | all: 12 | @$(MAKE) -j8 build 13 | @$(MAKE) -j8 run 14 | 15 | build: $(foreach test,$(WORKING_TESTS),build-test-$(test)) 16 | build-all: $(foreach test,$(ALL_TESTS),build-test-$(test)) 17 | run: $(foreach test,$(WORKING_TESTS),run-test-$(test)) 18 | 19 | # Helper targets 20 | 21 | build-test-%: 22 | @echo "Building $*..." 23 | @if ! $(MAKE) -C $* > $*/$(BUILD_LOG_NAME) 2>&1; then echo "Failed to build $*:"; sed 's/^/ /' $*/$(BUILD_LOG_NAME); exit 1; fi 24 | @echo "Built $*" 25 | 26 | run-test-%: 27 | @echo "Running $*..." 28 | @if ! $(MAKE) -C $* > $*/$(RUN_LOG_NAME) 2>&1; then echo "Failed to run $*:"; sed 's/^/ /' $*/$(RUN_LOG_NAME); exit 1; fi 29 | @echo "Built $*" 30 | 31 | update-logs: 32 | git clean -xxffddq 33 | $(MAKE) build-all -j8 BUILD_LOG_NAME=failed-build.log 34 | 35 | list-tests: 36 | @echo "All tests: $(ALL_TESTS)" 37 | @echo "Ignored tests: $(IGNORED_TESTS)" 38 | @echo "Working tests: $(WORKING_TESTS)" 39 | -------------------------------------------------------------------------------- /tests/3rd-party/Makefile.template: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=%REPO% 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=%HASH% 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | # XCODESCHEME=scheme 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/Material/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Issue with AnyObject https://github.com/xamarin/maccore/issues/1103 3 | Issue with Self associated type 4 | Issue with CoreAnimation 5 | -------------------------------------------------------------------------------- /tests/3rd-party/NMessenger/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Won't build with Beta Xcode 3 | -------------------------------------------------------------------------------- /tests/3rd-party/NMessenger/failed-build.log: -------------------------------------------------------------------------------- 1 | ../Makefile.inc:17: This test (NMessenger) will build/run, but the result is ignored because it's a known failure 2 | Building NMessenger 3 | test -f /usr/local/bin/carthage || brew install carthage || true 4 | cd repository && carthage bootstrap --platform iOS 5 | Successfully checked out a6e9547554fbf9b66c3f67eff6c550bee0529ea1 for https://github.com/eBay/NMessenger in ./repository. 6 | *** No Cartfile.resolved found, updating dependencies 7 | *** Fetching PINCache 8 | No available version for github "pinterest/PINCache" satisfies the requirement: >= 3.0.0 9 | make[2]: *** [prebuild.stamp] Error 1 10 | make[1]: [build] Error 2 (ignored) 11 | -------------------------------------------------------------------------------- /tests/3rd-party/Neon/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error with AnyObject protocl https://github.com/xamarin/maccore/issues/1103 3 | Error with CoreAnimation 4 | -------------------------------------------------------------------------------- /tests/3rd-party/Persei/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Errors in the wrappers; redundant declarations. https://github.com/xamarin/maccore/issues/1863 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Popover/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error in putting closures in pointer types and leaving the @escaping attribute 3 | https://github.com/xamarin/maccore/issues/927 4 | -------------------------------------------------------------------------------- /tests/3rd-party/Presentation/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Won't build in Beta Xcode 10.2.1 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Presentr/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error with Values vs NSValue https://github.com/xamarin/maccore/issues/1864 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Preview-Transition/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/Ramotion/Preview-Transition 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=74f93c36d54067dd44f6f419fea855945ace05b0 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | XCODEPROJECT=repository/PreviewTransitionDemo/PreviewTransitionDemo.xcodeproj 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=PreviewTransition 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/PullToRefresh/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/Yalantis/PullToRefresh 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=d97789079d570cc2a853040885a00c734c200700 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | XCODEPROJECT=./repository/PullToRefreshDemo.xcodeproj 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | # XCODESCHEME=scheme 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | #IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/SCLAlertView-Swift/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | NRE during wrapping 3 | https://github.com/xamarin/maccore/issues/1865 4 | 2019-07-11 5 | Wraps with three warnings: 6 | warning SM2015: Error while wrapping an open class SCLAlertView.SCLAlertView, skipping. 7 | warning SM1524: Unable to find constructor for struct SCLAlertView.SCLAlertView.SCLAppearance..ctor, skipping. 8 | warning SM1025: Skipping C# wrapping class SCLAlertView.SCLAlertView, due to a previous error. 9 | -------------------------------------------------------------------------------- /tests/3rd-party/SCLAlertView-Swift/failed-build.log: -------------------------------------------------------------------------------- 1 | ../Makefile.inc:17: This test (SCLAlertView-Swift) will build/run, but the result is ignored because it's a known failure 2 | Building SCLAlertView-Swift 3 | Cloning https://github.com/vikmeup/SCLAlertView-Swift into ./repository... 4 | Checking out 17f7c90dfc9c7f15564e84621d48441d403323ee for https://github.com/vikmeup/SCLAlertView-Swift... 5 | HEAD is now at 17f7c90 Release 0.8.1 6 | Updating submodules for https://github.com/vikmeup/SCLAlertView-Swift... 7 | Successfully checked out 17f7c90dfc9c7f15564e84621d48441d403323ee for https://github.com/vikmeup/SCLAlertView-Swift in ./repository. 8 | [XCODEBUILD/iphoneos] SCLAlertView-Swift 9 | [XCODEBUILD/iphonesimulator] SCLAlertView-Swift 10 | === BUILD TARGET SCLAlertViewTests OF PROJECT SCLAlertView WITH CONFIGURATION Debug === 11 | Code Signing Error: Signing for "SCLAlertViewTests" requires a development team. Select a development team in the project editor. 12 | Code Signing Error: Code signing is required for product type 'Unit Test Bundle' in SDK 'iOS 11.2' 13 | ** BUILD FAILED ** 14 | 15 | make[3]: *** [build-sdk-iphoneos.stamp] Error 65 16 | make[3]: *** Waiting for unfinished jobs.... 17 | make[2]: [build] Error 2 (ignored) 18 | -------------------------------------------------------------------------------- /tests/3rd-party/Scrollable-GraphView/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error building - signing error 3 | -------------------------------------------------------------------------------- /tests/3rd-party/Spring/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/MengTo/Spring 5 | NAME:=$(shell basename $(REPO)) 6 | # master requires Xcode 10, so grab a hash from the swift4 branch 7 | HASH=fafd0b2e8d4d46405bd86fa7ba84bb7f73a20b13 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | XCODEPROJECT=./repository/SpringApp.xcodeproj 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | # XCODESCHEME=scheme 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # Changing IGNORED? Consider updating the README.txt file and any Git issues 24 | # referenced therein. 25 | 26 | # These variables must be set before including Makefile.inc 27 | # 28 | 29 | include ../Makefile.inc 30 | 31 | # Standard targets: build, run 32 | # If the project does not need customization, we can forward to the default implementation of these targets. 33 | build-local: default-build 34 | run-local: default-run 35 | -------------------------------------------------------------------------------- /tests/3rd-party/Spring/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Errors on maybe skipped functions and an NRE 3 | https://github.com/xamarin/maccore/issues/1867 4 | -------------------------------------------------------------------------------- /tests/3rd-party/Stellar/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Many errors with Self type 3 | -------------------------------------------------------------------------------- /tests/3rd-party/SwiftLocation/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/malcommac/SwiftLocation 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=e25ab77e344624308f4ebe8fc73c880d8d5cda5a 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=SwiftLocation-iOS 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | FRAMEWORKNAME=SwiftLocation 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/SwiftMessages/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/SwiftKickMobile/SwiftMessages 5 | NAME:=$(shell basename $(REPO)) 6 | # master requires Xcode 10 / Swift 4.2 7 | HASH=6b348edcc4b1a167f2961f3f921d274792272c77 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | # XCODEPROJECT=/path/to/xcodeproject 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | # XCODESCHEME=scheme 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # Changing IGNORED? Consider updating the README.txt file and any Git issues 24 | # referenced therein. 25 | 26 | # These variables must be set before including Makefile.inc 27 | # 28 | 29 | include ../Makefile.inc 30 | 31 | # Standard targets: build, run 32 | # If the project does not need customization, we can forward to the default implementation of these targets. 33 | build-local: default-build 34 | run-local: default-run 35 | -------------------------------------------------------------------------------- /tests/3rd-party/SwiftMessages/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Error with wrappers finding member Weak. 3 | https://github.com/xamarin/maccore/issues/1678 4 | -------------------------------------------------------------------------------- /tests/3rd-party/XLActionController/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Errors with @escaping attribute not in parameter position 3 | https://github.com/xamarin/maccore/issues/1759 4 | -------------------------------------------------------------------------------- /tests/3rd-party/circle-menu/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/Ramotion/circle-menu 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=c57851627008f763fdcf1dddd98f7f23e5898e01 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | XCODEPROJECT=./repository/CircleMenu.xcodeproj 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=CircleMenu 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/folding-cell/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Errors with @escaping attribute not in parameter position 3 | https://github.com/xamarin/maccore/issues/1759 4 | -------------------------------------------------------------------------------- /tests/3rd-party/lottie-ios/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/airbnb/lottie-ios 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=e1825c68af24dd367b278018c5fd7021a5564c94 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | XCODEPROJECT=repository/Lottie.xcodeproj 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=Lottie_iOS 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | FRAMEWORKNAME=Lottie 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/paper-switch/Makefile: -------------------------------------------------------------------------------- 1 | TOP=../../.. 2 | 3 | # Define values specific to this test / repository 4 | REPO=https://github.com/Ramotion/paper-switch 5 | NAME:=$(shell basename $(REPO)) 6 | # Modify the hash if the latest won't compile (for instance if it requires Swift 4.2 / Xcode 10) 7 | HASH=b6482d01546d2b6ab3aa747ce8864b5b9a0ad2d2 8 | 9 | # The following variables can be used to customize the build: 10 | # 11 | # The path to the Xcode project (unless the default 'repository/$NAME.xcodeproj' isn't right) 12 | XCODEPROJECT=./repository/PaperSwitchDemo/PaperSwitchDemo.xcodeproj 13 | # 14 | # The Xcode project's scheme to build (unless the default '$NAME' isn't right). 15 | # You can execute 'make list-schemes' to list all schemes in any xcode projects any subdirectory. 16 | XCODESCHEME=PaperSwitch 17 | # 18 | # The name of the resulting framework (unless it doesn't match the Xcode scheme). 19 | # FRAMEWORKNAME=name 20 | # 21 | # If the project fails to build/bind, set IGNORED=1 22 | # IGNORED=1 23 | # 24 | 25 | # These variables must be set before including Makefile.inc 26 | # 27 | 28 | include ../Makefile.inc 29 | 30 | # Standard targets: build, run 31 | # If the project does not need customization, we can forward to the default implementation of these targets. 32 | build-local: default-build 33 | run-local: default-run 34 | -------------------------------------------------------------------------------- /tests/3rd-party/reel-search/README.txt: -------------------------------------------------------------------------------- 1 | 2018-07-09 2 | Unable to find swiftmodules for DataSource, CellClass, Self for target i386-apple-ios10.3 3 | https://github.com/xamarin/maccore/issues/1872 4 | -------------------------------------------------------------------------------- /tests/3rd-party/youtube-iOS/README.txt: -------------------------------------------------------------------------------- 1 | 2019-07-09 2 | Won't build, no iOS development cert 3 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/.gitignore: -------------------------------------------------------------------------------- 1 | SwiftRuntimeLibrary.Mac.dll.config 2 | TestResult.xml 3 | .failed-stamp 4 | *.zip 5 | 6 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/SwiftReflector/ClangTargetTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using SwiftReflector; 3 | using NUnit.Framework; 4 | using NUnit.Framework.Legacy; 5 | 6 | namespace SwiftReflector { 7 | 8 | [TestFixture] 9 | public class ClangTargetTests { 10 | [TestCase ("armv7-apple-ios10.3", false)] 11 | [TestCase ("armv7s-apple-ios10.3", false)] 12 | [TestCase ("arm64-apple-ios10.3", false)] 13 | [TestCase ("i386-apple-ios10.3-simulator", true)] 14 | [TestCase ("x86_64-apple-macosx10.9", false)] 15 | [TestCase ("x86_64-apple-ios10.3-simulator", true)] 16 | [TestCase ("armv7k-apple-watchos3.2", false)] 17 | [TestCase ("i386-apple-watchos3.2-simulator", true)] 18 | public void SimulatorTests (string target, bool expected) 19 | { 20 | ClassicAssert.AreEqual (expected, target.ClangTargetIsSimulator (), $"wrong simulator state for {target}"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/SwiftReflector/ConstructorTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.IO; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using Dynamo; 9 | using Dynamo.CSLang; 10 | using SwiftReflector.Inventory; 11 | using NUnit.Framework; 12 | using tomwiftytest; 13 | using SwiftReflector.TypeMapping; 14 | using NUnit.Framework.Legacy; 15 | 16 | namespace SwiftReflector { 17 | [TestFixture] 18 | [Parallelizable (ParallelScope.All)] 19 | [RunWithLeaks] 20 | public class ConstructorTests { 21 | [Test] 22 | public void SimpleConstructor () 23 | { 24 | string swiftcode = "public class None { public init() { } }"; 25 | using (Stream stm = Compiler.CompileStringUsing (null, XCodeCompiler.Swiftc, swiftcode, "")) { 26 | var errors = new ErrorHandling (); 27 | ModuleInventory inventory = ModuleInventory.FromStream (stm, errors); 28 | Utils.CheckErrors (errors); 29 | ClassicAssert.AreEqual (1, inventory.Classes.Count ()); 30 | ClassContents cl = inventory.Classes.First (); 31 | ClassicAssert.AreEqual ("noname.None", cl.Name.ToFullyQualifiedName ()); 32 | ClassicAssert.AreEqual (2, cl.Constructors.Values.Count ()); 33 | } 34 | } 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/SwiftReflector/LinkageTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using NUnit.Framework; 6 | using tomwiftytest; 7 | using Dynamo; 8 | using Dynamo.SwiftLang; 9 | using SwiftReflector.Inventory; 10 | using System.Linq; 11 | using Dynamo.CSLang; 12 | using SwiftRuntimeLibrary; 13 | 14 | namespace SwiftReflector { 15 | [TestFixture] 16 | [Parallelizable (ParallelScope.All)] 17 | [RunWithLeaks] 18 | public class LinkageTests { 19 | 20 | 21 | [Test] 22 | [TestCase (PlatformName.iOS)] 23 | [TestCase (PlatformName.macOS)] 24 | public void TestMissingNSObject(PlatformName platform) 25 | { 26 | string swiftCode = 27 | "import Foundation\n" + 28 | "public final class MissingNSObject {\n" + 29 | " public init() { }\n" + 30 | " public func val() -> Int { return 5; }\n" + 31 | " public func skip(a:NSObject) { }\n" + 32 | "}"; 33 | 34 | 35 | CodeElementCollection callingCode = new CodeElementCollection (); 36 | callingCode.Add (CSFunctionCall.ConsoleWriteLine (CSFunctionCall.Ctor ("MissingNSObject").Dot (CSFunctionCall.Function ("Val")))); 37 | TestRunning.TestAndExecute (swiftCode, callingCode, "5\n", platform: platform); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/SwiftRuntimeLibrary.Mac.dll.config.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/SwiftRuntimeLibraryTests/SwiftDateTests.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using System.Linq; 8 | 9 | using SwiftRuntimeLibrary; 10 | 11 | using NUnit.Framework; 12 | using Dynamo.CSLang; 13 | using tomwiftytest; 14 | using SwiftReflector; 15 | 16 | namespace SwiftRuntimeLibraryTests { 17 | [TestFixture] 18 | public class SwiftDateTests { 19 | 20 | [TestCase (PlatformName.macOS)] 21 | public void BasicTest (PlatformName platform) 22 | { 23 | var swiftCode = @" 24 | public func dateIsNotUsed () { } 25 | "; 26 | 27 | var clID = new CSIdentifier ("date"); 28 | var clDecl = CSVariableDeclaration.VarLine (CSSimpleType.Var, clID, new CSFunctionCall ("SwiftDate.SwiftDate_TimeIntervalSince1970", false, CSConstant.Val (0.0))); 29 | var printer = CSFunctionCall.ConsoleWriteLine (new CSFunctionCall ($"{clID.Name}.ToNSDate", false)); 30 | var disposer = CSFunctionCall.FunctionCallLine ($"{clID.Name}.Dispose"); 31 | 32 | var callingCode = CSCodeBlock.Create (clDecl, printer, disposer); 33 | TestRunning.TestAndExecute (swiftCode, callingCode, "1970-01-01 00:00:00 +0000\n", testName: $"BasicTest{platform}", platform: platform); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/devicetests/.gitignore: -------------------------------------------------------------------------------- 1 | # steve sez: the files and directories herein are automatically generated 2 | # by running the macos unit tests and should not be checked in 3 | */**/* 4 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | bin 3 | tomswiftydevicetests.csproj 4 | devices.xml 5 | 6 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/find-device.csharp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp 2 | 3 | // This script reads 'devices.xml', which is the output from 'mlaunch --listdev= --output-format=xml', and parses it to find any applicable and usable devices. 4 | // The device classes to search for are passed in as arguments. 5 | // Example: './find-device.csharp iPad iPhone' 6 | 7 | using System.Xml; 8 | 9 | var args = new List (Environment.GetCommandLineArgs ()); 10 | // two first arguments are 'csharp' and this script. 11 | args.RemoveAt (0); 12 | args.RemoveAt (0); 13 | 14 | var deviceClassQuery = string.Join (" or ", args.Select ((v) => $"DeviceClass='{v}'")); 15 | 16 | var doc = new XmlDocument (); 17 | doc.Load ("devices.xml"); 18 | var nodes = doc.SelectNodes ($"MTouch/Device[IsUsableForDebugging='True' and ({deviceClassQuery})]/UDID"); 19 | 20 | foreach (XmlNode n in nodes) { 21 | Console.WriteLine (n.InnerText); 22 | break; // Only need one 23 | } 24 | 25 | Environment.Exit (0); 26 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/iphone/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using Foundation; 5 | using UIKit; 6 | 7 | namespace tomswiftydevicetests 8 | { 9 | // The UIApplicationDelegate for the application. This class is responsible for launching the 10 | // User Interface of the application, as well as listening (and optionally responding) to application events from iOS. 11 | [Register ("AppDelegate")] 12 | public class AppDelegate : UIApplicationDelegate 13 | { 14 | // class-level declarations 15 | 16 | public override UIWindow Window { 17 | get; 18 | set; 19 | } 20 | 21 | public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions) 22 | { 23 | // Override point for customization after application launch. 24 | // If not required for your application you can safely delete this method 25 | 26 | return true; 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/iphone/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/iphone/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/iphone/ITomTest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | 6 | namespace TomTest 7 | { 8 | public interface ITomTest 9 | { 10 | void Run (); 11 | string TestName { get; } 12 | string ExpectedOutput { get; } 13 | } 14 | 15 | public class TomSkipAttribute : Attribute 16 | { 17 | public TomSkipAttribute (string reason) 18 | { 19 | Reason = reason; 20 | } 21 | public string Reason { get; private set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/iphone/Main.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using UIKit; 5 | 6 | namespace tomswiftydevicetests 7 | { 8 | public class Application 9 | { 10 | static string [] _args = null; 11 | // This is the main entry point of the application. 12 | static void Main (string [] args) 13 | { 14 | if (args.Length == 0) { 15 | _args = new string [] { 16 | // set these to report results back to the a host 17 | //"-host", 18 | //"192.168.5.115", 19 | //"-port", 20 | //"44444" 21 | }; 22 | } else { 23 | _args = args; 24 | } 25 | // if you want to use a different Application Delegate class from "AppDelegate" 26 | // you can specify it here. 27 | UIApplication.Main (args, null, "AppDelegate"); 28 | } 29 | 30 | public static string [] Args { get { return _args; } } 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/tom-swifty-test/tomswiftydevicetests/iphone/ViewController.designer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | // WARNING 5 | // 6 | // This file has been generated automatically by Visual Studio from the outlets and 7 | // actions declared in your storyboard file. 8 | // Manual changes to this file will not be maintained. 9 | // 10 | using Foundation; 11 | using System; 12 | using System.CodeDom.Compiler; 13 | 14 | namespace tomswiftydevicetests 15 | { 16 | [Register ("ViewController")] 17 | partial class ViewController 18 | { 19 | [Outlet] 20 | [GeneratedCode ("iOS Designer", "1.0")] 21 | UIKit.UITextView TestOutput { get; set; } 22 | 23 | void ReleaseDesignerOutlets () 24 | { 25 | if (TestOutput != null) { 26 | TestOutput.Dispose (); 27 | TestOutput = null; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tom-swifty/Extensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Linq; 6 | 7 | namespace tomswifty { 8 | public static class Extensions { 9 | public static T [] Prepend (this T [] arr, params T [] items) 10 | { 11 | return items.Concat(arr).ToArray(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tools/metadataforall: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | #usage: metadataforall /path/to/directory/of/dylibs 4 | 5 | if [ $# -ne 1 ]; then 6 | echo "Usage: $0 /path/to/directory/of/dylibs" 7 | exit 1 8 | fi 9 | 10 | if [ ! -d "$1" ]; then 11 | echo "$1: no such directory" 12 | exit 1 13 | fi 14 | 15 | #make the trailing slash optional 16 | path=${1%/} 17 | platform=$(basename "$path") 18 | echo "" 19 | echo "" 20 | for filename in "$path"/*.dylib; do 21 | ./metadatafordylib "$filename" 22 | done 23 | echo "" 24 | -------------------------------------------------------------------------------- /tools/metadatafordylib: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # usage: 4 | # metadatafordylib pathname 5 | 6 | if [ "$#" -ne 1 ]; then 7 | echo "Usage: $0 /path/to/file.dylib" 8 | exit 1 9 | fi 10 | 11 | if [ ! -f "$1" ]; then 12 | echo "Unable to find file $1" 13 | exit 1 14 | fi 15 | 16 | # libname=libswiftCore.dylib 17 | libname=$(basename "$1") 18 | # substitute=libswiftCore 19 | substitute="${libname%.*}" 20 | #substitute=Core 21 | substitute="${substitute#libswift}" 22 | 23 | echo "" 24 | nm "$1" | grep "__T0" | \ 25 | awk '{p=$(NF) ; gsub ("__T", "++T", p) ; print $(NF) " " p}' | \ 26 | xcrun swift-demangle | grep "_type metadata for" | \ 27 | awk '{print " "}' | \ 28 | sed 's/\+\+T/__T/' | \ 29 | sed s/__C/"$substitute"/ | \ 30 | sed s/__ObjC/"$substitute"/ 31 | echo "" 32 | -------------------------------------------------------------------------------- /tools/symbolicator/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using SwiftRuntimeLibrary; 7 | 8 | namespace Symbolicator { 9 | public class Program { 10 | static void Main (string[] args) { 11 | 12 | var tasks = new Dictionary { 13 | // Type holding the constants / Path to library to look for symbols. 14 | [typeof (SwiftCoreConstants)] = "/usr/lib/swift/libswiftCore.dylib", 15 | [typeof (XamGlueConstants)] = "../../swiftglue/bin/Debug/iphone/FinalProduct/XamGlue", 16 | }; 17 | 18 | Console.WriteLine ("Building binding-tools-for-swift..."); 19 | Tools.Exec ("/usr/bin/make", "-C", "../..", "all"); 20 | Console.WriteLine ("Done building binding-tools-for-swift..."); 21 | 22 | foreach (var task in tasks) { 23 | var code = Tools.UpdateMangledConstants (task.Key, task.Value); 24 | Tools.WriteToFile (task.Key, code); 25 | Console.WriteLine ($"{task.Key.Name} updated!"); 26 | } 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /tools/symbolicator/SymbolicatorInfoAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace SwiftRuntimeLibrary { 6 | internal class SymbolicatorInfoAttribute : Attribute { 7 | public string DemangledString { get; set; } 8 | public bool Skip { get; set; } = false; 9 | 10 | public SymbolicatorInfoAttribute (string demangledString) 11 | { 12 | DemangledString = demangledString; 13 | } 14 | 15 | public SymbolicatorInfoAttribute () { } 16 | 17 | #if SYMBOLICATOR 18 | public override string ToString () 19 | { 20 | if (Skip) 21 | return "\t\t[SymbolicatorInfo (Skip = true)]"; 22 | return $"\t\t[SymbolicatorInfo (\"{DemangledString}\")]"; 23 | } 24 | #endif 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tools/symbolicator/swift-demangle-lib.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | xcrun nm $1 | xcrun swift-demangle 4 | -------------------------------------------------------------------------------- /tools/symbolicator/symbolicator.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | net7.0 5 | $(DefaultItemExcludes);*.sh;*.md;*.props 6 | 7 | 8 | TRACE;DEBUG;SYMBOLICATOR;NETCOREAPP;NETCOREAPP2_1 9 | 10 | 11 | 12 | 13 | TRACE;RELEASE;SYMBOLICATOR;NETCOREAPP;NETCOREAPP2_1 14 | 15 | 16 | 17 | ExecAndCollect.cs 18 | 19 | 20 | StringUtils.cs 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /type-o-matic/FileSymbolPair.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. 2 | // Licensed under the MIT License. 3 | 4 | using System; 5 | namespace typeomatic { 6 | public class FileSymbolPair { 7 | public FileSymbolPair () { } 8 | public FileSymbolPair (string file, string symbol) 9 | { 10 | File = file; 11 | Symbol = symbol; 12 | } 13 | public string File { get; set; } 14 | public string Symbol { get; set; } 15 | } 16 | } 17 | --------------------------------------------------------------------------------