mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-01 06:29:53 +00:00
Release package building script
This commit is contained in:
parent
5d6be83499
commit
474639760a
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,6 +4,7 @@ target/
|
||||
project/target
|
||||
project/project/target/
|
||||
stuff
|
||||
releases
|
||||
|
||||
# hidden files
|
||||
*.~
|
||||
@ -11,6 +12,8 @@ stuff
|
||||
# compiled Scala files
|
||||
*.jar
|
||||
*.class
|
||||
*.zip
|
||||
*.js
|
||||
|
||||
# compiled Millfork files
|
||||
*.prg
|
||||
|
32
build.sbt
32
build.sbt
@ -32,4 +32,34 @@ lazy val root = (project in file(".")).
|
||||
settings(
|
||||
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
|
||||
buildInfoPackage := "millfork.buildinfo"
|
||||
)
|
||||
)
|
||||
|
||||
import sbtassembly.AssemblyKeys
|
||||
|
||||
val releaseDist = TaskKey[File]("release-dist", "Creates a distributable zip file.")
|
||||
|
||||
releaseDist := {
|
||||
val jar = AssemblyKeys.assembly.value
|
||||
val base = Keys.baseDirectory.value
|
||||
val target = Keys.target.value
|
||||
val name = Keys.name.value
|
||||
val version = Keys.version.value
|
||||
val distDir = target / (name + "-" + version)
|
||||
val releasesDir = base / "releases"
|
||||
val zipFile = releasesDir / (name + "-" + version + ".zip")
|
||||
IO.delete(zipFile)
|
||||
IO.delete(distDir)
|
||||
IO.createDirectory(releasesDir)
|
||||
IO.createDirectory(distDir)
|
||||
IO.copyFile(jar, distDir / jar.name)
|
||||
def copyDir(name: String): Unit = {
|
||||
IO.createDirectory(distDir / name)
|
||||
IO.copyDirectory(base / name, distDir / name)
|
||||
}
|
||||
copyDir("include")
|
||||
copyDir("doc")
|
||||
def entries(f: File): List[File] = f :: (if (f.isDirectory) IO.listFiles(f).toList.flatMap(entries) else Nil)
|
||||
IO.zip(entries(distDir).map(d => (d, d.getAbsolutePath.substring(distDir.getParent.length + 1))), zipFile)
|
||||
IO.delete(distDir)
|
||||
zipFile
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user