Skip to content

Commit

Permalink
Cask version fix (#18486)
Browse files Browse the repository at this point in the history
* using artefact version in build

* using artefact version in build

* cask knows how to honour artifact versions
  • Loading branch information
aaronp committed Apr 24, 2024
1 parent 50945d0 commit efb7e56
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/generators/scala-cask.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|apiPackage|package for generated api classes| |null|
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |null|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename. If not provided, uses the version from the OpenAPI specification file. If that's also not present, uses the default value of the artifactVersion option.| |null|
|dateLibrary|Option. Date library to use|<dl><dt>**joda**</dt><dd>Joda (for legacy app)</dd><dt>**java8**</dt><dd>Java 8 native JSR310 (preferred for JDK 1.8+)</dd></dl>|java8|
|disallowAdditionalPropertiesIfNotPresent|If false, the 'additionalProperties' implementation (set to true by default) is compliant with the OAS and JSON schema specifications. If true (default), keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.|<dl><dt>**false**</dt><dd>The 'additionalProperties' implementation is compliant with the OAS and JSON schema specifications.</dd><dt>**true**</dt><dd>Keep the old (incorrect) behaviour that 'additionalProperties' is set to false by default.</dd></dl>|true|
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public ScalaCaskServerCodegen() {

cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC));
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC));
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
cliOptions.add(new CliOption(CodegenConstants.GIT_REPO_ID, CodegenConstants.GIT_REPO_ID_DESC));
cliOptions.add(new CliOption(CodegenConstants.GIT_USER_ID, CodegenConstants.GIT_USER_ID_DESC));
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, CodegenConstants.PACKAGE_DESCRIPTION));
Expand Down Expand Up @@ -158,6 +159,7 @@ public void processOpts() {
final String groupId = ensureProp(CodegenConstants.GROUP_ID, "org.openapitools");
ensureProp(CodegenConstants.ARTIFACT_ID, "caskgen");
artifactVersion = ensureProp(CodegenConstants.ARTIFACT_VERSION, "0.0.1");

gitRepoId = ensureProp(CodegenConstants.GIT_REPO_ID, "<your git repo -- set 'gitRepoId'>");
gitUserId = ensureProp(CodegenConstants.GIT_USER_ID, "<your git user -- set 'gitUserId'>");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ThisBuild / name := "{{artifactId}}"
ThisBuild / organization := "{{groupId}}"
ThisBuild / version := "0.0.1-SNAPSHOT"
ThisBuild / version := "{{artifactVersion}}"
ThisBuild / scalaVersion := "3.4.1"
ThisBuild / scalafmtOnCompile := true
ThisBuild / versionScheme := Some("early-semver")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import mill._, scalalib._, scalafmt._, publish._
// mill _.publishLocal
// mill _.test.test
object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule {
def scalaVersion = "3.3.1"
def scalaVersion = "3.4.1"
def pomSettings = PomSettings(
description = "{{artifactId}}",
Expand All @@ -21,7 +21,7 @@ object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule {
)
)
def publishVersion: mill.T[String] = T("0.0.1-SNAPSHOT")
def publishVersion: mill.T[String] = T("{{artifactVersion}}")
def ivyDeps = Agg(
ivy"com.lihaoyi::cask:0.9.2" ,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "3.3.1"
//> using lib "{{groupId}}::{{artifactId}}:0.0.1-SNAPSHOT"
//> using scala "3.4.1"
//> using lib "{{groupId}}::{{artifactId}}:{{artifactVersion}}"
//> using repositories https://maven.pkg.github.com/{{{gitUserId}}}/{{{gitRepoId}}}


Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/scala-cask/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ThisBuild / name := "scala-cask-petstore"
ThisBuild / organization := "cask.groupId"
ThisBuild / version := "0.0.1-SNAPSHOT"
ThisBuild / version := "0.0.1"
ThisBuild / scalaVersion := "3.4.1"
ThisBuild / scalafmtOnCompile := true
ThisBuild / versionScheme := Some("early-semver")
Expand Down
4 changes: 2 additions & 2 deletions samples/server/petstore/scala-cask/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import mill._, scalalib._, scalafmt._, publish._
// mill _.publishLocal
// mill _.test.test
object scala-cask-petstore extends SbtModule with ScalafmtModule with PublishModule {
def scalaVersion = "3.3.1"
def scalaVersion = "3.4.1"

def pomSettings = PomSettings(
description = "scala-cask-petstore",
Expand All @@ -21,7 +21,7 @@ object scala-cask-petstore extends SbtModule with ScalafmtModule with PublishMod
)
)

def publishVersion: mill.T[String] = T("0.0.1-SNAPSHOT")
def publishVersion: mill.T[String] = T("0.0.1")

def ivyDeps = Agg(
ivy"com.lihaoyi::cask:0.9.2" ,
Expand Down
4 changes: 2 additions & 2 deletions samples/server/petstore/scala-cask/example/Server.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//> using scala "3.3.1"
//> using lib "cask.groupId::scala-cask-petstore:0.0.1-SNAPSHOT"
//> using scala "3.4.1"
//> using lib "cask.groupId::scala-cask-petstore:0.0.1"
//> using repositories https://maven.pkg.github.com/GIT_USER_ID/GIT_REPO_ID


Expand Down

0 comments on commit efb7e56

Please sign in to comment.