[DEV] set the model work again...

This commit is contained in:
Edouard DUPIN 2021-06-29 00:16:19 +02:00
parent ea883353e1
commit 19fa1f3983
3 changed files with 48 additions and 18 deletions

View File

@ -5,6 +5,7 @@
open module org.atriasoft.island {
exports org.atriasoft.island;
exports org.atriasoft.island.model;
exports org.atriasoft.island.model.manifest;
//exports org.atriasoft.island.actions;
requires transitive io.scenarium.logger;

View File

@ -15,8 +15,8 @@ import org.atriasoft.island.internal.Log;
import org.atriasoft.island.model.Link;
import org.atriasoft.island.model.ProjectConfig;
import org.atriasoft.island.model.RemoteConfig;
import org.atriasoft.island.model.RepositoryConfig;
import org.atriasoft.island.model.manifest.ManifestFile;
import org.atriasoft.island.model.manifest.OptionRepository;
public class Manifest {
public static boolean isInit() {
@ -54,10 +54,10 @@ public class Manifest {
private final String deliver_mode = "merge";
@Deprecated
List<ProjectConfig> projects = new ArrayList<>();
@Deprecated
RepositoryConfig defaultWhat = null;
@Deprecated
RepositoryConfig defaultBase = new RepositoryConfig();
OptionRepository defaultWhat = null;
OptionRepository defaultBase = new OptionRepository();
@Deprecated
List<RemoteConfig> remotes = new ArrayList<>();
@Deprecated
@ -354,7 +354,7 @@ public class Manifest {
return get_all_configs(null, new ArrayList<>());
}
public List<ProjectConfig> get_all_configs(RepositoryConfig defaultPlouf, final List<RemoteConfig> upper_remotes) {
public List<ProjectConfig> get_all_configs(OptionRepository defaultPlouf, final List<RemoteConfig> upper_remotes) {
List<ProjectConfig> out = new ArrayList<>();
if (defaultPlouf == null) {
if (this.defaultWhat != null) {
@ -376,29 +376,30 @@ public class Manifest {
// add default remote for the project (search in herited element)
for (RemoteConfig remote : this.remotes) {
Log.verbose(" Local Remote: " + remote);
if (remote.getName().equals(defaultPlouf.getRemote())) {
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
conf.getRemotes().add(remote);
}
}
if (conf.getRemotes().size() == 0) {
for (RemoteConfig remote : upper_remotes) {
Log.verbose(" upper Remote: " + remote);
if (remote.getName().equals(defaultPlouf.getRemote())) {
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
conf.getRemotes().add(remote);
}
}
}
if (conf.getRemotes().size() == 0) {
Log.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getRemote() + " this remote: " + this.remotes);
Log.error(" No remote detected: " + conf.getRemotes().size() + " for " + conf.getName() + " with default remote name : " + defaultPlouf.getDefaultRemote() + " this remote: " + this.remotes);
}
// select default remote:
Log.debug(" remotes count: " + conf.getRemotes().size());
for (RemoteConfig remote : conf.getRemotes()) {
Log.debug(" remote=" + remote);
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getRemote());
Log.debug(" Ckeck remote : " + remote.getName() + ".equals(" + defaultPlouf.getDefaultRemote());
Log.verbose(" remote=" + remote);
Log.verbose(" default=" + defaultPlouf);
if (remote.getName().equals(defaultPlouf.getRemote())) {
if (remote.getName().equals(defaultPlouf.getDefaultRemote())) {
conf.setSelectRemotes(remote.clone());
Log.debug(" copy select=" + conf.getSelectRemotes());
@ -410,7 +411,7 @@ public class Manifest {
if (conf.getSelectRemotes() == null) {
Log.error("missing remote for project: " + conf.getName());
}
conf.setBranch(defaultPlouf.getRevision());
conf.setBranch(defaultPlouf.getDefaultBranch());
out.add(conf);
}
// create a temporary variable to transmit the remote to includes

View File

@ -3,13 +3,30 @@ package org.atriasoft.island.model.manifest;
import org.atriasoft.exml.annotation.XmlName;
public class OptionRepository {
private String branchRelease = "master";
private String branchDevelop = "dev";
private DeliverMode deliverMode = DeliverMode.MERGE;
private String defaultBranch = "master";
private String defaultRemote = "origin";
private boolean synchronizeSubmodule = false;
private String branchRelease;
private String branchDevelop;
private DeliverMode deliverMode;
private String defaultBranch;
private String defaultRemote;
private boolean synchronizeSubmodule;
public OptionRepository() {
this.branchRelease = "master";
this.branchDevelop = "dev";
this.deliverMode = DeliverMode.MERGE;
this.defaultBranch = "master";
this.defaultRemote = "origin";
this.synchronizeSubmodule = false;
}
public OptionRepository(final String branchRelease, final String branchDevelop, final DeliverMode deliverMode, final String defaultBranch, final String defaultRemote, final boolean synchronizeSubmodule) {
this.branchRelease = branchRelease;
this.branchDevelop = branchDevelop;
this.deliverMode = deliverMode;
this.defaultBranch = defaultBranch;
this.defaultRemote = defaultRemote;
this.synchronizeSubmodule = synchronizeSubmodule;
}
@XmlName(value="branch-release")
public String getBranchRelease() {
return this.branchRelease;
@ -57,6 +74,17 @@ public class OptionRepository {
public void setSynchronizeSubmodule(final boolean downloadSubmodule) {
this.synchronizeSubmodule = downloadSubmodule;
}
@Override
public OptionRepository clone() {
// TODO Auto-generated method stub
return new OptionRepository( this.branchRelease, this.branchDevelop, this.deliverMode, this.defaultBranch, this.defaultRemote, this.synchronizeSubmodule);
}
@Override
public String toString() {
return "OptionRepository [branchRelease=" + this.branchRelease + ", branchDevelop=" + this.branchDevelop + ", deliverMode=" + this.deliverMode + ", defaultBranch=" + this.defaultBranch + ", defaultRemote="
+ this.defaultRemote + ", synchronizeSubmodule=" + this.synchronizeSubmodule + "]";
}