Seattle command line build

TwineCompile - Cut C++Builder compile times by up to 50x!
marymccartney
Posts: 2
Joined: Thu Jun 22, 2017 8:07 am

Seattle command line build

Post by marymccartney »

I am trying to do a command line build of an C++ Embarcadero Seattle project using MSBuild. The project builds fine in the IDE, but does not build on the command line.

I followed your instructions and added the "Import" line to my project file. Here are my Imports from the project file:
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')"/>
<Import Project="C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets10Seattle.targets" />
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
Here is my command Line:
call "C:\Program Files (x86)\Embarcadero\Studio\17.0\bin\rsvars.bat"
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe Poles.cbproj /t:build
Here is the build error:
C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets10Seattle.targets(110,5): error MSB4062: The "TCQueueFile" task could not be loaded from the assembly C:\Program Files (x86)\JomiTech\TwineCompile\JTBuildInterface10Seattle.dll. Could not load file or assembly 'Borland.Build.Tasks.Cpp, Version=23.0.0.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\WS\Code\PolesProjects\Poles\Poles.cbproj]
Done Building Project "C:\WS\Semaan - Engineering - 2011\Branches\Engineering - 2017-01-11 - US_PolesAndTowers_Branch\Code\PolesProjects\Poles\Poles.cbproj" (build target(s)) -- FAILED.

Build FAILED.

"C:\WS\Code\PolesProjects\Poles\Poles.cbproj" (build target) (1) ->
(TCBuildFileListBcc target) ->
C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets10Seattle.targets(110,5): error MSB4062: The "TCQueueFile" task could not be loaded from the assembly C:\Program Files (x86)\JomiTech\TwineCompile\JTBuildInterface10Seattle.dll. Could not load file or assembly 'Borland.Build.Tasks.Cpp, Version=23.0.0.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\WS\Semaan - Engineering - 2011\Branches\Engineering - 2017-01-11 - US_PolesAndTowers_Branch\Code\PolesProjects\Poles\Poles.cbproj]

0 Warning(s)
1 Error(s)

Time Elapsed 00:00:00.54
"=============End Build==============="
jomitech
Site Admin
Posts: 2153
Joined: Wed Oct 08, 2008 12:23 am

Re: Seattle command line build

Post by jomitech »

I would recommend copying the Borland.Build.Tasks.Cpp.dll from C:\Program Files (x86)\Embarcadero\Studio\17.0\bin into C:\Program Files (x86)\JomiTech\TwineCompile. That should fix that error. You may have to copy Borland.Build.Tasks.Common.dll, Borland.Build.Tasks.Shared.dll and Borland.Build.Tasks.Delphi.dll as well.

The other, simpler, approach is to use our jtmake utility, which is located in the TwineCompile directory to compile the project. Run it like this:

jtmake -B -ide10 Poles.cbproj
Jon
marymccartney
Posts: 2
Joined: Thu Jun 22, 2017 8:07 am

Re: Seattle command line build

Post by marymccartney »

Thank you for your prompt reply!
Nitro
Posts: 12
Joined: Wed Jul 18, 2018 8:22 am

Re: Seattle command line build

Post by Nitro »

Jon,

We were able to solve the problem by creating our task, which contains the following code. I think this can help you solve the problem.

Code: Select all

 public class GetBorlandDll : Microsoft.Build.Utilities.Task
  {
    public override bool Execute()
    {
      AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
      {
        if (e.Name.StartsWith("Borland"))
        {
          //   System.Diagnostics.Debugger.Break();
          string assemblySearchPath = Path.Combine(Environment.GetEnvironmentVariable("BDS"), Path.Combine("bin", e.Name.Split(',')[0]));
          if (!assemblySearchPath.EndsWith(".dll"))
            assemblySearchPath += ".dll";
          if (File.Exists(assemblySearchPath))
            return Assembly.LoadFrom(assemblySearchPath);
        }
        return null;
      };
      return true;
    }
  }
jomitech
Site Admin
Posts: 2153
Joined: Wed Oct 08, 2008 12:23 am

Re: Seattle command line build

Post by jomitech »

Thanks for following up with this. We'll definitely consider integrating this directly into the process.
Jon
Nitro
Posts: 12
Joined: Wed Jul 18, 2018 8:22 am

Re: Seattle command line build

Post by Nitro »

Hello, has this treatment been integrated with the latest version of TwineCompile ?
jomitech
Site Admin
Posts: 2153
Joined: Wed Oct 08, 2008 12:23 am

Re: Seattle command line build

Post by jomitech »

We have integrated something similar into TwineCompile, yes. Our implementation looks like this:

Code: Select all

private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
    var name = new AssemblyName(args.Name);
    var resolvedFileName = Path.Combine(BDSBin, name.Name + ".dll");

    if (File.Exists(resolvedFileName))
        return Assembly.LoadFrom(resolvedFileName);

    return null;
}
Jon
Nitro
Posts: 12
Joined: Wed Jul 18, 2018 8:22 am

Re: Seattle command line build

Post by Nitro »

Thank you.

This has been integrated on version 4.5 or only from version 5.0 ?
jomitech
Site Admin
Posts: 2153
Joined: Wed Oct 08, 2008 12:23 am

Re: Seattle command line build

Post by jomitech »

This was integrated into TwineCompile 4.5 as well as 5.0.
Jon
Nitro
Posts: 12
Joined: Wed Jul 18, 2018 8:22 am

Re: Seattle command line build

Post by Nitro »

I do not know if we are talking about the same thing.

I'm up to date with version 4.5, and I'm still forced to copy the Borland.Build.Tasks.Cpp.dll from C:\Program Files (x86)\Embarcadero\Studio\19.0\bin\ into C:\Program Files (x86)\JomiTech\TwineCompile\.
As this solution does not suit me, I use my solution which is to generate an assembly with the code :

Code: Select all

 public class GetBorlandDll : Microsoft.Build.Utilities.Task
  {
    public override bool Execute()
    {
      AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
      {
        if (e.Name.StartsWith("Borland"))
        {
          //   System.Diagnostics.Debugger.Break();
          string assemblySearchPath = Path.Combine(Environment.GetEnvironmentVariable("BDS"), Path.Combine("bin", e.Name.Split(',')[0]));
          if (!assemblySearchPath.EndsWith(".dll"))
            assemblySearchPath += ".dll";
          if (File.Exists(assemblySearchPath))
            return Assembly.LoadFrom(assemblySearchPath);
        }
        return null;
      };
      return true;
    }
  }
And I add thes lines to the project file:

Code: Select all

 <Import Project="C:\Program Files (x86)\JomiTech\TwineCompile\TCTargets10Tokyo.targets" />
<UsingTask TaskName="GetBorlandDll" AssemblyFile="[Assembly path].dll" />
    <Target Name="TCBuildFileList">
    <GetBorlandDll />
    <CallTarget Targets="TCBuildFileListClang" Condition="$(USING_CLANG)" />
    <CallTarget Targets="TCBuildFileListBcc" Condition="!$(USING_CLANG)" />
  </Target>
I received a private message from someone who can't use TwineCompile with MSBuild, and who used my solution.

Do you think my solution is still topical, or the problem of copying the Borland.Build.Tasks.* Files no longer exists with TwinCompile ?
Post Reply