diff --git a/src/main/java/tech/jhipster/lite/generator/language/kotlin/application/KotlinApplicationService.java b/src/main/java/tech/jhipster/lite/generator/language/kotlin/application/KotlinApplicationService.java new file mode 100644 index 00000000000..7947b08b88b --- /dev/null +++ b/src/main/java/tech/jhipster/lite/generator/language/kotlin/application/KotlinApplicationService.java @@ -0,0 +1,20 @@ +package tech.jhipster.lite.generator.language.kotlin.application; + +import org.springframework.stereotype.Service; +import tech.jhipster.lite.generator.language.kotlin.domain.KotlinModuleFactory; +import tech.jhipster.lite.module.domain.JHipsterModule; +import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; + +@Service +public class KotlinApplicationService { + + private final KotlinModuleFactory factory; + + public KotlinApplicationService() { + factory = new KotlinModuleFactory(); + } + + public JHipsterModule buildKotlinLanguageModule(JHipsterModuleProperties properties) { + return factory.buildKotlinLanguageModule(properties); + } +} diff --git a/src/main/java/tech/jhipster/lite/generator/language/kotlin/domain/KotlinModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/language/kotlin/domain/KotlinModuleFactory.java new file mode 100644 index 00000000000..f4f176b3e57 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/generator/language/kotlin/domain/KotlinModuleFactory.java @@ -0,0 +1,31 @@ +package tech.jhipster.lite.generator.language.kotlin.domain; + +import static tech.jhipster.lite.module.domain.JHipsterModule.moduleBuilder; + +import tech.jhipster.lite.module.domain.JHipsterModule; +import tech.jhipster.lite.module.domain.gradleplugin.GradleCorePlugin; +import tech.jhipster.lite.module.domain.gradleplugin.GradlePluginId; +import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; +import tech.jhipster.lite.shared.error.domain.Assert; + +public class KotlinModuleFactory { + + public JHipsterModule buildKotlinLanguageModule(JHipsterModuleProperties properties) { + Assert.notNull("properties", properties); + + //@formatter:off + return moduleBuilder(properties) + .gitIgnore() + .comment("Kotlin Language") + .and() + .gradlePlugins() + .plugin(kotlinPluginManagement()) + .and() + .build(); + //@formatter:on + } + + private GradleCorePlugin kotlinPluginManagement() { + return GradleCorePlugin.builder().id(new GradlePluginId("kotlin(\"jvm\") version \"1.9.25\"")).build(); + } +} diff --git a/src/main/java/tech/jhipster/lite/generator/language/kotlin/infrastructure/primary/KotlinModuleConfiguration.java b/src/main/java/tech/jhipster/lite/generator/language/kotlin/infrastructure/primary/KotlinModuleConfiguration.java new file mode 100644 index 00000000000..86cf781ef38 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/generator/language/kotlin/infrastructure/primary/KotlinModuleConfiguration.java @@ -0,0 +1,25 @@ +package tech.jhipster.lite.generator.language.kotlin.infrastructure.primary; + +import static tech.jhipster.lite.shared.slug.domain.JHLiteModuleSlug.GRADLE_JAVA; +import static tech.jhipster.lite.shared.slug.domain.JHLiteModuleSlug.GRADLE_KOTLIN; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import tech.jhipster.lite.generator.language.kotlin.application.KotlinApplicationService; +import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization; +import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource; + +@Configuration +public class KotlinModuleConfiguration { + + @Bean + JHipsterModuleResource gradleKotlinLanguageModule(KotlinApplicationService gradle) { + return JHipsterModuleResource.builder() + .slug(GRADLE_KOTLIN) + .withoutProperties() + .apiDoc("Extra Language", "Add Kotlin Language Supports") + .organization(JHipsterModuleOrganization.builder().addDependency(GRADLE_JAVA).build()) + .tags("buildtool", "test") + .factory(gradle::buildKotlinLanguageModule); + } +} diff --git a/src/main/java/tech/jhipster/lite/generator/language/kotlin/package-info.java b/src/main/java/tech/jhipster/lite/generator/language/kotlin/package-info.java new file mode 100644 index 00000000000..69cc0c6d722 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/generator/language/kotlin/package-info.java @@ -0,0 +1 @@ +package tech.jhipster.lite.generator.language.kotlin; diff --git a/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteModuleSlug.java b/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteModuleSlug.java index 66dd0ef692b..60953e986df 100644 --- a/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteModuleSlug.java +++ b/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteModuleSlug.java @@ -46,6 +46,7 @@ public enum JHLiteModuleSlug implements JHipsterModuleSlugFactory { RENOVATE("renovate"), GITPOD("gitpod"), GRADLE_JAVA("gradle-java"), + GRADLE_KOTLIN("gradle-kotlin"), GRADLE_WRAPPER("gradle-wrapper"), HIBERNATE_2ND_LEVEL_CACHE("hibernate-2nd-level-cache"), INFINITEST_FILTERS("infinitest-filters"),