Giter Site home page Giter Site logo

Comments (3)

mikolasstuchlik avatar mikolasstuchlik commented on September 28, 2024

This issue was discussed on Discord with @kabiroberai .

First message: https://discord.com/channels/791751777598570606/791751778092711941/872087233811853312
Last message: https://discord.com/channels/791751777598570606/791751778092711941/872404886833229824

Summary

Kabir suggested using SourceKit via https://github.com/jpsim/SourceKitten. SourceKitten is a commonly used tool. Kabir managed to create an example on using SwiftGLib:

# macOS
$ sourcekitten module-info --module CGLib -- -I"${PWD}/Sources" $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0)) -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"

# linux
$ sourcekitten module-info --module CGLib -- -I"${PWD}/Sources" $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0))

The output is ~800K lines long JSON, which contains embedded XML strings. It will take some time until I get familiar with the data structure.

The SourceKitten does not require the package to be built, but it needs path to the libsourcekitdInProc.so on Linux and the SDK on macOS.

from gir2swift.

mikolasstuchlik avatar mikolasstuchlik commented on September 28, 2024
#Linux
sourcekitten module-info --module Swift -- ""
sourcekitten module-info --module Foundation -- ""
sourcekitten module-info --module Glibc -- ""
sourcekitten module-info --module CGLib -- -I"$PWD"/Sources $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0))

#macOS
sourcekitten module-info --module Swift -- -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
sourcekitten module-info --module Foundation -- -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
sourcekitten module-info --module Darwin -- -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"
sourcekitten module-info --module CGLib -- -I"${PWD}/Sources" $(printf " -Xcc %s" $(pkg-config --cflags gio-unix-2.0)) -sdk "$(xcrun --show-sdk-platform-path)/Developer/SDKs/MacOSX$(xcrun --show-sdk-version).sdk"

from gir2swift.

mikolasstuchlik avatar mikolasstuchlik commented on September 28, 2024

For anyone interested, a MR mikolasstuchlik/g2swift#1 has been merged into my PoC repository g2swift. It implements a call to SourceKit and parses it's output.

This demonstrates how responses from SourceKit could be parsed. In future, I'll try to get a useful information about the environment.

from gir2swift.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.