mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Warnings.
This commit is contained in:
parent
639c0249a4
commit
732f17b7b7
12 changed files with 19 additions and 25 deletions
|
@ -93,7 +93,7 @@ private class Main @Inject constructor(
|
|||
|
||||
var result = 0
|
||||
val latestVersionFuture = github.latestKobaltVersion
|
||||
val seconds = benchmark("build", {
|
||||
val seconds = benchmark {
|
||||
try {
|
||||
result = runWithArgs(jc, args, argv)
|
||||
} catch(ex: KobaltException) {
|
||||
|
@ -102,7 +102,7 @@ private class Main @Inject constructor(
|
|||
} finally {
|
||||
executors.shutdown()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
log(1, if (result != 0) "BUILD FAILED: $result" else "BUILD SUCCESSFUL ($seconds seconds)")
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.beust.kobalt.api.*
|
|||
import com.beust.kobalt.maven.dependency.FileDependency
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.KobaltExecutors
|
||||
import com.beust.kobalt.misc.warn
|
||||
import com.google.common.collect.ArrayListMultimap
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
@ -98,12 +97,7 @@ public class DependencyManager @Inject constructor(val executors: KobaltExecutor
|
|||
it.project.name == project?.name
|
||||
}.forEach { pd ->
|
||||
pd.dependsOn.forEach { p ->
|
||||
val classesDir = p.classesDir(context)
|
||||
if (classesDir != null) {
|
||||
result.add(FileDependency(KFiles.joinDir(p.directory, classesDir)))
|
||||
} else {
|
||||
warn("Couldn't find any classes dir for project depended on ${p.name}")
|
||||
}
|
||||
result.add(FileDependency(KFiles.joinDir(p.directory, p.classesDir(context))))
|
||||
val otherDependencies = calculateDependencies(p, context, projectDescriptions,
|
||||
p.compileDependencies)
|
||||
result.addAll(otherDependencies)
|
||||
|
|
|
@ -52,7 +52,7 @@ public class PomGenerator @Inject constructor(@Assisted val project: Project) {
|
|||
val s = StringWriter()
|
||||
MavenXpp3Writer().write(s, m)
|
||||
|
||||
val buildDir = KFiles.makeDir(project.directory, project.buildDirectory!!)
|
||||
val buildDir = KFiles.makeDir(project.directory, project.buildDirectory)
|
||||
val outputDir = KFiles.makeDir(buildDir.path, "libs")
|
||||
val mavenId = MavenId.create(project.group!!, project.artifactId!!, project.packaging, project.version!!)
|
||||
val pomFile = SimpleDep(mavenId).toPomFileName()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.beust.kobalt.misc
|
||||
|
||||
public fun benchmark(message: String, run: () -> Unit) : Long {
|
||||
public fun benchmark(run: () -> Unit) : Long {
|
||||
val start = System.currentTimeMillis()
|
||||
run()
|
||||
return (System.currentTimeMillis() - start) / 1000
|
||||
|
|
|
@ -29,7 +29,7 @@ class LocalProperties {
|
|||
|
||||
fun get(name: String, docUrl: String? = null) : String {
|
||||
this.docUrl = docUrl
|
||||
val result = localProperties[name]
|
||||
val result = localProperties.getProperty(name)
|
||||
?: throw KobaltException("Couldn't find $name in local.properties", docUrl = docUrl)
|
||||
return result as String
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.beust.kobalt.plugin.android
|
||||
|
||||
import com.beust.kobalt.Variant
|
||||
import com.beust.kobalt.api.KobaltContext
|
||||
import com.beust.kobalt.api.Project
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
|
||||
|
@ -12,7 +11,7 @@ class AndroidFiles {
|
|||
fun intermediates(project: Project) = KFiles.joinDir(project.directory, project.buildDirectory,
|
||||
"intermediates")
|
||||
|
||||
fun manifest(project: Project, context: KobaltContext) : String {
|
||||
fun manifest(project: Project) : String {
|
||||
return KFiles.joinDir(project.directory, "src/main", "AndroidManifest.xml")
|
||||
}
|
||||
|
||||
|
@ -21,10 +20,10 @@ class AndroidFiles {
|
|||
return KFiles.joinDir(dir, "AndroidManifest.xml")
|
||||
}
|
||||
|
||||
fun mergedResourcesNoVariant(project: Project, variant: Variant) =
|
||||
fun mergedResourcesNoVariant(project: Project) =
|
||||
KFiles.joinAndMakeDir(AndroidFiles.intermediates(project), "res", "merged")
|
||||
|
||||
fun mergedResources(project: Project, variant: Variant) =
|
||||
KFiles.joinAndMakeDir(mergedResourcesNoVariant(project, variant), variant.toIntermediateDir())
|
||||
KFiles.joinAndMakeDir(mergedResourcesNoVariant(project), variant.toIntermediateDir())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,8 +254,6 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler, v
|
|||
// Call dx to generate classes.dex
|
||||
//
|
||||
val buildToolsDir = buildToolsVersion(project)
|
||||
val dx = "${androidHome(project)}/build-tools/$buildToolsDir/dx" +
|
||||
if (OperatingSystem.current().isWindows()) ".bat" else ""
|
||||
val classesDexDir = KFiles.joinDir(AndroidFiles.intermediates(project), "dex",
|
||||
context.variant.toIntermediateDir())
|
||||
File(classesDexDir).mkdirs()
|
||||
|
@ -388,12 +386,12 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler, v
|
|||
|
||||
// IRunContributor
|
||||
override fun affinity(project: Project, context: KobaltContext): Int {
|
||||
val manifest = AndroidFiles.manifest(project, context)
|
||||
val manifest = AndroidFiles.manifest(project)
|
||||
return if (File(manifest).exists()) IAffinity.DEFAULT_POSITIVE_AFFINITY else 0
|
||||
}
|
||||
|
||||
override fun run(project: Project, context: KobaltContext, classpath: List<IClasspathDependency>): TaskResult {
|
||||
val manifest = AndroidFiles.manifest(project, context)
|
||||
val manifest = AndroidFiles.manifest(project)
|
||||
FileInputStream(File(manifest)).use { ins ->
|
||||
// adb shell am start -n com.package.name/com.package.name.ActivityName
|
||||
val manifest = AndroidManifest(ins)
|
||||
|
|
|
@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlValue
|
|||
*/
|
||||
class Merger @Inject constructor() {
|
||||
fun merge(project: Project, context: KobaltContext) {
|
||||
File(AndroidFiles.mergedResourcesNoVariant(project, context.variant)).deleteRecursively()
|
||||
File(AndroidFiles.mergedResourcesNoVariant(project)).deleteRecursively()
|
||||
mergeResources(project, context.variant)
|
||||
mergeAndroidManifest(project, context.variant)
|
||||
log(2, "All done merging")
|
||||
|
|
|
@ -92,10 +92,12 @@ class ApplicationPlugin @Inject constructor(val executors: KobaltExecutors,
|
|||
|
||||
private fun runJarFile(project: Project, config: ApplicationConfig) : TaskResult {
|
||||
val jarName = project.projectProperties.get(PackagingPlugin.JAR_NAME) as String
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val packages = project.projectProperties.get(PackagingPlugin.PACKAGES) as List<PackageConfig>
|
||||
val allDeps = arrayListOf(jarName)
|
||||
val java = JavaInfo.create(File(SystemProperties.javaBase)).javaExecutable!!
|
||||
if (! isFatJar(packages, jarName)) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val projDeps = project.projectProperties.get(JvmCompilerPlugin.DEPENDENT_PROJECTS)
|
||||
as List<ProjectDescription>
|
||||
// If the jar file is not fat, we need to add the transitive closure of all dependencies
|
||||
|
|
|
@ -97,7 +97,7 @@ class KotlinCompiler @Inject constructor(val localRepo : LocalRepo,
|
|||
*/
|
||||
private fun compilerFirst(list: List<File>): List<File> {
|
||||
val result = arrayListOf<File>()
|
||||
list.forEach { it
|
||||
list.forEach {
|
||||
if (it.name.startsWith("kotlin-")) result.add(0, it)
|
||||
else result.add(it)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.beust.kobalt.api.annotation.Task
|
|||
import com.beust.kobalt.glob
|
||||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.api.IClasspathDependency
|
||||
import com.beust.kobalt.maven.LocalRepo
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
import com.beust.kobalt.misc.KobaltExecutors
|
||||
|
@ -171,6 +170,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
|||
log(2, "Creating fat jar")
|
||||
|
||||
val seen = hashSetOf<String>()
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val dependentProjects = project.projectProperties.get(JvmCompilerPlugin.DEPENDENT_PROJECTS)
|
||||
as List<ProjectDescription>
|
||||
listOf(dependencyManager.calculateDependencies(project, context, dependentProjects,
|
||||
|
@ -204,7 +204,7 @@ class PackagingPlugin @Inject constructor(val dependencyManager : DependencyMana
|
|||
true /* expandJarFiles */, jarFactory)
|
||||
}
|
||||
|
||||
private fun buildDir(project: Project) = KFiles.makeDir(project.directory, project.buildDirectory!!)
|
||||
private fun buildDir(project: Project) = KFiles.makeDir(project.directory, project.buildDirectory)
|
||||
|
||||
private fun findIncludedFiles(directory: String, files: List<IncludedFile>, excludes: List<IFileSpec.Glob>)
|
||||
: List<IncludedFile> {
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.io.File
|
|||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Suppress("VARIABLE_WITH_REDUNDANT_INITIALIZER")
|
||||
@Singleton
|
||||
public class PublishPlugin @Inject constructor(val files: KFiles, val factory: PomGenerator.IFactory,
|
||||
val jcenterFactory: JCenterApi.IFactory, val github: GithubApi, val localProperties: LocalProperties)
|
||||
|
@ -100,7 +101,7 @@ public class PublishPlugin @Inject constructor(val files: KFiles, val factory: P
|
|||
// Upload to Maven
|
||||
//
|
||||
val trMaven = jcenter.uploadMaven(project, findArtifactFiles(project), configuration)
|
||||
var success = trMaven.success
|
||||
success = trMaven.success
|
||||
if (! success) messages.add(trMaven.errorMessage!!)
|
||||
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue