-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Helidon uses the nested generator approach
Signed-off-by: Marc Nuri <marc@marcnuri.com>
- Loading branch information
Showing
8 changed files
with
255 additions
and
207 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...don/src/main/java/org/eclipse/jkube/helidon/generator/AbstractHelidonNestedGenerator.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 (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.GeneratorConfig; | ||
import org.eclipse.jkube.generator.api.GeneratorContext; | ||
import org.eclipse.jkube.generator.javaexec.JavaExecGenerator; | ||
import org.eclipse.jkube.kit.common.JavaProject; | ||
|
||
public abstract class AbstractHelidonNestedGenerator implements HelidonNestedGenerator { | ||
|
||
private final GeneratorContext generatorContext; | ||
private final GeneratorConfig generatorConfig; | ||
|
||
AbstractHelidonNestedGenerator(GeneratorContext generatorContext, GeneratorConfig generatorConfig) { | ||
this.generatorContext = generatorContext; | ||
this.generatorConfig = generatorConfig; | ||
} | ||
|
||
@Override | ||
public final JavaProject getProject() { | ||
return generatorContext.getProject(); | ||
} | ||
|
||
@Override | ||
public String getBuildWorkdir() { | ||
return generatorConfig.get(JavaExecGenerator.Config.TARGET_DIR); | ||
} | ||
|
||
@Override | ||
public String getTargetDir() { | ||
return generatorConfig.get(JavaExecGenerator.Config.TARGET_DIR); | ||
} | ||
} |
71 changes: 0 additions & 71 deletions
71
.../jkube-kit-helidon/src/main/java/org/eclipse/jkube/helidon/generator/HelidonAssembly.java
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
...be-kit-helidon/src/main/java/org/eclipse/jkube/helidon/generator/HelidonFromSelector.java
This file was deleted.
Oops, something went wrong.
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: 0 additions & 96 deletions
96
...kube-kit-helidon/src/main/java/org/eclipse/jkube/helidon/generator/HelidonGenerators.java
This file was deleted.
Oops, something went wrong.
58 changes: 58 additions & 0 deletions
58
...kit-helidon/src/main/java/org/eclipse/jkube/helidon/generator/HelidonNestedGenerator.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,58 @@ | ||
/** | ||
* 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.GeneratorConfig; | ||
import org.eclipse.jkube.generator.api.GeneratorContext; | ||
import org.eclipse.jkube.kit.common.Arguments; | ||
import org.eclipse.jkube.kit.common.AssemblyConfiguration; | ||
import org.eclipse.jkube.kit.common.JavaProject; | ||
|
||
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 interface HelidonNestedGenerator { | ||
|
||
JavaProject getProject(); | ||
|
||
AssemblyConfiguration createAssemblyConfiguration(); | ||
|
||
default String getFrom() { | ||
return null; | ||
} | ||
|
||
default String getDefaultJolokiaPort() { | ||
return JOLOKIA_PORT_DEFAULT; | ||
} | ||
|
||
default String getDefaultPrometheusPort() { | ||
return PROMETHEUS_PORT_DEFAULT; | ||
} | ||
|
||
default Arguments getBuildEntryPoint() { | ||
return null; | ||
} | ||
|
||
String getBuildWorkdir(); | ||
|
||
String getTargetDir(); | ||
|
||
static HelidonNestedGenerator from(GeneratorContext generatorContext, GeneratorConfig generatorConfig) { | ||
if (hasHelidonGraalNativeImageExtension(generatorContext.getProject())) { | ||
return new NativeGenerator(generatorContext, generatorConfig); | ||
} | ||
return new StandardGenerator(generatorContext, generatorConfig); | ||
} | ||
} |
Oops, something went wrong.