From 243c01485f9c71cafa504bb935ff8ff1634c9fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Rosa?= Date: Tue, 23 May 2017 17:25:44 +0100 Subject: [PATCH 1/2] Call bintrayUpload task only once time --- .../BintrayDeployAutomator.java | 11 +------- .../model/Configuration.java | 26 +++---------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java b/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java index a5980b5..57b9e13 100644 --- a/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java +++ b/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java @@ -25,9 +25,6 @@ public static void main(String args[]) { // Clean and build all projects. rebuild(gradleConnection, configuration); - // Bintrayupload. - bintrayUpload(gradleConnection, configuration); - // Replace version if needed. if (configuration.UpdateReadmeVersion()) { FileUtils.replaceSemVerInFile(configuration.getVersion(), configuration.getReadmePath()); @@ -43,12 +40,6 @@ 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()); - } + GradleUtils.runGradle(gradleConnection, configuration.getRebuildAndDeployTasks(), configuration.getRebuildAndDeployArguments()); } } diff --git a/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java b/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java index 4b5f67f..17d6d76 100644 --- a/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java +++ b/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java @@ -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; @@ -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 Date: Tue, 23 May 2017 17:56:02 +0100 Subject: [PATCH 2/2] Renamed methods to clarify operations. #7 --- .../bintraydeployautomator/BintrayDeployAutomator.java | 6 +++--- .../bintraydeployautomator/model/Configuration.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java b/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java index 57b9e13..aadb4db 100644 --- a/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java +++ b/src/main/java/com/massivedisaster/bintraydeployautomator/BintrayDeployAutomator.java @@ -23,7 +23,7 @@ public static void main(String args[]) { .connect(); // Clean and build all projects. - rebuild(gradleConnection, configuration); + rebuildAndBintrayDeploy(gradleConnection, configuration); // Replace version if needed. if (configuration.UpdateReadmeVersion()) { @@ -39,7 +39,7 @@ public static void main(String args[]) { } } - private static void rebuild(ProjectConnection gradleConnection, Configuration configuration) { - GradleUtils.runGradle(gradleConnection, configuration.getRebuildAndDeployTasks(), configuration.getRebuildAndDeployArguments()); + private static void rebuildAndBintrayDeploy(ProjectConnection gradleConnection, Configuration configuration) { + GradleUtils.runGradle(gradleConnection, configuration.getRebuildAndBintrayDeployTasks(), configuration.getRebuildAndBintrayDeployArguments()); } } diff --git a/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java b/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java index 17d6d76..ab8f935 100644 --- a/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java +++ b/src/main/java/com/massivedisaster/bintraydeployautomator/model/Configuration.java @@ -45,7 +45,7 @@ public String getBintrayKey() { return bintrayKey; } - public String[] getRebuildAndDeployArguments() { + public String[] getRebuildAndBintrayDeployArguments() { return new String[] { String.format("-PbintrayUser=%s", bintrayUsername), String.format("-PbintrayKey=%s", bintrayKey), @@ -55,7 +55,7 @@ public String[] getRebuildAndDeployArguments() { }; } - public String[] getRebuildAndDeployTasks() { + public String[] getRebuildAndBintrayDeployTasks() { return new String[]{"clean", "build", "bintrayUpload"}; }