1"use strict"; 2 3Object.defineProperty(exports, "__esModule", { 4 value: true 5}); 6exports.default = void 0; 7var _default = `// Build integration with EAS 8 9import java.nio.file.Paths 10 11android { 12 signingConfigs { 13 release { 14 // This is necessary to avoid needing the user to define a release signing config manually 15 // If no release config is defined, and this is not present, build for assembleRelease will crash 16 } 17 } 18 19 buildTypes { 20 release { 21 // This is necessary to avoid needing the user to define a release build type manually 22 } 23 } 24} 25 26def isEasBuildConfigured = false 27 28tasks.whenTaskAdded { 29 def debug = gradle.startParameter.taskNames.any { it.toLowerCase().contains('debug') } 30 31 if (debug) { 32 return 33 } 34 35 // We only need to configure EAS build once 36 if (isEasBuildConfigured) { 37 return 38 } 39 40 isEasBuildConfigured = true; 41 42 android.signingConfigs.release { 43 def credentialsJson = rootProject.file("../credentials.json"); 44 45 if (credentialsJson.exists()) { 46 if (storeFile && !System.getenv("EAS_BUILD")) { 47 println("Path to release keystore file is already set, ignoring 'credentials.json'") 48 } else { 49 try { 50 def credentials = new groovy.json.JsonSlurper().parse(credentialsJson) 51 def keystorePath = Paths.get(credentials.android.keystore.keystorePath); 52 def storeFilePath = keystorePath.isAbsolute() 53 ? keystorePath 54 : rootProject.file("..").toPath().resolve(keystorePath); 55 56 storeFile storeFilePath.toFile() 57 storePassword credentials.android.keystore.keystorePassword 58 keyAlias credentials.android.keystore.keyAlias 59 if (credentials.android.keystore.containsKey("keyPassword")) { 60 keyPassword credentials.android.keystore.keyPassword 61 } else { 62 // key password is required by Gradle, but PKCS keystores don't have one 63 // using the keystore password seems to satisfy the requirement 64 keyPassword credentials.android.keystore.keystorePassword 65 } 66 } catch (Exception e) { 67 println("An error occurred while parsing 'credentials.json': " + e.message) 68 } 69 } 70 } else { 71 if (storeFile == null) { 72 println("Couldn't find a 'credentials.json' file, skipping release keystore configuration") 73 } 74 } 75 } 76 77 android.buildTypes.release { 78 signingConfig android.signingConfigs.release 79 } 80} 81`; 82exports.default = _default; 83//# sourceMappingURL=EasBuildGradleScript.js.map