Skip to content

Commit

Permalink
Updated Spring and VueJS versions and added AI version. (#39)
Browse files Browse the repository at this point in the history
* Updated Spring and VueJS versions and added AI version.

* Updated Gradle
  • Loading branch information
nicholasnet authored Mar 31, 2024
1 parent f6f2439 commit d19c7d5
Show file tree
Hide file tree
Showing 27 changed files with 1,039 additions and 637 deletions.
2 changes: 1 addition & 1 deletion e2e/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test('visits the app root url and show dependency dialog', async ({ page }) => {

// Make sure that items are displayed
await expect(page.locator('div[role="dialog"]')).toHaveCount(1)
await expect(page.locator('div[data-package-item="true"]')).toHaveCount(75)
await expect(page.locator('div[data-package-item="true"]')).toHaveCount(94)
await expect(page.locator('div[data-package-item-id="lombok"]')).toHaveCount(1)

// Make sure package filter works
Expand Down
1,064 changes: 550 additions & 514 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"jszip": "^3.10.1",
"liquidjs": "^10.8.3",
"lodash.partition": "^4.6.0",
"marked": "^11.0.0",
"marked": "^12.0.1",
"pinia": "^2.1.4",
"prismjs": "^1.29.0",
"vue": "^3.3.7"
Expand All @@ -41,7 +41,7 @@
"@vitest/coverage-v8": "^1.0.4",
"autoprefixer": "^10.4.14",
"glob": "^10.3.3",
"husky": "^8.0.3",
"husky": "^9.0.11",
"nodemon": "^3.0.1",
"ts-node": "^10.9.2",
"postcss": "^8.4.23",
Expand All @@ -61,9 +61,9 @@
"jsdom": "^24.0.0",
"npm-run-all2": "^6.1.1",
"prettier": "^3.0.3",
"typescript": "~5.3.0",
"typescript": "~5.4.0",
"vite": "^5.0.10",
"vitest": "^1.2.2",
"vue-tsc": "^1.8.25"
"vue-tsc": "^2.0.6"
}
}
Binary file modified public/gradle-wrapper.jar
Binary file not shown.
20 changes: 10 additions & 10 deletions public/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const springProject = ref<{ active: boolean; valid: boolean; metaData: SpringPro
valid: true,
metaData: {
language: Language.Java,
springBootVersion: SpringBootVersion['3_2_3'] as SpringBootVersion,
springBootVersion: SpringBootVersion['3_2_4'] as SpringBootVersion,
group: defaultGroup,
name: 'demo',
artifact: 'demo',
Expand Down
8 changes: 4 additions & 4 deletions src/components/SpringProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,17 @@ function validate() {
<div class="flex space-x-4">
<BaseInput
v-model="springBootVersion"
:label="SpringBootVersion['3_2_3']"
:label="SpringBootVersion['3_2_4']"
name="springBootVersion"
type="radio"
:value="SpringBootVersion['3_2_3']"
:value="SpringBootVersion['3_2_4']"
></BaseInput>
<BaseInput
v-model="springBootVersion"
:label="SpringBootVersion['3_1_9']"
:label="SpringBootVersion['3_1_10']"
name="springBootVersion"
type="radio"
:value="SpringBootVersion['3_1_9']"
:value="SpringBootVersion['3_1_10']"
></BaseInput>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/__tests__/SpringProject.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('SpringProject works correctly', () => {
valid: false,
metaData: {
language: Language.Java,
springBootVersion: SpringBootVersion['3_1_9'] as SpringBootVersion,
springBootVersion: SpringBootVersion['3_1_10'] as SpringBootVersion,
group: 'test',
name: 'demo',
artifact: 'demo',
Expand All @@ -37,7 +37,7 @@ describe('SpringProject works correctly', () => {
valid: false,
metaData: {
language: Language.Java,
springBootVersion: SpringBootVersion['3_1_9'] as SpringBootVersion,
springBootVersion: SpringBootVersion['3_1_10'] as SpringBootVersion,
group: 'test',
name: 'demo',
artifact: 'demo',
Expand Down
4 changes: 2 additions & 2 deletions src/entity/SpringBootVersion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum SpringBootVersion {
'3_2_3' = '3.2.3',
'3_1_9' = '3.1.9'
'3_2_4' = '3.2.4',
'3_1_10' = '3.1.10'
}
32 changes: 24 additions & 8 deletions src/generator/spring/SpringProjectGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function getMinimumJdkCompatibility(
return selectedJavaVersion
}

if (selectedSpringBootVersion === SpringBootVersion['3_1_9']) {
if (selectedSpringBootVersion === SpringBootVersion['3_1_10']) {
return 17
}

Expand Down Expand Up @@ -429,6 +429,19 @@ export function getContent(projectMetaData: { metadata: SpringProject; dependenc

const enabledDependencies = projectMetaData.dependencies.filter((it) => it.supported ?? true)
const dependenciesIds: Set<string> = new Set<string>(enabledDependencies.map((it) => it.id))
let haveAIDependencies = false
for (const dependency of projectMetaData.dependencies) {
if (
dependency.parentName?.toLowerCase() === 'ai' &&
dependency.supported &&
dependency.id !== 'timefold-solver'
) {
haveAIDependencies = true
break
}
}
const springAIVersion = '0.8.1'
const timefoldVersion = '1.8.0'

const [plugins, d] = partition(enabledDependencies, (pointer: Package) => {
return pointer.plugin ?? false
Expand Down Expand Up @@ -501,29 +514,32 @@ export function getContent(projectMetaData: { metadata: SpringProject; dependenc
haveLombok: dependenciesIds.has('lombok'),
haveSpringShellDependency: dependenciesIds.has('spring-shell'),
haveTimeFoldSolverDependency: dependenciesIds.has('timefold-solver'),
timefoldVersion: timefoldVersion,
haveSpringCloudDependency: haveCloudDependencies(dependenciesIds),
annotationDependencies: annotationDependencies,
buildTool: projectMetaData.metadata.buildTool,
kotlin: Language.Kotlin,
haveAIDependencies: haveAIDependencies,
springAIVersion: springAIVersion,
java: Language.Java,
ormVersion:
projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_9']
? '"6.2.17.Final"'
: '"6.4.1.Final"',
projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_10']
? '"6.2.22.Final"'
: '"6.4.4.Final"',
explicitDockerImageForGradleIsRequired:
SpringBootVersion['3_1_9'] === projectMetaData.metadata.springBootVersion,
SpringBootVersion['3_1_10'] === projectMetaData.metadata.springBootVersion,
kotlinSelected: projectMetaData.metadata.language === Language.Kotlin,
javaSelected: projectMetaData.metadata.language === Language.Java,
springCloudVersion:
projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_9'] ? '2022.0.5' : '2023.0.0',
projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_10'] ? '2022.0.5' : '2023.0.1',
springShellVersion:
projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_9'] ? '3.1.7' : '3.2.0',
projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_10'] ? '3.1.7' : '3.2.0',
jdkSourceCompatibility: getMinimumJdkCompatibility(
projectMetaData.metadata.language,
projectMetaData.metadata.javaVersion,
projectMetaData.metadata.springBootVersion
),
kotlinPlugin: projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_9'] ? '1.8.22' : '1.9.22'
kotlinPlugin: projectMetaData.metadata.springBootVersion === SpringBootVersion['3_1_10'] ? '1.8.22' : '1.9.23'
}

const contentTree: Array<File | Folder> =
Expand Down
22 changes: 11 additions & 11 deletions src/generator/spring/__tests__/SpringProjectGenerator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import type { SpringProject } from '@/entity/SpringProject'
import type { File } from '@/entity/File'
import type { Package } from '@/entity/Dependency'
import { Language } from '../../../entity/Language'
import spring3_1_9 from '../../../stores/spring-3_1_9'
import spring3_2_3 from '../../../stores/spring-3_2_3'
import spring3_1_10 from '../../../stores/spring-3_1_10'
import spring3_2_4 from '../../../stores/spring-3_2_4'

const spring3_1_6Packages: Package[] = spring3_1_9.flatMap((it) => {
const spring3_1_6Packages: Package[] = spring3_1_10.flatMap((it) => {
return it.packages.map((pack) => {
return pack
})
})

const spring3_2_3Packages: Package[] = spring3_2_3.flatMap((it) => {
const spring3_2_4Packages: Package[] = spring3_2_4.flatMap((it) => {
return it.packages.map((pack) => {
return pack
})
Expand All @@ -31,7 +31,7 @@ function getOutput(fileName: string) {

function getMetadata(
language: Language.Kotlin | Language.Java = Language.Java,
springBootVersion: SpringBootVersion = SpringBootVersion['3_1_9'],
springBootVersion: SpringBootVersion = SpringBootVersion['3_1_10'],
jdkVersion: 17 | 21 = 17
): SpringProject {
return {
Expand All @@ -50,7 +50,7 @@ function getMetadata(
function getGradleContent(
dependencies: Package[],
language: Language.Kotlin | Language.Java = Language.Java,
springBootVersion: SpringBootVersion = SpringBootVersion['3_1_9'],
springBootVersion: SpringBootVersion = SpringBootVersion['3_1_10'],
jdkVersion: 17 | 21 = 17
): string {
return (
Expand All @@ -61,12 +61,12 @@ function getGradleContent(
).content!!
}

function getDependencies(input: string[], springBootVersion: SpringBootVersion = SpringBootVersion['3_1_9']) {
if (springBootVersion === SpringBootVersion['3_1_9']) {
function getDependencies(input: string[], springBootVersion: SpringBootVersion = SpringBootVersion['3_1_10']) {
if (springBootVersion === SpringBootVersion['3_1_10']) {
return spring3_1_6Packages.filter((it) => input.includes(it.id))
}

return spring3_2_3Packages.filter((it) => input.includes(it.id))
return spring3_2_4Packages.filter((it) => input.includes(it.id))
}

describe('Can generate build.gradle properly', () => {
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('Can generate build.gradle properly', () => {
'docker-compose-setup'
]),
Language.Kotlin,
SpringBootVersion['3_2_3']
SpringBootVersion['3_2_4']
)
).toBe(getOutput('all-developer-tools-selected-with-kotlin-for-spring-3-2'))
})
Expand All @@ -109,7 +109,7 @@ describe('Can generate build.gradle properly', () => {
getGradleContent(
getDependencies(['wavefront', 'distributed-tracing']),
Language.Java,
SpringBootVersion['3_2_3'],
SpringBootVersion['3_2_4'],
21
)
).toBe(getOutput('distributed-tracing-with-wavefront-with-java-spring_3_2_JDK_21'))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id("org.springframework.boot") version "3.2.3"
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
id("org.graalvm.buildtools.native") version "0.9.28"
id("com.netflix.dgs.codegen") version "6.0.3"
kotlin("jvm") version "1.9.22"
kotlin("plugin.spring") version "1.9.22"
kotlin("jvm") version "1.9.23"
kotlin("plugin.spring") version "1.9.23"
}

group = "com.test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.springframework.boot") version "3.1.9"
id("org.springframework.boot") version "3.1.10"
id("io.spring.dependency-management") version "1.1.4"
id("org.graalvm.buildtools.native") version "0.9.28"
kotlin("jvm") version "1.8.22"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
java
id("org.springframework.boot") version "3.2.3"
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.springframework.boot") version "3.1.9"
id("org.springframework.boot") version "3.1.10"
id("io.spring.dependency-management") version "1.1.4"
kotlin("jvm") version "1.8.22"
kotlin("plugin.spring") version "1.8.22"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
java
id("org.springframework.boot") version "3.1.9"
id("org.springframework.boot") version "3.1.10"
id("io.spring.dependency-management") version "1.1.4"
}

Expand Down
13 changes: 11 additions & 2 deletions src/generator/spring/template/build.gradle.kts.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ configurations {

repositories {
mavenCentral()
{%- if haveAIDependencies -%}
maven { url = uri("https://repo.spring.io/milestone") }
{%- endif -%}
}
{%- if haveSpringCloudDependency or haveSpringShellDependency or haveTimeFoldSolverDependency -%}
{%- if haveSpringCloudDependency or haveSpringShellDependency or haveTimeFoldSolverDependency or haveAIDependencies -%}

{%- if haveSpringCloudDependency -%}
extra["springCloudVersion"] = "{{ springCloudVersion }}"
Expand All @@ -50,7 +53,10 @@ extra["springCloudVersion"] = "{{ springCloudVersion }}"
extra["springShellVersion"] = "{{ springShellVersion }}"
{%- endif -%}
{%- if haveTimeFoldSolverDependency -%}
extra["timefoldSolverVersion"] = "1.7.0"
extra["timefoldSolverVersion"] = "{{ timefoldVersion }}"
{%- endif -%}
{%- if haveAIDependencies -%}
extra["springAiVersion"] = "{{ springAIVersion }}"
{%- endif -%}
{%- endif -%}

Expand Down Expand Up @@ -142,6 +148,9 @@ dependencyManagement {
{%- if haveTimeFoldSolverDependency -%}
mavenBom("ai.timefold.solver:timefold-solver-bom:${property("timefoldSolverVersion")}")
{%- endif -%}
{%- if haveAIDependencies -%}
mavenBom("org.springframework.ai:spring-ai-bom:${property("springAIVersion")}")
{%- endif -%}
}
}
{%- endif -%}
Expand Down
8 changes: 7 additions & 1 deletion src/generator/spring/template/compose.yaml.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
services:
{%- if dependenciesIds contains "qdrant-vector-database-ai" -%}
qdrant:
image: 'qdrant/qdrant'
ports:
- '6333:6333'
{%- endif -%}
{%- if dependenciesIds contains "data-elasticsearch" -%}
elasticsearch:
image: 'docker.elastic.co/elasticsearch/elasticsearch:7.17.10'
Expand Down Expand Up @@ -42,7 +48,7 @@ services:
ports:
- '5432'
{%- endif -%}
{%- if dependenciesIds contains "data-redis" -%}
{%- if dependenciesIds contains "data-redis" or dependenciesIds contains "redis-search-and-query-vector-database-ai" -%}
redis:
image: 'redis:alpine'
ports:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading

0 comments on commit d19c7d5

Please sign in to comment.