@@ -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}
0 commit comments