Open jGleitz opened 8 years ago
For anybody interested, I managed to add update sites to look for dependencies like this: (heavily inspired by #9):
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath group: 'org.akhikhl.wuff', name: 'wuff-plugin', version: '+'
classpath group: 'de.undercouch', name: 'gradle-download-task', version: '+'
classpath group: 'org.apache.ivy', name: 'ivy', version: '+'
}
}
import org.akhikhl.wuff.EclipseBundlePlugin
import de.undercouch.gradle.tasks.download.DownloadTaskPlugin
import org.apache.ivy.util.url.ApacheURLLister
apply plugin: EclipseBundlePlugin
apply plugin: DownloadTaskPlugin
def lister = new ApacheURLLister()
def downloadUpdatesite
/**
* Recursivly downloads an update site.
*/
downloadUpdatesite = { URL url, destinationDir ->
file(destinationDir).mkdirs()
project.download {
src lister.listFiles(url)
dest destinationDir
}
for (folder in lister.listDirectories(url)) {
def destPart = url.toURI().relativize(folder.toURI()).toString()
downloadUpdatesite folder, "$destinationDir/$destPart"
}
}
/**
* Downloads an update site and provides a path to it to be used by wuff.
*
* @param url The update site’s url.
*/
def updatesite = { url ->
// create a folder name out of the URL
def dirName = url.replaceAll("[^a-zA-Z0-9.-]", "_")
def wuffDir = project.wuff.wuffDir ?: System.getProperty('user.home') + '/.wuff'
// imitate unpuzzle’s checksum mechanism
def checksumFile = file("$wuffDir/downloaded-checksums/${dirName}.md5")
checksumFile.parentFile.mkdirs()
def destinationDir = "$wuffDir/unpacked/$dirName"
if (!checksumFile.exists() || !file(destinationDir).isDirectory()) {
downloadUpdatesite new URL(url), destinationDir
// unpuzzle’s dummy checksum
checksumFile.text = 'deadbea1'
}
return "file://$destinationDir"
}
project.wuff {
selectedEclipseVersion = '4.5'
eclipseVersion('4.5') {
sources {
/*
* Configure all update sites to get dependency plugins from here.
*/
source updatesite("https://sdqweb.ipd.kit.edu/eclipse/palladiosimulator/nightly/aggregate/")
}
}
}
It simply downloads the whole update site and makes it available to wuff.
Obviously, this is far from perfect. If adding update sites for bundle sources would be supported (or somebody told me how to do this) I’d be very happy.
@jGleitz your solution works pretty well when your P2 update site exposes index information for lister to consume. However, many update sites do not return index information and we fail with a "Please provide a download source" message.
For instance http://download.eclipse.org/eclipse/updates/4.5 fails with your code.
@izreal: I know that. But there is even a hack for the hack!
artefacts.jar
. In the case of http://download.eclipse.org/eclipse/updates/4.5, you can hit “Show Directory Contents” to navigate to R-4.5.1-201509040015/artefacts.jar
artefacts.xml
and search for a property p2.mirrorsURL
.I know that this is super dirty – but it works.
I am very sorry if I’m missing a major point here. But I’ve read all of this project’s wiki pages and tried a lot of things, but still can figure it out:
In our
MANIFEST.MF
, we require the Apache Commons:If we try to build that using wuff, we get:
Now on one hand it’s totally clear what’s happening here:
lang3
is not part of a default Eclipse installation. But: How do we solve this? We do not want to include the jar of the Apache Commons in our project, because we believe this is not how it’s supposed to work. We want to declare the dependency inMANIFEST.ML
.I expected to be able to point wuff to a target platform definition so it can retrieve further plugins from there, but I found no such option?
How do we point wuff where to get this plugin from?
This might be related to #75 and #98