mirror of
https://gitee.com/dcren/initializr.git
synced 2025-04-05 17:38:06 +08:00
Set "gradle" buildSystem for "gradle-project-kotlin" types
Prior to this commit, projects with type "gradle-project-kotlin" would not get the expected "gradle" buildSystem property, unlike the Groovy flavor with "gradle-project". This value would be set as empty. This commit ensures that the detection algorithm supports project types with multiple "-" within their values. Fixes gh-1370
This commit is contained in:
parent
7ea72e72d9
commit
10d22bc534
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2022 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -99,7 +99,7 @@ public class ProjectRequestDocumentFactory {
|
||||
private String determineBuildSystem(ProjectRequest request) {
|
||||
String type = request.getType();
|
||||
String[] elements = type.split("-");
|
||||
return (elements.length == 2) ? elements[0] : null;
|
||||
return (elements.length >= 2) ? elements[0] : null;
|
||||
}
|
||||
|
||||
private VersionInformation determineVersionInformation(ProjectRequest request) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -217,6 +217,16 @@ class ProjectRequestDocumentFactoryTests {
|
||||
assertThat(document.getErrorState().getDependencies()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDocumentExtendedType() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
request.setType("gradle-project-kotlin");
|
||||
ProjectGeneratedEvent event = createProjectGeneratedEvent(request);
|
||||
ProjectRequestDocument document = this.factory.createDocument(event);
|
||||
assertThat(document.getType()).isEqualTo("gradle-project-kotlin");
|
||||
assertThat(document.getBuildSystem()).isEqualTo("gradle");
|
||||
}
|
||||
|
||||
@Test
|
||||
void createDocumentInvalidDependency() {
|
||||
ProjectRequest request = createProjectRequest();
|
||||
|
Loading…
Reference in New Issue
Block a user