-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish "Generate test apps for spring-ai projects"
See gh-1484
- Loading branch information
1 parent
25f4998
commit f114449
Showing
15 changed files
with
260 additions
and
156 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
...ng/start/site/extension/dependency/springai/ConditionalOnRequestedSpringAiDependency.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2012-2024 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.spring.start.site.extension.dependency.springai; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import io.spring.initializr.generator.project.ProjectDescription; | ||
|
||
import org.springframework.context.annotation.Conditional; | ||
|
||
/** | ||
* Condition that matches when a {@link ProjectDescription} defines a dependency on Spring | ||
* AI. A generated project may ultimately define a different set of dependencies according | ||
* to the contributors that have been executed. To contribute to the project according to | ||
* the real set, prefer querying the model itself rather than using this condition. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ ElementType.TYPE, ElementType.METHOD }) | ||
@Documented | ||
@Conditional(OnRequestedSpringAiDependencyCondition.class) | ||
@interface ConditionalOnRequestedSpringAiDependency { | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...ring/start/site/extension/dependency/springai/OnRequestedSpringAiDependencyCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2012-2024 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.spring.start.site.extension.dependency.springai; | ||
|
||
import io.spring.initializr.generator.buildsystem.Dependency; | ||
import io.spring.initializr.generator.condition.ProjectGenerationCondition; | ||
import io.spring.initializr.generator.project.ProjectDescription; | ||
|
||
import org.springframework.context.annotation.ConditionContext; | ||
import org.springframework.core.type.AnnotatedTypeMetadata; | ||
|
||
/** | ||
* {@link ProjectGenerationCondition} implementation for | ||
* {@link ConditionalOnRequestedSpringAiDependency}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class OnRequestedSpringAiDependencyCondition extends ProjectGenerationCondition { | ||
|
||
@Override | ||
protected boolean matches(ProjectDescription description, ConditionContext context, | ||
AnnotatedTypeMetadata metadata) { | ||
for (Dependency dependency : description.getRequestedDependencies().values()) { | ||
if (dependency.getGroupId().equals("org.springframework.ai")) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
...ite/src/main/java/io/spring/start/site/extension/dependency/springai/SpringAiVersion.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.