<div dir="ltr"><div class="gmail_quote">On Mon, May 21, 2012 at 9:58 AM, Reinier Olislagers <span dir="ltr"><<a href="mailto:reinierolislagers@gmail.com" target="_blank">reinierolislagers@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I'm trying to figure out how to set packages for<br>
installation/compilation in Lazbuild.<br>
<br>
Goal: add packages to user IDE from command line using lazbuild.<br>
<br>
I've looked around the code and started a rough hack to try and install<br>
the rx component when rebuilding the IDE.<br>
<br>
I added this in TLazBuildApplication.BuildLazarusIDE:<br>
var<br>
..<br>
raotestpackage: TLazPackage;<br>
PkgName: string;<br>
APackage: TLazPackage;<br>
ConflictDep: TPkgDependency;<br>
...<br>
<br>
// try loading install packages<br>
PackageGraph.LoadAutoInstallPackages(BuildLazProfiles.StaticAutoInstallPackages);<br>
// my modifications start<br>
//rao: testing: add rx<br>
// adapted from addtoinstall<br>
PkgName:='rx';<br>
raotestpackage:=TLazPackage.Create;<br>
//todo: replace 'rx' with package name<br>
if not raotestpackage.StringToID(PkgName) then<br>
begin<br>
debugln('Invalid ID: ', PkgName);<br>
exit;<br>
end;<br>
APackage:=PackageGraph.FindPackageWithID(raotestpackage);<br>
if APackage<>nil then begin<br>
// check if package is loaded and has some attributes that prevents<br>
// installation in the IDE<br>
if APackage.PackageType in [lptRunTime,lptRunTimeOnly] then begin<br>
writeln(lisNotADesigntimePackage,<br>
Format(lisThePackageIsNotADesignTimePackageItCanNotBeInstall, [<br>
APackage.IDAsString]));<br>
exit;<br>
end;<br>
ConflictDep:=PackageGraph.FindRuntimePkgOnlyRecursively(<br>
APackage.FirstRequiredDependency);<br>
if ConflictDep<>nil then begin<br>
writeln(lisNotADesigntimePackage,<br>
Format(lisThePackageCanNotBeInstalledBecauseItRequiresWhichI, [<br>
APackage.Name, ConflictDep.AsString]));<br>
exit;<br>
end;<br>
end; //apackage<>nil<br>
// Mark package for installation - is this the right way?<br>
raotestpackage.AutoInstall:=pitStatic;<br>
// Add our new package to the packages we've currently loaded<br>
PackageGraph.AddPackage(raotestpackage);<br>
// I thought this would save the list of user-defined packages, is<br>
this correct?<br>
PackageGraph.SaveAutoInstallConfig;<br>
<br>
// Do I need something like this to save the list of packages?:<br>
//PkgManager.InstallPackages(pkgidlist, [piiifQuiet]);<br>
<br>
// save target directory //existing code resumes<br>
TargetDir:=CurProf.TargetDirectory;<br>
IDEMacros.SubstituteMacros(TargetDir);<br>
<br>
While the code runs, nothing happens... and I'm sure just copy/pasting<br>
code from other parts without understanding what's going on isn't the<br>
fastest/surest way of getting things working.<br>
<br>
Questions:<br>
1. Am I on the right track?<br>
2. Is packagegraph a representation of all packages present in the IDE?<br>
3. What do the package .AutoInstall types mean? None: not installed,<br>
dynamic: needed as a dependency for other packages, static: always<br>
installed in IDE (e.g. because it is selected by the user)? Am I right<br>
in manipulating this property?<br>
<br>
Thanks,<br>
Reinier<br></blockquote></div><br>Good feature,<br><br>I think it is related my my old ask,<br><a href="http://comments.gmane.org/gmane.comp.ide.lazarus.general/53455">http://comments.gmane.org/gmane.comp.ide.lazarus.general/53455</a><br>
<br><div dir="ltr">Best Regards<br>Zaher Dirkey</div><br>
</div>