Skip to content

Commit 1dc259f

Browse files
committed
#scm-ver 0.1.0
1 parent 5887b14 commit 1dc259f

File tree

4 files changed

+12
-28
lines changed

4 files changed

+12
-28
lines changed

mdeps

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
com.github.scm4j:scm4j-deployer-api:master-SNAPSHOT
1+
com.github.scm4j:scm4j-deployer-api:0.1.0

src/main/java/org/scm4j/deployer/engine/DeployerEngine.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public void deploy(String artifactId, String version) {
4949
log.warn(productName.append(" already installed!").toString());
5050
} else {
5151
if (!product.getDependentProducts().isEmpty()) {
52-
deployDependent(product, deployedProducts);
52+
List<String> dependents = product.getDependentProducts();
53+
for(String dependent : dependents) {
54+
Artifact depArt = new DefaultArtifact(dependent);
55+
deploy(depArt.getArtifactId(), depArt.getVersion());
56+
}
5357
deployedProducts = Utils.readYml(deployedProductsFolder);
5458
}
5559
File installersJar = runner.getDepCtx().get(artifactId).getArtifacts().get(INSTALLERS_JAR_NAME);
@@ -70,25 +74,6 @@ public void deploy(String artifactId, String version) {
7074
}
7175
}
7276

73-
private void deployDependent(IProduct product, Map<String, List<String>> deployedProducts) {
74-
List<String> dependents = product.getDependentProducts();
75-
for(String dep : dependents) {
76-
log.info("Need to install " + dep);
77-
String[] artIdPlusVers = dep.split("-");
78-
if(deployedProducts.getOrDefault(artIdPlusVers[0], new ArrayList<>()).contains(artIdPlusVers[1])) {
79-
continue;
80-
} else {
81-
File productFile = download(artIdPlusVers[0], artIdPlusVers[1]);
82-
IProduct dependent = runner.getProduct(productFile);
83-
if(dependent.isInstalled(artIdPlusVers[0])) {
84-
continue;
85-
} else {
86-
deploy(artIdPlusVers[0],artIdPlusVers[1]);
87-
}
88-
}
89-
}
90-
}
91-
9277
@Override
9378
public File download(String artifactId, String version) {
9479
String groupId = Utils.getGroupId(runner, artifactId);

src/main/java/org/scm4j/deployer/engine/DeployerRunner.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class DeployerRunner {
4848

4949
@SneakyThrows
5050
public DeployerRunner(File flashFolder, File workingFolder, String productListArtifactoryUrl) {
51-
if(flashFolder == null)
51+
if (flashFolder == null)
5252
flashFolder = workingFolder;
5353
this.repository = new File(workingFolder, REPOSITORY_FOLDER_NAME);
5454
this.flashRepository = new File(flashFolder, REPOSITORY_FOLDER_NAME);
@@ -109,12 +109,11 @@ private List<Artifact> resolveDependencies(List<Artifact> artifacts) {
109109
List<Artifact> components = new ArrayList<>();
110110
session = Utils.newRepositorySystemSession(system, TMP_REPOSITORY);
111111
CollectRequest collectRequest = new CollectRequest();
112-
List<String> urls = productList.getRepos().stream()
112+
//TODO add localrepo in runtime
113+
productList.getRepos().stream()
113114
.map(ArtifactoryReader::toString)
114-
.sorted()
115-
.collect(Collectors.toList());
116-
urls.forEach(url -> collectRequest.addRepository
117-
(new RemoteRepository.Builder("", "default", url).build()));
115+
.forEach(url -> collectRequest.addRepository
116+
(new RemoteRepository.Builder("", "default", url).build()));
118117
DependencyFilter filter = DependencyFilterUtils.classpathFilter(JavaScopes.COMPILE);
119118
for (Artifact artifact : artifacts) {
120119
collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0-SNAPSHOT
1+
0.1.0

0 commit comments

Comments
 (0)