Showing posts with label compilation. Show all posts
Showing posts with label compilation. Show all posts

Tuesday, January 20, 2015

Fast full compilation in AX 2012

This is just a short batch that runs a full compilation by means of AxBuild with after-run cleaning in AX 2012.

c:
cd "C:\Program Files\Microsoft Dynamics AX\60\Server\CGI_DAX62_DEVTM2_AOS1\bin"
axbuild xppcompileall  /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
@echo to start compilation log import press any key
pause
cd "C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
ax32.exe -startupCmd=importandcompileaxbuildlog_C:\Program*Files\Microsoft*Dynamics*AX\60\Server\CGI_DAX62_DEVTM2_AOS1\Log
pause

Do not forget to run it as administrator.





The cleaning requires a project installed as described in the second hyper link.





Tuesday, December 1, 2009

How to add all descendant classes to a new project

I bumped into the problem of a class compilation with no licence for X++ source code.

Forward compile option is not enough to make my changes working. Thus I need to export-import all descendant classes as well as the class I changed - FormLetter in my case.

I therefore have to add all these classes to my project. Natural laziness saved me again from this manual work.

I hope this short job inspired by system class SysCompilerOutput and miklenew's job from AXForum will help you in similar situations.






// add to a new project all descendant classes for forward compilation
public static void SISCreateCompileForwardProject(Args _args)
{
#AOT
str project = 'SIS_CompileForward';
SysCompilerOutput sysCompilerOutput;
Dictionary dictionary = new Dictionary();
DictClass dictClass = new DictClass(className2Id("Formletter"));
int numOfClasses = dictionary.classCnt();
ProjectNode sharedProjects;
ProjectNode newProject;

void addToProjectForwardClass(DictClass _dictClass, Dictionary _dictionary, int _numOfClasses)
{
ClassNode classNode;
DictClass dictClassLoop;
DictClass childClass;
int i;
;
if (_dictClass)
{
classNode = infolog.findNode(#ClassesPath + #AOTDelimiter + _dictClass.name());

if (classNode)
{
newProject.addUtilNode(UtilElementType::Class, classNode.name());

for (i=1; i <= _numOfClasses; i++)
{
dictClassLoop = _dictionary.classObject(_dictionary.classCnt2Id(i));

if (dictClassLoop.extend() == _dictClass.id())
{
childClass = new DictClass(dictClassLoop.id());
addToProjectForwardClass(childClass, _dictionary, _numOfClasses);
}
}
}
}
}
;

sharedProjects = infolog.projectRootNode().AOTfindChild('Shared');
sharedProjects.AOTAdd(project);
newProject = sharedProjects.AOTfindChild(project);
newProject.loadForInspection();
newProject = newProject.getRunNode();
addToProjectForwardClass(dictClass, dictionary, numOfClasses);
newProject.AOTsave();


}