Skip to content

Commit efb7e56

Browse files
authored
Cask version fix (#18486)
* using artefact version in build * using artefact version in build * cask knows how to honour artifact versions
1 parent 50945d0 commit efb7e56

File tree

8 files changed

+13
-10
lines changed

8 files changed

+13
-10
lines changed

docs/generators/scala-cask.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
2121
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
2222
|apiPackage|package for generated api classes| |null|
2323
|artifactId|artifactId in generated pom.xml. This also becomes part of the generated library's filename| |null|
24+
|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|
2425
|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|
2526
|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|
2627
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public ScalaCaskServerCodegen() {
118118

119119
cliOptions.add(new CliOption(CodegenConstants.GROUP_ID, CodegenConstants.GROUP_ID_DESC));
120120
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_ID, CodegenConstants.ARTIFACT_ID_DESC));
121+
cliOptions.add(new CliOption(CodegenConstants.ARTIFACT_VERSION, CodegenConstants.ARTIFACT_VERSION_DESC));
121122
cliOptions.add(new CliOption(CodegenConstants.GIT_REPO_ID, CodegenConstants.GIT_REPO_ID_DESC));
122123
cliOptions.add(new CliOption(CodegenConstants.GIT_USER_ID, CodegenConstants.GIT_USER_ID_DESC));
123124
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, CodegenConstants.PACKAGE_DESCRIPTION));
@@ -158,6 +159,7 @@ public void processOpts() {
158159
final String groupId = ensureProp(CodegenConstants.GROUP_ID, "org.openapitools");
159160
ensureProp(CodegenConstants.ARTIFACT_ID, "caskgen");
160161
artifactVersion = ensureProp(CodegenConstants.ARTIFACT_VERSION, "0.0.1");
162+
161163
gitRepoId = ensureProp(CodegenConstants.GIT_REPO_ID, "<your git repo -- set 'gitRepoId'>");
162164
gitUserId = ensureProp(CodegenConstants.GIT_USER_ID, "<your git user -- set 'gitUserId'>");
163165

modules/openapi-generator/src/main/resources/scala-cask/build.sbt.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ThisBuild / name := "{{artifactId}}"
22
ThisBuild / organization := "{{groupId}}"
3-
ThisBuild / version := "0.0.1-SNAPSHOT"
3+
ThisBuild / version := "{{artifactVersion}}"
44
ThisBuild / scalaVersion := "3.4.1"
55
ThisBuild / scalafmtOnCompile := true
66
ThisBuild / versionScheme := Some("early-semver")

modules/openapi-generator/src/main/resources/scala-cask/build.sc.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import mill._, scalalib._, scalafmt._, publish._
88
// mill _.publishLocal
99
// mill _.test.test
1010
object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule {
11-
def scalaVersion = "3.3.1"
11+
def scalaVersion = "3.4.1"
1212
1313
def pomSettings = PomSettings(
1414
description = "{{artifactId}}",
@@ -21,7 +21,7 @@ object {{artifactId}} extends SbtModule with ScalafmtModule with PublishModule {
2121
)
2222
)
2323
24-
def publishVersion: mill.T[String] = T("0.0.1-SNAPSHOT")
24+
def publishVersion: mill.T[String] = T("{{artifactVersion}}")
2525
2626
def ivyDeps = Agg(
2727
ivy"com.lihaoyi::cask:0.9.2" ,

modules/openapi-generator/src/main/resources/scala-cask/example.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//> using scala "3.3.1"
2-
//> using lib "{{groupId}}::{{artifactId}}:0.0.1-SNAPSHOT"
1+
//> using scala "3.4.1"
2+
//> using lib "{{groupId}}::{{artifactId}}:{{artifactVersion}}"
33
//> using repositories https://maven.pkg.github.com/{{{gitUserId}}}/{{{gitRepoId}}}
44

55

samples/server/petstore/scala-cask/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ThisBuild / name := "scala-cask-petstore"
22
ThisBuild / organization := "cask.groupId"
3-
ThisBuild / version := "0.0.1-SNAPSHOT"
3+
ThisBuild / version := "0.0.1"
44
ThisBuild / scalaVersion := "3.4.1"
55
ThisBuild / scalafmtOnCompile := true
66
ThisBuild / versionScheme := Some("early-semver")

samples/server/petstore/scala-cask/build.sc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import mill._, scalalib._, scalafmt._, publish._
88
// mill _.publishLocal
99
// mill _.test.test
1010
object scala-cask-petstore extends SbtModule with ScalafmtModule with PublishModule {
11-
def scalaVersion = "3.3.1"
11+
def scalaVersion = "3.4.1"
1212

1313
def pomSettings = PomSettings(
1414
description = "scala-cask-petstore",
@@ -21,7 +21,7 @@ object scala-cask-petstore extends SbtModule with ScalafmtModule with PublishMod
2121
)
2222
)
2323

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

2626
def ivyDeps = Agg(
2727
ivy"com.lihaoyi::cask:0.9.2" ,

samples/server/petstore/scala-cask/example/Server.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//> using scala "3.3.1"
2-
//> using lib "cask.groupId::scala-cask-petstore:0.0.1-SNAPSHOT"
1+
//> using scala "3.4.1"
2+
//> using lib "cask.groupId::scala-cask-petstore:0.0.1"
33
//> using repositories https://maven.pkg.github.com/GIT_USER_ID/GIT_REPO_ID
44

55

0 commit comments

Comments
 (0)