-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As discussed in #913 (comment), except the user tag is not limited to the first entry. A user tag will however disable the optimize option. Signed-off-by: Jens Andersen <[email protected]>
- Loading branch information
1 parent
fc53963
commit 355f7b4
Showing
26 changed files
with
436 additions
and
196 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
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
46 changes: 46 additions & 0 deletions
46
src/main/java/io/fabric8/maven/docker/MojoConfigurator.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,46 @@ | ||
package io.fabric8.maven.docker; | ||
|
||
import io.fabric8.maven.docker.assembly.DockerFileKeyword; | ||
import io.fabric8.maven.docker.config.RunCommand; | ||
import org.codehaus.plexus.component.configurator.BasicComponentConfigurator; | ||
import org.codehaus.plexus.component.configurator.ComponentConfigurationException; | ||
import org.codehaus.plexus.component.configurator.ConfigurationListener; | ||
import org.codehaus.plexus.component.configurator.converters.ConfigurationConverter; | ||
import org.codehaus.plexus.component.configurator.converters.lookup.ConverterLookup; | ||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; | ||
import org.codehaus.plexus.configuration.PlexusConfiguration; | ||
|
||
import javax.inject.Named; | ||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* Configure a converter for runcmds that can be either USER or RUN with value as parameter | ||
*/ | ||
|
||
@Named("fabric8-mojo-configurator") | ||
public class MojoConfigurator extends BasicComponentConfigurator { | ||
private static final Set<String> VALID_KEYWORDS = new HashSet<>(Arrays.asList("RUN", "USER")); | ||
|
||
public MojoConfigurator() { | ||
converterLookup.registerConverter(new ConfigurationConverter() { | ||
@Override | ||
public boolean canConvert(Class<?> aClass) { | ||
return RunCommand.class == aClass; | ||
} | ||
|
||
@Override | ||
public Object fromConfiguration(ConverterLookup converterLookup, PlexusConfiguration plexusConfiguration, Class<?> aClass, Class<?> aClass1, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator) throws ComponentConfigurationException { | ||
return fromConfiguration(converterLookup, plexusConfiguration, aClass, aClass1, classLoader, expressionEvaluator, null); | ||
} | ||
|
||
@Override | ||
public Object fromConfiguration(ConverterLookup converterLookup, PlexusConfiguration plexusConfiguration, Class<?> aClass, Class<?> aClass1, ClassLoader classLoader, ExpressionEvaluator expressionEvaluator, ConfigurationListener configurationListener) throws ComponentConfigurationException { | ||
String keyword = plexusConfiguration.getName().trim().toUpperCase(); | ||
if (!VALID_KEYWORDS.contains(keyword) || plexusConfiguration.getValue() == null) return null; | ||
return new RunCommand(DockerFileKeyword.valueOf(keyword), plexusConfiguration.getValue().trim()); | ||
} | ||
}); | ||
} | ||
} |
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
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
Oops, something went wrong.