From ee3a1839f784e5d7aac9cebe36b139703fb97743 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 4 Nov 2015 23:31:15 -0800 Subject: [PATCH] Make relative paths work. --- kobalt/src/Build.kt | 5 +++-- .../com/beust/kobalt/kotlin/BuildFileCompiler.kt | 15 --------------- .../kobalt/plugin/packaging/PackagingPlugin.kt | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt index d853ce72..76631dca 100644 --- a/kobalt/src/Build.kt +++ b/kobalt/src/Build.kt @@ -1,6 +1,7 @@ -import com.beust.kobalt.* + import com.beust.kobalt.api.License import com.beust.kobalt.api.Scm +import com.beust.kobalt.homeDir import com.beust.kobalt.internal.test import com.beust.kobalt.plugin.java.javaCompiler import com.beust.kobalt.plugin.java.javaProject @@ -33,7 +34,7 @@ fun readVersion() : String { val wrapper = javaProject { name = "kobalt-wrapper" version = readVersion() - directory = homeDir("kotlin/kobalt/modules/wrapper") + directory = "modules/wrapper" javaCompiler { args("-source", "1.7", "-target", "1.7") diff --git a/src/main/kotlin/com/beust/kobalt/kotlin/BuildFileCompiler.kt b/src/main/kotlin/com/beust/kobalt/kotlin/BuildFileCompiler.kt index e8d74cf8..3ecae1f4 100644 --- a/src/main/kotlin/com/beust/kobalt/kotlin/BuildFileCompiler.kt +++ b/src/main/kotlin/com/beust/kobalt/kotlin/BuildFileCompiler.kt @@ -44,21 +44,6 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b val allProjects = findProjects() - // - // Force each project.directory to be an absolute path, if it's not already - // - allProjects.forEach { - val fd = File(it.directory) - if (! fd.isAbsolute) { - it.directory = - if (args.buildFile != null) { - KFiles.findDotDir(File(args.buildFile)).parentFile.absolutePath - } else { - fd.absolutePath - } - } - } - plugins.applyPlugins(context, allProjects) return allProjects } diff --git a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt index b25f74e2..9aeaa2d2 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt @@ -132,7 +132,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana // If no includes were specified, assume the user wants a simple jar file made of the // classes of the project, so we specify a From("build/classes/"), To("") and // a list of files containing everything under it - val relClassesDir = Paths.get(project.directory).relativize(Paths.get(classesDir.absolutePath + "/")) + val relClassesDir = Paths.get(project.directory).relativize(Paths.get(classesDir.path)) val prefixPath = Paths.get(project.directory).relativize(Paths.get(classesDir.path + "/")) // Class files