Xcode IDE not showing download file in directory using Run Script - xcode

I'm having trouble with the 'Run Script' in the Xcode IDE. I'm able to download a file from a server using this script below, straight into a directory in Xcode, which can be viewed, by way of right clicking on the folder in the IDE where the download has been sent to, however although it appears here, its not appearing in the 'Copy Bundle Resources' nor in the Xcode resources folder, so when trying to pull this file into the code, I get file doesn't exist.
I'm aware of how to add the file manually(+), however this would be better if it run's automatically in the script.
Can anyone help with this Bash Script below, I've tried to copy (cp) to ${PRODUCTS_DIR} and ${BUILT_PRODUCTS_DIR} but its not copying over for some reason. I'm able to (mv) move the file but still this does appear in the 'Copy Bundle Resources'? Anyone got any clues to this? Thanks in advance.
fileToDownload=$(ssh $Username#server1 ls -t /doc_test_control/the_test_foler/myFile.txt)
echo "File to download: $fileToDownload"
scp $Username#server1:$fileToDownload "${SRCROOT}/Mobile-App-iOS/Test_Foler/"
echo "File downloaded to : ${SRCROOT}/"
mv "${SRCROOT}/Mobile-App-iOS/Test_Foler/""* "${BUILT_PRODUCTS_DIR}"
ls -l "${SRCROOT}/Mobile-App-iOS/Test_Foler/"
echo "DONE"

It looks like you need to copy the downloaded file inside the Bundle using bash commands in the Run Script phase itself. Please use the following script to copy the resource to the bundle.
cp downloadedFile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/
UNLOCALIZED_RESOURCES_FOLDER_PATH is nothing but app path itself. Please see its value in Build logs.
export UNLOCALIZED_RESOURCES_FOLDER_PATH=TestProject.app
I tested this with my local file in Desktop folder and found it to be working.
You cannot use "Copy Bundle Resource" phase to copy the downloaded file at compile time. Because, to use "Copy Bundle Resource", it has to be added to the Target which is not possible when it is downloaded during compile time.

Related

Can I force Crashlytics to call a script "run" in the current thread?

I have my own script through which I create a temporary folder for derivedDataPath. as soon as the script works and creates an IPA file, the derivedDataPath folder is deleted. But at the last stage of the build, I added a call:
Script:
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run
Input Files:
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
${SRCROOT}/${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}
He informs me that everything is fine and the upload will be completed in the background:
Running upload-symbols in Build Phase mode
Validating build environment for Crashlytics...
Validation succeeded. Symbol uploading will proceed in the background.
But in my IPA file creation script, the derivedDataPath folder will be deleted. Perhaps for this reason, the data is not being uploaded. How can I check the completion of the upload?
Now I have a console hanging in Firebase that there are no dSYM files for the desired version And I don't understand what's wrong with the Update not through the Appstore, but through air.
Instead of using the "run" script, you can call the "upload-symbols" script adding the --build-phase flag:
${BUILD_DIR%Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/upload-symbols --build-phase
This will make the script to upload the dSYMs as part of the build process instead of doing it in the background.

AWS Codedeploy access a file within BeforeInstall script

I'm bundling a file to be accessed by BeforeInstall shell script file. But shell script file cannot locate the file. I tried bundling in the same folder as script file. Still not working. It gives No such file or directory
bundle
scripts
beforeInstall.sh
file.properties
May I know if this is possible...
The files are not placed in the locations you have specified yet during the BeforeInstall step. At that point the zip has only been downloaded to a default location, so the file path in your script probably doesn't exist yet.
What do you want your script to do? Would running it during the AfterInstall step work?

How to use the log file in Server with Xcode 5 continuous integration (CI, bots)

I have scripts set up to run as post- and pre-actions in my Xcode project's scheme. printf and puts in Ruby don't seem to print to the logs that show up on the Xcode continuous integration website's "Logs" tab. How can I print to this log file? Also, is there a way to find out where the log file is located?
Please forgive my naivety: I know very little about how OS X Server works. The Xcode CI web interface is the only place I can see the log file:
Note, this is a cross-post from: https://devforums.apple.com/message/908997#908997
Yes, writing to /tmp is what worked for me, here is an exerpt from one of my scripts:
exec > /tmp/testflight.log 2>&1
echo "uploading to testflight"
On the server running the xcode bot, your file should be there in /tmp as specified. I did not receive the permissions errors so maybe this will work for you.

updating tool from site in cmd

so i have a simple batch tool
its url is somesite.tool[version].zip
eg: somesite.tool1.9.zip
and theres a file in the tool called version.
in this case it contains 1.9
the tool.zip will have the file version in its main folder
also it has 7za.exe in main folder.
and theres another file 'somesite.version.txt'
Oh just a note, the file downloads instantly on just entering the url and pressing enter (dropbox)
start "somesite.version.txt"
set /p "newversion=<path\version.txt"
its the path which gives the prob i know nothing about the path.
What i wanna to do is add a feature update in the tool which will automatically do the following
> download the version.txt
> close the browser from which it was dowloaded (optional)
> check with the current version.txt
> if not same extract the new tool after deleting the previous one
i am stuck at comparing coz i dont know where the file is downloaded automatically.
thanks in advance for your efforts
Found the Answer
using wget.exe i can download the file to the current directory
wget somesite.version.txt

appcfg.py is not running with cmd prompt (Windows 7)

I am having strange problem. I used to run appcfg.py to update my app to appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me anything, no error no feedback. Its just back to this line
C:\Program Files <x86>\Google\google_appengine>
Any idea about this issue!
P.S. I'm using Python 2.7. My code is updating through google app launcher but I need to run it from cmd prompt as I will be downloading/uploading appengine stuff which launcher doesn't allow me to do!
Thanks
I still had a little trouble with the instructions. Here's the steps I used to create a batch file to use the Google App Engine download_app with Windows 7.
In my example,
I'll use drive, C:
Default python path will be, C:\Python27\python.exe
GAE path (include "), "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
App ID {your_app_id} will be just your app-id name
{your_app_version} is the "Version:" number in your GAE app.yaml file
I'll create a folder on my Windows 7 desktop and call it GAE_App
The desktop folder path will be C:\Users\{username}\Desktop\GAE_App
{your email} will be the Gmail account connected to your GAE
Right-click on the desktop and select New->Text Document. Open the newly created text document and add the following line of code modified for your setup to the blank text document,
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" download_app -A {your_app_id} -V {your_app_version} --email={your email} C:\Users\{username}\Desktop\GAE_App
Save the text document and change the file name to GAE_Download.bat
It's important that the extension now says ".bat" instead of ".txt"
Once finished, click on the batch to execute it. You'll be asked for a password and then the files should download into the GAE_App folder on your desktop. Now, whenever you need to download your files, just click on the batch file.
Not sure why Google didn't simply include this feature with their GAE for Windows software.
I faced the same issue. Here is a simple solution.
Just do this following Steps:
Go to program file where google app engine is installed. Generally It is named as Google.
click on appcfg.py and select open with.. Select "Choose Default Programs".
Select Python from programs and select "Always Use the selected program to open this kind of file" .
Now run the command you should get the results on command line.
For reference click here
Fixed by accessing python lib like that
C:\Python27>python appcfg.py update E:\path\myApp\
Here's a solution that worked for me:
"google_appengine/appcfg.py" update "C:\PATH TO APP
The appcfg.bat that should be used is located **C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\appengine-java-sdk\bin** and not the empty appcfg.bat that for some unknown reason also was here C:\Program Files\Google\Cloud SDK\
Good practice is to add this path to the system variable PATH
This worked for me
Basis
<PATH_TO_PYTHON>python <PATH_TO_APPCFG.PY>appcfg.py -A <PROJECT_INSTANCE_NAME> update app.yaml
Example
X:\Software\Python2.7\python Q:\SOFTWARE\GoogleAppEngineSDK\appcfg.py -A great-1337 update app.yaml

Resources