-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marc Nuri <marc@marcnuri.com>
- Loading branch information
Showing
11 changed files
with
298 additions
and
93 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
26 changes: 26 additions & 0 deletions
26
...be-kit-helidon/src/main/java/org/eclipse/jkube/helidon/generator/HelidonFromSelector.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,26 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.helidon.generator; | ||
|
||
|
||
import org.eclipse.jkube.generator.api.FromSelector; | ||
|
||
@FunctionalInterface | ||
public interface HelidonFromSelector { | ||
|
||
FromSelector fromSelector(HelidonGenerator helidonGenerator); | ||
|
||
HelidonFromSelector NATIVE = helidonGenerator -> new FromSelector.Default(helidonGenerator.getContext(), "helidon-native"); | ||
HelidonFromSelector STANDARD = helidonGenerator -> new FromSelector.Default(helidonGenerator.getContext(), "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
96 changes: 96 additions & 0 deletions
96
...kube-kit-helidon/src/main/java/org/eclipse/jkube/helidon/generator/HelidonGenerators.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,96 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.helidon.generator; | ||
|
||
import org.eclipse.jkube.generator.api.FromSelector; | ||
import org.eclipse.jkube.generator.javaexec.JavaExecGenerator; | ||
import org.eclipse.jkube.kit.common.Arguments; | ||
import org.eclipse.jkube.kit.common.AssemblyConfiguration; | ||
import org.eclipse.jkube.kit.common.JavaProject; | ||
|
||
import java.util.function.Function; | ||
|
||
import static org.eclipse.jkube.generator.javaexec.JavaExecGenerator.JOLOKIA_PORT_DEFAULT; | ||
import static org.eclipse.jkube.generator.javaexec.JavaExecGenerator.PROMETHEUS_PORT_DEFAULT; | ||
import static org.eclipse.jkube.helidon.HelidonUtils.hasHelidonGraalNativeImageExtension; | ||
|
||
public enum HelidonGenerators { | ||
|
||
NATIVE( | ||
HelidonFromSelector.NATIVE, | ||
HelidonAssembly.NATIVE, | ||
helidonGenerator -> "/", | ||
helidonGenerator -> Arguments.builder() | ||
.execArgument("./" + helidonGenerator.getContext().getProject().getArtifactId()) | ||
.build(), | ||
"0", | ||
"0"), | ||
STANDARD( | ||
HelidonFromSelector.STANDARD, | ||
HelidonAssembly.STANDARD, | ||
helidonGenerator -> helidonGenerator.getConfig(JavaExecGenerator.Config.TARGET_DIR), | ||
helidonGenerator -> null, | ||
JOLOKIA_PORT_DEFAULT, | ||
PROMETHEUS_PORT_DEFAULT); | ||
|
||
private final HelidonFromSelector fromSelector; | ||
private final HelidonAssembly assembly; | ||
private final Function<HelidonGenerator, String> buildWorkdir; | ||
private final Function<HelidonGenerator, Arguments> buildEntryPoint; | ||
private final String jolokiaPort; | ||
private final String prometheusPort; | ||
|
||
HelidonGenerators( | ||
HelidonFromSelector fromSelector, HelidonAssembly assembly, Function<HelidonGenerator, String> buildWorkdir, | ||
Function<HelidonGenerator, Arguments> buildEntryPoint, String jolokiaPort, String prometheusPort) { | ||
this.fromSelector = fromSelector; | ||
this.assembly = assembly; | ||
this.buildWorkdir = buildWorkdir; | ||
this.buildEntryPoint = buildEntryPoint; | ||
this.jolokiaPort = jolokiaPort; | ||
this.prometheusPort = prometheusPort; | ||
} | ||
|
||
|
||
public FromSelector fromSelector(HelidonGenerator helidonGenerator) { | ||
return fromSelector.fromSelector(helidonGenerator); | ||
} | ||
|
||
public AssemblyConfiguration createAssemblyConfiguration(HelidonGenerator helidonGenerator) { | ||
return assembly.createAssemblyConfiguration(helidonGenerator); | ||
} | ||
|
||
public String getBuildWorkdir(HelidonGenerator helidonGenerator) { | ||
return buildWorkdir.apply(helidonGenerator); | ||
} | ||
|
||
public Arguments getBuildEntryPoint(HelidonGenerator helidonGenerator) { | ||
return buildEntryPoint.apply(helidonGenerator); | ||
} | ||
|
||
public String getDefaultJolokiaPort() { | ||
return jolokiaPort; | ||
} | ||
|
||
public String getDefaultPrometheusPort() { | ||
return prometheusPort; | ||
} | ||
|
||
public static HelidonGenerators from(JavaProject project) { | ||
if (hasHelidonGraalNativeImageExtension(project)) { | ||
return NATIVE; | ||
} | ||
return STANDARD; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...it/jkube-kit-helidon/src/main/resources-filtered/META-INF/jkube/default-images.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,21 @@ | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at: | ||
# | ||
# https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Red Hat, Inc. - initial API and implementation | ||
# | ||
|
||
# Properties for specifying the default images version to use | ||
# The replacement values are defined in the parent pom.xml as properties | ||
|
||
# Upstream images | ||
helidon-native.upstream.s2i=${image.helidon-native.upstream.s2i} | ||
helidon-native.upstream.docker=${image.helidon-native.upstream.docker} | ||
helidon-native.upstream.istag=${image.helidon-native.upstream.istag} |
Oops, something went wrong.