Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-dev] How to get P2 dependency URL with tycho.

Hi Tobias
    Thank you very much! I archived all my targets. You hint was very valuable. You show me where is no solution. That significantly narrow my field of decisions and I save huge chunk of time.
I just rewrote a little DefaultEquinoxEmbedder and then right after resolution process:

    val agentClass = equinox.getClass.getClassLoader().loadClass("org.eclipse.equinox.p2.core.IProvisioningAgent")
    val remoteAgent = equinox.getService(agentClass).asInstanceOf[{ def getService(serviceName: String): AnyRef }]
    val remoteMetadataRepositoryManager = remoteAgent.getService(IMetadataRepositoryManager.SERVICE_NAME).asInstanceOf[IMetadataRepositoryManager]
    val remoteArtifactRepositoryManager = remoteAgent.getService(IArtifactRepositoryManager.SERVICE_NAME).asInstanceOf[IArtifactRepositoryManager]
    val repos = remoteArtifactRepositoryManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)
    for (i <- repos) {
      val x = remoteArtifactRepositoryManager.loadRepository(i, null) <---- Hurray!!! Bingo. All bundles per URL + bundles with source code as a bonus!!! Wow
      System.err.println("!!!" + x)
    }

Only few lines, splendid. I will buy to you your favorite alcohol drink (or cup of coffee, tea, chai, cocoa, etc.) if there will be occasion ;-)

Thank you for help.
Alexey


2013/5/6 Oberlies, Tobias <tobias.oberlies@xxxxxxx>

From your code snippet, it seems that you already got the shortest way to make Tycho download artifacts – by doing the full target platform & resolve cycle.

 

But this will probably improve in the near future: I need to simplify things for Tycho (https://bugs.eclipse.org/bugs/show_bug.cgi?id=393004 ), and you may be able to directly use the new MirroringArtifactProvider to simply download the artifacts you want. Note that all this isn’t in master yet, but you can see a prototype in Gerrit (see link in the bug). I’ll probably also post an updated patch in the next couple of days.

 

Regards

Tobias

 

 

From: tycho-dev-bounces@xxxxxxxxxxx [mailto:tycho-dev-bounces@xxxxxxxxxxx] On Behalf Of Alexey Aksenov
Sent: Montag, 6. Mai 2013 15:10
To: Tycho developers list
Subject: Re: [tycho-dev] How to get P2 dependency URL with tycho.

 

Hi Tobias,

    Thank you for interest in my problem. My little application is not OSGi. Tycho team already do some work for integration OSGi with "the real world of classpath hell". IMHO most effective way is to reuse components, not to create my own. My "resolve" function already download artifacts. I just want to reduce it functionality a bit.
Some people write there own class loaders on second day. But I know that this is not fun for them. Sure that they have a lot of other problems.
    I must to pass URLs to external resolution mechanism. Please just point me to the right chunk of source code in Tycho infrastructure. I may spent a lot of time to read it all page by page.

My thankfulness will be unlimited. Within reasonable limits of course ;-)

Thank you,
Alexey

 

2013/5/6 Oberlies, Tobias <tobias.oberlies@xxxxxxx>

Hi Alexey,

 

I don’t know if writing your own resolver is really the next step you want to do after having done the Hello World example. This is a bit like writing your own class loader on the second day of a Java beginners course… ;-)

 

So if you are only interested in downloading p2 artifacts to the Maven repository? Why don’t you just trigger a Tycho build to do this for you, and then do whatever you like with the artifacts cached by Tycho?

 

Regards

Tobias

 

 

From: tycho-dev-bounces@xxxxxxxxxxx [mailto:tycho-dev-bounces@xxxxxxxxxxx] On Behalf Of Alexey Aksenov
Sent: Montag, 6. Mai 2013 14:39
To: tycho-dev@xxxxxxxxxxx
Subject: [tycho-dev] How to get P2 dependency URL with tycho.

 

Hi All.

I read tycho helloworld documentation and write my own resolver. I run maven as embedded library. This way allow to download P2 bundles to .m2 directory :-)
The problem is I don't want to download dependency. I want to know dependency URL!?? Huh!
I resolve P2 dependency with the following simple function (I like Scala, but this is not significant):

def resolve2(maven: Maven, log: Logger) {
    val equinox = maven.lookup(classOf[EquinoxServiceFactory])
    val resolverFactory = equinox.getService(classOf[P2ResolverFactory])
    val targetPlatformBuilder = resolverFactory.createTargetPlatformBuilder(
      new ExecutionEnvironmentConfigurationStub("JavaSE-1.6"))
    targetPlatformBuilder.addP2Repository(new MavenRepositoryLocation("test", new URL("http://eclipse.ialto.com/eclipse/updates/4.2/R-4.2.1-201209141800/").toURI))
    val targetPlatform = targetPlatformBuilder.buildTargetPlatform()
    val resolver = resolverFactory.createResolver(new MavenLoggerAdapter(maven.plexus.getLogger, true))
    val result = resolver.resolveDependencies(targetPlatform, null)
    System.err.println("!!!" + result)
  }

There is a lot of components involved in the process. So, I need a little hint that point me to the right direction. What is class (or package) responsible for a dependency URL resolution/collection?

Regards,
Alexey


_______________________________________________
tycho-dev mailing list
tycho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-dev

 


_______________________________________________
tycho-dev mailing list
tycho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-dev



Back to the top