Skip to content

Commit

Permalink
Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeust committed Dec 18, 2015
1 parent 9aca808 commit 767b617
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ local.properties
classes
libs
.kobalt/
build/
./build/
out
.DS_Store
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -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)
}
}
}

0 comments on commit 767b617

Please sign in to comment.