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)
|
||||
public void download()
|
||||
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;
|
||||
|
||||
import rife.bld.CommandHelp;
|
||||
import rife.tools.StringUtils;
|
||||
import rife.bld.operations.DownloadOperation;
|
||||
|
||||
/**
|
||||
* Provides help for the download command.
|
||||
|
|
@ -15,13 +15,13 @@ import rife.tools.StringUtils;
|
|||
*/
|
||||
public class DownloadHelp implements CommandHelp {
|
||||
public String getSummary() {
|
||||
return "Downloads all dependencies of the project";
|
||||
return "Downloads all dependencies of the project (take option)";
|
||||
}
|
||||
|
||||
public String getDescription(String topic) {
|
||||
return StringUtils.replace("""
|
||||
Downloads all dependencies of the project
|
||||
|
||||
Usage : ${topic}""", "${topic}", topic);
|
||||
return String.format("""
|
||||
Downloads all dependencies of the project
|
||||
|
||||
Usage : %s [%s]""", topic, DownloadOperation.AUTO_OPTION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,6 +25,7 @@ import static rife.bld.dependencies.Dependency.CLASSIFIER_SOURCES;
|
|||
* @since 1.5
|
||||
*/
|
||||
public class DownloadOperation extends AbstractOperation<DownloadOperation> {
|
||||
public static final String AUTO_OPTION = "--auto";
|
||||
private boolean offline_ = false;
|
||||
private HierarchicalProperties properties_ = null;
|
||||
private ArtifactRetriever retriever_ = null;
|
||||
|
|
|
|||
Loading…
Reference in a new issue