[DEV] add link on artefact folder and basic generation of GLD files for java dependency

This commit is contained in:
Edouard DUPIN 2022-05-08 17:59:13 +02:00
parent 381980372e
commit db54f8d50c
8 changed files with 344 additions and 237 deletions

View File

@ -5,26 +5,6 @@
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-exml">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scenarium-logger">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-death">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-etk">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
@ -45,5 +25,30 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-etk">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-death">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/scenarium-logger">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-exml">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-ejson">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="out/eclipse/classes"/>
</classpath>

View File

@ -15,4 +15,5 @@ open module org.atriasoft.island {
requires org.atriasoft.etk;
//requires org.eclipse.jgit;
requires jgit.bundle;
requires org.atriasoft.ejson;
}

View File

@ -45,6 +45,7 @@ public class Env {
private static Path islandPathManifest = null;
private static Path islandPathArtifactoryLink = null;
private static Path islandPathArtifactory = null;
static {
//String tmp = island_root_path.toAbsolutePath().toString();
@ -66,6 +67,7 @@ public class Env {
Env.islandPathConfig = Env.islandPath.resolve("config.xml");
Env.islandPathManifest = Env.islandPath.resolve("manifest");
Env.islandPathArtifactory = Env.islandPath.resolve(Env.artifactoryBaseFolder);
Env.islandPathArtifactoryLink = Env.islandRootPath.resolve(Env.artifactoryBaseFolder);
}
public static boolean getDisplayFolderInsteadOfGitName() {
@ -88,6 +90,10 @@ public class Env {
return Env.islandPathArtifactory;
}
public static Path getIslandPathArtifactoryLink() {
return Env.islandPathArtifactoryLink;
}
public static Path getIslandPathConfig() {
return Env.islandPathConfig;
}
@ -121,12 +127,13 @@ public class Env {
}
public static void main(final String[] args) {
Log.error("islandRootPath = " + Env.islandRootPath.toAbsolutePath());
Log.error("islandPathUserConfig = " + Env.islandPathUserConfig.toAbsolutePath());
Log.error("islandPath = " + Env.islandPath.toAbsolutePath());
Log.error("islandPathConfig = " + Env.islandPathConfig.toAbsolutePath());
Log.error("islandPathManifest = " + Env.islandPathManifest.toAbsolutePath());
Log.error("islandPathArtifactory = " + Env.islandPathArtifactory.toAbsolutePath());
Log.error("islandRootPath = {}", Env.islandRootPath.toAbsolutePath());
Log.error("islandPathUserConfig = {}", Env.islandPathUserConfig.toAbsolutePath());
Log.error("islandPath = {}", Env.islandPath.toAbsolutePath());
Log.error("islandPathConfig = {}", Env.islandPathConfig.toAbsolutePath());
Log.error("islandPathManifest = {}", Env.islandPathManifest.toAbsolutePath());
Log.error("islandPathArtifactory = {}", Env.islandPathArtifactory.toAbsolutePath());
Log.error("islandPathArtifactoryLink = {}", Env.islandPathArtifactoryLink.toAbsolutePath());
}
public static boolean needProcessWithFilter(final String data) {

View File

@ -5,6 +5,7 @@ import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -15,20 +16,6 @@ import org.atriasoft.island.model.manifest.ProjectConfig;
public class Tools {
public static String getListBaseDisplay(final int id, final int count, final ProjectConfig elem) {
if (!Env.getDisplayFolderInsteadOfGitName()) {
return id + "/" + count + " : " + elem.getName();
}
return id + "/" + count + " : " + elem.getPath();
}
public static String getListBaseDisplay(final int id, final int count, final Dependency elem) {
if (!Env.getDisplayFolderInsteadOfGitName()) {
return id + "/" + count + " : " + elem.name();
}
return id + "/" + count + " : " + elem.name();
}
public static void createDirectory(final Path basePath) {
Path absPath = basePath.toAbsolutePath();
if (!Files.exists(absPath)) {
@ -42,67 +29,18 @@ public class Tools {
}
}
public static void waitForServerIfNeeded() {
int waitTime = Env.getWaitBetweenSeverCommand();
if (waitTime>0) {
Log.info("Waiting between commands: " + waitTime + "s");
try {
Thread.sleep(waitTime*1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
public static void createSymbolicLink(Path link, Path target) throws IOException {
Log.warning("create Link {} -> {}", link, target);
createDirectory(link.getParent());
if (Files.exists(link)) {
Files.delete(link);
}
}
}
public static String readFile(final Path path, final Charset encoding) throws IOException {
byte[] encoded = Files.readAllBytes(path);
return new String(encoded, encoding);
}
/**
* Generate the split of the generic version :
* - 1.5.2-dev
* @param version
* @return list of element : {"1", "5", "2", "dev"}
*/
public static String[] versionStringToList(final String version) {
Log.verbose("parse version string '" + version +"'");
List<String> out = new ArrayList<>();
if (version == null || version.isEmpty()) {
return new String[]{"0", "0", "0"};
}
String[] elems = version.split("-");
if (elems[0].split(".").length <= 1) {
Log.critical("Can not parde a version with wrong version model '" + version +"'");
}
List<String> values = Arrays.asList(elems[0].split("."));
for (String elem : values) {
out.add(elem);
}
if (elems.length >= 2) {
out.add(elems[1]);
}
return out.toArray(new String[0]);
}
public static String versionToString(final int[] version, final boolean develop) {
StringBuilder sb = new StringBuilder();
for (int iii=0; iii<version.length; iii++) {
if (sb.length() != 0) {
sb.append(".");
}
sb.append(Integer.toString(version[iii]));
}
if (develop) {
sb.append("-dev");
}
return sb.toString();
Files.createSymbolicLink(link, target);
}
public static void fileWriteData(final Path path, final String data) {
Path tmpFile = path.getParent().resolve(path.getFileName()+"__tmp");
Path tmpFile = path.getParent().resolve(path.getFileName() + "__tmp");
if (!Files.exists(path.getParent())) {
File file = path.getParent().toFile();
if (!file.mkdirs()) {
@ -117,7 +55,7 @@ public class Tools {
}
// this is the way to have atomic replacement of file and not partial downloaded file ==> move is 99.999999% atomic.
try {
Files.move(tmpFile, path);
Files.move(tmpFile, path, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
} catch (IOException e) {
// TODO Auto-generated catch block
@ -125,8 +63,81 @@ public class Tools {
}
}
public static String getListBaseDisplay(final int id, final int count, final Dependency elem) {
if (!Env.getDisplayFolderInsteadOfGitName()) {
return id + "/" + count + " : " + elem.name();
}
return id + "/" + count + " : " + elem.name();
}
public static String getListBaseDisplay(final int id, final int count, final ProjectConfig elem) {
if (!Env.getDisplayFolderInsteadOfGitName()) {
return id + "/" + count + " : " + elem.getName();
}
return id + "/" + count + " : " + elem.getPath();
}
public static String getPlural(final List<?> artefactories) {
return artefactories.size() > 1 ? "ies" : "y";
}
public static String readFile(final Path path, final Charset encoding) throws IOException {
byte[] encoded = Files.readAllBytes(path);
return new String(encoded, encoding);
}
/**
* Generate the split of the generic version :
* - 1.5.2-dev
* @param version
* @return list of element : {"1", "5", "2", "dev"}
*/
public static String[] versionStringToList(final String version) {
Log.verbose("parse version string '" + version + "'");
List<String> out = new ArrayList<>();
if (version == null || version.isEmpty()) {
return new String[] { "0", "0", "0" };
}
String[] elems = version.split("-");
if (elems[0].split(".").length <= 1) {
Log.critical("Can not parde a version with wrong version model '" + version + "'");
}
List<String> values = Arrays.asList(elems[0].split("."));
for (String elem : values) {
out.add(elem);
}
if (elems.length >= 2) {
out.add(elems[1]);
}
return out.toArray(new String[0]);
}
public static String versionToString(final int[] version, final boolean develop) {
StringBuilder sb = new StringBuilder();
for (int iii = 0; iii < version.length; iii++) {
if (sb.length() != 0) {
sb.append(".");
}
sb.append(Integer.toString(version[iii]));
}
if (develop) {
sb.append("-dev");
}
return sb.toString();
}
public static void waitForServerIfNeeded() {
int waitTime = Env.getWaitBetweenSeverCommand();
if (waitTime > 0) {
Log.info("Waiting between commands: " + waitTime + "s");
try {
Thread.sleep(waitTime * 1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

View File

@ -22,6 +22,10 @@ import org.atriasoft.death.annotation.ArgDescription;
import org.atriasoft.death.annotation.ArgExecute;
import org.atriasoft.death.annotation.ArgName;
import org.atriasoft.death.annotation.ArgSample;
import org.atriasoft.ejson.Ejson;
import org.atriasoft.ejson.model.JsonArray;
import org.atriasoft.ejson.model.JsonObject;
import org.atriasoft.ejson.model.JsonString;
import org.atriasoft.exml.Exml;
import org.atriasoft.exml.exception.ExmlException;
import org.atriasoft.island.Config;
@ -30,6 +34,7 @@ import org.atriasoft.island.Manifest;
import org.atriasoft.island.Tools;
import org.atriasoft.island.internal.Log;
import org.atriasoft.island.model.ActionException;
import org.atriasoft.island.model.GLDDependModel;
import org.atriasoft.island.model.manifest.Artifactory;
import org.atriasoft.island.model.manifest.ConfigManifest;
import org.atriasoft.island.model.manifest.Dependency;
@ -42,6 +47,13 @@ import org.atriasoft.island.model.maven.PomMaven;
@ArgSample("depend-sync")
public class DependencySync {
private class UpdateDependency {
public Dependency dependency;
public List<String> download = new ArrayList<>();
}
private static final String MAVEN_METADATA = "maven-metadata.xml";
@ArgName("doc")
@ArgDescription("enable download of the documentation")
public boolean documentation = false;
@ -50,33 +62,73 @@ public class DependencySync {
@ArgDescription("enable download of the sources")
public boolean sources = false;
public Path createArtefactLinkFileName(final String fileName) {
Path outPath = Env.getIslandPathArtifactoryLink().resolve(fileName);
return outPath;
}
public Path createArtefactLinkGLDFile(final String fileName) {
Path outPath = Env.getIslandPathArtifactoryLink().resolve("GLD_" + fileName + ".json");
return outPath;
}
public Path createBasePkgLocalFileName(final List<Artifactory> artefactories, final Dependency dependency, final String version) {
Artifactory artifactory = findArtifactory(artefactories, dependency.remote());
String out = artifactory.getName() + "/" + dependency.org().replace(".", "/") + "/" + dependency.name() + "/" + version;
Path outPath = Env.getIslandPathArtifactory().resolve(out);
return outPath;
}
private static final String MAVEN_METADATA = "maven-metadata.xml";
Artifactory findArtifactory(final List<Artifactory> artefactories, final String name) {
Artifactory out = null;
for (Artifactory elem: artefactories) {
if ("default".equals(elem.getName())) {
out = elem;
break;
public String createBasePkgRemoteFileName(final List<Artifactory> artefactories, final Dependency dependency, final String version) {
Artifactory artifactory = findArtifactory(artefactories, dependency.remote());
String out = artifactory.getFetch();
while (out.endsWith("/")) {
out = out.substring(0, out.length() - 1);
}
}
// By default we are capable to use maven artefactory (can be replace with using "default" name).
if (out == null) {
out = new Artifactory("default", "https://repo1.maven.org/maven2", "maven");
}
boolean find = false;
for (Artifactory elem: artefactories) {
if (name.equals(elem.getName())) {
return elem;
}
}
Log.error("Can not find the remote '" + name + "'artefactory in the list ==> fallback to 'default'");
out += "/" + dependency.org().replace(".", "/") + "/" + dependency.name() + "/" + version;
return out;
}
private void createGLDFile(PomMaven mavenPom, Path createArtefactLinkGLDFile, Path artefactLink) {
GLDDependModel model = new GLDDependModel();
model.path.java.add(artefactLink.getFileName().toString());
model.groupId = mavenPom.groupId();
model.version = mavenPom.version();
if (mavenPom.dependencies() != null) {
for (PomDependency elem : mavenPom.dependencies()) {
model.dependency.add(elem.artifactId());
}
}
// TODO: for later : create a generic serializer ...
StringBuilder data = new StringBuilder();
JsonObject root = new JsonObject();
root.put("type", new JsonString(model.type));
root.put("group-id", new JsonString(model.groupId));
root.put("version", new JsonString(model.version));
JsonObject path = new JsonObject();
root.put("path", path);
JsonArray java = new JsonArray();
for (String elem : model.path.java) {
java.add(new JsonString(elem));
}
path.put("java", java);
JsonArray dep = new JsonArray();
for (String elem : model.dependency) {
dep.add(new JsonString(elem));
}
root.put("dependency", dep);
Ejson.generate(root, data);
//Log.error("generated GLD dependency : {}", data.toString());
//Log.error(" ==> {}", createArtefactLinkGLDFile.toString());
//Log.error(" --> {}", artefactLink.toString());
Tools.fileWriteData(createArtefactLinkGLDFile, data.toString());
}
void createLinkOnArtefact(final Path path, final String baseName) throws Exception {
// remove previous file in the link area:
Tools.createSymbolicLink(createArtefactLinkFileName(baseName), path);
}
public String createMavenMetadataRemoteFileName(final List<Artifactory> artefactories, final Dependency dependency) {
return createBasePkgRemoteFileName(artefactories, dependency, DependencySync.MAVEN_METADATA);
}
@ -85,52 +137,10 @@ public class DependencySync {
return createBasePkgLocalFileName(artefactories, dependency, DependencySync.MAVEN_METADATA);
}
public String createBasePkgRemoteFileName(final List<Artifactory> artefactories, final Dependency dependency, final String version) {
Artifactory artifactory = findArtifactory(artefactories, dependency.remote());
String out = artifactory.getFetch();
while (out.endsWith("/")) {
out = out.substring(0, out.length()-1);
}
out += "/" + dependency.org().replace(".", "/") + "/" + dependency.name() + "/" + version;
return out;
}
public Path createBasePkgLocalFileName(final List<Artifactory> artefactories, final Dependency dependency, final String version) {
Artifactory artifactory = findArtifactory(artefactories, dependency.remote());
String out = artifactory.getName() + "/" + dependency.org().replace(".", "/") + "/" + dependency.name() + "/" + version;
Path outPath = Env.getIslandPathArtifactory().resolve(out);
return outPath;
}
// this is the maven module interface
public String getPomFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + ".pom";
}
public String getJavaPackageFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + ".jar";
}
public String getJavaDocFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + "-javadoc.jar";
}
public String getJavaSourceFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + "-sources.jar";
}
// This is the gradle module interface
public String getModuleFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + ".module";
}
private class UpdateDependency {
public Dependency dependency;
public List<String> download = new ArrayList<>();
}
private void downloadPackage(final List<Artifactory> artefactories, final Dependency dependency, final List<UpdateDependency> alreadyDone) throws Exception {
Log.debug("download : " + dependency);
for (UpdateDependency elem : alreadyDone) {
if (elem.dependency.org().equals(dependency.org())
&& elem.dependency.name().equals(dependency.name())
&& elem.dependency.remote().equals(dependency.remote())) {
if (elem.dependency.org().equals(dependency.org()) && elem.dependency.name().equals(dependency.name()) && elem.dependency.remote().equals(dependency.remote())) {
// find element ==> check version
for (String version : elem.download) {
if (version.equals(dependency.revision())) {
@ -142,10 +152,10 @@ public class DependencySync {
}
String metadataFile = createMavenMetadataRemoteFileName(artefactories, dependency);
Log.print("Metadata position: " + metadataFile);
Log.verbose("Metadata position: " + metadataFile);
Path localPath = createMetadataLocalFileName(artefactories, dependency);
String dataAsString = readAllMatadataAndStore(metadataFile, localPath);
Log.print("dataAsString: " + dataAsString);
Log.verbose("dataAsString: " + dataAsString);
MavenMetadata metaData = null;
try {
metaData = Exml.parseOne(dataAsString, MavenMetadata.class, "metadata");
@ -173,9 +183,16 @@ public class DependencySync {
// TODO Auto-generated catch block
e.printStackTrace();
}
// retrieve binary
base = getJavaPackageFileName(dependency, lastReleaseTag);
readRemoteFileAndStore(remotePakageFileName + "/" + base, localPackageFileName.resolve(base), base);
// TODO: If Zip artefact this mean we need to uncompress it.
createLinkOnArtefact(localPackageFileName.resolve(base), base);
// create the GLD file with maven dependency
createGLDFile(mavenPom, createArtefactLinkGLDFile(mavenPom.artifactId()), createArtefactLinkFileName(base));
// listFiles(localPackageFileName.resolve(base));
// retrieve javadoc
if (this.documentation) {
@ -194,28 +211,27 @@ public class DependencySync {
*/
boolean find = false;
for (UpdateDependency elem : alreadyDone) {
if (elem.dependency.org().equals(dependency.org())
&& elem.dependency.name().equals(dependency.name())
&& elem.dependency.remote().equals(dependency.remote())) {
if (elem.dependency.org().equals(dependency.org()) && elem.dependency.name().equals(dependency.name()) && elem.dependency.remote().equals(dependency.remote())) {
// find element ==> check version
elem.download.add(dependency.revision());
find = true;
break;
}
}
if (!find ) {
if (!find) {
UpdateDependency tmpp = new UpdateDependency();
tmpp.dependency = dependency;
tmpp.download.add(dependency.revision());
alreadyDone.add(tmpp);
}
if (mavenPom != null && mavenPom.dependencies() != null) {
for ( PomDependency value : mavenPom.dependencies()) {
for (PomDependency value : mavenPom.dependencies()) {
Dependency dependencyTmp = new Dependency(value.groupId(), value.artifactId(), value.version(), dependency.remote());
downloadPackage(artefactories, dependencyTmp, alreadyDone);
}
}
}
@ArgExecute
public void execute() throws ActionException, Exception {
List<UpdateDependency> alreadyDone = new ArrayList<>();
@ -247,6 +263,67 @@ public class DependencySync {
Log.print("Dependency sync END");
}
Artifactory findArtifactory(final List<Artifactory> artefactories, final String name) {
Artifactory out = null;
for (Artifactory elem : artefactories) {
if ("default".equals(elem.getName())) {
out = elem;
break;
}
}
// By default we are capable to use maven artefactory (can be replace with using "default" name).
if (out == null) {
out = new Artifactory("default", "https://repo1.maven.org/maven2", "maven");
}
boolean find = false;
for (Artifactory elem : artefactories) {
if (name.equals(elem.getName())) {
return elem;
}
}
Log.error("Can not find the remote '" + name + "'artefactory in the list ==> fallback to 'default'");
return out;
}
public String getJavaDocFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + "-javadoc.jar";
}
public String getJavaPackageFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + ".jar";
}
public String getJavaSourceFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + "-sources.jar";
}
// This is the gradle module interface
public String getModuleFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + ".module";
}
// this is the maven module interface
public String getPomFileName(final Dependency dependency, final String version) {
return dependency.name() + "-" + version + ".pom";
}
void listFiles(final Path path) {
Log.info("List of file in " + path);
try {
ZipFile zipFile = new ZipFile(path.toFile());
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
Log.info(" - " + entry.getName() + " (" + entry.getSize() + ")");
//InputStream stream = zipFile.getInputStream(entry);
}
} catch (IOException ex) {
Log.error("Catch Exception : " + ex.getLocalizedMessage());
ex.printStackTrace();
}
}
String readAllMatadataAndStore(final String urlPath, final Path path) throws Exception {
URL url = new URL(urlPath);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
@ -256,7 +333,7 @@ public class DependencySync {
con.setInstanceFollowRedirects(false);
StringBuilder result = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
for (String line; (line = reader.readLine()) != null; ) {
for (String line; (line = reader.readLine()) != null;) {
result.append(line);
result.append("\n");
}
@ -265,7 +342,7 @@ public class DependencySync {
throw ex;
}
String dataAsString = result.toString();
Log.print("return=" + dataAsString);
Log.verbose("return=" + dataAsString);
Tools.fileWriteData(path, dataAsString);
return dataAsString;
}
@ -288,10 +365,9 @@ public class DependencySync {
con.setConnectTimeout(5000);
con.setReadTimeout(5000);
con.setInstanceFollowRedirects(false);
final int BUFFER_SIZE = 1024*1024;
StringBuilder result = new StringBuilder();
final int BUFFER_SIZE = 1024 * 1024;
InputStream inputStream = con.getInputStream();
Path tmpFile = path.getParent().resolve(path.getFileName()+"__tmp");
Path tmpFile = path.getParent().resolve(path.getFileName() + "__tmp");
FileOutputStream outputStream = new FileOutputStream(tmpFile.toFile());
int bytesRead = -1;
int totalRead = 0;
@ -312,22 +388,4 @@ public class DependencySync {
}
}
void listFiles(final Path path) {
Log.info("List of file in " + path);
try {
ZipFile zipFile = new ZipFile(path.toFile());
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while(entries.hasMoreElements()){
ZipEntry entry = entries.nextElement();
Log.info(" - " + entry.getName() + " (" + entry.getSize() + ")");
//InputStream stream = zipFile.getInputStream(entry);
}
} catch (IOException ex) {
Log.error("Catch Exception : " + ex.getLocalizedMessage());
ex.printStackTrace();
}
}
}

View File

@ -16,12 +16,6 @@ public class Log {
private static final boolean PRINT_TODO = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.TODO);
private static final boolean PRINT_PRINT = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.PRINT);
public static void critical(final String data) {
if (Log.PRINT_CRITICAL || Log.FORCE) {
Logger.critical(Log.LIB_NAME_DRAW, data);
}
}
public static void critical(final String data, final Exception e) {
e.printStackTrace();
if (Log.PRINT_CRITICAL || Log.FORCE) {
@ -29,45 +23,51 @@ public class Log {
}
}
public static void debug(final String data) {
public static void critical(final String data, Object... objects) {
if (Log.PRINT_CRITICAL || Log.FORCE) {
Logger.critical(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void debug(final String data, Object... objects) {
if (Log.PRINT_DEBUG || Log.FORCE) {
Logger.debug(Log.LIB_NAME_DRAW, data);
Logger.debug(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void error(final String data) {
public static void error(final String data, Object... objects) {
if (Log.PRINT_ERROR || Log.FORCE) {
Logger.error(Log.LIB_NAME_DRAW, data);
Logger.error(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void info(final String data) {
public static void info(final String data, Object... objects) {
if (Log.PRINT_INFO || Log.FORCE) {
Logger.info(Log.LIB_NAME_DRAW, data);
Logger.info(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void print(final String data) {
public static void print(final String data, Object... objects) {
if (Log.PRINT_PRINT || Log.FORCE) {
System.out.println(data);
Logger.print(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void todo(final String data) {
public static void todo(final String data, Object... objects) {
if (Log.PRINT_TODO || Log.FORCE) {
Logger.todo(Log.LIB_NAME_DRAW, data);
Logger.todo(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void verbose(final String data) {
public static void verbose(final String data, Object... objects) {
if (Log.PRINT_VERBOSE || Log.FORCE) {
Logger.verbose(Log.LIB_NAME_DRAW, data);
Logger.verbose(Log.LIB_NAME_DRAW, data, objects);
}
}
public static void warning(final String data) {
public static void warning(final String data, Object... objects) {
if (Log.PRINT_WARNING || Log.FORCE) {
Logger.warning(Log.LIB_NAME_DRAW, data);
Logger.warning(Log.LIB_NAME_DRAW, data, objects);
}
}

View File

@ -0,0 +1,17 @@
package org.atriasoft.island.model;
import java.util.ArrayList;
import java.util.List;
import org.atriasoft.aknot.annotation.AknotName;
public class GLDDependModel {
public String type = "LIBRARY";
@AknotName("group-id")
public String groupId;
public String version;
public GLDDependPathModel path = new GLDDependPathModel();
public List<String> dependency = new ArrayList<>();
@AknotName("dependency-build")
public List<String> dependencyBuild = new ArrayList<>();
}

View File

@ -0,0 +1,8 @@
package org.atriasoft.island.model;
import java.util.ArrayList;
import java.util.List;
public class GLDDependPathModel {
public List<String> java = new ArrayList<>();
}