Step 1 - Package the source code
Overview
This page explains what an application’s source code package must contain, and how to structure it, so that CAST Imaging can analyze the application completely. It is intended for the people who collect the source code from the application team and for the CAST Imaging operators who deliver it. Read it before you register and deliver the source code.
The page starts with the principles that apply to every application, then lists the requirements for each technology with a link to the detailed instructions where they exist.
General principles
Get the code from your repository
Take the code from the source code repository, not from a developer workstation or a build server, so that the package is complete and can be reproduced for the next version. Get the branch or tag that matches the version you want to analyze, and keep the repository’s folder structure as it is: do not flatten, rename or reorganize folders.
Applies to GitHub, GitLab, Bitbucket, Azure Repos and any other Git server.
- Clone the branch or tag to analyze, including any submodules:
$ git clone --branch <branch-or-tag> --recurse-submodules <repository-url>
- If the repository stores files with Git LFS, fetch them from inside the cloned folder:
$ git lfs pull
- Package the cloned folder. The
.gitfolder can stay: it is skipped automatically.
- Export the trunk, branch or tag to analyze. An export contains no
.svnfolders:
$ svn export <repository-url>/tags/<tag> <folder>
- If the repository uses
svn:externals, check that the external folders were exported too. - Package the exported folder.
Applies to Azure DevOps TFVC, IBM Rational ClearCase, Perforce and other systems.
- Get the version to analyze into a new, empty workspace, so that no local changes are included.
- Package the workspace folder as it is.
Copy the folder tree used by the development team as it is, and package the copy.
When the application is split across several repositories, get each one in the same way and place it in its own top-level folder in the package.
Deliver everything needed to build the application
Include everything a developer would need to compile the application:
- Source files written by developers and files generated by the IDE.
- Source code generated during the build - see Make sure the code is complete.
- Third-party libraries, and the files that reference them (
pom.xml,package.json,.csprojand so on).
CAST Imaging does not compile the code. With two exceptions, it does not download dependencies either, so a dependency that is not in the package is not resolved:
- Maven (Java): CAST Imaging can resolve the dependencies declared in the POM files from local or remote Maven repositories. See Using the Maven Dependencies option.
- NuGet (.NET): the NuGet Resources Extractor can extract the packages referenced in
.csprojandpackages.configfiles from a NuGet repository.
Dependencies from npm, pip and other package managers must be in the package.
Make sure the code is complete
Many builds generate source code during compilation, for example from WSDL or XSD files, from annotation processors, or from Protocol Buffers definitions. This code is not in the repository, but the application depends on it, and CAST Imaging cannot generate it because it does not compile the code.
- Run the application’s build.
- Find the generated source files. Typical locations are
target/generated-sourcesfor Maven andbuild/generatedfor Gradle. - Add them to the package as source text files (
.java,.csand so on), in a folder whose name shows they are generated. Do not deliver the compiled classes instead.
What to leave out
- Test code.
- HTML and JavaScript generated by documentation or code analysis tools.
- Large data files that do not contribute to the application’s structure, such as videos or images stored in a content management system.
- Compiled binaries, unless a technology section below asks for them.
Minified JavaScript (*.min.js) and bundled JavaScript or HTML files with very long lines are excluded automatically. Deliver these files in their normal, non-minified form.
Version control folders (.git, .github, .svn) are skipped automatically when the package is extracted, so you do not need to remove them.
Databases
When the application uses a relational database, deliver its structure as DDL scripts:
- One DDL script per database or schema. Incremental definitions are not supported.
- Each script starts with the creation of the schema and contains all its elements: tables, views, constraints, indexes, procedures, functions and triggers.
- No data: do not include
INSERTorUPDATEstatements.
Optionally, you can also provide table size statistics from production and unit test coverage reports.
Character sets
Source files must use ASCII or a supported Unicode encoding. See Supported character sets.
Package structure
Deliver the source code as a single ZIP file, or in a folder defined as a source folder location. Place each technology in its own top-level folder, and zip the contents of the parent folder rather than the parent folder itself:
application.zip
├── Java
├── Mainframe
├── Database
└── Web
Technology-specific instructions
Each section below summarizes what to deliver for a technology and links to its detailed instructions, where they exist.
C and C++
Detailed instructions: not available yet.
- Source and project files:
.c,.cpp,.cxx,.pc, and headers.h,.hh,.hpp,.tpp,.inl,.inc. - System headers for the operating system and compiler, and third-party headers.
- All makefiles and build files, and the build logs when the compiler is not a Microsoft compiler.
- The list of include paths, predefined macros and macros set by build options.
- A description of how the code is split into executables and libraries, the database access APIs used, and any dynamic loading.
- Do not deliver
.lib,.a,.obj,.so,.dllor.exefiles.
COBOL (non-IBM)
Micro Focus, GCOS and COBOL for VMS.
Detailed instructions: not available yet.
- Confirm the exact file types to deliver with your CAST technical contact.
IBM i
RPG, COBOL for IBM i and DataStage.
Detailed instructions: Midrange expected input.
- RPG:
.rpg,.rpgleand.sqlrpglefiles fromQRPGSRC;.cpyrpgand.cpyclpfiles fromQCPYSRC;.clleand.clpfiles fromQCLPSRC;.dspfand.prtffiles;.lfand.pffiles fromQDDSSRC. - COBOL:
.cbl,.sqlcbl,.sqlcblpcml,.sqlcblletand.sqlcbllecfiles fromQCBLSRC;.cpycblfiles fromQCPYSRC. - DataStage:
.dsxexports of the jobs and stage types.
IBM Mainframe
COBOL, JCL, CICS, IMS, Db2 and the other z/OS languages.
Detailed instructions: Mainframe expected input.
The detailed page walks you through platform qualification, the artifact types to extract, source extraction (including PDS dumps and CICS CSD extraction) and the expected folder structure. Follow it rather than a summary here.
IBM PL/1
Detailed instructions: not available yet.
- One artifact per file.
- Programs as
.plifiles. - Includes and table definitions as
.plcfiles: include files in aPLCfolder and table definitions in aTLCfolder. Export Db2 table definitions to include files.
Java and JEE
Detailed instructions: not available yet.
- All
.javafiles. - The Java sources generated during the build (JAXB, WSDL and gRPC stubs, annotation processor output and so on), as
.javafiles. See Make sure the code is complete. - Configuration and framework files: XML, properties, JSON and YAML files, EJB and mapping files,
web.xml, JSP and similar files, XSL, TLD, DTD, HTML, JavaScript, CSS, WSDL and WSDD files. - All
.pomfiles, including parent POMs, and Gradle build files. - All JAR files the application needs to build: JDK, JEE and third-party libraries. A copy of the local Maven repository is optional; the JARs actually used are mandatory, unless CAST Imaging can resolve them from a Maven repository. Deliver custom JARs together with their source code.
- Ant and Ivy scripts, for information only.
- Do not deliver
.war,.earor.classfiles, or data files.
Message queues
ActiveMQ, IBM MQ, RabbitMQ, Spring JMS and Spring AMQP.
Detailed instructions: not available yet.
- All the queue configuration files, together with the application source code that uses them.
Microsoft .NET
Detailed instructions: not available yet.
- Project files:
.sln,.csproj,.vbproj. - Code:
.cs,.vb. - User interface:
.aspx,.ascx,.cshtml,.vbhtml,.xaml. - Assets and configuration files:
.config,.properties,.edmx. - Third-party assemblies (
.dll,.ocx). Either include the NuGetpackagesfolders, or deliver the compiled application so that the assemblies are available. Thebinandpackagesfolders can be included for this purpose. Alternatively, the NuGet Resources Extractor can extract the referenced packages from a NuGet repository at delivery time. - Do not deliver the
objfolders.
Microsoft ASP
Detailed instructions: not available yet.
.asp,.inc,.asa,.htm,.html,.htc,.css,.vbsand.jsfiles, and images. Do not deliver COM binaries or components without their source code.
Mobile
Android, Ionic and React Native.
Detailed instructions: not available yet.
- All application and configuration files. Source code written by developers is mandatory.
- Ionic: the pre-compilation
.ts,.html,.cssand.scssfiles. - React Native: the pre-compilation
.jsfiles only.
NoSQL databases
MongoDB, Couchbase, MarkLogic, CouchDB, Cosmos DB, DynamoDB, Elasticsearch, Memcached and Redis.
Detailed instructions: not available yet.
- No database-specific files are needed. Deliver the source code of the application that uses the database.
Oracle Forms and Reports
Detailed instructions: not available yet.
- Forms
.fmb,.olb,.mmband.pllfiles, and Reports.rexfiles. See the detailed instructions for how to prepare them.
PHP
Detailed instructions: not available yet.
.html,.htm,.phtml,.php,.php4,.php5,.php6,.inc,.jsand.cssfiles, and images. XML and XSL files are not analyzed but can be included.- State which framework the application uses, if any (Symfony, Drupal, Joomla and so on).
Python
Detailed instructions: not available yet.
- All
.pyfiles and therequirements.txtfile.
SAP
Detailed instructions: not available yet.
- ABAP: extract the code with the CAST SAP Extractor.
- UI5: deliver as for Web.
- Hybris: deliver as for Java and JEE.
Shell scripts
Korn shell, Bourne shell and C shell.
Detailed instructions: not available yet.
- One artifact per file.
SQL databases
Microsoft SQL Server and Sybase (T-SQL), IBM Db2, Informix, MariaDB, MySQL, Oracle (PL/SQL), PostgreSQL, SQLite and Teradata.
Detailed instructions: not available yet.
- One DDL script per database or schema, following the general principles.
Web
Angular, AngularJS, JavaScript, jQuery, Node.js, ReactJS, TypeScript and VBScript.
![]()
Detailed instructions: not available yet.
- The pre-compilation source code with its project and configuration files.
- Angular:
.ts,.html,.cssand.scssfiles. Excludespec.tsfiles. - ReactJS:
.jsfiles. Exclude spec and test files. - jQuery: non-minified files. State the jQuery version.
- Node.js:
.js,.jsx,.ts,.tsx,.pug,.jade,.vue,.json,.yml,.css,.scssand.sassfiles, and images. Include thepackage.jsonandpackage-lock.jsonfiles, but not thenode_modulesfolder. - VBScript:
.vbsfiles.
Next steps
- Step 2 - CAST Profiler (optional) - check the package is complete and its technologies are supported before you onboard it
- Step 3 - Register and deliver source code - create the application in CAST Imaging and deliver the package