From d4c51cb6baa9195a06b46df0f0e7c20106130e94 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 7 Oct 2015 01:07:51 -0700 Subject: [PATCH] Support parent poms. --- TODO | 4 +++ kobalt/wrapper/kobalt-wrapper.jar | Bin 6149 -> 6149 bytes kobalt/wrapper/kobalt-wrapper.properties | 2 +- .../beust/kobalt/maven/DependencyManager.kt | 3 ++- .../com/beust/kobalt/maven/MavenDependency.kt | 8 ++++-- .../com/beust/kobalt/maven/RepoFinder.kt | 23 +++++++++++++----- src/main/resources/kobalt.properties | 2 +- 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 63e1e2ef..35b5b160 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,8 @@ To do: +- Link kobalt to JCenter +- --update +- --resolve - ProjectGenerator: support migration from pom.xml (starting with dependencies) - Generate .idea and other IDEA files - Make files appear in download list automatically on bintray (undocumented API) @@ -22,6 +25,7 @@ To do: Done: +- Support .pom pointing to other deps (and no jars) - provided scope - --dryRun - --init: import dependencies from pom.xml diff --git a/kobalt/wrapper/kobalt-wrapper.jar b/kobalt/wrapper/kobalt-wrapper.jar index 03c34295f76ae63eaf1e614aec3abb4571c2baf5..4c3c9b4ba9add4ff76a75de0cb70acee666703bd 100644 GIT binary patch delta 55 zcmZoQXf@ys@MdNaVc_84V3@?=zLEF3D7PsKLx49shxyB#mdWo$XE6iCC-;cmWdRH1 Hiq8N5ftwJy delta 55 zcmZoQXf@ys@MdNaVc_84U|`^O+sJ!el-rP = CacheBuilder.newBuilder() @@ -83,16 +84,26 @@ public class RepoFinder @Inject constructor(val http: Http, val executors: Kobal val dep = SimpleDep(c[0], c[1], c[2]) val snapshotVersion = findSnapshotVersion(dep.toMetadataXmlPath(false), repoUrl) if (snapshotVersion != null) { - return RepoResult(repoUrl, true, c[2], snapshotVersion) + return RepoResult(repoUrl, true, c[2], true /* hasJar, potential bug here */, snapshotVersion) } else { return RepoResult(repoUrl, false, "") } } else { val dep = SimpleDep(c[0], c[1], c[2]) - val url = repoUrl + "/" + dep.toJarFile(dep.version) - val body = http.get(url) - log(2, "Result for ${repoUrl} for ${id}: ${body.code == 200}") - return RepoResult(repoUrl, body.code == 200, dep.version) + // Try to find the jar file + val urlJar = repoUrl + dep.toJarFile(dep.version) + val hasJar = http.get(urlJar).code == 200 + + val found = + if (! hasJar) { + // No jar, try to find the directory + val url = repoUrl + File(dep.toJarFile(dep.version)).parentFile.path + http.get(url).code == 200 + } else { + true + } + log(2, "Result for $repoUrl for $id: $found") + return RepoResult(repoUrl, found, dep.version, hasJar) } } } diff --git a/src/main/resources/kobalt.properties b/src/main/resources/kobalt.properties index afd8368a..5a3e80e4 100644 --- a/src/main/resources/kobalt.properties +++ b/src/main/resources/kobalt.properties @@ -1 +1 @@ -kobalt.version=0.148 \ No newline at end of file +kobalt.version=0.151 \ No newline at end of file