Command phasescriptexecution failed with a nonzero exit development and production firebase - swift

I'm trying to add firebase for my own project in dev and production environtment.
I need to add GoogleService-Info.plist for Dev and Prod environment.
After add new run script phase. There's error show phase script execution failed.
GOOG_DEV=${PROJECT_DIR}/${TARGET_NAME}/Debug/GoogleService-Info-Dev.plist
GOOG_PROD=${PROJECT_DIR}/${TARGET_NAME}/Release/GoogleService-Info.plist
GOOG_DST=${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app/GoogleService-Info.plist
if [ "${CONFIGURATION}" == "Release" ]; then
GOOG_SRC="${GOOG_PROD}"
else
GOOG_SRC="${GOOG_DEV}"
fi
if [ ! -f "$GOOG_SRC" ]; then
echo "Missing 'GoogleService-Info.plist' source at '${GOOG_SRC}"
exit 1
fi
cp "${GOOG_SRC}" "${GOOG_DST}"
GoogleService plist located like image below
googleservice plist location
NOTE
This will run smoothly if i'm using the same GoogleService-Info.plist NAME for both dev and prod
and i just tick the checkbox for 1 one of them in target Membership when i build the app. But it's really bother me to change it for every build environment changes

Related

How to fix the sdk_addon data copy build error?

I tried to build the Android SDK Addon System Image of halogenOS 13 (AOSP 13, nothing was changed in the AOSP source code yet).
The steps to build are as usual:
source build/envsetup.sh
lunch aosp_sdk_phone_x86_64-eng
m sdk_addon
At 100%, the build fails with following error:
[100% 12483/12483] Packaging SDK Addon System-Image: out/host/linux-x86/sdk_addon/custom-eng.simao--
FAILED: out/host/linux-x86/sdk_addon/custom-eng.simao--img.zip
/bin/bash -c "(cp -R out/target/product/emulator_x86_64/data out/host/linux-x86/obj/SDK_ADDON/custom_intermediates/custom-eng.simao--img/images/x86_64/data ) && (out/host/linux-x86/bin/soong_zip -o out/host/linux-x86/sdk_addon/custom-eng.simao--img.zip -C out/host/linux-x86/obj/SDK_ADDON/custom_intermediates/custom-eng.simao--img/images/ -D out/host/linux-x86/obj/SDK_ADDON/custom_intermediates/custom-eng.simao--img/images/x86_64 )"
cp: bad 'out/target/product/emulator_x86_64/data': No such file or directory
13:17:13 ninja failed with: exit status 1
If I just mkdir out/target/product/emulator_x86_64/data, of course, that just solves the build error but the SDK addon does not actually boot in the emulator due to encryption issues with the userdata partition so I think this is related. This makes me guess that in the data directory there should be some files in there but for some reason the are not created.
EDIT:
What's really odd here is that the file device/generic/goldfish/vendor.mk explicitly adds some data files to PRODUCT_COPY_FILES, notably:
PRODUCT_COPY_FILES += \
device/generic/goldfish/data/etc/dtb.img:dtb.img \
device/generic/goldfish/emulator-info.txt:data/misc/emulator/version.txt \
device/generic/goldfish/data/etc/apns-conf.xml:data/misc/apns/apns-conf.xml \
device/generic/goldfish/radio/RadioConfig/radioconfig.xml:data/misc/emulator/config/radioconfig.xml \
device/generic/goldfish/data/etc/iccprofile_for_sim0.xml:data/misc/modem_simulator/iccprofile_for_sim0.xml \
If I manually build them using, for example, m out/target/product/emulator_x86_64/data/misc/emulator/version.txt, the file is created at the correct location, as expected. Which leads me to wonder when entries PRODUCT_COPY_FILES are considered targets to be built and when they aren't.
EDIT2:
I got the emulator to boot but the data directory is still not being created. (Creating manually or building one target in the data dir is a workaorund).

Crashlytics does not work with Swift Package Manager iOS 14.6

Using XCode10.5.1, iOS 14.6, Swift5.4.2,
Using the Swift Package Manger (SPM) for getting Firebase dependency in to my project - I try to get going Google Crashlytics on my iOS device.
I saw in several posts (ex. this one) that in order for Crashlytics to work via the SPM, you need to add a Build run script in Xcode as follows:
${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run
Now since I do have two different configurations defines (DEV and PROD), I somehow need to make this run script know about this.
My script looks as follows:
if ["${CONFIGURATION}" == "Release"] || ["${CONFIGURATION}" == "Debug"]; then
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run
elif ["${CONFIGURATION}" == "ReleaseDev"] || ["${CONFIGURATION}" == "DebugDev"]; then
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run -gsp ${PROJECT_DIR}/iOS/SupportFiles/GoogleService-InfoDev.plist
fi
But Crashlytics still does not work !
Question NR1: How does the run script look like for Crashlytics to work with SPM ?
Question NR2: In particular, how can I improve my run script for making a clear distinction between DEV and PROD environment. (so far I need to do the workaround with CONFIGURATION).
Here is a working example of Crashlytics in Xcode when used via Swift Package Manager (i.e. not via Cocoapod):
I found the solution - the run Script had a wrong syntax.
Here is the correct one:
echo "Configuration = $CONFIGURATION";
if [ $CONFIGURATION == 'Debug' ] || [ $CONFIGURATION == 'Release' ]; then
echo "PROD";
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run -gsp ${PROJECT_DIR}/iOS/SupportFiles/GoogleService-Info.plist;
elif [ $CONFIGURATION == 'DebugDev' ] || [ $CONFIGURATION == 'ReleaseDev' ]; then
echo "DEV";
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run -gsp ${PROJECT_DIR}/iOS/SupportFiles/GoogleService-InfoDev.plist;
fi
Of course, Debug, Release, DebugDev and ReleaseDev depends on your own naming of your configurations in Xcode.
This way, the two configurations DEV and PROD both work with Google Crashlytics. The script makes sure the necessary dSYM files are sent to Google once a crash occurs.
To verify that the script is executed, you can follow the echo print under the report Navigator in Xcode (i.e. see screenshot)
I am unable to edit the above post. [showing "Suggested edit queue is full"]
So commenting here:
There is an issue in the script here https://stackoverflow.com/a/68460653/3913535
$CONFIGURATION should be in quotes inside the if condition.
if [ "$CONFIGURATION" == 'Debug' ] || [ "$CONFIGURATION" == 'Release' ]; then

Failure to deploy on netlify: failed during stage 'building site': Build script returned non-zero exit code: 255

I failed to deploy my file, which was developed from blogdown (dev, R 3.6.1) and hugo (0.57.2) on the netlify platform.
I have tried to update the URL of my config.toml file from \ to my target web name https*.com\ .
Also, I created a netlify.toml at the root directory.
Both of them did not make any sense.
Local development is fine, while the netlify could not be deployed well.
failed during stage 'building site': Build script returned non-zero exit code: 255
Related code:
blogdown::new_site(theme = "gcushen/hugo-academic")
# netlify
[build]
publish = "public"
command = "hugo"
[context.production.environment]
HUGO_VERSION = "0.57.2"
HUGO_ENV = "production"
HUGO_ENABLEGITINFO = "true"
[context.branch-deploy.environment]
HUGO_VERSION = "0.57.2"
# 0.57.2
blogdown::hugo_version()
This answer is probably too late, but I just had the same issue. It which was solved by the Netlify team.
Trying to deploy through Github provides a built command "hugo". This caused the error message.
Go to your netlify page and the domain settings on the failed deploy. Remove "hugo" in the command built and retry to deploy.

capistrano v2 not failing / rolling back when custom task fails

i have to compile a custom c coded binary used by our rails app.
this setup is held in a custom rake file (ourapp.rake, below)
running cap v2 i noticed the make was failing but the deploy didn't "fail".
i since just made the task
system "cd #{thedir} && exit 1" # simulate failing of custom task
but the deploy:cold doesn't fail, the debug output (below) clearly shows make failing
am i missing something? i've tried
searching for error codes/failing scenario of capistrano - nothing (lots of mentions of trying to run custom scripts on failing)
system v run v invoke
help appreciated, code below
# ourapp.rake
namespace :ourapp do
desc "Compile and Install Performant Parser"
task :compile_performant_parser do
thedir=File.join(Rails.root, 'parser')
system "cd #{thedir} && make clean && make && make install"
end # compile
desc "Compile and Install Compareplans process"
task :compile_binary do
thedir=File.join(Rails.root, 'compareplans_process/src')
#system "cd #{thedir} && make clean && make && make install"
system "exit 1"
end # compile
task :install => [:compile_performant_parser, :compile_binary ] do
puts "Preparing Ourapp for run"
end
end
additions to deploy.rb
namespace :deploy do
desc "setup ourapp dependencies, dir, binaries and (later data)"
task :setup_ourapp do
run "cd #{current_release} && /usr/bin/env bundle exec rake our app:install RAILS_ENV=#{rails_env}"
end
after 'deploy:update_code', 'deploy:setup_ourapp'
end
so i figured out that capistrano does not exit, so you need to test the error code
Capistrano run local command exit on failure
and to rollback you need to use a transaction type
How do I use transactions within custom capistrano tasks?

Rails 3.1 - how can I tell if assets are precompiling on production?

Trying to get the hang of deploying a rails 3.1 App ...
Based on what I've read, I've put the following code in my deploy.rb:
before "deploy:symlink", "assets:precompile"
namespace :assets do
desc "Compile assets"
task :precompile, :roles => :app do
run "cd #{release_path} && rake RAILS_ENV=#{rails_env} assets:precompile"
end
end
But to tell you the truth, I can't notice any difference with or without it. Is there something I'm missing here?
EDIT* found the answer:
http://spreecommerce.com/blog
To pre-compile assets for production you would normally execute the following rake task (on the production server).
$ bundle exec rake assets:precompile
This would write all the assets to the public/assets directory while including an MD5 fingerprint in the filename for added caching benefits.
NOTE: In production all references to assets from views using image_tag, asset_path, javascript_include_tag, etc. will automatically include this fingerprint in the file name so the correct version will be served.
There is configuration to do, but it should be correctly set by default. Get in your config/application.rb and see if you find this:
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
...
config.assets.enabled = true
You should also have those in your production.rb file:
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
This should be set that way. Is it?