mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57:12 -07:00
Fix build.
This commit is contained in:
parent
9aca80800b
commit
767b617638
3 changed files with 38 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,6 +9,6 @@ local.properties
|
||||||
classes
|
classes
|
||||||
libs
|
libs
|
||||||
.kobalt/
|
.kobalt/
|
||||||
build/
|
./build/
|
||||||
out
|
out
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.beust.kobalt.internal.build
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
import java.nio.file.attribute.BasicFileAttributes
|
||||||
|
/**
|
||||||
|
* Sometimes, build files are moved to temporary files, so we give them a specific name for clarity.
|
||||||
|
*/
|
||||||
|
class BuildFile(val path: Path, val name: String) {
|
||||||
|
public fun exists() : Boolean = Files.exists(path)
|
||||||
|
|
||||||
|
public val lastModified : Long
|
||||||
|
get() = Files.readAttributes(path, BasicFileAttributes::class.java).lastModifiedTime().toMillis()
|
||||||
|
|
||||||
|
public val directory : File get() = path.toFile().directory
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.beust.kobalt.internal.build
|
||||||
|
|
||||||
|
import com.beust.kobalt.api.Kobalt
|
||||||
|
import com.beust.kobalt.misc.KFiles
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class VersionFile {
|
||||||
|
companion object {
|
||||||
|
private val VERSION_FILE = "version.txt"
|
||||||
|
|
||||||
|
fun generateVersionFile(directory: File) {
|
||||||
|
KFiles.saveFile(File(directory, VERSION_FILE), Kobalt.version)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isSameVersionFile(directory: File) =
|
||||||
|
with(File(directory, VERSION_FILE)) {
|
||||||
|
! exists() || (exists() && readText() == Kobalt.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue