Commit 6639e48c authored by javi's avatar javi
Browse files

alpine new version and zip files

parent 1b835eb4
Pipeline #24743 passed with stage
in 1 minute and 56 seconds
FROM alpine:3.9
FROM alpine:3.14
WORKDIR /usr/local/share/dictionary_annotation
ARG DICT_TAGGER_VERSION=1.0
......
......@@ -13,18 +13,18 @@ if [ $# -ge 1 ] ; then
fi
if [ -f /etc/alpine-release ] ; then
# Installing OpenJDK 8
apk add --update openjdk8-jre
# Installing OpenJDK 11
apk add --update openjdk11-jre
# dict tagger development dependencies
apk add openjdk8 git maven
apk add openjdk11 git maven
else
# Runtime dependencies
apt-get update
apt-get install openjdk-8-jre
apt-get install openjdk-11-jre
# The development dependencies
apt-get install openjdk-8-jdk git maven
apt-get install openjdk-11-jdk git maven
fi
......@@ -47,10 +47,10 @@ apk add bash
if [ -f /etc/alpine-release ] ; then
# Removing not needed tools
apk del openjdk8 git maven
#apk del openjdk11 git maven
rm -rf /var/cache/apk/*
else
apt-get remove openjdk-8-jdk git maven
apt-get remove openjdk-11-jdk git maven
rm -rf /var/cache/dpkg
fi
......@@ -192,6 +192,26 @@ public class App {
System.out.println("Please set the list of dictionaries to annotate in the correct format. You can provide the list.def file (or files , separated) or a zip file. Please if you provided a zip file remember that it must contain a list.def file inside");
System.exit(1);
}
if(lf.endsWith(".zip")) {
try {
File file = new File(lf);
String dictionaryFolderPath = file.getName().substring(0, file.getName().indexOf(".zip"));
unZipIt(lf, workdirPath + dictionaryFolderPath );
lf = workdirPath + dictionaryFolderPath + File.separator + "lists.def";
if (!java.nio.file.Files.isRegularFile(Paths.get(lf))) {
System.out.println("Please if you provided a zip file remember that it must contain a list.def file inside.");
System.out.println(lf);
System.exit(1);
}
}catch(Exception e) {
System.out.println("Error unziping directory, please if you provided a zip file remember that it must contain a list.def file inside. ");
System.exit(1);
}
}else if(!lf.endsWith(".def")) {
System.out.println(" Please set the list of dictionaries to annotate. No list.def file or .zip file provided.");
System.out.println(lf);
System.exit(1);
}
result.append(lf);
result.append(",");
}
......@@ -205,26 +225,32 @@ public class App {
// //System.exit(1);
// //remember to validate with comma separated
// }
if(listsDefinitionsPath.endsWith(".zip")) {
try {
File file = new File(listsDefinitionsPath);
String dictionaryFolderPath = file.getName().substring(0, file.getName().indexOf(".zip"));
unZipIt(listsDefinitionsPath, workdirPath + dictionaryFolderPath );
listsDefinitionsPath = workdirPath + dictionaryFolderPath + File.separator + "lists.def";
if (!java.nio.file.Files.isRegularFile(Paths.get(listsDefinitionsPath))) {
System.out.println("Please if you provided a zip file remember that it must contain a list.def file inside.");
System.exit(1);
}
}catch(Exception e) {
System.out.println("Error unziping directory, please if you provided a zip file remember that it must contain a list.def file inside. ");
System.exit(1);
}
}else if(!listsDefinitionsPath.endsWith(".def")) {
System.out.println(" Please set the list of dictionaries to annotate. No list.def file or .zip file provided.");
System.exit(1);
}
// String[] list_defs_aux = listsDefinitionsPath.split(",");
// StringBuilder result_aux = new StringBuilder();
// for (String lf : list_defs_aux) {
// if(lf.endsWith(".zip")) {
// try {
// File file = new File(lf);
// String dictionaryFolderPath = file.getName().substring(0, file.getName().indexOf(".zip"));
// unZipIt(lf, workdirPath + dictionaryFolderPath );
// lf = workdirPath + dictionaryFolderPath + File.separator + "lists.def";
// if (!java.nio.file.Files.isRegularFile(Paths.get(lf))) {
// System.out.println("Please if you provided a zip file remember that it must contain a list.def file inside.");
// System.out.println(lf);
// System.exit(1);
// }
// }catch(Exception e) {
// System.out.println("Error unziping directory, please if you provided a zip file remember that it must contain a list.def file inside. ");
// System.exit(1);
// }
// }else if(!lf.endsWith(".def")) {
// System.out.println(" Please set the list of dictionaries to annotate. No list.def file or .zip file provided.");
// System.out.println(lf);
// System.exit(1);
// }
// result.append(lf);
// result.append(",");
// }
}
parameters.put("listsURL", listsDefinitionsPath);
......
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