Add Sentry build tags (#3765)
This commit is contained in:
@@ -27,10 +27,12 @@ android {
|
||||
minSdk = 21
|
||||
targetSdk = 33
|
||||
versionCode = 14
|
||||
versionName = "6.0.1"
|
||||
testInstrumentationRunner = "org.maplibre.android.InstrumentationRunner"
|
||||
multiDexEnabled = true
|
||||
versionName = file("../VERSION").readText().trim()
|
||||
|
||||
manifestPlaceholders["SENTRY_DSN"] = ""
|
||||
manifestPlaceholders["SENTRY_ENV"] = ""
|
||||
}
|
||||
|
||||
nativeBuild(listOf("example-custom-layer"))
|
||||
@@ -53,9 +55,11 @@ android {
|
||||
keepDebugSymbols += "**/*.so"
|
||||
}
|
||||
}
|
||||
|
||||
buildConfigField("String", "SENTRY_DSN", "\"" + (System.getenv("SENTRY_DSN") ?: "") + "\"")
|
||||
manifestPlaceholders["SENTRY_DSN"] = System.getenv("SENTRY_DSN") ?: ""
|
||||
}
|
||||
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
|
||||
@@ -1317,6 +1317,11 @@
|
||||
android:value="${SENTRY_DSN}"
|
||||
/>
|
||||
|
||||
<meta-data
|
||||
android:name="io.sentry.environment"
|
||||
android:value="${SENTRY_ENV}"
|
||||
/>
|
||||
|
||||
<!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
|
||||
<meta-data
|
||||
android:name="io.sentry.send-default-pii"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import com.android.build.gradle.AppExtension
|
||||
import java.io.ByteArrayOutputStream
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
|
||||
@@ -39,11 +41,14 @@ class SentryConditionalPlugin : Plugin<Project> {
|
||||
}
|
||||
}
|
||||
|
||||
val androidExtension = project.extensions.getByType(AppExtension::class.java)
|
||||
|
||||
val propertiesToSet = mapOf(
|
||||
"getDebug" to true,
|
||||
"getOrg" to System.getenv("SENTRY_ORG"),
|
||||
"getProjectName" to System.getenv("SENTRY_PROJECT"),
|
||||
"getAuthToken" to System.getenv("SENTRY_AUTH_TOKEN"),
|
||||
"getRelease" to androidExtension.defaultConfig.versionName,
|
||||
"getIncludeProguardMapping" to true,
|
||||
"getAutoUploadProguardMapping" to true,
|
||||
"getDexguardEnabled" to false,
|
||||
@@ -58,5 +63,20 @@ class SentryConditionalPlugin : Plugin<Project> {
|
||||
propertiesToSet.forEach { (getterName, value) ->
|
||||
setProperty(sentryExt, getterName, value)
|
||||
}
|
||||
|
||||
project.afterEvaluate {
|
||||
val commitHash = ByteArrayOutputStream()
|
||||
|
||||
project.exec {
|
||||
commandLine("git", "rev-parse", "HEAD")
|
||||
standardOutput = commitHash
|
||||
workingDir = project.rootDir
|
||||
isIgnoreExitValue = true
|
||||
}
|
||||
|
||||
androidExtension.applicationVariants.forEach { variant ->
|
||||
variant.mergedFlavor.manifestPlaceholders["SENTRY_ENV"] = "${variant.name}-$commitHash"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,11 +106,15 @@ void checkCompileStatus(GLuint shader) {
|
||||
GLint maxLength = 0;
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
|
||||
|
||||
// The maxLength includes the NULL character
|
||||
std::vector<GLchar> errorLog(maxLength);
|
||||
glGetShaderInfoLog(shader, maxLength, &maxLength, errorLog.data());
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, errorLog.data());
|
||||
throw Error(std::string(errorLog.begin(), errorLog.end()));
|
||||
if (maxLength > 0) {
|
||||
// The maxLength includes the NULL character
|
||||
std::vector<GLchar> errorLog(maxLength + 1);
|
||||
glGetShaderInfoLog(shader, maxLength, &maxLength, errorLog.data());
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, errorLog.data());
|
||||
throw Error(std::string(errorLog.begin(), errorLog.end()));
|
||||
} else {
|
||||
throw Error("checkCompileStatus failed to get error string");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user