Comments (1)
Yes, it would be nice to integrate the post-processing steps directly into gir2swift
. From my experience, there a number of different reasons for why post-processing is needed. They all vary a bit in terms of what is required. Some examples I can think of:
- inadequate code generation in
gir2swift
. These often fix syntax errors or insert keywords/attributes that Swift requires (such as@escaping
, adding/removingoverride
, etc.).
- ideally these should be fixed by making gir2swift smarter, so they are not needed anymore
- however, this can be a lot of work for only a few edge cases
- errors in the relevant
.gir
files.
- these are often version specific (so should be tagable)
- ideally, they should be upstreamed to ensure they eventually get fixed (so would be nice to tag them with an upstream PR number)
- errors in the relevant header files.
- sometimes what is defined varies between different platforms or versions
- examples include
#define
that is visible to Swift in some cases and invisible in other cases
- syntactic sugar
- there are cases where
gir2swift
generates correct code, but small changes can make the generated code more Swift-friendly
So what's a good way forward? Maybe initially, it would be good if the existing functionality was integrated directly into gir2swift
. Probably the sed
scripts are low-hanging fruit as a first step, as they provide simple search and replace based on regular expressions. Rather than a generic gir2swift-manifest.jsonfile, I would suggest using a module-specific file (similar to the
.preambleand other files we already have), e.g.
GObjectmight have a
GObject-2.0.quirks` file.
Also, since these files need to be created by humans, I would not use json as a format. We probably want an expression system for versions and platforms (to avoid complex shell scripts such as the GLib one that needs to handle differently versioned .sed
and .awk
files), so something simple like the sed
format would not be enough. Maybe something like yaml/StrictYAML might strike the right balance. Also, we will eventually needs something that can replace the state-based awk
scripts (ideally with some domain knowledge that awk
doesn't have, but gir2swift
does: e.g. "the XYZ
pointer type in the convenience initialisers implemented by functions containing new_abc_label
that are part of the ABC
struct).
from gir2swift.
Related Issues (13)
- Compilation failure with Swift 4 HOT 2
- Automate swiftObject integration for classes
- Expanding the `.yaml` manifest capabilities HOT 2
- Discussion: Additional sources of truth for wrapper generation HOT 3
- Raspberry Pi 4 CI for the project HOT 1
- Use element-type for lists/hash tables HOT 2
- Module.module/Module.preamble not working
- Includes error HOT 3
- Generated files not building with Swift 5.2 HOT 1
- Use dlopen(), dlsym() and dlclose() to launch functions. HOT 1
- gir2swift creates duplicate labels for some (template) methods
- Redundant protocol conformance warnings
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gir2swift.