Skip to content

Commit

Permalink
Merge pull request #7 from massivedisaster/feature/call_bintray_uploa…
Browse files Browse the repository at this point in the history
…d_once

Call bintrayUpload task only once time
  • Loading branch information
jzeferino authored May 23, 2017
2 parents 6f5defb + d132292 commit 583a81d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ public static void main(String args[]) {
.connect();

// Clean and build all projects.
rebuild(gradleConnection, configuration);

// Bintrayupload.
bintrayUpload(gradleConnection, configuration);
rebuildAndBintrayDeploy(gradleConnection, configuration);

// Replace version if needed.
if (configuration.UpdateReadmeVersion()) {
Expand All @@ -42,13 +39,7 @@ public static void main(String args[]) {
}
}

private static void rebuild(ProjectConnection gradleConnection, Configuration configuration) {
GradleUtils.runGradle(gradleConnection, configuration.getRebuildTasks(), configuration.getRebuildArguments());
}

private static void bintrayUpload(ProjectConnection gradleConnection, Configuration configuration) {
for (String task: configuration.getBintrayTasks()) {
GradleUtils.runGradle(gradleConnection, new String[] {task}, configuration.getBintrayArguments());
}
private static void rebuildAndBintrayDeploy(ProjectConnection gradleConnection, Configuration configuration) {
GradleUtils.runGradle(gradleConnection, configuration.getRebuildAndBintrayDeployTasks(), configuration.getRebuildAndBintrayDeployArguments());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.massivedisaster.bintraydeployautomator.model;

import com.google.gson.Gson;
import org.gradle.internal.impldep.org.apache.commons.lang.NullArgumentException;
import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils;

import java.io.IOException;
Expand Down Expand Up @@ -46,22 +45,7 @@ public String getBintrayKey() {
return bintrayKey;
}

public String[] getBintrayTasks() {
if(modules == null){
throw new NullArgumentException("modules can't be null");
}

if(bintrayTasks == null){
int size = modules.size();
bintrayTasks = new String[size];
for (int i = 0; i <size ; i++) {
bintrayTasks[i] = modules.get(i)+":bintrayUpload";
}
}
return bintrayTasks;
}

public String[] getBintrayArguments() {
public String[] getRebuildAndBintrayDeployArguments() {
return new String[] {
String.format("-PbintrayUser=%s", bintrayUsername),
String.format("-PbintrayKey=%s", bintrayKey),
Expand All @@ -71,12 +55,8 @@ public String[] getBintrayArguments() {
};
}

public String[] getRebuildTasks() {
return new String[] {"clean", "build"};
}

public String getRebuildArguments() {
return String.format("-PlibraryVersionName=%s", version);
public String[] getRebuildAndBintrayDeployTasks() {
return new String[]{"clean", "build", "bintrayUpload"};
}

public boolean UpdateReadmeVersion() {
Expand Down

0 comments on commit 583a81d

Please sign in to comment.