Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default staging mode in config file #172

Merged
merged 3 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/com/askimed/nf/test/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class Config {

private StageBuilder stageBuilder = new StageBuilder();

private String stageMode = FileStaging.MODE_COPY;

public void testsDir(String testsDir) {
this.testsDir = testsDir;
}
Expand Down Expand Up @@ -114,6 +116,18 @@ public String getLibDir() {
return libDir;
}

public void setStageMode(String stageMode) {
this.stageMode = stageMode;
}

public String getStageMode() {
return stageMode;
}

public void stageMode(String stageMode) {
this.stageMode = stageMode;
}

public void stage(Closure closure) {
closure.setDelegate(stageBuilder);
closure.setResolveStrategy(Closure.DELEGATE_ONLY);
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/askimed/nf/test/core/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ public abstract class AbstractTest implements ITest {

public boolean skipped = false;

public static FileStaging[] SHARED_DIRECTORIES = { new FileStaging("bin"), new FileStaging("lib"),
new FileStaging("assets") };

protected File config = null;

private boolean updateSnapshot = false;
Expand Down Expand Up @@ -109,10 +106,14 @@ public void setup(Config config, File testDirectory) throws IOException {
metaDir = initDirectory("Meta Directory", launchDir, DIRECTORY_META);
outputDir = initDirectory("Output Directory", launchDir, DIRECTORY_OUTPUT);
workDir = initDirectory("Working Directory", launchDir, DIRECTORY_WORK);

FileStaging[] sharedDirectories = new FileStaging[]{
new FileStaging("bin", config != null ? config.getStageMode() : FileStaging.MODE_COPY),
new FileStaging("lib", config != null ? config.getStageMode() : FileStaging.MODE_COPY),
new FileStaging("assets", config != null ? config.getStageMode() : FileStaging.MODE_COPY)
};
try {
// copy bin, assets and lib to metaDir
shareDirectories(SHARED_DIRECTORIES, metaDir);
shareDirectories(sharedDirectories, metaDir);
if (config != null) {
// copy user defined staging directories
log.debug("Stage {} user provided files...", config.getStageBuilder().getPaths().size());
Expand Down
Loading