[DEV] update new exml
This commit is contained in:
parent
db54f8d50c
commit
cf7da8138d
@ -9,6 +9,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.atriasoft.aknot.exception.AknotException;
|
||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.Exml;
|
||||||
import org.atriasoft.exml.exception.ExmlBuilderException;
|
import org.atriasoft.exml.exception.ExmlBuilderException;
|
||||||
import org.atriasoft.exml.exception.ExmlException;
|
import org.atriasoft.exml.exception.ExmlException;
|
||||||
@ -62,7 +63,7 @@ public class Manifest {
|
|||||||
// load the manifest
|
// load the manifest
|
||||||
try {
|
try {
|
||||||
load();
|
load();
|
||||||
} catch (ExmlBuilderException e) {
|
} catch (final ExmlBuilderException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -82,12 +83,12 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ProjectConfig> get_all_configs() {
|
public List<ProjectConfig> get_all_configs() {
|
||||||
ManifestFile mani = this.manifests.get(this.rootManifest);
|
final ManifestFile mani = this.manifests.get(this.rootManifest);
|
||||||
return get_all_configs(mani, null, new ArrayList<>());
|
return get_all_configs(mani, null, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProjectConfig> get_all_configs(final ManifestFile mani, OptionRepository defaultPlouf, final List<RemoteConfig> upper_remotes) {
|
public List<ProjectConfig> get_all_configs(final ManifestFile mani, OptionRepository defaultPlouf, final List<RemoteConfig> upper_remotes) {
|
||||||
List<ProjectConfig> out = new ArrayList<>();
|
final List<ProjectConfig> out = new ArrayList<>();
|
||||||
if (defaultPlouf == null) {
|
if (defaultPlouf == null) {
|
||||||
if (this.defaultWhat != null) {
|
if (this.defaultWhat != null) {
|
||||||
defaultPlouf = this.defaultWhat.clone();
|
defaultPlouf = this.defaultWhat.clone();
|
||||||
@ -97,23 +98,23 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
// Log.error(" this.default=" + str(this.default))
|
// Log.error(" this.default=" + str(this.default))
|
||||||
// add all local project
|
// add all local project
|
||||||
for (ProjectConfig elem : mani.getProjects()) {
|
for (final ProjectConfig elem : mani.getProjects()) {
|
||||||
Log.verbose("parse element " + elem);
|
Log.verbose("parse element " + elem);
|
||||||
if (!Env.needProcessWithFilter(elem.getName())) {
|
if (!Env.needProcessWithFilter(elem.getName())) {
|
||||||
Log.info("Filter repository: " + elem.getName());
|
Log.info("Filter repository: " + elem.getName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ProjectConfig conf = new ProjectConfig(elem.getName(), createPathWithElem(elem), elem.getTag());
|
final ProjectConfig conf = new ProjectConfig(elem.getName(), createPathWithElem(elem), elem.getTag());
|
||||||
|
|
||||||
// add default remote for the project (search in herited element)
|
// add default remote for the project (search in herited element)
|
||||||
for (RemoteConfig remote : mani.getRemotes()) {
|
for (final RemoteConfig remote : mani.getRemotes()) {
|
||||||
Log.verbose(" Local Remote: " + remote);
|
Log.verbose(" Local Remote: " + remote);
|
||||||
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
|
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
|
||||||
conf.getRemotes().add(remote);
|
conf.getRemotes().add(remote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (conf.getRemotes().size() == 0) {
|
if (conf.getRemotes().size() == 0) {
|
||||||
for (RemoteConfig remote : upper_remotes) {
|
for (final RemoteConfig remote : upper_remotes) {
|
||||||
Log.verbose(" upper Remote: " + remote);
|
Log.verbose(" upper Remote: " + remote);
|
||||||
if (remote.getName() != null && remote.getName().equals(defaultPlouf.getDefaultRemote())) {
|
if (remote.getName() != null && remote.getName().equals(defaultPlouf.getDefaultRemote())) {
|
||||||
conf.getRemotes().add(remote);
|
conf.getRemotes().add(remote);
|
||||||
@ -126,7 +127,7 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
// select default remote:
|
// select default remote:
|
||||||
Log.debug(" remotes count: " + conf.getRemotes().size());
|
Log.debug(" remotes count: " + conf.getRemotes().size());
|
||||||
for (RemoteConfig remote : conf.getRemotes()) {
|
for (final RemoteConfig remote : conf.getRemotes()) {
|
||||||
Log.debug(" remote=" + remote);
|
Log.debug(" remote=" + remote);
|
||||||
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote());
|
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote());
|
||||||
Log.verbose(" remote=" + remote);
|
Log.verbose(" remote=" + remote);
|
||||||
@ -147,15 +148,15 @@ public class Manifest {
|
|||||||
out.add(conf);
|
out.add(conf);
|
||||||
}
|
}
|
||||||
// create a temporary variable to transmit the remote to includes
|
// create a temporary variable to transmit the remote to includes
|
||||||
List<RemoteConfig> upper_remotes_forward = new ArrayList<>(upper_remotes);
|
final List<RemoteConfig> upper_remotes_forward = new ArrayList<>(upper_remotes);
|
||||||
for (RemoteConfig remote : mani.getRemotes()) {
|
for (final RemoteConfig remote : mani.getRemotes()) {
|
||||||
upper_remotes_forward.add(remote);
|
upper_remotes_forward.add(remote);
|
||||||
}
|
}
|
||||||
// add all include project
|
// add all include project
|
||||||
for (String elemInclude : mani.getIncludes()) {
|
for (final String elemInclude : mani.getIncludes()) {
|
||||||
ManifestFile mani2 = this.manifests.get(elemInclude);
|
final ManifestFile mani2 = this.manifests.get(elemInclude);
|
||||||
List<ProjectConfig> list_project = get_all_configs(mani2, defaultPlouf, upper_remotes_forward);
|
final List<ProjectConfig> list_project = get_all_configs(mani2, defaultPlouf, upper_remotes_forward);
|
||||||
for (ProjectConfig elem_proj : list_project) {
|
for (final ProjectConfig elem_proj : list_project) {
|
||||||
out.add(elem_proj);
|
out.add(elem_proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,23 +204,23 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Artifactory> getAllArtefactories() {
|
public List<Artifactory> getAllArtefactories() {
|
||||||
ManifestFile mani = this.manifests.get(this.rootManifest);
|
final ManifestFile mani = this.manifests.get(this.rootManifest);
|
||||||
return getAllArtefactories(mani);
|
return getAllArtefactories(mani);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Artifactory> getAllArtefactories(final ManifestFile mani) {
|
public List<Artifactory> getAllArtefactories(final ManifestFile mani) {
|
||||||
List<Artifactory> out = new ArrayList<>();
|
final List<Artifactory> out = new ArrayList<>();
|
||||||
// add all local project
|
// add all local project
|
||||||
for (Artifactory elem : mani.getArtefactories()) {
|
for (final Artifactory elem : mani.getArtefactories()) {
|
||||||
Log.verbose("parse a " + elem);
|
Log.verbose("parse a " + elem);
|
||||||
Artifactory conf = elem.clone();
|
final Artifactory conf = elem.clone();
|
||||||
out.add(conf);
|
out.add(conf);
|
||||||
}
|
}
|
||||||
// add all include project
|
// add all include project
|
||||||
for (String elemInclude : mani.getIncludes()) {
|
for (final String elemInclude : mani.getIncludes()) {
|
||||||
ManifestFile mani2 = this.manifests.get(elemInclude);
|
final ManifestFile mani2 = this.manifests.get(elemInclude);
|
||||||
List<Artifactory> list_project = getAllArtefactories(mani2);
|
final List<Artifactory> list_project = getAllArtefactories(mani2);
|
||||||
for (Artifactory elem_proj : list_project) {
|
for (final Artifactory elem_proj : list_project) {
|
||||||
out.add(elem_proj);
|
out.add(elem_proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,15 +228,15 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Dependency> getAllDependencies() {
|
public List<Dependency> getAllDependencies() {
|
||||||
ManifestFile mani = this.manifests.get(this.rootManifest);
|
final ManifestFile mani = this.manifests.get(this.rootManifest);
|
||||||
return getAllDependencies(mani);
|
return getAllDependencies(mani);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Dependency> getAllDependencies(final ManifestFile mani) {
|
public List<Dependency> getAllDependencies(final ManifestFile mani) {
|
||||||
List<Dependency> out = new ArrayList<>(mani.getDependencies());
|
final List<Dependency> out = new ArrayList<>(mani.getDependencies());
|
||||||
// add all include project
|
// add all include project
|
||||||
for (String elemInclude : mani.getIncludes()) {
|
for (final String elemInclude : mani.getIncludes()) {
|
||||||
ManifestFile mani2 = this.manifests.get(elemInclude);
|
final ManifestFile mani2 = this.manifests.get(elemInclude);
|
||||||
out.addAll(getAllDependencies(mani2));
|
out.addAll(getAllDependencies(mani2));
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
@ -266,9 +267,9 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Link> getLinks() {
|
public List<Link> getLinks() {
|
||||||
List<Link> out = new ArrayList<>();
|
final List<Link> out = new ArrayList<>();
|
||||||
for (Entry<String, ManifestFile> elem : this.manifests.entrySet()) {
|
for (final Entry<String, ManifestFile> elem : this.manifests.entrySet()) {
|
||||||
for (Link link : elem.getValue().getLinks()) {
|
for (final Link link : elem.getValue().getLinks()) {
|
||||||
out.add(link);
|
out.add(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -284,19 +285,25 @@ public class Manifest {
|
|||||||
ManifestFile parsedElements = null;
|
ManifestFile parsedElements = null;
|
||||||
try {
|
try {
|
||||||
parsedElements = Exml.parseOne(this.manifestXml, ManifestFile.class, "manifest");
|
parsedElements = Exml.parseOne(this.manifestXml, ManifestFile.class, "manifest");
|
||||||
} catch (ExmlException e1) {
|
} catch (final ExmlException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
} catch (final AknotException e1) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
parsedElements.setFileRealPath(this.manifestXml);
|
parsedElements.setFileRealPath(this.manifestXml);
|
||||||
this.manifests.put(this.rootManifest, parsedElements);
|
this.manifests.put(this.rootManifest, parsedElements);
|
||||||
for (String includeElem : parsedElements.getIncludes()) {
|
for (final String includeElem : parsedElements.getIncludes()) {
|
||||||
Path maniPath = rootDirectory.resolve(includeElem);
|
final Path maniPath = rootDirectory.resolve(includeElem);
|
||||||
Log.debug("PArse <<SUB>> XML config " + maniPath);
|
Log.debug("PArse <<SUB>> XML config " + maniPath);
|
||||||
ManifestFile tmpManifest = null;
|
ManifestFile tmpManifest = null;
|
||||||
try {
|
try {
|
||||||
tmpManifest = Exml.parseOne(maniPath, ManifestFile.class, "manifest");
|
tmpManifest = Exml.parseOne(maniPath, ManifestFile.class, "manifest");
|
||||||
} catch (ExmlException e) {
|
} catch (final ExmlException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (final AknotException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import java.util.ListIterator;
|
|||||||
|
|
||||||
import org.atriasoft.aknot.annotation.AknotList;
|
import org.atriasoft.aknot.annotation.AknotList;
|
||||||
import org.atriasoft.aknot.annotation.AknotName;
|
import org.atriasoft.aknot.annotation.AknotName;
|
||||||
|
import org.atriasoft.aknot.exception.AknotException;
|
||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.Exml;
|
||||||
import org.atriasoft.exml.exception.ExmlBuilderException;
|
import org.atriasoft.exml.exception.ExmlBuilderException;
|
||||||
import org.atriasoft.exml.exception.ExmlException;
|
import org.atriasoft.exml.exception.ExmlException;
|
||||||
@ -28,9 +29,12 @@ public class ConfigManifest {
|
|||||||
} catch (final ExmlException e) {
|
} catch (final ExmlException e) {
|
||||||
Log.error("Can not parse the file.1. " + path);
|
Log.error("Can not parse the file.1. " + path);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} catch (final AknotException e) {
|
||||||
|
Log.error("Can not parse the file.2. " + path);
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (root.length != 1) {
|
if (root.length != 1) {
|
||||||
Log.error("Can not parse the file.2. " + path);
|
Log.error("Can not parse the file.3. " + path);
|
||||||
}
|
}
|
||||||
return root[0];
|
return root[0];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user