Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ShirasawaSama committed Mar 8, 2023
1 parent 9cebed6 commit 37ba152
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
13 changes: 2 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
plugins {
id 'java'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

group 'com.microsoft.appcenter'
version '1.0.0'
Expand All @@ -13,14 +12,6 @@ java {
withSourcesJar()
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}

repositories {
mavenCentral()
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONStringer;
import oshi.SystemInfo;
import oshi.software.os.OSProcess;

import java.io.File;
import java.io.FilenameFilter;
Expand Down Expand Up @@ -188,8 +190,8 @@ public static ManagedErrorLog createErrorLog(@NonNull Context context, @NonNull
// }
// }
// }
errorLog.setProcessId((int) ProcessHandle.current().pid());
errorLog.setProcessName(ProcessHandle.current().info().commandLine().orElse(""));

setProcessInfo(errorLog);

/*
* Process name is required field for crash processing but cannot always be available,
Expand Down Expand Up @@ -698,4 +700,18 @@ public static void clearStaticState() {
sErrorLogDirectory = null;
sPendingMinidumpDirectory = null;
}

// ------------------------------------------------------------------------
private static int PID = -1;
private static String PROCESS_NAME;

private static void setProcessInfo(ManagedErrorLog log) {
if (PROCESS_NAME == null) {
OSProcess process = new SystemInfo().getOperatingSystem().getCurrentProcess();
PID = process.getProcessID();
PROCESS_NAME = process.getName();
}
log.setProcessId(PID);
log.setProcessName(PROCESS_NAME);
}
}

0 comments on commit 37ba152

Please sign in to comment.