[DEV] commit all with new insland
This commit is contained in:
parent
0a0889afa3
commit
62e1c3bd80
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
|||||||
|
|
||||||
|
/__pycache__/
|
||||||
# Compiled python modules.
|
# Compiled python modules.
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
|
2
out/eclipse/.gitignore
vendored
2
out/eclipse/.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
|
|
||||||
|
/__pycache__/
|
||||||
/classes/
|
/classes/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.atriasoft.island;
|
package org.atriasoft.island;
|
||||||
//!/usr/bin/python
|
//!/usr/bin/python
|
||||||
|
|
||||||
// -*- coding: utf-8 -*-
|
// -*- coding: utf-8 -*-
|
||||||
//#
|
//#
|
||||||
//# @author Edouard DUPIN
|
//# @author Edouard DUPIN
|
||||||
@ -17,96 +18,44 @@ import java.nio.file.Paths;
|
|||||||
import org.atriasoft.island.internal.Log;
|
import org.atriasoft.island.internal.Log;
|
||||||
|
|
||||||
public class Env {
|
public class Env {
|
||||||
private Env() {}
|
|
||||||
public static final int RET_MANIFEST_IS_NOT_EXISTING = -5;
|
public static final int RET_MANIFEST_IS_NOT_EXISTING = -5;
|
||||||
public static final int RET_ACTION_IS_NOT_EXISTING = -10;
|
public static final int RET_ACTION_IS_NOT_EXISTING = -10;
|
||||||
public static final int RET_ACTION_EXECUTING_SYSTEM_ERROR = -11;
|
public static final int RET_ACTION_EXECUTING_SYSTEM_ERROR = -11;
|
||||||
public static final int RET_ACTION_WRONG_PARAMETERS = -12;
|
public static final int RET_ACTION_WRONG_PARAMETERS = -12;
|
||||||
public static final int RET_ACTION_PARTIAL_DONE = -13;
|
public static final int RET_ACTION_PARTIAL_DONE = -13;
|
||||||
public static final int RET_ACTION_FAIL = -14;
|
public static final int RET_ACTION_FAIL = -14;
|
||||||
|
|
||||||
public static final int RET_ACTION_NEED_UPDTATE = 15;
|
public static final int RET_ACTION_NEED_UPDTATE = 15;
|
||||||
|
|
||||||
public static String systemBaseName = "island";
|
public static String systemBaseName = "island";
|
||||||
|
|
||||||
public static String artifactoryBaseFolder = "artifact";
|
public static String artifactoryBaseFolder = "artifact";
|
||||||
|
|
||||||
public static void setSystemBaseName(final String val) {
|
|
||||||
Env.systemBaseName = val;
|
|
||||||
}
|
|
||||||
public static String getSystemBaseName() {
|
|
||||||
return Env.systemBaseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getSystemConfigName() {
|
|
||||||
return "." + Env.systemBaseName + "Config.json";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean fetchManifest = true;
|
private static boolean fetchManifest = true;
|
||||||
|
|
||||||
public static void setFetchManifest(final boolean val) {
|
|
||||||
Env.fetchManifest = val;
|
|
||||||
}
|
|
||||||
public static boolean getFetchManifest() {
|
|
||||||
return Env.fetchManifest;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int waitBetweenSeverCommand = 0;
|
private static int waitBetweenSeverCommand = 0;
|
||||||
|
|
||||||
public static void setWaitBetweenSeverCommand(final int val) {
|
|
||||||
Env.waitBetweenSeverCommand = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getWaitBetweenSeverCommand() {
|
|
||||||
return Env.waitBetweenSeverCommand;
|
|
||||||
}
|
|
||||||
public static String filterCommand = null;
|
public static String filterCommand = null;
|
||||||
|
|
||||||
public static void setFilterCommand(final String val) {
|
|
||||||
Env.filterCommand = val;
|
|
||||||
}
|
|
||||||
public static String getFilterCommand() {
|
|
||||||
return Env.filterCommand;
|
|
||||||
}
|
|
||||||
public static boolean needProcessWithFilter(final String data) {
|
|
||||||
if (Env.filterCommand == null || Env.filterCommand.equals("")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (data.length() < Env.filterCommand.length()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (data.substring(0,Env.filterCommand.length()).equals(Env.filterCommand)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean displayFolderInsteadOfGitName = true;
|
private static boolean displayFolderInsteadOfGitName = true;
|
||||||
|
|
||||||
public static void setDisplayFolderInstead_ofGitName(final boolean val) {
|
|
||||||
Env.displayFolderInsteadOfGitName = val;
|
|
||||||
}
|
|
||||||
public static boolean getDisplayFolderInsteadOfGitName() {
|
|
||||||
return Env.displayFolderInsteadOfGitName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Path islandRootPath = null;
|
private static Path islandRootPath = null;
|
||||||
|
|
||||||
private static Path islandPathUserConfig = null;
|
private static Path islandPathUserConfig = null;
|
||||||
private static Path islandPath = null;
|
private static Path islandPath = null;
|
||||||
|
|
||||||
private static Path islandPathConfig = null;
|
private static Path islandPathConfig = null;
|
||||||
|
|
||||||
private static Path islandPathManifest = null;
|
private static Path islandPathManifest = null;
|
||||||
|
|
||||||
private static Path islandPathArtifactory = null;
|
private static Path islandPathArtifactory = null;
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
//String tmp = island_root_path.toAbsolutePath().toString();
|
//String tmp = island_root_path.toAbsolutePath().toString();
|
||||||
Env.islandRootPath = Paths.get("");
|
Env.islandRootPath = Paths.get("");
|
||||||
Path tmpPath = Env.islandRootPath.toAbsolutePath();
|
Path tmpPath = Env.islandRootPath.toAbsolutePath();
|
||||||
Log.info("Current absolute path is: " + tmpPath);
|
Log.debug("Current absolute path is: " + tmpPath);
|
||||||
while (!Files.isDirectory(tmpPath.resolve("." + Env.getSystemBaseName()))) {
|
while (!Files.isDirectory(tmpPath.resolve("." + Env.getSystemBaseName()))) {
|
||||||
tmpPath = tmpPath.getParent();
|
tmpPath = tmpPath.getParent();
|
||||||
Log.info("test upper path: " + tmpPath);
|
Log.debug("test upper path: " + tmpPath);
|
||||||
if (tmpPath == null) {
|
if (tmpPath == null) {
|
||||||
Log.info("the root path of " + Env.getSystemBaseName() + " must not be upper parent paths of (" + Env.islandRootPath.toAbsolutePath() + ")");
|
Log.debug("the root path of " + Env.getSystemBaseName() + " must not be upper parent paths of (" + Env.islandRootPath.toAbsolutePath() + ")");
|
||||||
tmpPath = Env.islandRootPath.toAbsolutePath();
|
tmpPath = Env.islandRootPath.toAbsolutePath();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -118,6 +67,39 @@ public class Env {
|
|||||||
Env.islandPathManifest = Env.islandPath.resolve("manifest");
|
Env.islandPathManifest = Env.islandPath.resolve("manifest");
|
||||||
Env.islandPathArtifactory = Env.islandPath.resolve(Env.artifactoryBaseFolder);
|
Env.islandPathArtifactory = Env.islandPath.resolve(Env.artifactoryBaseFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean getDisplayFolderInsteadOfGitName() {
|
||||||
|
return Env.displayFolderInsteadOfGitName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getFetchManifest() {
|
||||||
|
return Env.fetchManifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFilterCommand() {
|
||||||
|
return Env.filterCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Path getIslandPath() {
|
||||||
|
return Env.islandPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Path getIslandPathArtifactory() {
|
||||||
|
return Env.islandPathArtifactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Path getIslandPathConfig() {
|
||||||
|
return Env.islandPathConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Path getIslandPathManifest() {
|
||||||
|
return Env.islandPathManifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Path getIslandPathUserConfig() {
|
||||||
|
return Env.islandPathUserConfig;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To use later to know where the ".island" parent path is ...
|
* To use later to know where the ".island" parent path is ...
|
||||||
* @return the parent path of the ".island"
|
* @return the parent path of the ".island"
|
||||||
@ -125,20 +107,17 @@ public class Env {
|
|||||||
public static Path getIslandRootPath() {
|
public static Path getIslandRootPath() {
|
||||||
return Env.islandRootPath;
|
return Env.islandRootPath;
|
||||||
}
|
}
|
||||||
public static Path getIslandPath() {
|
|
||||||
return Env.islandPath;
|
public static String getSystemBaseName() {
|
||||||
|
return Env.systemBaseName;
|
||||||
}
|
}
|
||||||
public static Path getIslandPathConfig() {
|
|
||||||
return Env.islandPathConfig;
|
public static String getSystemConfigName() {
|
||||||
|
return "." + Env.systemBaseName + "Config.json";
|
||||||
}
|
}
|
||||||
public static Path getIslandPathManifest() {
|
|
||||||
return Env.islandPathManifest;
|
public static int getWaitBetweenSeverCommand() {
|
||||||
}
|
return Env.waitBetweenSeverCommand;
|
||||||
public static Path getIslandPathArtifactory() {
|
|
||||||
return Env.islandPathArtifactory;
|
|
||||||
}
|
|
||||||
public static Path getIslandPathUserConfig() {
|
|
||||||
return Env.islandPathUserConfig;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
@ -150,5 +129,39 @@ public class Env {
|
|||||||
Log.error("islandPathArtifactory = " + Env.islandPathArtifactory.toAbsolutePath());
|
Log.error("islandPathArtifactory = " + Env.islandPathArtifactory.toAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean needProcessWithFilter(final String data) {
|
||||||
|
if (Env.filterCommand == null || Env.filterCommand.equals("")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (data.length() < Env.filterCommand.length()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (data.substring(0, Env.filterCommand.length()).equals(Env.filterCommand)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDisplayFolderInstead_ofGitName(final boolean val) {
|
||||||
|
Env.displayFolderInsteadOfGitName = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFetchManifest(final boolean val) {
|
||||||
|
Env.fetchManifest = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFilterCommand(final String val) {
|
||||||
|
Env.filterCommand = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setSystemBaseName(final String val) {
|
||||||
|
Env.systemBaseName = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setWaitBetweenSeverCommand(final int val) {
|
||||||
|
Env.waitBetweenSeverCommand = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Env() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,16 @@ import org.atriasoft.island.model.manifest.ProjectConfig;
|
|||||||
import org.atriasoft.island.model.manifest.RemoteConfig;
|
import org.atriasoft.island.model.manifest.RemoteConfig;
|
||||||
|
|
||||||
public class Manifest {
|
public class Manifest {
|
||||||
|
public static void checkIsInit() {
|
||||||
|
// check if .XXX exist (create it if needed)
|
||||||
|
if (!Manifest.isInit()) {
|
||||||
|
Log.error("System not init: missing config: '" + Env.getIslandPath() + "'. Call <island init> first");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isInit() {
|
public static boolean isInit() {
|
||||||
if (!Files.exists(Env.getIslandPath())){
|
if (!Files.exists(Env.getIslandPath())) {
|
||||||
Log.verbose("Lutin is not init: path does not exist: '" + Env.getIslandPath() + "'");
|
Log.verbose("Lutin is not init: path does not exist: '" + Env.getIslandPath() + "'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -39,18 +47,11 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static void checkIsInit() {
|
|
||||||
// check if .XXX exist (create it if needed)
|
|
||||||
if (!Manifest.isInit()) {
|
|
||||||
Log.error("System not init: missing config: '" + Env.getIslandPath() + "'. Call <island init> first");
|
|
||||||
System.exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Path manifestXml;
|
private final Path manifestXml;
|
||||||
|
|
||||||
private String rootManifest;
|
private String rootManifest;
|
||||||
private final Map<String,ManifestFile> manifests = new HashMap<>();
|
private final Map<String, ManifestFile> manifests = new HashMap<>();
|
||||||
|
|
||||||
OptionRepository defaultWhat = null;
|
OptionRepository defaultWhat = null;
|
||||||
|
|
||||||
@ -69,106 +70,17 @@ public class Manifest {
|
|||||||
// TODO checkDoublePath();
|
// TODO checkDoublePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Link> getLinks() {
|
|
||||||
List<Link> out = new ArrayList<>();
|
|
||||||
for (Entry<String, ManifestFile> elem : this.manifests.entrySet()) {
|
|
||||||
for (Link link : elem.getValue().getLinks()) {
|
|
||||||
out.add(link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
String removeEndSlash(String value) {
|
|
||||||
while (value.length() > 1
|
|
||||||
&& ( value.charAt(value.length()-1) == '\\'
|
|
||||||
|| value.charAt(value.length()-1) == '/') ) {
|
|
||||||
value = value.substring(0, value.length()-1);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void load() throws ExmlParserErrorMulti, ExmlBuilderException, IOException {
|
|
||||||
Path rootDirectory = this.manifestXml.toAbsolutePath();
|
|
||||||
this.rootManifest = rootDirectory.getFileName().toString();
|
|
||||||
rootDirectory = rootDirectory.getParent();
|
|
||||||
|
|
||||||
Log.info("PArse main XML config " + rootDirectory);
|
|
||||||
ManifestFile parsedElements = null;
|
|
||||||
try {
|
|
||||||
parsedElements = Exml.parseOne(this.manifestXml, ManifestFile.class, "manifest");
|
|
||||||
} catch (ExmlException e1) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
parsedElements.setFileRealPath(this.manifestXml);
|
|
||||||
this.manifests.put(this.rootManifest, parsedElements);
|
|
||||||
for (String includeElem : parsedElements.getIncludes()) {
|
|
||||||
Path maniPath = rootDirectory.resolve(includeElem);
|
|
||||||
Log.info("PArse <<SUB>> XML config " + maniPath);
|
|
||||||
ManifestFile tmpManifest = null;
|
|
||||||
try {
|
|
||||||
tmpManifest = Exml.parseOne(maniPath, ManifestFile.class, "manifest");
|
|
||||||
} catch (ExmlException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
tmpManifest.setFileRealPath(maniPath);
|
|
||||||
this.manifests.put(includeElem, tmpManifest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String createPathWithElem(final ProjectConfig element) {
|
public String createPathWithElem(final ProjectConfig element) {
|
||||||
String path = element.getPath();
|
String path = element.getPath();
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
path = element.getName();
|
path = element.getName();
|
||||||
if (path.endsWith(".git")) {
|
if (path.endsWith(".git")) {
|
||||||
path = path.substring(0, path.length()-4);
|
path = path.substring(0, path.length() - 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Artifactory> getAllArtefactories() {
|
|
||||||
ManifestFile mani = this.manifests.get(this.rootManifest);
|
|
||||||
return getAllArtefactories(mani);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Artifactory> getAllArtefactories(final ManifestFile mani) {
|
|
||||||
List<Artifactory> out = new ArrayList<>();
|
|
||||||
// add all local project
|
|
||||||
for (Artifactory elem : mani.getArtefactories()) {
|
|
||||||
Log.verbose("parse a " + elem);
|
|
||||||
Artifactory conf = elem.clone();
|
|
||||||
out.add(conf);
|
|
||||||
}
|
|
||||||
// add all include project
|
|
||||||
for (String elemInclude : mani.getIncludes()) {
|
|
||||||
ManifestFile mani2 = this.manifests.get(elemInclude);
|
|
||||||
List<Artifactory> list_project = getAllArtefactories(mani2);
|
|
||||||
for (Artifactory elem_proj : list_project) {
|
|
||||||
out.add(elem_proj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
public List<Dependency> getAllDependencies() {
|
|
||||||
ManifestFile mani = this.manifests.get(this.rootManifest);
|
|
||||||
return getAllDependencies(mani);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Dependency> getAllDependencies(final ManifestFile mani) {
|
|
||||||
List<Dependency> out = new ArrayList<>();
|
|
||||||
// add all local project
|
|
||||||
out.addAll(mani.getDependencies());
|
|
||||||
// add all include project
|
|
||||||
for (String elemInclude : mani.getIncludes()) {
|
|
||||||
ManifestFile mani2 = this.manifests.get(elemInclude);
|
|
||||||
out.addAll(getAllDependencies(mani2));
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ProjectConfig> get_all_configs() {
|
public List<ProjectConfig> get_all_configs() {
|
||||||
ManifestFile mani = this.manifests.get(this.rootManifest);
|
ManifestFile mani = this.manifests.get(this.rootManifest);
|
||||||
return get_all_configs(mani, null, new ArrayList<>());
|
return get_all_configs(mani, null, new ArrayList<>());
|
||||||
@ -209,7 +121,8 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (conf.getRemotes().size() == 0) {
|
if (conf.getRemotes().size() == 0) {
|
||||||
Log.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getDefaultRemote() + " this remote: " + mani.getRemotes());
|
Log.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getDefaultRemote() + " this remote: "
|
||||||
|
+ mani.getRemotes());
|
||||||
}
|
}
|
||||||
// select default remote:
|
// select default remote:
|
||||||
Log.debug(" remotes count: " + conf.getRemotes().size());
|
Log.debug(" remotes count: " + conf.getRemotes().size());
|
||||||
@ -289,6 +202,52 @@ public class Manifest {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Artifactory> getAllArtefactories() {
|
||||||
|
ManifestFile mani = this.manifests.get(this.rootManifest);
|
||||||
|
return getAllArtefactories(mani);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Artifactory> getAllArtefactories(final ManifestFile mani) {
|
||||||
|
List<Artifactory> out = new ArrayList<>();
|
||||||
|
// add all local project
|
||||||
|
for (Artifactory elem : mani.getArtefactories()) {
|
||||||
|
Log.verbose("parse a " + elem);
|
||||||
|
Artifactory conf = elem.clone();
|
||||||
|
out.add(conf);
|
||||||
|
}
|
||||||
|
// add all include project
|
||||||
|
for (String elemInclude : mani.getIncludes()) {
|
||||||
|
ManifestFile mani2 = this.manifests.get(elemInclude);
|
||||||
|
List<Artifactory> list_project = getAllArtefactories(mani2);
|
||||||
|
for (Artifactory elem_proj : list_project) {
|
||||||
|
out.add(elem_proj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Dependency> getAllDependencies() {
|
||||||
|
ManifestFile mani = this.manifests.get(this.rootManifest);
|
||||||
|
return getAllDependencies(mani);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Dependency> getAllDependencies(final ManifestFile mani) {
|
||||||
|
List<Dependency> out = new ArrayList<>(mani.getDependencies());
|
||||||
|
// add all include project
|
||||||
|
for (String elemInclude : mani.getIncludes()) {
|
||||||
|
ManifestFile mani2 = this.manifests.get(elemInclude);
|
||||||
|
out.addAll(getAllDependencies(mani2));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBranchRelease() {
|
||||||
|
OptionRepository defaultPlouf = this.defaultBase;
|
||||||
|
if (this.defaultWhat != null) {
|
||||||
|
defaultPlouf = this.defaultWhat;
|
||||||
|
}
|
||||||
|
return defaultPlouf.getBranchRelease();
|
||||||
|
}
|
||||||
|
|
||||||
public String getDeliverDevelop() {
|
public String getDeliverDevelop() {
|
||||||
OptionRepository defaultPlouf = this.defaultBase;
|
OptionRepository defaultPlouf = this.defaultBase;
|
||||||
@ -297,13 +256,7 @@ public class Manifest {
|
|||||||
}
|
}
|
||||||
return defaultPlouf.getBranchDevelop();
|
return defaultPlouf.getBranchDevelop();
|
||||||
}
|
}
|
||||||
public String getBranchRelease() {
|
|
||||||
OptionRepository defaultPlouf = this.defaultBase;
|
|
||||||
if (this.defaultWhat != null) {
|
|
||||||
defaultPlouf = this.defaultWhat;
|
|
||||||
}
|
|
||||||
return defaultPlouf.getBranchRelease();
|
|
||||||
}
|
|
||||||
public DeliverMode getDeliverModeMerge() {
|
public DeliverMode getDeliverModeMerge() {
|
||||||
OptionRepository defaultPlouf = this.defaultBase;
|
OptionRepository defaultPlouf = this.defaultBase;
|
||||||
if (this.defaultWhat != null) {
|
if (this.defaultWhat != null) {
|
||||||
@ -312,4 +265,51 @@ public class Manifest {
|
|||||||
return defaultPlouf.getDeliverMode();
|
return defaultPlouf.getDeliverMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Link> getLinks() {
|
||||||
|
List<Link> out = new ArrayList<>();
|
||||||
|
for (Entry<String, ManifestFile> elem : this.manifests.entrySet()) {
|
||||||
|
for (Link link : elem.getValue().getLinks()) {
|
||||||
|
out.add(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() throws ExmlParserErrorMulti, ExmlBuilderException, IOException {
|
||||||
|
Path rootDirectory = this.manifestXml.toAbsolutePath();
|
||||||
|
this.rootManifest = rootDirectory.getFileName().toString();
|
||||||
|
rootDirectory = rootDirectory.getParent();
|
||||||
|
|
||||||
|
Log.debug("PArse main XML config " + rootDirectory);
|
||||||
|
ManifestFile parsedElements = null;
|
||||||
|
try {
|
||||||
|
parsedElements = Exml.parseOne(this.manifestXml, ManifestFile.class, "manifest");
|
||||||
|
} catch (ExmlException e1) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
parsedElements.setFileRealPath(this.manifestXml);
|
||||||
|
this.manifests.put(this.rootManifest, parsedElements);
|
||||||
|
for (String includeElem : parsedElements.getIncludes()) {
|
||||||
|
Path maniPath = rootDirectory.resolve(includeElem);
|
||||||
|
Log.debug("PArse <<SUB>> XML config " + maniPath);
|
||||||
|
ManifestFile tmpManifest = null;
|
||||||
|
try {
|
||||||
|
tmpManifest = Exml.parseOne(maniPath, ManifestFile.class, "manifest");
|
||||||
|
} catch (ExmlException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
tmpManifest.setFileRealPath(maniPath);
|
||||||
|
this.manifests.put(includeElem, tmpManifest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String removeEndSlash(String value) {
|
||||||
|
while (value.length() > 1 && (value.charAt(value.length() - 1) == '\\' || value.charAt(value.length() - 1) == '/')) {
|
||||||
|
value = value.substring(0, value.length() - 1);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ import org.atriasoft.island.internal.Log;
|
|||||||
import org.atriasoft.island.model.ActionException;
|
import org.atriasoft.island.model.ActionException;
|
||||||
import org.atriasoft.island.model.manifest.ConfigManifest;
|
import org.atriasoft.island.model.manifest.ConfigManifest;
|
||||||
import org.atriasoft.island.model.manifest.ProjectConfig;
|
import org.atriasoft.island.model.manifest.ProjectConfig;
|
||||||
|
|
||||||
import org.eclipse.jgit.api.Git;
|
import org.eclipse.jgit.api.Git;
|
||||||
import org.eclipse.jgit.lib.TextProgressMonitor;
|
import org.eclipse.jgit.lib.TextProgressMonitor;
|
||||||
import org.eclipse.jgit.transport.PushResult;
|
import org.eclipse.jgit.transport.PushResult;
|
||||||
@ -72,13 +71,14 @@ public class BasePush {
|
|||||||
Git git = Git.open(git_repo_path.toFile());
|
Git git = Git.open(git_repo_path.toFile());
|
||||||
String select_branch = git.getRepository().getBranch();
|
String select_branch = git.getRepository().getBranch();
|
||||||
|
|
||||||
Iterable<PushResult> plo = git.push()
|
Iterable<PushResult> plo = git.push() //
|
||||||
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)))
|
.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))) //
|
||||||
.setRemote(elem.getSelectRemotes().getName())
|
.setRemote(elem.getSelectRemotes().getName()) //
|
||||||
.setForce(this.force)
|
.setForce(this.force) //
|
||||||
.add(select_branch)
|
.add(select_branch) //
|
||||||
.setDryRun(this.dryRun)
|
.setDryRun(this.dryRun) //
|
||||||
.call();
|
.call();
|
||||||
|
Log.verbose("plop " + plo.hashCode());
|
||||||
Log.info("[" + elem.getName() + "] fetch done " + dryRunComment);
|
Log.info("[" + elem.getName() + "] fetch done " + dryRunComment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -87,4 +87,3 @@ public class BasePush {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,12 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.atriasoft.exml.annotation.XmlIgnoreUnknow;
|
||||||
import org.atriasoft.exml.annotation.XmlList;
|
import org.atriasoft.exml.annotation.XmlList;
|
||||||
import org.atriasoft.exml.annotation.XmlManaged;
|
import org.atriasoft.exml.annotation.XmlManaged;
|
||||||
import org.atriasoft.exml.annotation.XmlName;
|
import org.atriasoft.exml.annotation.XmlName;
|
||||||
|
|
||||||
|
@XmlIgnoreUnknow
|
||||||
public class ManifestFile {
|
public class ManifestFile {
|
||||||
private Path fileRealPath = null;
|
private Path fileRealPath = null;
|
||||||
private List<ProjectConfig> projects = new ArrayList<>();
|
private List<ProjectConfig> projects = new ArrayList<>();
|
||||||
@ -18,68 +20,76 @@ public class ManifestFile {
|
|||||||
private OptionRepository options = null;
|
private OptionRepository options = null;
|
||||||
private List<Link> links = new ArrayList<>();
|
private List<Link> links = new ArrayList<>();
|
||||||
|
|
||||||
@XmlName(value="project")
|
@XmlName("artefactory")
|
||||||
public List<ProjectConfig> getProjects() {
|
public List<Artifactory> getArtefactories() {
|
||||||
return this.projects;
|
return this.artefactories;
|
||||||
}
|
|
||||||
public void setProjects(final List<ProjectConfig> projects) {
|
|
||||||
this.projects = projects;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlName(value="remote")
|
@XmlName(value = "dependencies")
|
||||||
public List<RemoteConfig> getRemotes() {
|
@XmlList(value = "dependency")
|
||||||
return this.remotes;
|
|
||||||
}
|
|
||||||
public void setRemotes(final List<RemoteConfig> remotes) {
|
|
||||||
this.remotes = remotes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlName(value="include")
|
|
||||||
public List<String> getIncludes() {
|
|
||||||
return this.includes;
|
|
||||||
}
|
|
||||||
public void setIncludes(final List<String> includes) {
|
|
||||||
this.includes = includes;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlName(value="dependencies")
|
|
||||||
@XmlList(value="dependency")
|
|
||||||
public List<Dependency> getDependencies() {
|
public List<Dependency> getDependencies() {
|
||||||
return this.dependencies;
|
return this.dependencies;
|
||||||
}
|
}
|
||||||
public void setDependencies(final List<Dependency> dependency) {
|
|
||||||
this.dependencies = dependency;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OptionRepository getOptions() {
|
|
||||||
return this.options;
|
|
||||||
}
|
|
||||||
public void setOptions(final OptionRepository options) {
|
|
||||||
this.options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlName(value="link")
|
|
||||||
public List<Link> getLinks() {
|
|
||||||
return this.links;
|
|
||||||
}
|
|
||||||
public void setLinks(final List<Link> links) {
|
|
||||||
this.links = links;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlManaged(false)
|
@XmlManaged(false)
|
||||||
public Path getFileRealPath() {
|
public Path getFileRealPath() {
|
||||||
return this.fileRealPath;
|
return this.fileRealPath;
|
||||||
}
|
}
|
||||||
public void setFileRealPath(final Path fileRealPath) {
|
|
||||||
this.fileRealPath = fileRealPath;
|
@XmlName(value = "include")
|
||||||
|
public List<String> getIncludes() {
|
||||||
|
return this.includes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XmlName("artefactory")
|
@XmlName(value = "link")
|
||||||
public List<Artifactory> getArtefactories() {
|
public List<Link> getLinks() {
|
||||||
return this.artefactories;
|
return this.links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OptionRepository getOptions() {
|
||||||
|
return this.options;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlName(value = "project")
|
||||||
|
public List<ProjectConfig> getProjects() {
|
||||||
|
return this.projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlName(value = "remote")
|
||||||
|
public List<RemoteConfig> getRemotes() {
|
||||||
|
return this.remotes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setArtefactories(final List<Artifactory> artefacts) {
|
public void setArtefactories(final List<Artifactory> artefacts) {
|
||||||
this.artefactories = artefacts;
|
this.artefactories = artefacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDependencies(final List<Dependency> dependency) {
|
||||||
|
this.dependencies = dependency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFileRealPath(final Path fileRealPath) {
|
||||||
|
this.fileRealPath = fileRealPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncludes(final List<String> includes) {
|
||||||
|
this.includes = includes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLinks(final List<Link> links) {
|
||||||
|
this.links = links;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptions(final OptionRepository options) {
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProjects(final List<ProjectConfig> projects) {
|
||||||
|
this.projects = projects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemotes(final List<RemoteConfig> remotes) {
|
||||||
|
this.remotes = remotes;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user