Building Apache QPID on Windows missing setup.py - c#

I am new to Apache Qpid, Cmake and Python. I have successfully built Qpid on Debian and ran some of the tests. I am now trying to build Qpid on Windows so that I can write a C# client, but something seems wrong. When I run the cmake command it ends up giving me to following output:
Please wait while cmake processes CMakeLists.txt files....
C:/Program Files (x86)/Python330/python.exe: can't open file 'setup.py': [Errno 2] No such file or directory
Variable Name: BUILD_ACL
Description: Build ACL enforcement broker plugin
Current Value: ON
New Value (Enter to keep current value):
I am trying to understand when setup.py should have been generated/downloaded. I can't find it and I can't find any documentation that describes when it should have been generated or installed. Also, somewhat off-topic, why did the cmake process start prompting me for BUILD_ACL and other configs?
I have ran cmake for both VS 2008 and 2010, using the following commands, and both yield the same output:
cmake -i -G "Visual Studio 9 2008" .
cmake -i -G "Visual Studio 2010" .
I am using the following file from Apache to build Qpid:
qpid-cpp-0.18.tar.gz
As you can tell from the log statements above I am using Python 3.3.0.
I understand that the setup.py is a file used by Python for installing components. It appears that the cmake script is attempting to install something in the tests directory based on part of the cmake script I found by searching for setup.py. I would think this is something that would either be supplied in the Qpid tarball or somehow generated as part of this cmake process.
All that said, I ended up holding down the enter key accepting all the defaults of cmake and it generated the solution file and project files. I am able to open the resulting Qpid solution in VS2008 and build some of the projects. So, that raises the question, why was the setup.py needed?

Qpid user questions get good responses when asked at users#qpid.apache.org
The qpid developers are fairly responsive to the mailing list.
cmake -i does an interactive configuration. That's why it asks for all the variable values. cmake without the -i goes with the defaults. It is possible to answer "y" to variables that should be 'n' for your system, producing a build environment that won't work. Try without the -i to get things started.
Running cmake twice in the same directory with two different generators is generally a bad practice. In your case it will generate a .sln file and .vcproj files for VS2008, and it will generate a .sln file and .vcxproj files for VS2010. If you do in-source builds the files may look the same but they are not. After you've run both cmake commands then the files will continue to look the same.
Unpack the source tarball again and try cmake using an out-of-source build.
mkdir b32-vs2010
cd b32-vs2010
cmake -G "Visual Studio 2010" ..\qpidc-0.18
Directory b32-vs2010 will have your 2010 solution and project files, and all the generated source files. It leaves the source directory clean and free of generated files.
This should run without a complaint about setup.py. If you continue to have trouble please take advantage of the users mailing list.

Related

Jenkins build failing on what looks to be the Nuget Restore step

I've downloaded and set up jenkins on my local machine to test it out.
I have a job created to run some basic unit tests for an automation framework. I'm stumped on this error I'm seeing. If I'm reading this message correctly it's saying that it can't find the csproj file in the listed directory but when I navigate to it manually every file is indeed there.
Did I miss a step in the job build process?
MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\bin'.
C:\WINDOWS\TEMP\NuGetScratch\m224fx2s.f0i.nugetrestore.targets(285,5): error MSB3202: The project file "C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\CATS Framework Unit Tests\CATS.Framework\CATS.Framework\CATS.Framework.csproj" was not found. [C:\WINDOWS\TEMP\NuGetScratch\id0uys0i.dbk.nugetinputs.targets]
Try running below command on two terminal windows, one with admin privilege and one without:
cd "C:\Windows\System32\config\systemprofile\AppData\Local"
The one without admin privelege won't let you. My best guess is that your process is not elevated. I would move the project to some other folder.

Wix resource harvesting tool "Heat". How to harvest files with dynamic name like Microsoft run time files generated on build

I have really simple issue but seems I can't find answer easily due Wix restrictions, also to mention I am pretty new to Wix.
Problem is, as described in title, I can't make heat harvest couple of files that are generated on build and name of those files are changed based on OS run time (precisely .Net Core) other then going manually to product.wix file and changing name of couple of resources.
File example
\obj\Release\netcoreapp2.2\win-x64\PubTmp\Out\mscordaccore_amd64_amd64_4.6.28207.03.dll".
Version 4.6.28207.03.dll is dynamical generated.
You can have a try harvesting the outputs of your vs project, since the dll files are the output of your project.
heat project "MyProject.csproj" -pog:Binaries -ag -template:fragment -out project.wxs
And you can also try adding a post-build event on your main application project to copy those files in a special location and have the Heat.exe read them from there. You can refer to this blog here.
In azure devops pipeline, You can try adding a copy file task to copy those files to a specific location where Heat can read from.

Msbuild not producing XML file with code analysis

I have been digging but cannot find the answer - I THOUGHT I had found it in this question but it is not working on my system. The only difference that I can see is that I am giving msbuild a solution file and not an individual project file - must I do it at the project level to get output? The command line I entered was:
msbuild Interlink.NET.sln /p:RunCodeAnalysis=true /p:CodeAnalysisLogFile=test.xml
Obviously, test.xml was not created or I would not be asking this question...
The solution is a C# project in VS2015, in case any of that effects things. In Visual Studio, I can select "Analyze | Run Code Analysis on Solution" and things work as expected. I want to incorporate the analysis into an automated build process and produce an XML file with the analysis.
Well yes the command that you used is correct and will work for .sln files.
Only a test.xml file will be created inside each of the constituent projects.
And these copies will contain the static code analysis reports of that specific prject.
It will not be created at the level of the .sln file.
I ran msbuild with the following arguments and the xml file got produced in the output directory, but the filename I've given got ignored. It was named vc.nativecodeanalysis.all.xml instead.
msbuild Project.sln /p:Configuration=Release /p:Platform=x64 /p:RunCodeAnalysis=true /p:CodeAnalysisLogFile=test.xml /t:Clean;Rebuild
Project.sln is a C++ project in VS2017 though.
Please refer to the below forum
https://stackoverflow.com/questions/30472569/how-to-get-an-xml-report-out-of-msbuild-code-analysis
msbuild MyProject.csproj /p:RunCodeAnalysis=true /p:CodeAnalysisLogFile=MyXmlReport.xml

Verify that all Git commits of a C# project compile after rewriting history

Is there any automated way to verify that all commits in a Git repo are in a compilable state?
I need this to verify I haven't broken anything after rewriting history. Since I'm rewriting history, this excludes a build server - a commit that worked at the time it was committed might be broken after rewriting history.
For example I have a Visual Studio 2015 C# project, and I imagine some script like:
git filter-branch --tree-filter msbuild
I want it to run a build on each commit, and stop with an error message if the build process returns nonzero.
Considering the tree-filter will execute the command from a Git bash, you might want to use
git filter-branch --tree-filter "MSBuild.exe"
(making sure your %PATH% does include c:\Program Files (x86)\MSBuild\14.0\Bin)
(or use forward slash as in here)
That would be equally valid for the other option mentioned in the comments
git rebase -i --exec MSBuild.exe <first sha you want to test>~
You can use a CMD session similar to this gist, from Tim Abell:
#echo off
REM batch script for loading git-bash and the vs tools in the same window
REM inspiration: http://www.drrandom.org/post/2011/11/16/Grappling-with-multiple-remotes-in-git-tfs.aspx
REM screenshot: https://twitter.com/#!/tim_abell/status/199474387731226624/photo/1
%HOMEDRIVE%
cd %HOMEPATH%
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
echo Use full exe names when running under bash, e.g. "msbuild.exe"
echo Loading bash, you may now use git and msbuild in the same console \o/.
"C:\Program Files (x86)\Git\bin\sh.exe" --login -i
Assuming you want to check all the historical commits in the repo, not the future commits:
You can use git bisect to do that:
git bisect start
git bisect bad # Mark the current HEAD as bad
git bisect good <the first commit>
You then need a script that runs msbuild, returns 1 for build errors, and 125 for successful build. This is because we can't mark any build as "good", since we don't know if the commits before this one also work, so instead we skip those that do work.
Then, start bisecting with the run command:
git bisect run myscript
This will then start running builds (in a non-consecutive order) until it finds a broken build, and stops. See https://git-scm.com/docs/git-bisect#_bisect_run for more explanation.
What about (tested on Git Bash and Git Posh):
Creating git alias for msbuild command:
git config --global --add alias.msbuild "!c:\path\to\msbuild.exe"
If "msbuild.exe" path is present in PATH env. var, you can just write "!msbuild" instead of a full path.
Then run the command:
git filter-branch --tree-filter "git msbuild"

Write Git info strings to exe file C#

I need to write git information: Commit name, tags, branch, etc
to a binary (exe) file.
It is needed to run strings * | grep git, on that file to simply view latest git info about it.
I know that AssemblyInfo is displayed when I run this command (without grep), but I'm facing two possible problems:
I'm not sure if I can write to AssemblyInfo from code, to run 'git log' command and then get its output and write into AssemblyInfo.
If I want to use command 'git log' then it's not going to work on Windows, but it is possible that my App will be built on Windows and not on unix environment.
Maybe you know another way to do that?
This is usually done in your build script, filling a templated version of your AssemblyInfo (look at mustache, a templating language).
This build step does the following:
get the necessary info with git plumbing commands (e.g. How to programmatically determine the current checked out Git branch)
generate the AssemblyInfo file using a template.
Then your software build continues as usual.
There is a .net wrapper for Git windows implementation. Some high profile projects use this implementation. https://github.com/libgit2/libgit2sharp, http://libgit2.github.com/

Categories