Class: Mysigner::Build::AndroidExecutor
- Inherits:
-
Object
- Object
- Mysigner::Build::AndroidExecutor
- Defined in:
- lib/mysigner/build/android_executor.rb
Defined Under Namespace
Classes: BuildError
Instance Method Summary collapse
-
#build_aab!(variant: 'release', keystore_path: nil, keystore_password: nil, key_alias: nil, key_password: nil, version_code: nil) ⇒ Object
Build AAB (Android App Bundle) for Play Store Returns: path to .aab file Options: - variant: Build variant (default: ‘release’) - keystore_path: Path to keystore file - keystore_password: Keystore password - key_alias: Key alias in keystore - key_password: Key password (defaults to keystore_password) - version_code: Override version code (passed via gradle property).
-
#build_apk!(variant: 'release', keystore_path: nil, keystore_password: nil, key_alias: nil, key_password: nil) ⇒ Object
Build APK Returns: path to .apk file.
-
#clean! ⇒ Object
Clean build outputs.
-
#initialize(project_info, parser) ⇒ AndroidExecutor
constructor
A new instance of AndroidExecutor.
Constructor Details
#initialize(project_info, parser) ⇒ AndroidExecutor
Returns a new instance of AndroidExecutor.
12 13 14 15 |
# File 'lib/mysigner/build/android_executor.rb', line 12 def initialize(project_info, parser) @project_info = project_info @parser = parser end |
Instance Method Details
#build_aab!(variant: 'release', keystore_path: nil, keystore_password: nil, key_alias: nil, key_password: nil, version_code: nil) ⇒ Object
Build AAB (Android App Bundle) for Play Store Returns: path to .aab file Options:
- variant: Build variant (default: 'release')
- keystore_path: Path to keystore file
- keystore_password: Keystore password
- key_alias: Key alias in keystore
- key_password: Key password (defaults to keystore_password)
- version_code: Override version code (passed via gradle property)
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/mysigner/build/android_executor.rb', line 26 def build_aab!(variant: 'release', keystore_path: nil, keystore_password: nil, key_alias: nil, key_password: nil, version_code: nil) @variant = variant @keystore_path = keystore_path @keystore_password = keystore_password @key_alias = key_alias @key_password = key_password || keystore_password @version_code = version_code @build_started_at = Time.now # Determine task name task = "bundle#{variant_suffix(variant)}" # Build success = run_gradle_build(task) unless success raise BuildError, 'Android build failed — the details are in the Gradle output above. ' \ 'Common causes: signing rejected (check keystore password/alias), a ' \ "missing SDK component (run 'mysigner doctor'), or a compile error in " \ "your app (look for 'error:' lines). Re-run with DEBUG=1 for more." end # Find output AAB aab_path = find_aab_output(variant) unless aab_path && File.exist?(aab_path) raise BuildError, "Build reported success but AAB not found. Expected at: #{@parser.aab_output_path(variant)}" end aab_path end |
#build_apk!(variant: 'release', keystore_path: nil, keystore_password: nil, key_alias: nil, key_password: nil) ⇒ Object
Build APK Returns: path to .apk file
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/mysigner/build/android_executor.rb', line 61 def build_apk!(variant: 'release', keystore_path: nil, keystore_password: nil, key_alias: nil, key_password: nil) @variant = variant @keystore_path = keystore_path @keystore_password = keystore_password @key_alias = key_alias @key_password = key_password || keystore_password @build_started_at = Time.now # Determine task name task = "assemble#{variant_suffix(variant)}" # Build success = run_gradle_build(task) unless success raise BuildError, 'Android build failed — the details are in the Gradle output above. ' \ 'Common causes: signing rejected (check keystore password/alias), a ' \ "missing SDK component (run 'mysigner doctor'), or a compile error in " \ "your app (look for 'error:' lines). Re-run with DEBUG=1 for more." end # Find output APK apk_path = find_apk_output(variant) unless apk_path && File.exist?(apk_path) raise BuildError, "Build reported success but APK not found. Expected at: #{@parser.apk_output_path(variant)}" end apk_path end |
#clean! ⇒ Object
Clean build outputs
93 94 95 |
# File 'lib/mysigner/build/android_executor.rb', line 93 def clean! run_gradle_command('clean') end |