Skip to content

Commit feb7289

Browse files
author
Jean-Marc van Leerdam
committed
Use correct temporary folder
1 parent 0a4bf8b commit feb7289

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

plugin/src/main/scala/sbtazurefunctions/AzureFunctions.scala

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ object AzureFunctions extends AutoPlugin {
3939
object autoImport {
4040
val AzureFunctionsKeys = sbtazurefunctions.AzureFunctionsKeys
4141
val azfunJarName = sbtazurefunctions.AzureFunctionsKeys.azfunJarName
42-
val azfunTargetFolder = sbtazurefunctions.AzureFunctionsKeys.azfunTargetFolder
4342
val azfunZipName = sbtazurefunctions.AzureFunctionsKeys.azfunZipName
4443
val azfunCreateZipFile = sbtazurefunctions.AzureFunctionsKeys.azfunCreateZipFile
4544
}
@@ -49,7 +48,7 @@ object AzureFunctions extends AutoPlugin {
4948
override lazy val projectSettings: Seq[Setting[_]] = Seq(
5049
azfunHostJsonFile := (baseDirectory in Compile).value / "host.json",
5150
azfunLocalSettingsFile := (baseDirectory in Compile).value / "local.settings.json",
52-
azfunTargetFolder := (target in Compile).value / azfunZipName.value,
51+
azfunTargetFolder := (target in Compile).value / stripExtension(azfunZipName.value),
5352
azfunZipName := "AzureFunction.zip",
5453
azfunJarName := "AzureFunction.jar",
5554
azfunCopyHostJson := {
@@ -106,7 +105,7 @@ object AzureFunctions extends AutoPlugin {
106105
)
107106

108107
val src = azfunTargetFolder.value
109-
val tgt = tgtFolder / azfunZipName.value
108+
val tgt = tgtFolder / ensureExtension(azfunZipName.value, "zip")
110109
IO.zip(allSubpaths(src), tgt)
111110
tgt
112111
},
@@ -135,4 +134,19 @@ object AzureFunctions extends AutoPlugin {
135134
}
136135
)
137136

137+
private def ensureExtension(input: String, extension: String): String = {
138+
input.lastIndexOf('.') match {
139+
case 0 => s"${input}.${extension}"
140+
case n if (n == input.size - 1) => s"${input}${extension}"
141+
case _ => input
142+
}
143+
}
144+
145+
private def stripExtension(input: String): String = {
146+
input.lastIndexOf('.') match {
147+
case 0 => input
148+
case n => input.take(n)
149+
}
150+
}
151+
138152
}

releasenotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release notes
22

3+
## Version 0.4.1
4+
Bug fixes:
5+
* Default folder name for results used .zip extension
6+
37
## Version 0.4.0
48
New Features:
59
* Instead of in-place packaging of the result from the assembly step, the plugin now copies and renames the assembly jar

0 commit comments

Comments
 (0)