Skip to content

Commit

Permalink
Merge pull request #377 from Countly/fix_plugin
Browse files Browse the repository at this point in the history
fix: upload plugin
  • Loading branch information
turtledreams committed Aug 14, 2024
2 parents 4955c24 + 0d8ba27 commit 9669272
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 24.7.2
* Mitigated an issue in the upload plugin that prevented the upload of a symbol file

## 24.7.1
* ! Minor breaking change ! Unsupported types for user properties will now be omitted, they won't be converted to strings.

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ org.gradle.configureondemand=true
android.useAndroidX=true
android.enableJetifier=true
# RELEASE FIELD SECTION
VERSION_NAME=24.7.1
VERSION_NAME=24.7.2
GROUP=ly.count.android
POM_URL=https://github.com/Countly/countly-sdk-android
POM_SCM_URL=https://github.com/Countly/countly-sdk-android
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class TestUtils {
public final static String commonAppKey = "appkey";
public final static String commonDeviceId = "1234";
public final static String SDK_NAME = "java-native-android";
public final static String SDK_VERSION = "24.7.1";
public final static String SDK_VERSION = "24.7.2";
public static final int MAX_THREAD_COUNT_PER_STACK_TRACE = 50;

public static class Activity2 extends Activity {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/main/java/ly/count/android/sdk/Countly.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ of this software and associated documentation files (the "Software"), to deal
*/
public class Countly {

private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "24.7.1";
private final String DEFAULT_COUNTLY_SDK_VERSION_STRING = "24.7.2";

/**
* Used as request meta data on every request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class UploadSymbolsPlugin implements Plugin<Project> {
throw new StopExecutionException("Please specify your server in countly block.")
}
String buildVersion = project.android.defaultConfig.versionName
String url = "${ext.server}/i/crash_symbols/upload_symbol"
String url = ext.server;
String path = "i/crash_symbols/upload_symbol";
// Ensure there is exactly one "/" between the base URL and the path
url = url.endsWith("/") ? url + path : url + "/" + path;
def filePath = "$project.buildDir/$ext.mappingFile"
logger.debug("uploadJavaSymbols, Version name:[ {} ], Upload symbol url:[ {} ], Mapping file path:[ {} ]", buildVersion, url, filePath)
File file = new File(filePath)
Expand All @@ -55,17 +58,27 @@ class UploadSymbolsPlugin implements Plugin<Project> {
.build()
request = new Request.Builder().url(url).post(formBody).build()
}
logger.debug("uploadJavaSymbols, Generated request: {}", request.body().toString())
doLast {
if (request == null) {
logger.error("Request not constructed")
throw new StopActionException("Something happened while constructing the request. Please try again.")
}

if (request.body() != null) {
logger.debug("uploadJavaSymbols, Generated request: {}", request.body().toString())
} else {
logger.error("uploadJavaSymbols, Request body is null which should not be the case")
}

client = new OkHttpClient()
Response response = client.newCall(request).execute()

if (response.code() != 200) {
logger.error("An error occurred while uploading the mapping file: {}", response.body().string())
if (response.body() != null) {
logger.error("An error occurred while uploading the mapping file: {}", response.body().string())
} else {
logger.error("An error occurred while uploading the mapping file, response body null")
}
} else {
logger.debug("File upload successful")
}
Expand Down

0 comments on commit 9669272

Please sign in to comment.