As the title says, I want to implement a Git interface in my Flutter app: I need it to have basic functionality (commit, push, pull, merge) on an internal path repo (no external storage access). There is this git package for Dart, which is only a CLI interface, i.e. not compatible with Android, which is the main issue I'm facing, as I need my app to be compatible with that and Windows.
I happen to use GitJournal, an Android note-taking app that uses Git to sync. I found out that it is also built in Flutter -- it does essentially the same things I need out of this Git implementation, so eureka, maybe?
It seems to be using libgit2, along with both(?) this custom git_bindings Dart package (related pub.dev page) and this other dart-git custom implementation fully in Dart. This last package apparently isn't fully-featured, is experimental and maybe only used in parallel with the previous git_bindings thingy.
Last thing I found, one could write custom ffigen-libgit2 bindings, but I'm positive that some of the things I posted before are already using this in some way. Plus, I would have no clue on where to start with this.
I don't require a bullet-proof implementation, meaning that I'd be willing to play around with an experimental / bleeding-edge solution, as long as it does the job and doesn't require me to reinvent the wheel.
I have no familiarity with bindings, interfaces between languages and such trickeries, but I'd be willing to do some learning if necessary. Needless to say, the simplest the solution, the better -- I chose Flutter for a reason, after all :D
Thanks in advance
Related
Fetching the AOSP source, is 134GB.
A checkout of a particular version of Android is likely to be many GBs.
How do developers who customise AOSP keep their changes under (their own) version control? (Given that checking-in a snapshot of an Android version's source will be many GBs.)
This is my flow, maybe not the best....
I don't like dealing with repo tool and multiple remotes, so I get rid of all the .git subfolders and create just one tremendously huge repository. This has the bad effect of essentially removing all the "history". So we have a server with the original sync for git blame if we need to.
First check-out for a developer will be time-consuming either way. To make it faster, we have a local bare git repo cloned. So people run git clone on the local server, and the switch the origin to the actual remote.
After all is set-up, the day-to-day dealings are not time consuming. Commits and pushes are quite fast ( maybe 5-10s ) even for a large repo like this. Thanks GIT!
Sorry for necro-posting, but maybe somebody find it useful.
I just use repo utility from Google, e.g. repo start.
Only first repo sync procedure take a long time,
even subsequent checkouts do not like so time-consuming.
If you check some popular ROM, e.g. GrapheneOS, you find they repo too.
I want to build an app for Android, iOS and web from a single Codebase using Flutter. Since web does not support all Flutter plugins yet, I'll have to use alternatives that have dependencies (for example dart:html) which aren't available on Android and iOS.
How can I inject the right implementation depending on the platform on which the application runs, without loading unnecessary/unavailable packages?
This is possible using conditional imports. You can find an example of the syntax here: https://github.com/dart-lang/site-www/issues/1569. However, I can't seem to find the official documentation for this language feature.
import 'stub.dart'
if (dart.library.io) 'io.dart'
if (dart.library.html) 'html.dart';
Define methods in stub.dart throwing UnsupportedOperationException or something the like. It doesn't really matter since stub.dart isn't going to be imported anyway. Put the actual implementations in io.dart and html.dart, respectively. The signatures have to match those in stub.dart.
You probably only want to do this conditional import at a single point in your program so I highly recommend hiding everything behind a common interface defined somewhere else than in stub.dart (common.dart in this example). You can then import and implement common.dart in io.dart and html.dart and use conditional import to chose your implementation at your program root. This way everything else only needs to depend on common.dart.
You could put the common parts into a third hierarchy, then include that in your mobile and web hierarchies using local pubspec includes. I'm not sure how you'd publish that to pub if you wanted to share it, although if you're already sharing it, it'd just be three pub repos like you have locally.
I'm building an app with android studio with another developer. Is there any way in which I can make it so that both my partner and I can work on the project at the same time on different computers (both Windows computers)? I know there is a similar question, but I am looking for a more detailed explanation on how to do it.
My suggestion: Use Version Control preferably git.
This will help both of you to develop Apps without any problems of copying & pasting and manually making changes in all files one-by-one.
Note: Want to use git but do not want to open source your code (since Github allows creating private repository but with some Payment), then use Bitbucket, you can create private repositories for FREE!
EDIT: Github now provides unlimited private repositories.
Hope it helps!
Take a look at git. I will help you and your partner to work on the same project on a different computer (Windows, Mac, Linux...).
https://www.atlassian.com/git/tutorials/comparing-workflows
As others have indicated, you should use a version control system like git for this. This will give you the following features (among others):
The ability to share code between people
Essentially keeps a backup of your code on an external server
Keeps a history of revisions to files (so you can "back out" changes if you need) as well as differences between your local file and the version on the server
Allows you to merge changes between you and people working with you
How you do this will depend on which version control system you use, but some version control providers will allow you to also set up what's known as "Continuous Integration" - basically, if you or your partner check code in, it'll immediately start a build. If this is available to you, I strongly recommend using it. The advantage of that is that it'll give you quick feedback if you did something that'll prevent it from building for the other person (e.g. if you forgot to check in a file or something). This'll prevent a lot of frustration and wasted time. (This happens a lot more often than you'd think; you don't want the other person to have to spend half an hour trying to get the app to build again when they download your code only to find out that you forgot to check in a file).
I also strongly recommend integrating your stuff with each other as often as possible as well as practicing regular "re-baselines" (i.e. downloading each others' stuff and merging it with what you have locally). The longer you wait to integrate your stuff with each other the more complicated it'll become, and waiting too long greatly increases the risk of introducing bugs when merging or forcing unnecessary rework.
I have recently started to look into android development (aosp) and read about "repo" tool/wrapper that takes care of all the android's sub projects .
While I think repo does a fairly good job at what it does, I wanted to know if there are any alternatives to it.
I thought git submodules are sufficient for this but many posts on internet discourage use of submodules ( due to some "drawbacks" which I feel are not drawbacks at all ).
Keeping in mind that the source code for different sub projects should have their own releases or indipendednt code bases I am not sure if git subtree is a good solution for this.
It would be great if someone can point out some alternatives to repo or any other information about this.
The repo tool is the standard way to work with AOSP code base. Sure you can manually manage the repos yourself but that is going to be rather tiresome and error prone.
Otherwise using submodules or subtrees won't let you inter-operate with Google and everyone else working on the AOSP codebase, so unless you are planning to do a one-way fork of AOSP there are no alternatives to the repo tool for working on AOSP.
repo has one huge disadvantage: it detaches HEADs. You can't switch to specific branch under specific subrepo. Unless you do repo start
tsrc, as far as I know, has less functionality but doesn't have this specific problem.
Also, you can use embedded mechanisms of build systems like Bazel (git_repository/new_git_repository).
I am taking care of an open source project: mixare. It's an augmented reality browser released under the GPLv3.
The source code of the project is on github and I would like to hook the localization part to some web-service a-la pootle. If necessary I can install my own instance of a translation service on our server, but also an hosted solution would be fine. So I would like to know:
Is there a preferred translation web service that syncs using github's service hooks? Any best practice to share?
Thanks a lot!
Git integration is one of major reasons why I started to write Weblate. It also supports remote trigger for git pull using URL, so it nicely integrates with Github (you just need to put the URL there).
PS: I've just noticed that Android string resources are not supported by backend I use for loading translations (translate toolkit), so it probably won't work for you...
While I appreciate your wish for git support, shouldn't you primarily be looking for a solution that will give you many and good translations?
To get many translations I'd recommend Translatewiki, unfortunately their manual setup takes some time though.
Apart from Translatewiki, transifex seems to be one of the better and not least bigger (counting translators) services. They've made their own client that take care of importing and merging translations. For gettext translations it can also pull in updated template (pot) files automatically from github, I don't know if that's also possible with Android style translations.
Both Translatewiki and Transifex are 100% free and open source software.
I've been through the same "nothing good out there" phase, so I've started writing my own, as a symfony2 bundle. Maybe it's of use to you: https://github.com/tvogt/translator-bundle
Why? Because I couldn't get weblate or pootle to work, you probably have to be familiar with all the pip and python and ve and whatever stuff. Translatewiki is only for free software. Transifix is commercial.
In 2020, with GitHub Actions (hooks executed on GitHub side), you now have GitLocalize
GitLocalize is a continuous localization tool built for communities and teams that want to simplify their workflow when translating their content.
GitLocalize automatically keeps translations up to date by syncing with your repository.
That won't apply to the OP's project github.com/mixare/mixare, which was moved to GitLab in 2018.
But it can help other projects with a similar need.
You can have a look at Amanuens - it's able to sync with any Git repository, including Github. It's totally free for open-source projects (contact support for details). Disclaimer: it is my company's service.