Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created buildinfo task (#78) #79

Merged
merged 1 commit into from
Jun 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@ task generateVersion {
}
}

task buildInfo {
group = "JPF Build Properties"
description = "Creates build info properties."
doLast {

// Must fail if there are uncommitted changes
def status = "git status --short".execute().text.trim()
if (!status.isEmpty()) {
throw new GradleException("There are uncomitted changes:\n " + status)
}
Properties info = new Properties()

def revision = "git rev-parse --short HEAD".execute().text.trim()
def userName = ["git", "log", "-1", "--format=%an <%ae>"].execute().text.trim()
def date = "git log -1 --format=%ci".execute().text.trim()

info.setProperty("revision", revision)
info.setProperty("date", date)
info.setProperty("author", userName)
info.setProperty("os.arch", System.getProperty("os.arch"))
info.setProperty("os.name", System.getProperty("os.name"))
info.setProperty("user.country", System.getProperty("user.country"))
info.setProperty("java.version", System.getProperty("java.version"))

def writer = new File("build.properties").newWriter("utf-8")
info.store(writer, "JPF core build info")
writer.close()
}
}

task compile(type: Copy) {
group = "JPF Build"
description = "Compiles all JPF core sources."
Expand Down