mirror of
https://github.com/rife2/bld
synced 2026-06-20 19:27:47 +02:00
Add download --auto argument, emulating autoDownloadPurge = true in the CLI.
To be used when caching dependencies in CI workflows.
This commit is contained in:
parent
8ca8c213d5
commit
c521d6578f
|
|
@ -534,7 +534,22 @@ public class BaseProject extends BuildExecutor {
|
||||||
@BuildCommand(help = DownloadHelp.class)
|
@BuildCommand(help = DownloadHelp.class)
|
||||||
public void download()
|
public void download()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
downloadOperation().executeOnce(() -> downloadOperation().fromProject(this));
|
var auto = false;
|
||||||
|
var arguments = this.arguments();
|
||||||
|
while (!arguments.isEmpty()) {
|
||||||
|
var argument = arguments.get(0);
|
||||||
|
if (DownloadOperation.AUTO_OPTION.equals(argument)) {
|
||||||
|
arguments.remove(0);
|
||||||
|
auto = true;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (auto) {
|
||||||
|
performAutoDownloadPurge();
|
||||||
|
} else {
|
||||||
|
downloadOperation().executeOnce(() -> downloadOperation().fromProject(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
package rife.bld.help;
|
package rife.bld.help;
|
||||||
|
|
||||||
import rife.bld.CommandHelp;
|
import rife.bld.CommandHelp;
|
||||||
import rife.tools.StringUtils;
|
import rife.bld.operations.DownloadOperation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides help for the download command.
|
* Provides help for the download command.
|
||||||
|
|
@ -15,13 +15,13 @@ import rife.tools.StringUtils;
|
||||||
*/
|
*/
|
||||||
public class DownloadHelp implements CommandHelp {
|
public class DownloadHelp implements CommandHelp {
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return "Downloads all dependencies of the project";
|
return "Downloads all dependencies of the project (take option)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription(String topic) {
|
public String getDescription(String topic) {
|
||||||
return StringUtils.replace("""
|
return String.format("""
|
||||||
Downloads all dependencies of the project
|
Downloads all dependencies of the project
|
||||||
|
|
||||||
Usage : ${topic}""", "${topic}", topic);
|
Usage : %s [%s]""", topic, DownloadOperation.AUTO_OPTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -25,6 +25,7 @@ import static rife.bld.dependencies.Dependency.CLASSIFIER_SOURCES;
|
||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
public class DownloadOperation extends AbstractOperation<DownloadOperation> {
|
public class DownloadOperation extends AbstractOperation<DownloadOperation> {
|
||||||
|
public static final String AUTO_OPTION = "--auto";
|
||||||
private boolean offline_ = false;
|
private boolean offline_ = false;
|
||||||
private HierarchicalProperties properties_ = null;
|
private HierarchicalProperties properties_ = null;
|
||||||
private ArtifactRetriever retriever_ = null;
|
private ArtifactRetriever retriever_ = null;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue