generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ef52a6
commit 5a87ebf
Showing
16 changed files
with
2,076 additions
and
45 deletions.
There are no files selected for viewing
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
48 changes: 48 additions & 0 deletions
48
gcn/gcn-core/src/main/java/cloud/graal/gcn/GcnVersionInfo.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,48 @@ | ||
/* | ||
* Copyright 2023 Oracle and/or its affiliates | ||
* | ||
* 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 cloud.graal.gcn; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
import java.io.Reader; | ||
import java.net.URL; | ||
import java.util.Properties; | ||
|
||
import static java.nio.charset.StandardCharsets.UTF_8; | ||
|
||
public class GcnVersionInfo { | ||
|
||
private static final Properties VERSIONS = new Properties(); | ||
|
||
static { | ||
URL resource = GcnVersionInfo.class.getResource("/gcn-platform-versions.properties"); | ||
if (resource != null) { | ||
try (Reader reader = new InputStreamReader(resource.openStream(), UTF_8)) { | ||
VERSIONS.load(reader); | ||
} catch (IOException ignored) { | ||
// ignore | ||
} | ||
} | ||
} | ||
|
||
public static String getMicronautVersion() { | ||
Object micronautVersion = VERSIONS.get("micronaut.platform.version"); | ||
if (micronautVersion != null) { | ||
return micronautVersion.toString(); | ||
} | ||
return "2.0.0"; | ||
} | ||
} |
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
67 changes: 67 additions & 0 deletions
67
gcn/gcn-core/src/main/java/cloud/graal/gcn/feature/create/app/GcnSpringBootCloudApp.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,67 @@ | ||
/* | ||
* Copyright 2023 Oracle and/or its affiliates | ||
* | ||
* 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 cloud.graal.gcn.feature.create.app; | ||
|
||
import cloud.graal.gcn.GcnGeneratorContext; | ||
import cloud.graal.gcn.feature.GcnFeatureContext; | ||
import cloud.graal.gcn.feature.create.AbstractGcnCreateFeature; | ||
import cloud.graal.gcn.model.GcnCloud; | ||
import cloud.graal.gcn.model.GcnProjectType; | ||
import io.micronaut.core.annotation.NonNull; | ||
import io.micronaut.starter.feature.lang.java.JavaApplication; | ||
import jakarta.inject.Singleton; | ||
|
||
import static cloud.graal.gcn.model.GcnCloud.NONE; | ||
import static cloud.graal.gcn.model.GcnProjectType.SPRING_BOOT_APPLICATION; | ||
|
||
/** | ||
* Base class for Spring Boot create-app features. | ||
* | ||
* @since 4.0.0 | ||
*/ | ||
@Singleton | ||
public class GcnSpringBootCloudApp extends AbstractGcnCreateFeature { | ||
|
||
@NonNull | ||
@Override | ||
public GcnProjectType getProjectType() { | ||
return SPRING_BOOT_APPLICATION; | ||
} | ||
|
||
@Override | ||
public GcnCloud getCloud() { | ||
return NONE; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public String getName() { | ||
return "gcn-spring-boot-app"; | ||
} | ||
|
||
@Override | ||
public void processSelectedFeatures(GcnFeatureContext featureContext) { | ||
// exclude default Application and ApplicationTest classes | ||
featureContext.exclude(feature -> feature instanceof JavaApplication); | ||
} | ||
|
||
@Override | ||
public void apply(GcnGeneratorContext generatorContext) { | ||
// Do nothing | ||
// gradle or maven files and Application file are copied | ||
} | ||
|
||
} |
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
1 change: 1 addition & 0 deletions
1
gcn/gcn-core/src/main/resources/gcn-platform-versions.properties
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 @@ | ||
micronaut.platform.version=4.0.7 |
Oops, something went wrong.