Skip to content

Commit

Permalink
write to build/ instead
Browse files Browse the repository at this point in the history
  • Loading branch information
spacey-sooty committed Dec 7, 2023
1 parent b28d3b5 commit 5d47416
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main/java/edu/wpi/first/gradlerio/deploy/DeployData.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import java.util.Map;

import org.gradle.api.GradleException;
import org.gradle.internal.impldep.software.amazon.ion.IonException;

import java.util.HashMap;
import java.io.IOException;
import java.io.File;
import java.lang.Runtime;
import java.time.LocalDateTime;

class DeployLogFile {
public String deployHost;
Expand All @@ -25,7 +25,7 @@ class DeployLogFile {
public String gitHash;
public String gitBranch;
public String gitDesc;
public static final String LOG_FILE_PATH = "deploy.json";
public static final String LOG_FILE_PATH = "/tmp/deploy.json";
public File deployFile;
public String[] deployItems = {
"deployHost",
Expand All @@ -52,9 +52,20 @@ class DeployLogFile {
inGitRepo = false;
}

data.put(deployItems[0], deployHost);
try {
deployHost = Runtime.getRuntime().exec("hostname").getOutputStream().toString().strip();
data.put(deployItems[0], deployHost);
} catch (IOException e) {
throw new GradleException("Couldn't get hostname", e);
}

deployUser = System.getProperty("user.name");
data.put(deployItems[1], deployUser);

deployDate = LocalDateTime.now().toString();
data.put(deployItems[2], deployDate);

codePath = System.getProperty("user.dir");
data.put(deployItems[3], codePath);

if (inGitRepo) {
Expand Down Expand Up @@ -93,7 +104,7 @@ class DeployLogFile {
throw new GradleException("Couldn't write deploy log file", e);
}

deployArtifact = new FileArtifact(LOG_FILE_PATH, target);
deployArtifact = new FileArtifact("/home/lvuser/deploy.json", target);

target.getArtifacts().add(deployArtifact);
}
Expand Down

0 comments on commit 5d47416

Please sign in to comment.