-
Notifications
You must be signed in to change notification settings - Fork 67
[native_assets_cli] fetch
and offline
mode
#1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To be had in a separate discussion probably:
That we do many process invocations for hooks is a problem in itself, which I believe should be addressed at some point (Maybe collect all hooks into a single Dart file?). |
Not in any use case that I've encountered so far. |
Notes from a discussion with @mkustermann regarding support for working offline and sandboxing.
|
There is also a specific |
Yes, in the case of jnigen this is useful for downloading jars from maven/gradle/... The same hook could be used to generate bindings from the said jars. However, for jnigen, it's important that this hook is run while development and not while building, because the user would want to use the downloaded jars and their generated bindings in their code and they shouldn't be forced to compile and run the entire app once in order to have access to this. |
TIL |
Yeah we have but keeping gradle working has been the higher priority. FWIW I think do we actually download gradle but just not the builds dependencies. Gradle shares a gradle cache across the machine by default so for some users their dependencies are already there. |
I didn't mean precaching Gradle itself, but the dependencies that are in an app's (Edit: Though Gradle itself of course should as well be cached. In the same way that for example the Rust toolchain should be cached if a build hook wants to use Rust to build a dylib.)
That is is similar to what @mkustermann and I mentioned above. On the second run of a |
This is true, but also as discussed previously, there are Currently, flutter/plugins is able to drive almost all downloading steps from a separate CI step, so that we can isolate network-based failures from actual test failures. We do this via a combination of things like If native assets become commonplace without similar isolation being possible, it will be a regression for our packages CI. (And to capture another important point from previous discussions: I'm fully aware that it is already possible for packages to do arbitrary downloads during builds; there is a huge difference, in practice, between "it is possible for packages that don't follow standard practice to cause downloads to only be driven by doing a full build" and "the standard (or only) way of doing downloads can only be driven by doing a full build".) |
As an example here is a build where we have a gradle cache step where we download all the gradle dependencies. It is just not part of the flutter tool. https://ci.chromium.org/ui/p/flutter/builders/staging/Linux_android_emu%20flutter_driver_android_test/2810/overview |
Ah, I see. So we'd want to have something like (Thanks for being patient with Dart-only folks, we basically only have |
For a prefetch hook:
RE: Recognizing network failures: An alternative approach without a prefetch hook could be:
|
@reidbaker Suggested we should have
fetch
hook/flag, and anoffline
flag.I've spend some thought on what would be a good way of doing this.
One design goal should be that a build hook can wrap an existing native build system or native package manager (#189). This leads to the following design constraints:
fetch
andbuild
should be shared. Otherwise the fetch step invoking the fetch step in the native tool would download dependencies to a place where the build step cannot access them.Another design goal should be that after the fetch step, the build step wouldn't need any internet access. In other words, it would succeed offline. This leads to the following design constraints:
flutter run
doesn't have target architectures available for example, onlyflutter assemble
does.)I'm not sure if the best design would be to have a
hook/fetch.dart
which would get aFetchConfig
(most likely no output, just exitCode of the process for success or not). Or ifBuildConfig
should get abool fetchOnly
.Pros for fetch as flag on
hook/build.dart
fetchOnly
is false, it's a single process invocation for fetch and build, instead of two.package:gradle
), fetch on fetch, build on build, offline on offline. If we have ahook/fetch.dart
and ahook/build.dart
there'd be two hooks which forward with the same configuration.fetch
andbuild
hooks have access to the same configuration, and the same output directory.Cons for
fetch
as flag onhook/build.dart
For
offline
, I think abool
onBuildConfig
is the right place.And
offline
andfetch
are related in the sense that afterfetch
the build hook should not need any internet access. Which passing the offline flag would enforce.@HosseinYousefi @mosuem @liamappelbe @brianquinlan In your use cases, do you wrap existing native build systems / native package managers that need internet access to fetch dependencies? (To produce dylibs/jars/...) And if yes, do those have a separate fetch step and an offline mode?
Any other concerns we should take into account for a fetch step/flag and offline flag?
cc @mkustermann @stuartmorgan
The text was updated successfully, but these errors were encountered: