Skip to content

Commit

Permalink
Increase timeout so that the API responds properly. Temporarily disab…
Browse files Browse the repository at this point in the history
…le uploading of deobfuscation files, and "What's new" until the bugs are sorted out with that data coming after a Bundle upload. [Triple-T#262]
  • Loading branch information
gtcompscientist committed May 18, 2018
1 parent 76d969c commit daec5ac
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 29 deletions.
Expand Up @@ -18,6 +18,8 @@ package de.triplet.gradle.play
import com.google.api.client.auth.oauth2.Credential
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport
import com.google.api.client.http.HttpRequest
import com.google.api.client.http.HttpRequestInitializer
import com.google.api.client.http.HttpTransport
import com.google.api.client.json.jackson2.JacksonFactory
import com.google.api.services.androidpublisher.AndroidPublisher
Expand Down Expand Up @@ -93,7 +95,13 @@ class AndroidPublisherHelper {
}

// Set up and return API client.
return new AndroidPublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
return new AndroidPublisher.Builder(HTTP_TRANSPORT, JSON_FACTORY, new HttpRequestInitializer() {
@Override
void initialize(HttpRequest request) throws IOException {
request.setConnectTimeout(100_000).setReadTimeout(100_000)
credential.initialize(request)
}
})
.setApplicationName(APPLICATION_NAME)
.build()
}
Expand Down
57 changes: 29 additions & 28 deletions src/main/groovy/de/triplet/gradle/play/PlayPublishBundleTask.groovy
Expand Up @@ -4,6 +4,7 @@ import com.google.api.client.googleapis.json.GoogleJsonResponseException
import com.google.api.client.http.FileContent
import com.google.api.services.androidpublisher.model.ApkListing
import com.google.api.services.androidpublisher.model.Bundle
import com.google.api.services.androidpublisher.model.Listing
import com.google.api.services.androidpublisher.model.Track
import org.gradle.api.logging.LogLevel
import org.gradle.api.tasks.TaskAction
Expand Down Expand Up @@ -70,34 +71,34 @@ class PlayPublishBundleTask extends PlayPublishTask {
}
}

// Upload Proguard mapping.txt if available
if (variant.mappingFile?.exists()) {
def fileStream = new FileContent('application/octet-stream', variant.mappingFile)
edits.deobfuscationfiles().upload(variant.applicationId, editId, bundle.getVersionCode(), 'proguard', fileStream).execute()
}

if (inputFolder.exists()) {

// Matches if locale have the correct naming e.g. en-US for play store
inputFolder.eachDirMatch(matcher) { dir ->
def whatsNewFile = new File(dir, FILE_NAME_FOR_WHATS_NEW_TEXT + '-' + extension.track)

if (!whatsNewFile.exists()) {
whatsNewFile = new File(dir, FILE_NAME_FOR_WHATS_NEW_TEXT)
}

if (whatsNewFile.exists()) {

def whatsNewText = TaskHelper.readAndTrimFile(project, whatsNewFile, MAX_CHARACTER_LENGTH_FOR_WHATS_NEW_TEXT, extension.errorOnSizeLimit)
def locale = dir.name

def newApkListing = new ApkListing().setRecentChanges(whatsNewText)
edits.apklistings()
.update(variant.applicationId, editId, bundle.getVersionCode(), locale, newApkListing)
.execute()
}
}
}
// // Upload Proguard mapping.txt if available
// if (variant.mappingFile?.exists()) {
// def fileStream = new FileContent('application/octet-stream', variant.mappingFile)
// edits.deobfuscationfiles().upload(variant.applicationId, editId, bundle.getVersionCode(), 'proguard', fileStream).execute()
// }

// if (inputFolder.exists()) {
//
// // Matches if locale have the correct naming e.g. en-US for play store
// inputFolder.eachDirMatch(matcher) { dir ->
// def whatsNewFile = new File(dir, FILE_NAME_FOR_WHATS_NEW_TEXT + '-' + extension.track)
//
// if (!whatsNewFile.exists()) {
// whatsNewFile = new File(dir, FILE_NAME_FOR_WHATS_NEW_TEXT)
// }
//
// if (whatsNewFile.exists()) {
//
// def whatsNewText = TaskHelper.readAndTrimFile(project, whatsNewFile, MAX_CHARACTER_LENGTH_FOR_WHATS_NEW_TEXT, extension.errorOnSizeLimit)
// def locale = dir.name
//
// def newApkListing = new ApkListing().setRecentChanges(whatsNewText)
// edits.apklistings()
// .update(variant.applicationId, editId, bundle.getVersionCode(), locale, newApkListing)
// .execute()
// }
// }
// }

return bundle
}
Expand Down

0 comments on commit daec5ac

Please sign in to comment.