question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] Fall back dependencies

See original GitHub issue

Short: I am looking for a proper way to have a primary and a secondary dependency. In the way that if primary is not there, then use secondary.

Long: Our product consists of tree parts: Foo, Zum and Baz. Each with sources in its own git repo. Zum and Baz, are libraries used by Foo.

When a either Zum, Baz and Foo is build from main branch, they are uploaded to stable channel. When build from some feature branch, they are uploaded to the experimental channel. ( we do have other branches and channels, but let’s keep it simple here)

So far a pretty common setup i think.

When I do development. I branch out on an feature branch, let’s say feature/greatThing, So far no issue. But often the work on a feature includes more than just the library or the main program.

So let’s say that my greatThing involves changes to Foo and Baz, but not Zum I created feature branches of same name in both Foo and Baz repos.

When I build Foo it must require the latest Baz build from my feature branch and latest Zum build from stable

I could take the tedious job of changing the conan file for Foo on the feature branch, and pray that I never forget to change it back when merging into stable.

But I would like to automate this, And was considering using the channels for this, thus making a channel for each feature, (easily done I would just reuse the branch name) So now my Foo should require Baz/[>0]@user/greatThing and Zum[>0]@user/stable

To do this automatically Foo somehow needs to know if Baz or Zum is available on the greatThing channel and if not require latest from stable.

I created this ugly hack.

    def requirements(self):
        mybuf = StringIO()
        self.run('conan search baz/*@user/greatThing --raw -r all', output=mybuf)
        if 'baz' in mybuf.getvalue() :
            self.requires( "baz/[>0, include_prerelease=True]@user/greatThing")
        else :
            self.requires( "baz/[>0, include_prerelease=True]@User/stable")

*In this example greatThing is hardcoded, in real code it is a variable, but I like to KISS. 😉

So now my question: Is this a missing feature in Conan, or is there another/better way to achieve the same?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DdOtzencommented, Mar 2, 2021

@memsharded regarding the run("conan... I agree and Is exactly why I am looking for other solution. 😉

I will dive into your link and get back.

0reactions
stevenvandenbrandenstiftcommented, Aug 13, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle dependency fallback - Stack Overflow
Is there a way to use fallback dependency in gradle. For example, there is dependency com.example.module:artifact:version .
Read more >
How an Ancient Philosophy Problem Explains Software ...
With fallback, the failure of B does not imply the failure of A. Does this mean that A does not depend on B?...
Read more >
Creating Question Dependency Rules - SurveyVista
Question Dependency Options. A logic rule enables the question branching mechanism to show or skip questions based on the criteria of a source...
Read more >
Filing an Online Dependency Claim Frequently Asked Questions
step children, and adopted children) ... electronic dependency claim through eBenefits allows VA to make ... You will be paid back from the...
Read more >
What is Dependency Testing? (Software Testing Interview ...
In this session, I have answered What is Dependency Testing?View Notes Here - http://www.evernote.com/l/AbHOvDAwaWFB7JvgEG-aTrkyK1XJjm6wZF0/
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found