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..86a71378be7 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/generator/language/kotlin/infrastructure/primary/KotlinModuleConfiguration.java @@ -0,0 +1,26 @@ +package tech.jhipster.lite.generator.language.kotlin.infrastructure.primary; + +import static tech.jhipster.lite.shared.slug.domain.JHLiteFeatureSlug.EXTRA_LANGUAGE; +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().feature(EXTRA_LANGUAGE).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/JHLiteFeatureSlug.java b/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteFeatureSlug.java index cca8f6c2a05..9ec0ab7e082 100644 --- a/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteFeatureSlug.java +++ b/src/main/java/tech/jhipster/lite/shared/slug/domain/JHLiteFeatureSlug.java @@ -21,6 +21,7 @@ public enum JHLiteFeatureSlug implements JHipsterFeatureSlugFactory { CODE_COVERAGE_JAVA("code-coverage-java"), JAVA_BUILD_TOOL("java-build-tool"), JAVA_BUILD_TOOL_WRAPPER("java-build-tool-wrapper"), + EXTRA_LANGUAGE("extra-language"), JPA_PERSISTENCE("jpa-persistence"), LICENSE("license"), OAUTH_PROVIDER("oauth-provider"), 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 e31a781e8cc..c769698cc71 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"),