Skip to content

Commit

Permalink
Kotlin Language Supports
Browse files Browse the repository at this point in the history
  • Loading branch information
BingZi-233 committed Nov 5, 2024
1 parent b698153 commit 0079c8d
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package tech.jhipster.lite.generator.language.kotlin;
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 0079c8d

Please sign in to comment.