Skip to content

If a git path in a pubspec is relative interpret it relative to the pubspec #449

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

Closed
DartBot opened this issue Jun 5, 2015 · 15 comments · Fixed by #4060
Closed

If a git path in a pubspec is relative interpret it relative to the pubspec #449

DartBot opened this issue Jun 5, 2015 · 15 comments · Fixed by #4060
Labels
contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="96" height="96"hspace="10"> Issue by munificent
Originally opened as dart-lang/sdk#8570


You can use a file path as a git dependency. When you do, it's interpreted as relative to the package directory of the root package. It should be resolve as relative to the pubspec that contains the dependency (like relative path deps are).

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Added Community-StarterBug label.

@DartBot DartBot added type-enhancement A request for a change that isn't a bug Priority-Medium labels Jun 5, 2015
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/2156198?v=3" align="left" width="48" height="48"hspace="10"> Comment by kasperl


Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/2156198?v=3" align="left" width="48" height="48"hspace="10"> Comment by kasperl


Removed Oldschool-Milestone-Later label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/2130849?v=3" align="left" width="48" height="48"hspace="10"> Comment by kaendfinger


Shouldn't this have a PatchesWelcome label?

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Patches are welcome on every bug! :)

I think the "PatchesWelcome" usually means "we don't intend to put time into this ourselves, but will take a contribution from someone else for it", but I'm not positive since I haven't used that tag.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Patches are welcome on every bug! :)

Well, let me qualify that by saying contributions are welcome on every bug, but we do like to know a bit about what the contributor has in mind before seeing an actual patch. We don't always do a great job of writing down the full context behind some bug, so there may be some tribal knowledge to impart before a contributor gets coding.

@nex3 nex3 added contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) and removed Community-StarterBug labels Jun 5, 2015
@kevmoo
Copy link
Member

kevmoo commented Jun 26, 2017

Closing this as a dupe of #1305

While #1305 is newer, it's also been tracked and commented on more actively.

@kevmoo kevmoo closed this as completed Jun 26, 2017
@kevmoo kevmoo added the closed-duplicate Closed in favor of an existing report label Jun 26, 2017
@nex3
Copy link
Member

nex3 commented Jun 26, 2017

This is totally different than #1305. This is requesting that the Git URL itself be interpreted relative to the pubspec's location.

@nex3 nex3 reopened this Jun 26, 2017
@kevmoo
Copy link
Member

kevmoo commented Jun 26, 2017

Oops!

@xuanswe
Copy link

xuanswe commented Apr 12, 2020

I'm not sure if this issue is the same as #2447?

@danielvestergaard
Copy link

We've run into this problem when trying to share packages via Git.

In a shared package repo we would like to do the following directory structure:

packages
  core_package
  web_impl_package
  ios_impl_package

With the following pubspec.yaml for web_impl_package:

dependencies:
  core_package:
    path: ../core_package

And pubspec.yaml for ios_impl_package:

dependencies:
  core_package:
    path: ../core_package

Being referenced in pubspec.yaml in our app in a separate repo:

dependencies:
  core_package:
    git:
      url: https://github.com/org/shared-repo.git
      ref: main
      path: packages/core_package
    
  web_impl_package:
    git:
      url: https://github.com/org/shared-repo.git
      ref: main
      path: packages/web_impl_package

However we end up with the error:

flutter pub get
Resolving dependencies... 
Error on line 15, column 11: Invalid description in the "web_impl_package" pubspec on the "core_package" dependency: "../core_package" is a relative path, but this isn't a local pubspec.
   ╷
15 │     path: ../core_package
   │           ^^^^^^^^^^^^^^^
   ╵

It would be great if multiple dependencies pointing to the same Git url and ref could resolve the local paths.

@mit-mit
Copy link
Member

mit-mit commented Aug 31, 2023

cc @sigurdm

@martin-bertele
Copy link

maybe I tried to tackle something similar @danielvestergaard
inside our app's pubspec.yaml I add our private git repo

dependencies:
  jitsi_meet_bundle: 
      git:
        url: [email protected]:org/jitsi_meet_bundle.git
        ref: main

This jitsi_meet_bundle.gitrepo contains 3 packages (each with its own pubspec.yaml) in a subfolder:

lib
  jitsi_meet_bundle.dart
  packages
    jitsi_meet
    jitsi_meet_web_plugin
    jitsi_meet_platform_interface
pubspec.yaml

Then again inside the jitsi_meet_bundle.gits pubspec.yaml I declare the folders paths instead with dependencies: via packages:

dependencies:
  flutter:
    sdk: flutter

packages:
  jitsi_meet:
    path: lib/packages/jitsi_meet
  jitsi_meet_platform_interface:
    path: lib/packages/jitsi_meet_platform_interface
  jitsi_meet_web_plugin:
    path: lib/packages/jitsi_meet_web_plugin

While in the jitsi_meet_bundle.dart I export all source files

library jitsi_meet_bundle;

export 'packages/jitsi_meet/lib/jitsi_meet.dart';
export 'packages/jitsi_meet_platform_interface/lib/jitsi_meet_platform_interface.dart';
export 'packages/jitsi_meet_web_plugin/lib/jitsi_meet_web.dart';

I got so far that all static code analysis is successful, however even after successful XCode build I get

Xcode build done.                                           23,8s
Failed to build iOS app
Error (Xcode): Error: Couldn't resolve the package 'jitsi_meet_platform_interface' in 'package:jitsi_meet_platform_interface/jitsi_meet_platform_interface.dart'.

Could not build the application for the simulator.
Error launching application on iPad Pro (12.9-inch) (6th generation).

I wonder what I confused here ?
My original problem I believe is the same as yours, that I would love to import relative dependencies path inside the bundle's pubspec.yaml and get the very same error "is a relative path, but this isn't a local pubspec".
By the way how did you beautifully color the code sections in your comment ?

@mit-mit
Copy link
Member

mit-mit commented Feb 9, 2024

@sigurdm can you provide an update on this work?

@sigurdm
Copy link
Contributor

sigurdm commented Feb 9, 2024

Yeah - I have a PR with the functionality ready - but It is taking a few shortcuts, I need to sit down and find a cleaner way to do this. I hope to get around to do that soon...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants