Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Gir submodules alternative #107

Closed
gkoz opened this issue Apr 19, 2016 · 10 comments
Closed

Gir submodules alternative #107

gkoz opened this issue Apr 19, 2016 · 10 comments

Comments

@gkoz
Copy link
Member

gkoz commented Apr 19, 2016

There is a significant drawback to having 'gir' and 'gir-files' submodules in each repo: wasted space and build time when working with several repos at once. It is desirable to find another solution which would retain ease of use (edit Gir.toml, make gir) and similar control over 'gir' and 'gir-files' revisions used to regenerate code.

@gkoz
Copy link
Member Author

gkoz commented Apr 19, 2016

A possible alternative.

Use an ignored local-gir directory and a gir.txt with commit hashes. The makefile would know how to

  • mkdir local-gir; git clone $GIR_URL local-gir/gir; git clone $GIR_FILES_URL local-gir/gir-files if they're absent but not clobber existing ones
  • check out the commits set in gir.txt (basically what git submodule update does)

You could either let make gir do the default thing or symlink local-gir somewhere and it would only check out the necessary commits if asked to (e.g. make reset-gir) or just build run the existing gir it finds.

@EPashkin
Copy link
Member

Other alternative: optionally make gir/target symlink to base gir/target, may be ever add make target to do that.

@gkoz
Copy link
Member Author

gkoz commented Apr 19, 2016

Something like this can be achieved with cargo config.

workdir
├── gdk
│   └── gir
├── gtk
│   └── gir
├── .cargo
│   └── config
└── target

Put target-dir = "./target" in config to make all crates use the same target directory. Just need to make make aware of where to find the binary somehow, or rewrite it to use cargo run.

@EPashkin
Copy link
Member

EPashkin commented Apr 19, 2016

Hard making all target to same directory IMHO not good idea as modules can have different version of gir.
If you think that gir better be always same then better just add new module with gtk, gdk, ..., gir, gir-files as sub-modules.

@gkoz
Copy link
Member Author

gkoz commented Apr 19, 2016

You'll still have to rebuild gir when jumping between crates but none of its dependencies (if the lockfiles don't differ). This can be avoided by getting even more creative and using cargo install to make this independent of where the target directory is and let each crate have its own gir binary:

GIR = gir/target/bin/gir
# ...
$(GIR) : gir/Cargo.toml gir/Cargo.lock gir/build.rs $(shell find gir/src -name '*.rs')
    # This line can be removed once we have `cargo install --force`
    cargo uninstall --root gir/target gir 2&>1 > /dev/null || true
    cargo install --root gir/target --path gir

@EPashkin
Copy link
Member

I not understand how cargo install be better.

PS. We need full rebuild gir on update local rustc version (every 6 week).

@gkoz
Copy link
Member Author

gkoz commented Apr 19, 2016

I'll probably add a PR to make the install idea easier to understand. As to rustc upgrades the benefit of static linking by default is gir the binary isn't dependent on libstd-blahblah.so, you don't need to rebuild it just because rustc is upgraded.

@EPashkin
Copy link
Member

Yes, it static linked, so when we try build gir under new rustc it do full rebuild as std version changed.

@EPashkin
Copy link
Member

Last only true if not using make.

alex179ohm referenced this issue in alex179ohm/gtk Oct 21, 2019
@bilelmoussaoui bilelmoussaoui transferred this issue from gtk-rs/gtk Nov 10, 2020
@sdroege
Copy link
Member

sdroege commented Nov 10, 2020

We don't have them per module any more as everything's merged into one.

@sdroege sdroege closed this as completed Nov 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants