Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin Language Supports #11307

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//@formatter:off
    return moduleBuilder(properties)
      .gitIgnore()
        .comment("Kotlin Language")
        .and()
      .gradlePlugins()
        .plugin(kotlinPluginManagement())
        .and()
      .build();
    //@formatter:on
  }

.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,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);
}
}
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 @@ -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
Loading