From be6876be303416bd87d29b211b4e65630f09ac7b Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Fri, 15 Aug 2025 15:27:07 +0200 Subject: [PATCH 01/22] Update scala/sbt/dependency versions to make the project build and to pass the tests. --- README.md | 2 +- build.sbt | 14 +++++++------- .../sbtazurefunctions/CreateZipFileTask.scala | 4 ++-- .../scala/sbtazurefunctions/DefaultSettings.scala | 6 +++--- .../sbt-test/sbt-azure-functions/deploy/build.sbt | 4 ++-- .../sbt-azure-functions/deploy/project/plugins.sbt | 2 +- .../sbt-test/sbt-azure-functions/simple/build.sbt | 8 ++++++-- .../sbt-azure-functions/simple/project/plugins.sbt | 2 +- .../FunctionConfigGeneratorTest.scala | 6 +++--- project/build.properties | 2 +- project/plugins.sbt | 4 ++-- showcase/project/build.properties | 2 +- showcase/project/plugins.sbt | 2 +- 13 files changed, 31 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index ae08af2..8dcc4e9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Experimental plugin for sbt to create Azure Function artefacts (function.json) n in your `project/plugins.sbt` add sbt-assembly and sbt-azure-functions: - addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") + addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") addSbtPlugin("nl.codestar" % "sbt-azure-functions" % "") in your `build.sbt` provide values for the assembly and azure-functions plugins: diff --git a/build.sbt b/build.sbt index 11edba1..98d7108 100644 --- a/build.sbt +++ b/build.sbt @@ -8,13 +8,13 @@ lazy val commonSettings = Seq( Developer( "jeanmarc", "Jean-Marc van Leerdam", - "jean-marc.van.leerdam@ordina.nl", - url("https://github.com/jeanmarc") + "jean-marc.vanleerdam@soprasteria.com", + url("https://soprasteria.com") ) ) ) -lazy val root = (project in file(".")) +lazy val root = project.in(file(".")) .aggregate(plugin) .settings( name := "sbt-azure-functions-plugin", @@ -24,7 +24,7 @@ lazy val root = (project in file(".")) publish := {} ) -lazy val plugin = (project in file("plugin")) +lazy val plugin = project.in(file("plugin")) .enablePlugins(SbtPlugin) .settings( name := "sbt-azure-functions", @@ -48,14 +48,14 @@ lazy val plugin = (project in file("plugin")) "org.scalatest" %% "scalatest" % "3.2.2" % "test", "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value ), - addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10"), + addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1"), scriptedLaunchOpts := { scriptedLaunchOpts.value ++ Seq("-Xmx1024M", "-Dplugin.version=" + version.value) }, scriptedBufferLog := false, - logBuffered in Test := false, - publishArtifact in Test := false + Test / logBuffered := false, + Test / publishArtifact := false ) // workaround for interactive sessions that do not echo the user input (https://github.com/sbt/sbt-bintray/issues/177) diff --git a/plugin/src/main/scala/sbtazurefunctions/CreateZipFileTask.scala b/plugin/src/main/scala/sbtazurefunctions/CreateZipFileTask.scala index c52b21d..d99de29 100644 --- a/plugin/src/main/scala/sbtazurefunctions/CreateZipFileTask.scala +++ b/plugin/src/main/scala/sbtazurefunctions/CreateZipFileTask.scala @@ -19,7 +19,7 @@ object CreateZipFileTask { val log = sbt.Keys.streams.value.log - val tgtFolder = (target in Compile).value + val tgtFolder = (Compile / target).value log.info("Running azfunCreateZipFile task...") log.info( @@ -28,7 +28,7 @@ object CreateZipFileTask { val src = azfunTargetFolder.value val tgt = tgtFolder / ensureExtension(azfunZipName.value, "zip") - IO.zip(allSubpaths(src), tgt) + IO.zip(allSubpaths(src), tgt, None) tgt } ) diff --git a/plugin/src/main/scala/sbtazurefunctions/DefaultSettings.scala b/plugin/src/main/scala/sbtazurefunctions/DefaultSettings.scala index a108be1..a773aed 100644 --- a/plugin/src/main/scala/sbtazurefunctions/DefaultSettings.scala +++ b/plugin/src/main/scala/sbtazurefunctions/DefaultSettings.scala @@ -18,11 +18,11 @@ object DefaultSettings { def settings: Seq[Setting[_]] = Seq( azfunAppInsightsName := azfunFunctionAppName.value, - azfunHostJsonFile := (baseDirectory in Compile).value / "host.json", + azfunHostJsonFile := (Compile / baseDirectory).value / "host.json", azfunJarName := "AzureFunction.jar", - azfunLocalSettingsFile := (baseDirectory in Compile).value / "local.settings.json", + azfunLocalSettingsFile := (Compile / baseDirectory).value / "local.settings.json", azfunSKU := "Standard_LRS", - azfunTargetFolder := (target in Compile).value / stripExtension(azfunZipName.value), + azfunTargetFolder := (Compile / target).value / stripExtension(azfunZipName.value), azfunZipName := "AzureFunction.zip" ) diff --git a/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt b/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt index 8c5081e..2a234ba 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt @@ -3,11 +3,11 @@ import sbt.Keys.libraryDependencies lazy val root = (project in file(".")) .settings( version := "0.1", - scalaVersion := "2.12.7", + scalaVersion := "2.12.18", libraryDependencies ++= Seq( "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" ), - assemblyJarName in assembly := "ScalaFunctions.jar", + assembly / assemblyJarName := "ScalaFunctions.jar", azfunFunctionAppName := "rd-scala-functions", azfunLocation := "westeurope", azfunResourceGroup := "rg-rd-scala-functions", diff --git a/plugin/src/sbt-test/sbt-azure-functions/deploy/project/plugins.sbt b/plugin/src/sbt-test/sbt-azure-functions/deploy/project/plugins.sbt index 8111a40..1326da4 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/deploy/project/plugins.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/deploy/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") sys.props.get("plugin.version") match { case Some(x) => addSbtPlugin("nl.codestar" % "sbt-azure-functions" % x) diff --git a/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt b/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt index 6ea06be..2a234ba 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt @@ -3,9 +3,13 @@ import sbt.Keys.libraryDependencies lazy val root = (project in file(".")) .settings( version := "0.1", - scalaVersion := "2.12.7", + scalaVersion := "2.12.18", libraryDependencies ++= Seq( "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" ), - assemblyJarName in assembly := "ScalaFunctions.jar" + assembly / assemblyJarName := "ScalaFunctions.jar", + azfunFunctionAppName := "rd-scala-functions", + azfunLocation := "westeurope", + azfunResourceGroup := "rg-rd-scala-functions", + azfunStorageAccount := "a77a749630954151919e" ) diff --git a/plugin/src/sbt-test/sbt-azure-functions/simple/project/plugins.sbt b/plugin/src/sbt-test/sbt-azure-functions/simple/project/plugins.sbt index 8111a40..1326da4 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/simple/project/plugins.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/simple/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") sys.props.get("plugin.version") match { case Some(x) => addSbtPlugin("nl.codestar" % "sbt-azure-functions" % x) diff --git a/plugin/src/test/scala/nl/codestar/azurefunctions/FunctionConfigGeneratorTest.scala b/plugin/src/test/scala/nl/codestar/azurefunctions/FunctionConfigGeneratorTest.scala index a4c5e57..bca3bc5 100644 --- a/plugin/src/test/scala/nl/codestar/azurefunctions/FunctionConfigGeneratorTest.scala +++ b/plugin/src/test/scala/nl/codestar/azurefunctions/FunctionConfigGeneratorTest.scala @@ -30,14 +30,14 @@ class FunctionConfigGeneratorTest extends AnyFlatSpec { "An annotated function" should "be found" in { val result = FunctionConfigGenerator.getFunctions(List(getClassUrl)) - assert(result.isEmpty == false) + assert(result.nonEmpty) } "An annotated function" should "produce a configuration" in { val result = FunctionConfigGenerator.getConfigs(List(getClassUrl)) - assert(result.isEmpty == false) + assert(result.nonEmpty) assert(result.get("ScalaFunction") != null) - val config = result.get("ScalaFunction").get + val config = result("ScalaFunction") assert(config.getEntryPoint == "nl.codestar.azurefunctions.FunctionConfigGeneratorTest.SampleAzureFunctions.run") assert(config.getScriptFile == null) val binding = config.getBindings.get(0) diff --git a/project/build.properties b/project/build.properties index 654fe70..6520f69 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.12 +sbt.version=1.11.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index e131dc0..b0a6bc4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,2 @@ -addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") diff --git a/showcase/project/build.properties b/showcase/project/build.properties index 654fe70..6520f69 100644 --- a/showcase/project/build.properties +++ b/showcase/project/build.properties @@ -1 +1 @@ -sbt.version=1.3.12 +sbt.version=1.11.0 diff --git a/showcase/project/plugins.sbt b/showcase/project/plugins.sbt index 25fefef..c44d62d 100644 --- a/showcase/project/plugins.sbt +++ b/showcase/project/plugins.sbt @@ -1,4 +1,4 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") // build root project lazy val root = Project("showcase", file(".")) dependsOn (ProjectRef(pluginParent, "plugin")) From a19c7314eabfde062f126c16a75aafff3660d627 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Fri, 15 Aug 2025 15:45:14 +0200 Subject: [PATCH 02/22] Update some more dependency versions --- README.md | 2 +- build.sbt | 10 +++++----- .../src/sbt-test/sbt-azure-functions/deploy/build.sbt | 2 +- .../src/sbt-test/sbt-azure-functions/simple/build.sbt | 2 +- showcase/build.sbt | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8dcc4e9..8ab83d1 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ in your `build.sbt` provide values for the assembly and azure-functions plugins: // you need this dependency to be able to use the annotations libraryDependencies ++= Seq( - "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" + "com.microsoft.azure.functions" % "azure-functions-java-library" % "3.1.0" ) ) diff --git a/build.sbt b/build.sbt index 98d7108..65e2961 100644 --- a/build.sbt +++ b/build.sbt @@ -41,11 +41,11 @@ lazy val plugin = project.in(file("plugin")) "-Ywarn-adapted-args" ), libraryDependencies ++= Seq( - "com.fasterxml.jackson.core" % "jackson-databind" % "2.12.0", - "com.microsoft.azure" % "azure-tools-common" % "0.10.0", - "com.typesafe.scala-logging" %% "scala-logging" % "3.9.2", - "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" % "test", - "org.scalatest" %% "scalatest" % "3.2.2" % "test", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.19.2", + "com.microsoft.azure" % "azure-tools-common" % "0.14.0", + "com.typesafe.scala-logging" %% "scala-logging" % "3.9.5", + "com.microsoft.azure.functions" % "azure-functions-java-library" % "3.1.0" % "test", + "org.scalatest" %% "scalatest" % "3.2.19" % "test", "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value ), addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1"), diff --git a/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt b/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt index 2a234ba..410ccde 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt @@ -5,7 +5,7 @@ lazy val root = (project in file(".")) version := "0.1", scalaVersion := "2.12.18", libraryDependencies ++= Seq( - "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" + "com.microsoft.azure.functions" % "azure-functions-java-library" % "3.1.0" ), assembly / assemblyJarName := "ScalaFunctions.jar", azfunFunctionAppName := "rd-scala-functions", diff --git a/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt b/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt index 2a234ba..410ccde 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt @@ -5,7 +5,7 @@ lazy val root = (project in file(".")) version := "0.1", scalaVersion := "2.12.18", libraryDependencies ++= Seq( - "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" + "com.microsoft.azure.functions" % "azure-functions-java-library" % "3.1.0" ), assembly / assemblyJarName := "ScalaFunctions.jar", azfunFunctionAppName := "rd-scala-functions", diff --git a/showcase/build.sbt b/showcase/build.sbt index 2a8b30d..f86000b 100644 --- a/showcase/build.sbt +++ b/showcase/build.sbt @@ -3,6 +3,6 @@ lazy val root = (project in file(".")) name := "showcase", version := "1.0", libraryDependencies ++= Seq( - "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" + "com.microsoft.azure.functions" % "azure-functions-java-library" % "3.1.0" ) ) From a7a9336259644efe54b184db6196da5dd2ae0487 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Fri, 15 Aug 2025 16:02:43 +0200 Subject: [PATCH 03/22] Add remark about the Azure content that is needed to make the `scripted` `deploy` test pass. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 8ab83d1..161bd2c 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,9 @@ For now I will use these versions #### Scripted tests * `sbt scripted` +Note: to successfully run the `deploy` scripted test, you need to have the Azure CLI installed and logged in to Azure with proper access +to a subscription that has a resource group and storage account as specified in the `sbt-test/sbt-azure-functions/deploy/build.sbt` file. + ## Releasing (for plugin maintainers) To release a new version: * Get a [bintray](https://bintray.com) account and make sure you're a member of the [`code-star`](https://bintray.com/code-star) organization. From dcafa457e26caf002e27d943c41123b5f2f8b96b Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 12:56:40 +0200 Subject: [PATCH 04/22] ignore .bloop and .bsp folders --- .gitignore | 2 ++ project/plugins.sbt | 1 + 2 files changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 8d77446..3ef8eb7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.bloop/ +.bsp/ .DS_Store .idea/ target/ diff --git a/project/plugins.sbt b/project/plugins.sbt index b0a6bc4..4066ab6 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,3 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") +addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.13") From e6d9caa0ab91facbe066377b011c15830bab7a47 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 14:44:55 +0200 Subject: [PATCH 05/22] Describe the expected release process; include plugins that are needed for the release process --- .gitignore | 2 ++ .jvmopts | 2 ++ README.md | 40 ++++++++++++++++++++++++---------- build.sbt | 52 ++++++++++++++++++++++++++++++++++++++++++++- project/plugins.sbt | 6 ++++-- 5 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 .jvmopts diff --git a/.gitignore b/.gitignore index 3ef8eb7..c1ea2b1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ target/ local_env.sh *.iml + +.env diff --git a/.jvmopts b/.jvmopts new file mode 100644 index 0000000..e6e135d --- /dev/null +++ b/.jvmopts @@ -0,0 +1,2 @@ +--add-opens=java.base/java.util=ALL-UNNAMED +--add-opens=java.base/java.lang=ALL-UNNAMED diff --git a/README.md b/README.md index 161bd2c..83065f8 100644 --- a/README.md +++ b/README.md @@ -96,14 +96,32 @@ Note: to successfully run the `deploy` scripted test, you need to have the Azure to a subscription that has a resource group and storage account as specified in the `sbt-test/sbt-azure-functions/deploy/build.sbt` file. ## Releasing (for plugin maintainers) -To release a new version: -* Get a [bintray](https://bintray.com) account and make sure you're a member of the [`code-star`](https://bintray.com/code-star) organization. -* Set your credentials - you can use `sbt bintrayChangeCredentials`, but when run from the interactive sbt prompt - you will not see the requests for username and password. So blindly first type your username, press enter, then - paste your API key and press enter again. - - (found a workaround that shows the prompt again: add to build.sbt: `ThisBuild / useSuperShell := false`) -* reload to make new settings known to sbt -* Run `sbt release` - -Update Feb 2021: we started moving away from Bintray. We will start using sbt-ci-release and release to Maven Central. +To release a new version, make sure you have: +* proper access to the `nl.codestar` namespace on Sonatype. +* GnuPG (`gpg`) installed and a signing key configured. + * We use `sbt-pgp` plugin to sign, which relies on the `gpg` command line tool +* create a `.env` file in the project root with the following variables: + ``` + PGP_KEYID= + PGP_PASSPHRASE= + SONATYPE_USER= + SONATYPE_PASSWORD= + + ``` + +Note: The `.env` file needs to be kept out of the git repository (it is `.gitignore`d). + +See [Using Sonatype](https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html) in the SBT documentation. + +Steps to release SNAPSHOT version (not preferred): +1. `sbt publishSigned` +2. `sbt sonaUpload` +3. Go to https://central.sonatype.com/publishing/deployments and publish the deployment. + * or run `sbt sonaRelease` to publish the deployment automatically + +Steps to release (preferred): +1. Tag the current commit with the new version number, e.g. `git tag v0.5.0` +2. `sbt publishSigned` +3. `sbt sonaUpload` +4. Go to https://central.sonatype.com/publishing/deployments and publish the deployment. + * or run `sbt sonaRelease` to publish the deployment automatically diff --git a/build.sbt b/build.sbt index 65e2961..cca97d0 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,12 @@ lazy val commonSettings = Seq( organization := "nl.codestar", homepage := Some(url("https://github.com/code-star/sbt-azure-functions-plugin")), - // version is set by sbt-dynver plugin (included through sbt-ci-assembly) + // version is set by sbt-dynver plugin (included through sbt-ci-release) description := "SBT Plugin to generate function.json artefacts needed to publish code as an Azure Function", + organization := "nl.codestar", + organizationName := "Codestar powered by Sopra Steria", + organizationHomepage := Some(url("https://codestar.nl")), + homepage := Some(url("https://codestar.nl/sbt-azure-functions-plugin")), licenses += ("MIT", url("https://opensource.org/licenses/MIT")), developers := List( Developer( @@ -11,7 +15,38 @@ lazy val commonSettings = Seq( "jean-marc.vanleerdam@soprasteria.com", url("https://soprasteria.com") ) + ), + scmInfo := Some( + ScmInfo( + url("https://github.com/code-star/sbt-azure-functions-plugin"),"scm:git@github.com:code-star/sbt-azure-functions-plugin.git") + ), + credentials ++= Seq( + Credentials( + "GnuPG Key ID", + "gpg", + System.getenv("PGP_KEYID"), // key identifier + "ignored" // this field is ignored; passwords are supplied by pinentry + ), + Credentials( + "Sonatype Nexus Repository Manager", + "oss.sonatype.org", + System.getenv("SONATYPE_USER"), + System.getenv("SONATYPE_PASSWORD") // Use environment variable for security + ), + Credentials( + "Sonatype Nexus Repository Manager", + "central.sonatype.com", + System.getenv("SONATYPE_USER"), + System.getenv("SONATYPE_PASSWORD") // Use environment variable for security + ), + Credentials( + "central-snapshots", + "central.sonatype.com", + System.getenv("SONATYPE_USER"), + System.getenv("SONATYPE_PASSWORD") // Use environment variable for security + ) ) + ) lazy val root = project.in(file(".")) @@ -29,6 +64,12 @@ lazy val plugin = project.in(file("plugin")) .settings( name := "sbt-azure-functions", commonSettings, + scalaVersion := "2.12.18", + pluginCrossBuild / sbtVersion := { + scalaBinaryVersion.value match { + case "2.12" => "1.11.4" // set minimum version + } + }, scalacOptions ++= Seq( "-encoding", "UTF8", @@ -60,3 +101,12 @@ lazy val plugin = project.in(file("plugin")) // workaround for interactive sessions that do not echo the user input (https://github.com/sbt/sbt-bintray/issues/177) ThisBuild / useSuperShell := false + +ThisBuild / pomIncludeRepository := { _ => false } +ThisBuild / publishMavenStyle := true + +ThisBuild / publishTo := { + val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/" + if (isSnapshot.value) Some("central-snapshots" at centralSnapshots) + else localStaging.value +} diff --git a/project/plugins.sbt b/project/plugins.sbt index 4066ab6..8811210 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,5 @@ -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1") -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "2.0.13") +addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.1") +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1") +addSbtPlugin("nl.gn0s1s" % "sbt-dotenv" % "3.1.1") From db990aeddc22266ee0f9ee1457af96f3d2f6ac96 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 15:31:23 +0200 Subject: [PATCH 06/22] Update release documentation --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 83065f8..482af4f 100644 --- a/README.md +++ b/README.md @@ -113,13 +113,14 @@ Note: The `.env` file needs to be kept out of the git repository (it is `.gitign See [Using Sonatype](https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html) in the SBT documentation. -Steps to release SNAPSHOT version (not preferred): -1. `sbt publishSigned` -2. `sbt sonaUpload` -3. Go to https://central.sonatype.com/publishing/deployments and publish the deployment. - * or run `sbt sonaRelease` to publish the deployment automatically +### SNAPSHOT versions +Steps to release SNAPSHOT version: +1. Make sure HEAD is not directly pointing to a tag +2. `sbt publishSigned` +3. make note of the SNAPSHOT version that is used (Sonatype does not allow searching/browsing for SNAPSHOT versions) -Steps to release (preferred): +### Production versions +Steps to release production version: 1. Tag the current commit with the new version number, e.g. `git tag v0.5.0` 2. `sbt publishSigned` 3. `sbt sonaUpload` From 7b23687c3d37828f232dc9351f48ff132aea900b Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 15:33:50 +0200 Subject: [PATCH 07/22] Update release notes --- releasenotes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/releasenotes.md b/releasenotes.md index e905417..75c24ed 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -4,6 +4,9 @@ New features: * New task to deploy function to azure (`azfunDeploy`) +## Version 0.4.6 +Based on latest main (0.5.0), used to release to Sonatype instead of Bintray + ## Version 0.4.1 Bug fixes: * Default folder name for results used .zip extension From e3daddcfb5c24ba4efb1a4e73c4acacb3aa55ffd Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 17:15:16 +0200 Subject: [PATCH 08/22] Set a name for the deployment --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index cca97d0..247b985 100644 --- a/build.sbt +++ b/build.sbt @@ -110,3 +110,5 @@ ThisBuild / publishTo := { if (isSnapshot.value) Some("central-snapshots" at centralSnapshots) else localStaging.value } + +ThisBuild / sonaDeploymentName := "sbt-azure-functions" From d7b6cc4292fc0bbb0e97a4af7177a89d6fda6d03 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 17:18:06 +0200 Subject: [PATCH 09/22] Move setting for deployment name --- build.sbt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 247b985..b81fbb4 100644 --- a/build.sbt +++ b/build.sbt @@ -63,6 +63,7 @@ lazy val plugin = project.in(file("plugin")) .enablePlugins(SbtPlugin) .settings( name := "sbt-azure-functions", + sonaDeploymentName := "sbt-azure-functions", commonSettings, scalaVersion := "2.12.18", pluginCrossBuild / sbtVersion := { @@ -110,5 +111,3 @@ ThisBuild / publishTo := { if (isSnapshot.value) Some("central-snapshots" at centralSnapshots) else localStaging.value } - -ThisBuild / sonaDeploymentName := "sbt-azure-functions" From 28486245adaee482b2c4dc1213e7990f883a1cc6 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 17:27:32 +0200 Subject: [PATCH 10/22] Update sbt version --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 6520f69..489e0a7 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.0 +sbt.version=1.11.4 From 71074dc9c2e26bca22b2e64b56a453501347f4a0 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Tue, 19 Aug 2025 17:38:31 +0200 Subject: [PATCH 11/22] Setting sonaDeploymentName does not seem to have any effect --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index b81fbb4..cca97d0 100644 --- a/build.sbt +++ b/build.sbt @@ -63,7 +63,6 @@ lazy val plugin = project.in(file("plugin")) .enablePlugins(SbtPlugin) .settings( name := "sbt-azure-functions", - sonaDeploymentName := "sbt-azure-functions", commonSettings, scalaVersion := "2.12.18", pluginCrossBuild / sbtVersion := { From 5d7b510156fdd0b878195ceffd195503e40546b5 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Wed, 20 Aug 2025 08:38:59 +0200 Subject: [PATCH 12/22] Try a local sbt build --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 489e0a7..f58f1c9 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.4 +sbt.version=1.11.1-SNAPSHOT From 3ad9880a95a1c85ae5c5fbff3d979ff30112a634 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Wed, 20 Aug 2025 14:07:33 +0200 Subject: [PATCH 13/22] Set deployment name --- build.sbt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.sbt b/build.sbt index cca97d0..cd80a99 100644 --- a/build.sbt +++ b/build.sbt @@ -64,6 +64,14 @@ lazy val plugin = project.in(file("plugin")) .settings( name := "sbt-azure-functions", commonSettings, + sonaDeploymentName := { + val o = organization.value + val n = name.value + val v = version.value + val time = java.time.LocalTime.now.format(java.time.format.DateTimeFormatter.ofPattern("HHmmss")) + s"$o:$n:$v:$time" + }, + scalaVersion := "2.12.18", pluginCrossBuild / sbtVersion := { scalaBinaryVersion.value match { From 2212335cb418de31b58acd67ec36df6fa25fa173 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Wed, 20 Aug 2025 14:50:57 +0200 Subject: [PATCH 14/22] use a timestamp instead of a random uid in the deployment name --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index cd80a99..0580be0 100644 --- a/build.sbt +++ b/build.sbt @@ -68,8 +68,8 @@ lazy val plugin = project.in(file("plugin")) val o = organization.value val n = name.value val v = version.value - val time = java.time.LocalTime.now.format(java.time.format.DateTimeFormatter.ofPattern("HHmmss")) - s"$o:$n:$v:$time" + val dt = java.time.LocalDateTime.now.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) + s"$o:$n:$v:$dt" }, scalaVersion := "2.12.18", From e56739041f29650020da235ba71e1d06cd13c814 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 09:07:20 +0200 Subject: [PATCH 15/22] switch sbt version --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index f58f1c9..61c9b1c 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.11.1-SNAPSHOT +sbt.version=1.11.1 From 6bf1738120e5931de1b85525322d59512da70a57 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 09:10:23 +0200 Subject: [PATCH 16/22] move the sonaDeploymentName setting --- build.sbt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 0580be0..bbe41f9 100644 --- a/build.sbt +++ b/build.sbt @@ -56,7 +56,14 @@ lazy val root = project.in(file(".")) commonSettings, // the root project should not produce any artifacts publishArtifact := false, - publish := {} + publish := {}, + sonaDeploymentName := { + val o = organization.value + val n = "sbt-azure-functions" + val v = version.value + val dt = java.time.LocalDateTime.now.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) + s"$o:$n:$v:$dt" + }, ) lazy val plugin = project.in(file("plugin")) @@ -64,13 +71,6 @@ lazy val plugin = project.in(file("plugin")) .settings( name := "sbt-azure-functions", commonSettings, - sonaDeploymentName := { - val o = organization.value - val n = name.value - val v = version.value - val dt = java.time.LocalDateTime.now.format(java.time.format.DateTimeFormatter.ofPattern("yyyyMMdd_HHmmss")) - s"$o:$n:$v:$dt" - }, scalaVersion := "2.12.18", pluginCrossBuild / sbtVersion := { From 39a94b0721d8e969c61a9b0804fb8fbc43b63f9a Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 10:05:55 +0200 Subject: [PATCH 17/22] Update showcase project so it loads again; document mandatory settings --- README.md | 7 ++++++- showcase/build.sbt | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 482af4f..055ab0c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,11 @@ in your `build.sbt` provide values for the assembly and azure-functions plugins: lazy val root = (project in file(".")) .settings( ... + // replace these values with appropriate values for your Azure Function + azfunFunctionAppName := "ScalaFunction", + azfunLocation := "azure-location", // e.g. "westeurope", "eastus", etc. + azfunResourceGroup := "your-resource-group", + azfunStorageAccount := "yourstorageaccount" // optional: override the zip and/or jar name (defaults are AzureFunction.zip and AzureFunction.jar) azfunZipName := "myFunctions.zip", @@ -52,7 +57,7 @@ in your `build.sbt` provide values for the assembly and azure-functions plugins: and logged in to the correct Azure Subscription. You will also have to install the app-insights extension to the CLI, by running `az extension add -n application-insights` - You can provide the following settings to determine the destination: + You must provide the following settings to determine the destination: * `azfunResourceGroup` * `azfunStorageAccount` diff --git a/showcase/build.sbt b/showcase/build.sbt index f86000b..0dd849f 100644 --- a/showcase/build.sbt +++ b/showcase/build.sbt @@ -4,5 +4,9 @@ lazy val root = (project in file(".")) version := "1.0", libraryDependencies ++= Seq( "com.microsoft.azure.functions" % "azure-functions-java-library" % "3.1.0" - ) + ), + azfunFunctionAppName := "ScalaFunction", + azfunLocation := "West Europe", + azfunResourceGroup := "your-resource-group", + azfunStorageAccount := "yourstorageaccount" ) From a7047e5d2283f483d33640dff625bfdcfec45bb9 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 10:57:08 +0200 Subject: [PATCH 18/22] Refresh references to existing resource group and storage account; update extensionbundle requirement --- README.md | 17 ++++++++--------- .../sbt-azure-functions/deploy/build.sbt | 4 ++-- .../sbt-azure-functions/deploy/host.json | 2 +- .../sbt-azure-functions/simple/build.sbt | 4 ++-- .../sbt-azure-functions/simple/host.json | 2 +- showcase/host.json | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 055ab0c..690ce28 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,6 @@ in your `build.sbt` provide values for the assembly and azure-functions plugins: ## TODO: -1. add task to upload to Azure 1. add support for App Insights workspaces 1. add tests against multiple Java versions (java 8 and Java 11) @@ -75,19 +74,19 @@ released for different scala versions and different sbt versions. I have not (ye what Scala version is used for each sbt release, except for https://github.com/sbt/sbt/issues/5032, so I am also keeping track here: -| SBT release(s)| Scala version | Remarks | -|---------------|-------------------|--------------------------------------------------| -| 0.x | 2.10.x | -| 1.x | 2.12.x | -| 2.x | 2.13.x or 3.0.x | -| 3.x | 3.0.x or 3.1.x | +| SBT release(s) | Scala version | Remarks | +|-----------------|-----------------|---------| +| 0.x | 2.10.x | | +| 1.x | 2.12.x | | +| 2.x | 2.13.x or 3.0.x | | +| 3.x | 3.0.x or 3.1.x | | For now, I will focus only on sbt 1.x and Scala 2.12.x ### Microsoft Azure Dependencies This plugin uses artifacts from Microsoft: -* "com.microsoft.azure" % "azure-tools-common" % "0.10.0" -* "com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" % "test" +* `"com.microsoft.azure" % "azure-tools-common" % "0.10.0"` +* `"com.microsoft.azure.functions" % "azure-functions-java-library" % "1.3.1" % "test"` For now I will use these versions diff --git a/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt b/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt index 410ccde..e75b33a 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/deploy/build.sbt @@ -10,6 +10,6 @@ lazy val root = (project in file(".")) assembly / assemblyJarName := "ScalaFunctions.jar", azfunFunctionAppName := "rd-scala-functions", azfunLocation := "westeurope", - azfunResourceGroup := "rg-rd-scala-functions", - azfunStorageAccount := "a77a749630954151919e" + azfunResourceGroup := "rg-function-showcase", + azfunStorageAccount := "rgfunctionshowcasebaa9" ) diff --git a/plugin/src/sbt-test/sbt-azure-functions/deploy/host.json b/plugin/src/sbt-test/sbt-azure-functions/deploy/host.json index 4ac8957..b2eb067 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/deploy/host.json +++ b/plugin/src/sbt-test/sbt-azure-functions/deploy/host.json @@ -2,6 +2,6 @@ "version": "2.0", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[1.*, 2.0.0)" + "version": "[2.*, 3.0.0)" } } \ No newline at end of file diff --git a/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt b/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt index 410ccde..e75b33a 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt +++ b/plugin/src/sbt-test/sbt-azure-functions/simple/build.sbt @@ -10,6 +10,6 @@ lazy val root = (project in file(".")) assembly / assemblyJarName := "ScalaFunctions.jar", azfunFunctionAppName := "rd-scala-functions", azfunLocation := "westeurope", - azfunResourceGroup := "rg-rd-scala-functions", - azfunStorageAccount := "a77a749630954151919e" + azfunResourceGroup := "rg-function-showcase", + azfunStorageAccount := "rgfunctionshowcasebaa9" ) diff --git a/plugin/src/sbt-test/sbt-azure-functions/simple/host.json b/plugin/src/sbt-test/sbt-azure-functions/simple/host.json index 4ac8957..b2eb067 100644 --- a/plugin/src/sbt-test/sbt-azure-functions/simple/host.json +++ b/plugin/src/sbt-test/sbt-azure-functions/simple/host.json @@ -2,6 +2,6 @@ "version": "2.0", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[1.*, 2.0.0)" + "version": "[2.*, 3.0.0)" } } \ No newline at end of file diff --git a/showcase/host.json b/showcase/host.json index 4ac8957..b2eb067 100644 --- a/showcase/host.json +++ b/showcase/host.json @@ -2,6 +2,6 @@ "version": "2.0", "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[1.*, 2.0.0)" + "version": "[2.*, 3.0.0)" } } \ No newline at end of file From 9f2e185d3d5dc91abcec3c8eb0254b74adb453da Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 15:23:56 +0200 Subject: [PATCH 19/22] Mention the need to publishLocal before running scripted tests --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 690ce28..f2b8356 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ For now I will use these versions #### Unit tests * `sbt clean test` #### Scripted tests +* `sbt publishLocal` * `sbt scripted` Note: to successfully run the `deploy` scripted test, you need to have the Azure CLI installed and logged in to Azure with proper access From d9f87e3dc26124d03f5524389d1f775d4da1b5fb Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 15:41:00 +0200 Subject: [PATCH 20/22] Update release notes --- releasenotes.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/releasenotes.md b/releasenotes.md index 75c24ed..3294fc4 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,11 +1,17 @@ # Release notes ## Version 0.5.0 -New features: -* New task to deploy function to azure (`azfunDeploy`) +Updates: +* version updates to our dependencies +* use the 2.x series of the Microsoft Extension Bundle (1.x is no longer supported) + + ## Version 0.4.6 -Based on latest main (0.5.0), used to release to Sonatype instead of Bintray +Based on latest develop (August 2025), used to release to Sonatype instead of Bintray + +New features: +* New task to deploy function to azure (`azfunDeploy`) ## Version 0.4.1 Bug fixes: From 15e86f2a97cf7aa5d322bf4ec359c6ccc391bb30 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 15:53:32 +0200 Subject: [PATCH 21/22] Update CI settings --- .github/workflows/scala.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 2e177e9..3446219 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -14,10 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 with: - java-version: 1.8 + java-version: 17 + - uses: sbt/setup-sbt@v1 - name: Run tests + shell: bash run: sbt test From 0fbe5bb023bec8b0997f2e8630358aef9982c4e6 Mon Sep 17 00:00:00 2001 From: JeanMarc van Leerdam Date: Thu, 21 Aug 2025 15:56:01 +0200 Subject: [PATCH 22/22] Update CI settings --- .github/workflows/scala.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 3446219..ac65d26 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -18,6 +18,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: + distribution: temurin java-version: 17 - uses: sbt/setup-sbt@v1 - name: Run tests