Commit 1497c861 authored by Abdallah Atouani's avatar Abdallah Atouani
Browse files

change regex strucutre for LayerArtifactParameterSymbol

parent 4a0cf96a
Pipeline #403477 failed with stage
in 31 seconds
...@@ -18,22 +18,26 @@ public class LayerArtifactParameterSymbol extends TagSymbol { ...@@ -18,22 +18,26 @@ public class LayerArtifactParameterSymbol extends TagSymbol {
super(KIND, "."); super(KIND, ".");
} }
public LayerArtifactParameterSymbol(String artifact, String name) { public LayerArtifactParameterSymbol(String artifact, String jar, String id) {
this(KIND, artifact, name); this(KIND, artifact, jar, id);
} }
public LayerArtifactParameterSymbol(LayerArtifactParameterKind kind, String artifact, String name) { public LayerArtifactParameterSymbol(LayerArtifactParameterKind kind, String artifact, String jar, String id) {
super(kind, artifact, name); super(kind, artifact, jar, id);
} }
public String getArtifact() { public String getArtifact() {
return getValue(0); return getValue(0);
} }
public String getId() { public String getJar() {
return getValue(1); return getValue(1);
} }
public String getId() {
return getValue(2);
}
@Override @Override
public String toString() { public String toString() {
return super.toString(); return super.toString();
......
...@@ -21,13 +21,14 @@ import de.se_rwth.commons.Joiners; ...@@ -21,13 +21,14 @@ import de.se_rwth.commons.Joiners;
import de.se_rwth.commons.logging.Log; import de.se_rwth.commons.logging.Log;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class LayerArtifactParameterSymbolCreator implements TagSymbolCreator { public class LayerArtifactParameterSymbolCreator implements TagSymbolCreator {
protected final String regexExpression = "\\s*\\{\\s*artifact\\s*=\\s*(.*)\\s*,\\s*id\\s*=\\s*(.*)\\s*\\}\\s*"; protected final String regexExpression = "\\s*\\{\\s*artifact\\s*=\\s*(.+):(.+):(.+)\\s*,\\s*id\\s*=\\s*(.*)\\s*\\}\\s*";
protected final Pattern pattern = Pattern.compile(regexExpression, Pattern.MULTILINE); protected final Pattern pattern = Pattern.compile(regexExpression, Pattern.MULTILINE);
@Override @Override
...@@ -69,8 +70,12 @@ public class LayerArtifactParameterSymbolCreator implements TagSymbolCreator { ...@@ -69,8 +70,12 @@ public class LayerArtifactParameterSymbolCreator implements TagSymbolCreator {
) )
.filter(Optional::isPresent) .filter(Optional::isPresent)
.map(Optional::get) .map(Optional::get)
.forEachOrdered(scope -> .forEachOrdered(scope -> {
tagging.addTag(scope, new LayerArtifactParameterSymbol(matcher.group(1), matcher.group(2))) String artifact = String.format("%s%s%s%s%s", matcher.group(1).replace('.', File.separatorChar),
File.separator, matcher.group(2), File.separator, matcher.group(3));
// TODO: change dataset to pretrained
String jar = String.format("%s-%s-pretrained", matcher.group(2), matcher.group(3));
tagging.addTag(scope, new LayerArtifactParameterSymbol(artifact, jar, matcher.group(4))); }
); );
}); });
} }
...@@ -84,7 +89,7 @@ public class LayerArtifactParameterSymbolCreator implements TagSymbolCreator { ...@@ -84,7 +89,7 @@ public class LayerArtifactParameterSymbolCreator implements TagSymbolCreator {
Log.error( Log.error(
String.format( String.format(
"'%s' does not match the specified regex pattern '%s'", "'%s' does not match the specified regex pattern '%s'",
regex, "{artifact = {LayerArtifactParameter}, id = {tagId}}" regex, "{artifact = {groupId:artifactId:version}, id = {tagId}}"
) )
); );
return null; return null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment