mirror of https://github.com/sbt/sbt.git
Fail publishing when artifacts to publish do not exist.
This commit is contained in:
parent
66ac1dbc9a
commit
a0b5b0e7ac
|
|
@ -251,9 +251,11 @@ object IvyActions
|
||||||
}
|
}
|
||||||
|
|
||||||
def publish(module: ModuleDescriptor, artifacts: Seq[(IArtifact, File)], resolver: DependencyResolver, overwrite: Boolean): Unit =
|
def publish(module: ModuleDescriptor, artifacts: Seq[(IArtifact, File)], resolver: DependencyResolver, overwrite: Boolean): Unit =
|
||||||
|
{
|
||||||
|
checkFilesPresent(artifacts)
|
||||||
try {
|
try {
|
||||||
resolver.beginPublishTransaction(module.getModuleRevisionId(), overwrite);
|
resolver.beginPublishTransaction(module.getModuleRevisionId(), overwrite);
|
||||||
for( (artifact, file) <- artifacts) if(file.exists)
|
for( (artifact, file) <- artifacts)
|
||||||
resolver.publish(artifact, file, overwrite)
|
resolver.publish(artifact, file, overwrite)
|
||||||
resolver.commitPublishTransaction()
|
resolver.commitPublishTransaction()
|
||||||
} catch {
|
} catch {
|
||||||
|
|
@ -261,6 +263,12 @@ object IvyActions
|
||||||
try { resolver.abortPublishTransaction() }
|
try { resolver.abortPublishTransaction() }
|
||||||
finally { throw e }
|
finally { throw e }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
private[this] def checkFilesPresent(artifacts: Seq[(IArtifact, File)])
|
||||||
|
{
|
||||||
|
val missing = artifacts filter { case (a, file) => !file.exists }
|
||||||
|
if(missing.nonEmpty)
|
||||||
|
error("Missing files for publishing:\n\t" + missing.map(_._2.getAbsolutePath).mkString("\n\t"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
final class ResolveException(val messages: Seq[String], val failed: Seq[ModuleID]) extends RuntimeException(messages.mkString("\n"))
|
final class ResolveException(val messages: Seq[String], val failed: Seq[ModuleID]) extends RuntimeException(messages.mkString("\n"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue