On 3 Sep 2014, at 7:13 am, Tobias Schulte <tobias.schu...@gliderpilot.de> wrote:

> Hello,
> 
> for the gradle plugin wuff there exists one issue to support p2 repositories 
> (https://github.com/akhikhl/wuff/issues/9). But I am not sure if this can be 
> implemented in a plugin -- at least if one wants to have a dsl like
> 
>    repositories {
>        p2 { url 'http://download.eclipse.org/releases/luna/' }
>    }
> 
> IMHO the only way to get the above from a plugin would be to use 
> meta-programming. Sure, I could create an extension named p2 on 
> project.repositories with a method url, but I might want to support
> 
>    repositories {
>        p2 {
>            url 'http://download.eclipse.org/releases/luna'
>            unit id: 'org.eclipse.foo', version: '1.5'
>            unit id: 'org.eclipse.bar', version: '2.3'
>        }
>    }
> 
> to restrict the repository to some installable units, or define a name
> 
>    repositories {
>        p2 {
>            name 'luna'
>            url 'http://download.eclipse.org/releases/luna'
>        }
>    }
> 
> From my understanding of the current implementation of repositories.maven and 
> repositories.ivy, if I wanted to implement a p2 repository access in 
> gradle-core, I would start by adding a new method p2 to 
> DefaultRepositoryHandler, implementing it like the maven and ivy support, 
> maybe even delegating to a pattern based ivy repository to download the 
> artifacts and only implement some logic to read the artifacts.jar, 
> content.jar, compositeContent.jar and compositeArtifacts.jar. Is this the way 
> to go?
> 
> Or will 
> https://github.com/gradle/gradle/blob/master/design-docs/repository-extensibility.md
>  allow to implement this with less problems?
> 
> What do you think?

I think you’d have to change Gradle core in some way to make this work well. 
There are two approaches:

1. Implement RepositoryHandler.p2() and all the related stuff in Gradle core in 
the same way as maven() or ivy().
2. Add some public APIs to Gradle core that would allow a repository 
implementation to be provided by a plugin, and then implement p2 support in 
some new ‘p2' plugin.


--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
CTO Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com



Reply via email to