buildtime.sh “Permission denied” when building in Xcode - Native Project generated by WL Ant Task - ibm-mobilefirst

Please refer the below post.
IBM Worklight - "Permission denied" when building in Xcode
I am using the Worklight 6.1. I build the environment with Ant Task. Ant task creates my Native folder for android and iPhone environment. I try to build the iPhone native which has been generated by Ant Task is giving the below error. Tried giving read & right permission manually. no fix.
Running a custom build phase script: buildtime.sh
/Users/prasanna/Library/Developer/Xcode/DerivedData/MobileAppIphone-coksdtlrretmihenzyztxxxdcuss/Build/Intermediates/MobileAppIphone.build/Debug-iphonesimulator/MobileAppIphone.build/Script-427B829D1393724500F223DC.sh: line 7: /Volumes/DataHD/ST/Mobile_Client/temp/PROD/iPhone/buildtime.sh: Permission denied
DONE with script: buildtime.sh (exitStatus=126)\n\n

Verify the following:
Create the project in Eclipse
Build it using Worklight Studio
Right-click on the generated iphone\native\buildtime.sh file
Check if it has the required permissions
Do the same with Ant
Check if it has the required permissions
If the result differs then this is a defect in Worklight 6.1.0.x
That said, following one of the options from the answer you've linked to should work, however you do not mention which option did you follow...
Given you are using a command line, I'd opt to following the second option to use CHMOD.
It could be that you have given it the wrong path.
Experiment with the path and come back with results.
you can also change the permission using [CHMOD][3]:
Copy the path to the folder holding the buildtime.sh file
Open the Terminal app
Run the following command (but use your own path from 1 above): chmod 755
/Users/idan/Documents/Worklight/workspace-6001/TestProject/apps/TestApp/iphone/native/buildtime.sh

buildtime.sh is executable file, you need to give it executable permissions, not just r&w

Adding the CHMOD 755 in my Ant Script for all files and folder will solve this permission issue.
<target name="set-permission"> <echo level="info">Setting Read / Write / Execute Permissions to all files and .sh files</echo> <chmod perm="755" includes="/*.sh"> <fileset dir="${basedir}/temp/QA/iphone"> <exclude name="**/trial/"/> </fileset> </chmod> </target>

Related

How to use msbuild command line to create a bundle but exclude test projects

I have a C# solution with VS 2017, containing an app project and a test project. I can use the "create app package" wizard to create one single bundle for x86 and x64. However, I would like to automate this process, which means I need to use msbuild in command line to do the same work.
With the reference from here and here, I got:
msbuild .\MyProject.sln /p:AppxBundle=Always /p:AppxBundlePlatforms="x86|x64" /p:Configuration=Debug
But I will get errors for my test projects, like:
MakeAppx : error : Error info: error 80080204: The package with file name "Tests.XXXX.Shared.Uwp_1.0.0.0_x86_Debug.appx" and package full name "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx_1.0.0.0_x86__xxxxxxxxxxx" is not valid in the bundle because it has a different package family name than other packages in the bundle. The expected package name is xxxx-Test.xxxxTestApp....
My guess is that I should not use "Always" for AppxBundle, but I cannot find any document online mentioning how to set this value as "If Needed". I also tried to add "Never" in project properties for the test project, but the command line argument seems to overwrite that.
So my question is: How to exclude a test project from the solution when creating a bundle using msbuild in the command line?
How to exclude a test project from the solution when creating a bundle using msbuild in the command line?
To resolve this issue, you can build the project file directly when you create a bundle using MSBuild in the command line:
msbuild .\YourProjectFile.csproj /p:AppxBundle=Always /p:AppxBundlePlatforms="x86|x64" /p:Configuration=Debug
Alternatively, you can open test project file and add the following properties at the end of the first <PropertyGroup> element to exclude the test project to be included:
<PropertyGroup>
<AppxBundle>Never</AppxBundle>
</PropertyGroup>
Check this thread and the document for some more details.
Hope this helps.

Build using TeamCity: Failed to start MSBuild; please specify a nuspec or project file to use

I'm trying to build a website in Teamcity, but the first build step "starting MSBuild" is failing.It seems that the command is trying to install nuget, but it is complaining that there is no nuspec or project file specified.
I have a "nuget.targets" file and the code compiles fine outside of teamcity , so I think it must be a setting I am missing, and not a file I actually need to add but maybe I do need to add a nuspec or project file? Assuming I do, how would I go about doing that?
[Exec] C:\TeamCity\buildAgent\work\61cf1fbc18b86c6f\.nuget\NuGet.targets
(109, 9): Please specify a nuspec or project file to use.
I am completely new to Teamcity (~3hrs); how do I resolve this problem?
If a build fails or behaves differntly in TeamCity than locally, then it is recommended to run the build in the working folder on agent machine under the same user that the agent is running. Find more details here.

How to add Java classes to a Worklight adapter when using CLI

I am trying to add Java classes to my adapter as described in the tutorial Using Java in Adapters. However, I am trying to do that from the CLI.
When I do:
wl create WLProject
cd WLProject
wl add adapter
copy the Java class (Calculator1.java) to server/java/com/worklight/customcode
wl start
The build process fails and no war file is created;
When I do:
wl create WLProject
cd WLProject
wl add adapter
wl start
copy the Java class (Calculator1.java) to server/java/com/worklight/customcode
wl build
wl deploy
wl invoke
The invocation fails. When I inspect the war file, the Calculator1.class has not been deployed.
So the question is: how can I add Java classes to an adapter when using the CLI?
Sounds like a bug to me. It looks like the build process fails when introducing server-side artifacts.
This might be not currently supported in the CLI, but I can't imagine such a limitation...
I've opened a defect to have this looked at.
You can open a PMR (support ticket) to receive a fix if/when available.
If I do the following,
the .war file is being generated.
wl create myTestProject
cd myTestProject/
wl build
But if I do this,
the .war file is not generated which is why everything else then fails:
wl create myTestProject
mkdir -p myTestProject/server/java/com/worklight/customcode
cp Calculator.java myTestProject/server/java/com/worklight/customcode
cd myTestProject/
wl build
There's an invalid classpathref in the build file that's producing the WAR.
You can edit [CLI Install Location]/worklight-cli/node_modules/generator-worklight-server/lib/build.xml to fix this issue with the classpathref.
If you're not planning on using any server runtime libraries:
On line 132, you can remove the attribute classpathref="server-classpath".
If you plan on using server runtime libraries:
You'll need to add the "server-classpath" to be used when compiling your code. Before the build-WAR target in the build.xml file, you can add the following
<path id="server-classpath">
<fileset dir="${worklight.jars.dir}" includes="worklight-jee-library.jar" />
<fileset dir="[your home directory]/.worklight/6.2.0/server/wlp/dev" includes="**/*.jar" />
</path>
Please note that the second fileset, you'll have to change [your home directory] to the appropriate path. Adding both of these filesets includes the worklight runtime and the server runtime when compiling your classes.
When you've made your changes:
Restart the server. At this point, the Calculator1 class should be added to your WAR.

Web Deploy - Using Relative Paths for local file system deployment

I am wanting to use Web Deploy to run a custom deployment setup.
As I am wanting to have this work fine when running on many different environments (team members local machines, 4 different builds servers) I want to deploy to a local path that is relative.
What I am wanting to do is:
Deploy to a local relative path
Have the after build step do magical things...
However when i enter the local file path to deploy to as: "..\Deploy_Production"
web deploy complains with this:
2>Connecting to ..\Deploy_Live...
2>Unable to create the Web site '../Deploy_Live'. The URL http://:0 is invalid.
Its as if Web deploy thinks that the relative file path is a website URL. Using "..\" instead doesn't help my cause.
How do you get WebDeploy to deploy to a local relative path?
Edit 1:
I have tried to use a ConvertToAbsolutePath task before build, to no avail:
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<SiteUrlToLaunchAfterPublish>http://mywebsite.com</SiteUrlToLaunchAfterPublish>
<publishUrl>..\Deploy_Production</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
<Target Name="BeforeBuild">
<ConvertToAbsolutePath Paths="$(publishUrl)">
<Output TaskParameter="AbsolutePaths" PropertyName="publishUrl" />
</ConvertToAbsolutePath>
</Target>
Edit 2:
The above works, but only when running commandline builds against the Solution file not a project file
We have a bug here, when publishing using File system you have to provide a full path. We actually found this bug earlier this week. It will be fixed in our next update. In this case when the relative path is passed it incorrectly thinks that its an IIS path.
As a workaround you can edit the .pubxml to make the publishUrl a fullpath. Fortunately you can use an MSBuild property so that this works in team scenarios. Here is what you should do, edit your .pubxml file and update the value of publishUrl to be the following.
<publishUrl>$(MSBuildThisFileDirectory)..\..\..\Deploy_Production</publishUrl>
This path will be relative to the .pubxml file itself. I've verified that this works from both the command line as well as the publish dialog. If you have any issues with this let me know, but the fix should hopefully be released in a few months [no guarantees of course :) ].

TeamCity + MSBuild: Tagging a deployment with a VCS build number

I am using TeamCity 4.5.1 to build and deploy an ASP.Net application to development.
This is working perfectly so far, however, my manager has asked that I tag the folder with the specific SVN Revision from which the source was compiled.
I am using an MSBuild script to do the build and deployment, however, I am unable to successfully retrieve the build number.
Here is the MSBuild command I'm using (sanitized):
<Exec Command=">\\server08\D$\Websites\MYPROJECT\version.txt echo %env.BUILD_VCS_NUMBER%,%env.BUILD_VCS_NUMBER.1%,%system.build.vcs.number%,%system.build.vcs.number.1%,%system.build.number.format%,%system.build.number.format.1%,%system.build.vcs.number.MYPROJECT_Web_Root%,%env.TEAMCITY_VCS_NUMBER_MYPROJECT_Web_Root%" />
Version.txt turns up like this:
,,,,,,,,
Aka, empty. What am I doing wrong? Any better way to do this?
%env.XYZ% is TeamCity's method of referring to the environment variables, if you want to use them in ITS settings anywhere.
In a batch file or via msbuild, you only want the XYZ part.
echo %BUILD_VCS_NUMBER% > \\path\to\version.txt