Skip to content
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

How does versioning work for custom forks? #773

Closed
matthew-carroll opened this issue Aug 30, 2024 · 14 comments
Closed

How does versioning work for custom forks? #773

matthew-carroll opened this issue Aug 30, 2024 · 14 comments

Comments

@matthew-carroll
Copy link

matthew-carroll commented Aug 30, 2024

I setup a custom fork following instructions: https://fvm.app/documentation/advanced/custom-version

However, the reported Flutter version is 0.0.0-unknown:

Screenshot 2024-08-29 at 11 28 46 PM

How should I resolve this?

When running fvm flutter pub get I get the following error:

Resolving dependencies... 
Note: leak_tracker_flutter_testing is pinned to version 3.0.5 by flutter_test from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.

The current Flutter SDK version is 0.0.0-unknown.

Because every version of flutter_test from sdk depends on leak_tracker_flutter_testing 3.0.5 which requires Flutter SDK version
  >=3.18.0-18.0.pre.54, flutter_test from sdk is forbidden.
So, because example depends on flutter_test from sdk, version solving failed.


You can try the following suggestion to make the pubspec resolve:
* Try using the Flutter SDK version: 3.24.1. 
@leoafarias
Copy link
Owner

@matthew-carroll I was not able to replicate the issue using a git clone command as is.

However, I do get this problem is if I set a --depth parameter, which you should not do, as Flutter tools depend on repository references to determine their version. I have added a warning.

Are you using any special parameter during the clone?

@matthew-carroll
Copy link
Author

Nope, no special flags. I went to the versions directory and did a standard git clone https:....

Where is the "Flutter Version" value being pulled from?

@matthew-carroll
Copy link
Author

BTW, here's my RC file, if it's relevant:

{
  "flutter": "custom_flock",
  "flutter_url": "https://github.com/Flutter-Foundation/flutter.git",
  "updateVscodeSettings": true,
  "updateGitIgnore": true,
  "runPubGetOnSdkChanges": true
}

@matthew-carroll
Copy link
Author

@leoafarias is there something else I should do to debug this? This is a blocker for using FVM...

@leoafarias
Copy link
Owner

leoafarias commented Sep 4, 2024

All fvm does is run the flutter tool in the directory.

Did you try running the forked version directly? Meaning, adding this clone to the path and running the version command?

Can you see the version number if you do that?

Also, is the fork on any particular branch, tag, or version?

Also something that might help

flutter/flutter#99503

@leoafarias
Copy link
Owner

@matthew-carroll I ran successfully. You should remove the flutterUrl from your rc file.

If you are cloning the repository to the fork: First option

You do not use the flutterUrl parameter.

The flutterUrl and config are used for the Second Option

terminal.mp4

@matthew-carroll
Copy link
Author

matthew-carroll commented Sep 4, 2024

If you are cloning the repository to the fork: First option
The flutterUrl and config are used for the Second Option

Ok - I'd like the config per project. So I deleted my clone of the fork. Then I put the following in the RC file in my project:

{
  "flutter": "custom_flock",
  "flutter_url": "https://github.com/Flutter-Foundation/flutter.git"
}

I run fvm flutter pub get and I get the following:

(base) matt@Matts-Mac-mini example % fvm flutter pub get
✗ Failed to ensure FlutterVersion(name: custom_flock, releaseFromChannel: null, type: VersionType.custom) is cached.
✗ Custom Flutter SDKs must be installed manually.

@leoafarias
Copy link
Owner

@matthew-carroll I have found a typo in the docs and it should be

{
   "flutterUrl": "https://github.com/Flutter-Foundation/flutter.git"
}

When you run something like fvm use master

It will install the version master from this repository. I have done it and here is what it shows.

Flutter 3.25.0-1.0.pre.275 • channel master • https://github.com/Flutter-Foundation/flutter.git
Framework • revision a341c7f174 (2 hours ago) • 2024-09-05 12:28:45 +0000
Engine • revision 34b61eb53b
Tools • Dart 3.6.0 (build 3.6.0-216.0.dev) • DevTools 2.39.0

Keep in mind, as stated in the docs, the branch needs to be the branch or tags used in the repo now. FVM will use this repository to fetch the versions, which means these versions should not conflict with other versions that are cached.

FVM does not have the feature to hold project-specific cache.

Let me know if that helps.

@matthew-carroll
Copy link
Author

I think the difficulty here is that the instructions (both on the website and in this thread) are all partial instructions. There are various details missing between the steps.

For example, you mentioned fvm use master - am I supposed to run that command when I already have an RC file? Isn't the point of the RC file to store all relevant details and preferences for the version of Flutter that a given project uses? What impact does fvm use master have on a project with an RC file?

Keep in mind, as stated in the docs, the branch needs to be the branch or tags used in the repo now.

What branch are we talking about? The RC file doesn't specify a branch or tag, nor do the docs for the RC file mention a branch or tag...

I think you'd probably have much better results with the docs if you provided a full start-to-finish setup for each configuration: approach with environment variable, approach with just the CLI, approach with RC. Those instructions might have some overlap, but at least there wouldn't be any confusion or missing parts.

For example, the following is the total instructions currently provided for an RC file with a custom fork:

Screenshot 2024-09-05 at 11 23 59 AM

As for where I am now, I ran fvm use master as you suggested. Now running fvm flutter pub get successfully executes.

However, FVM has now edited my RC file and replaced "flutter": "custom_flock" with "flutter": "master" - so it seems like FVM is no longer attempting to use my fork of Flutter, which defeats the purpose. Or, if FVM is using my fork, I can't tell whether that's happening or not. Under ~/fvm/versions I now have only two directories: master, stable. I went to those directories and checked the git status - both of those directories are coming from the regular Flutter repository. Not my custom one.

So I'm back at a place where I've followed your instructions to the best of my ability and I still can't seem to get FVM to use my fork....

@leoafarias
Copy link
Owner

leoafarias commented Sep 5, 2024

fvm should have installed the master branch from your fork.

.fvmrc is changed and managed by fvm, which determines which version is currently linked.

I can update the docs and improve but it seems you are trying to use 2 approaches, the custom version and the custom repo, they are not compatible

You either setup flutterUrl or do the fork as I mentioned first.

@matthew-carroll
Copy link
Author

Like I said, I've simply tried to do what you've mentioned, but you've mentioned a number of different approaches, each with partial instructions. I've tried to be very clear with my goal. I want a specific Flutter project to use a fork of Flutter. I have no opinion about how that's accomplished. Nothing I've tried has worked.

I guess I'll just start digging into the source code and figure out what FVM is trying to do.

@leoafarias
Copy link
Owner

I have updated the docs based on the previous discussion. It does breaks down into 2 different approaches. If the docs are not clear let me know!

Also let me know if you prefer to get on a dm or call might be easier.

@matthew-carroll
Copy link
Author

@leoafarias I think a call would be much easier. I imagine that we can probably work through this in about 5 minutes.

@leoafarias
Copy link
Owner

@matthew-carroll closign this issue, and will create a new issue in reference to namespacing forks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants