Skip to content

Commit

Permalink
Use a consistent name for .aab and .apk files
Browse files Browse the repository at this point in the history
  • Loading branch information
jkmassel committed Oct 24, 2019
1 parent 3decc92 commit 6a80ca6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ android {

defaultConfig {
applicationId "org.wordpress.android"
archivesBaseName = "$applicationId"

// Allow versionName to be overridden with property. e.g. -PversionName=1234
if (project.hasProperty("versionName")) {
versionName project.property("versionName")
Expand Down
14 changes: 10 additions & 4 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ ENV["HAS_ALPHA_VERSION"]="true"

# Create the file names
version=android_get_alpha_version()
build_bundle(version: version, flavor:"Zalpha")
build_bundle(version: version, flavor:"Zalpha", buildType: "release")
end

#####################################################################################
Expand All @@ -272,7 +272,7 @@ ENV["HAS_ALPHA_VERSION"]="true"

# Create the file names
version=android_get_release_version()
build_bundle(version: version, flavor:"Vanilla")
build_bundle(version: version, flavor:"Vanilla", buildType: "release")
end

#####################################################################################
Expand Down Expand Up @@ -359,11 +359,14 @@ ENV["HAS_ALPHA_VERSION"]="true"
version=options[:version]
name="wpandroid-#{version["name"]}.aab"
apk_name="wpandroid-#{version["name"]}-universal.apk"
aab_file="WordPress.aab"
aab_file="org.wordpress.android-#{options[:flavor]}-#{options[:buildType]}.aab"
output_dir="WordPress/build/outputs/bundle/"
build_dir="build/"
logfile_path="#{build_dir}build.log"

# Intermediate Variables
bundle_path = "#{output_dir}#{options[:flavor]}Release/#{aab_file}"

# Build
Dir.chdir("..") do
UI.message("Cleaning branch...")
Expand All @@ -375,7 +378,10 @@ ENV["HAS_ALPHA_VERSION"]="true"
UI.message("Building #{version["name"]} / #{version["code"]} - #{aab_file}...")
sh("echo \"Building #{version["name"]} / #{version["code"]} - #{aab_file}...\" >> #{logfile_path}")
sh("./gradlew bundle#{options[:flavor]}Release >> #{logfile_path} 2>&1")
sh("cp -v #{output_dir}#{options[:flavor]}Release/#{aab_file} #{build_dir}#{name} | tee -a #{logfile_path}")

UI.crash!("Unable to find a bundle at #{bundle_path}") unless File.file?(bundle_path)

sh("cp -v #{bundle_path} #{build_dir}#{name} | tee -a #{logfile_path}")
UI.message("Bundle ready: #{name}")
sh("echo \"Bundle ready: #{name}\" >> #{logfile_path}")
extract_universal_apk(bundle_path:"#{build_dir}#{name}", apk_path:"#{build_dir}#{apk_name}")
Expand Down

0 comments on commit 6a80ca6

Please sign in to comment.