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