From 6094528f32c1adaaeb2211eb0b8f8d87b2f4e7e3 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Fri, 6 Nov 2015 19:50:38 -0800 Subject: [PATCH] Warnings. --- .../kobalt/internal/remote/KobaltClient.kt | 9 +------- .../com/beust/kobalt/misc/KobaltLogger.kt | 2 +- .../kobalt/plugin/android/AndroidPlugin.kt | 2 +- .../plugin/packaging/PackagingPlugin.kt | 1 - .../beust/kobalt/plugin/publish/JCenterApi.kt | 23 ++++++++----------- 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/main/kotlin/com/beust/kobalt/internal/remote/KobaltClient.kt b/src/main/kotlin/com/beust/kobalt/internal/remote/KobaltClient.kt index 0755457d..01cefe59 100644 --- a/src/main/kotlin/com/beust/kobalt/internal/remote/KobaltClient.kt +++ b/src/main/kotlin/com/beust/kobalt/internal/remote/KobaltClient.kt @@ -1,22 +1,17 @@ package com.beust.kobalt.internal.remote -import com.beust.kobalt.Args import com.beust.kobalt.SystemProperties -import com.beust.kobalt.kotlin.BuildFileCompiler -import com.beust.kobalt.mainNoExit import com.beust.kobalt.misc.log import com.google.gson.Gson import com.google.gson.JsonObject import com.google.gson.JsonParser -import javax.inject.Inject import java.io.BufferedReader -import java.io.BufferedWriter import java.io.InputStreamReader import java.io.PrintWriter import java.net.ConnectException import java.net.Socket import java.nio.file.Paths -import java.util.concurrent.Executors +import javax.inject.Inject public class KobaltClient @Inject constructor() : Runnable { var outgoing: PrintWriter? = null @@ -32,8 +27,6 @@ public class KobaltClient @Inject constructor() : Runnable { outgoing = PrintWriter(socket.outputStream, true) val testBuildfile = Paths.get(SystemProperties.homeDir, "java", "testng", "Build.kt") .toFile().absolutePath - val testBuildfile2 = Paths.get(SystemProperties.homeDir, "java", "jcommander", "Build.kt") - .toFile().absolutePath val c : String = "{ \"name\":\"GetDependencies\", \"buildFile\": \"$testBuildfile\"}" outgoing!!.println(c) val ins = BufferedReader(InputStreamReader(socket.inputStream)) diff --git a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt index c48fb871..a3507f42 100644 --- a/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt +++ b/src/main/kotlin/com/beust/kobalt/misc/KobaltLogger.kt @@ -55,7 +55,7 @@ class Logger(val dev: Boolean) { final fun warn(tag: String, message: String, e: Throwable? = null) = - println(getPattern("W", "***** WARNING ", tag, message)) + println(getPattern("W", "***** WARNING ${e?.message}", tag, message)) final fun log(tag: String, message: String, newLine: Boolean) = with(getPattern("L", "", tag, message)) { diff --git a/src/main/kotlin/com/beust/kobalt/plugin/android/AndroidPlugin.kt b/src/main/kotlin/com/beust/kobalt/plugin/android/AndroidPlugin.kt index 7a38dc0d..34504a2e 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/android/AndroidPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/android/AndroidPlugin.kt @@ -69,7 +69,7 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler) : val version = configurations[project.name!!]?.buildToolsVersion if (OperatingSystem.current().isWindows()) { if (version == "22.0.1" || version == "23.0.1") { - return version as String + return version } else { return "build-tools-$version" } 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 9aeaa2d2..23818238 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/packaging/PackagingPlugin.kt @@ -221,7 +221,6 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana includedFiles: List, expandJarFiles : Boolean = false, outputStreamFactory: (OutputStream) -> ZipOutputStream = DEFAULT_STREAM_FACTORY) : File { - val buildDir = KFiles.makeDir(project.directory, project.buildDirectory!!) val fullArchiveName = archiveName ?: arrayListOf(project.name!!, project.version!!).joinToString("-") + suffix val archiveDir = libsDir(project) val result = File(archiveDir.path, fullArchiveName) diff --git a/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt b/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt index e9f22044..02234875 100644 --- a/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt +++ b/src/main/kotlin/com/beust/kobalt/plugin/publish/JCenterApi.kt @@ -6,16 +6,16 @@ import com.beust.kobalt.maven.Gpg import com.beust.kobalt.maven.Http import com.beust.kobalt.maven.KobaltException import com.beust.kobalt.maven.Md5 -import com.beust.kobalt.misc.* -import com.google.gson.Gson +import com.beust.kobalt.misc.KobaltExecutors +import com.beust.kobalt.misc.error +import com.beust.kobalt.misc.log +import com.beust.kobalt.misc.warn import com.google.gson.JsonObject import com.google.gson.JsonParser import com.google.inject.assistedinject.Assisted import com.squareup.okhttp.Response import org.jetbrains.annotations.Nullable -import java.io.ByteArrayInputStream import java.io.File -import java.nio.charset.Charset import javax.inject.Inject data class JCenterPackage(val jo: JsonObject) { @@ -34,15 +34,12 @@ open public class UnauthenticatedJCenterApi @Inject constructor(open val http: H // return Parser().parse(ByteArrayInputStream(response.toByteArray(Charset.defaultCharset()))) as JsonObject } - fun getPackage(name: String) : JCenterPackage { - val url = arrayListOf(BINTRAY_URL_API, "packages", "cbeust", "maven", "kobalt").joinToString("/") - val response = http.get(url).getAsString() - val result = parseResponse(response) - return JCenterPackage(result) - } - - val kobaltPackage : JCenterPackage - get() = getPackage("kobalt") +// fun getPackage() : JCenterPackage { +// val url = arrayListOf(BINTRAY_URL_API, "packages", "cbeust", "maven", "kobalt").joinToString("/") +// val response = http.get(url).getAsString() +// val result = parseResponse(response) +// return JCenterPackage(result) +// } } public class JCenterApi @Inject constructor (@Nullable @Assisted("username") val username: String?,