=doc #3689 zip samples and upload to s3
This commit is contained in:
parent
5a019c0a7a
commit
3a04c89945
3 changed files with 58 additions and 7 deletions
49
project/ActivatorDist.scala
Normal file
49
project/ActivatorDist.scala
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
package akka
|
||||
|
||||
import sbt._
|
||||
import sbt.Keys._
|
||||
import sbt.classpath.ClasspathUtilities
|
||||
import sbt.Project.Initialize
|
||||
import java.io.File
|
||||
|
||||
object ActivatorDist {
|
||||
|
||||
val activatorDistDirectory = SettingKey[File]("activator-dist-directory")
|
||||
val activatorDist = TaskKey[File]("activator-dist", "Create a zipped distribution of each activator sample.")
|
||||
|
||||
lazy val settings: Seq[Setting[_]] = Seq(
|
||||
activatorDistDirectory <<= crossTarget / "activator-dist",
|
||||
activatorDist <<= activatorDistTask
|
||||
)
|
||||
|
||||
def aggregatedProjects(projectRef: ProjectRef, structure: Load.BuildStructure): Seq[ProjectRef] = {
|
||||
val aggregate = Project.getProject(projectRef, structure).toSeq.flatMap(_.aggregate)
|
||||
aggregate flatMap { ref =>
|
||||
ref +: aggregatedProjects(ref, structure)
|
||||
}
|
||||
}
|
||||
|
||||
def activatorDistTask: Initialize[Task[File]] = {
|
||||
(thisProjectRef, baseDirectory, activatorDistDirectory, version, buildStructure, streams) map {
|
||||
(project, projectBase, activatorDistDirectory, version, structure, s) => {
|
||||
val allProjects = aggregatedProjects(project, structure).flatMap(p => Project.getProject(p, structure))
|
||||
val rootGitignoreLines = IO.readLines(AkkaBuild.akka.base / ".gitignore")
|
||||
for (p <- allProjects) {
|
||||
val localGitignoreLines = if ((p.base / ".gitignore").exists) IO.readLines(p.base / ".gitignore") else Nil
|
||||
val gitignorePathFinder = (".gitignore" :: localGitignoreLines ::: rootGitignoreLines).foldLeft(PathFinder.empty)(
|
||||
(acc, x) => acc +++ (p.base * x))
|
||||
val filteredPathFinder = (p.base * "*") --- gitignorePathFinder
|
||||
for (f <- filteredPathFinder.get) {
|
||||
val target = activatorDistDirectory / p.id / f.name
|
||||
println("copy: " + target)
|
||||
IO.copyDirectory(f, target, overwrite = true, preserveLastModified = true)
|
||||
}
|
||||
Dist.zip(activatorDistDirectory / p.id, activatorDistDirectory / (p.id + "-" + version + ".zip"))
|
||||
}
|
||||
|
||||
activatorDistDirectory
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -70,11 +70,9 @@ object AkkaBuild extends Build {
|
|||
S3.host in S3.upload := "downloads.typesafe.com.s3.amazonaws.com",
|
||||
S3.progress in S3.upload := true,
|
||||
mappings in S3.upload <<= (Release.releaseDirectory, version) map { (d, v) =>
|
||||
def distMapping(extension: String): (File, String) = {
|
||||
val file = d / "downloads" / ("akka-" + v + "." + extension)
|
||||
file -> ("akka/" + file.getName)
|
||||
}
|
||||
Seq(distMapping("zip"), distMapping("tgz"))
|
||||
val downloads = d / "downloads"
|
||||
val archivesPathFinder = (downloads * ("*" + v + ".zip")) +++ (downloads * ("*" + v + ".tgz"))
|
||||
archivesPathFinder.get.map(file => (file -> ("akka/" + file.getName)))
|
||||
}
|
||||
|
||||
),
|
||||
|
|
@ -445,7 +443,7 @@ object AkkaBuild extends Build {
|
|||
lazy val samples = Project(
|
||||
id = "akka-samples",
|
||||
base = file("akka-samples"),
|
||||
settings = parentSettings,
|
||||
settings = parentSettings ++ ActivatorDist.settings,
|
||||
aggregate = Seq(camelSampleJava, camelSampleScala, mainSampleJava, mainSampleScala,
|
||||
remoteSampleJava, remoteSampleScala, clusterSampleJava, clusterSampleScala,
|
||||
fsmSample, persistenceSample,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ object Release {
|
|||
val (state2, (api, japi)) = extracted.runTask(Unidoc.unidoc, state1)
|
||||
val (state3, docs) = extracted.runTask(generate in Sphinx, state2)
|
||||
val (state4, dist) = extracted.runTask(Dist.dist, state3)
|
||||
val (state5, activatorDist) = extracted.runTask(ActivatorDist.activatorDist in LocalProject(AkkaBuild.samples.id), state4)
|
||||
|
||||
IO.delete(release)
|
||||
IO.createDirectory(release)
|
||||
IO.copyDirectory(repo, release / "releases")
|
||||
|
|
@ -35,7 +37,9 @@ object Release {
|
|||
IO.copyDirectory(japi, release / "japi" / "akka" / releaseVersion)
|
||||
IO.copyDirectory(docs, release / "docs" / "akka" / releaseVersion)
|
||||
IO.copyFile(dist, release / "downloads" / dist.name)
|
||||
state4
|
||||
for (f <- (activatorDist * "*.zip").get)
|
||||
IO.copyFile(f, release / "downloads" / f.name)
|
||||
state5
|
||||
}
|
||||
|
||||
def uploadReleaseCommand = Command.command("upload-release") { state =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue