Running a Worklight app from within Xcode (so that I can run it in
the iOS simulator or on an iOS device), I'm getting this error:
Running a custom build phase script: buildtime.sh
/Users/haible/Library/Developer/Xcode/DerivedData/MyProjectMyAppIpad-esxuznsvaaxiytezluyjbanoligf/Build/Intermediates/MyProjectMyAppIpad.build/Debug-iphonesimulator/MyProjectMyAppIpad.build/Script-427B829D1393724500F223DC.sh: line 7: /Users/haible/worklight/simple-workspace/MyProject/apps/MyApp/ipad/native/buildtime.sh: Permission deniedDONE with script: buildtime.sh (exitStatus=126)\\n\\n
How to reproduce:
1) Create a working app using Worklight Studio on a Linux machine.
Configure it for the environments 'android' and 'ipad'.
Build and Deploy it.
2) Export the Worklight project, using "File > Export... > General > Archive File".
3) Copy the resulting zip file to the Mac machine.
4) On the Mac machine, in Worklight Studio: Import the worklight project, using "File > Import... > General > Existing Projects into Workspace".
5) Build and deploy the app.
6) Right-click on the 'ipad' folder of the app, select "Run As... > Xcode project".
7) In Xcode, click the "Run" button.
What happened is:
- Step 1 creates, in particular, the file MyProject/apps/MyApp/ipad/native/buildtime.sh, with permissions r-xr--r--, that is, executable for the owner. (The same would also happen for permission r-xr-xr-x.)
- In step 2, the zip file contains the MyProject/apps/MyApp/ipad/native/buildtime.sh, but without execute permissions. Although zip files can contain permissions when created by the Unix 'zip' program, the "Export" wizard apparently drops the execute permissions.
- After step 4, on the Mac, the file has permissions rw-r--r-- or rw-------, depending on the umask. It is not executable.
- Step 5 doesn't change that.
- In step 7, the Xcode build attempts to execute the file buildtime.sh, but this fails because the permissions don't contain the execute bit.
The workaround is to manually do a "chmod a+x" of the buildtime.sh file.
But it would be nice if the Worklight build (step 5) would do this.