Wiki
Version 1 (modified by Charles, 11 years ago)

--

Build Script

Small and medium sized projects can often be built with a simple script that invokes the Cobra compiler with the correct options for the given project.

For example, here is a bash script in a bin/ subdirectory of a project:

#!/bin/bash

# change to the directory of the script
cd "`dirname "$0"`"
# backup
cd ..

mkdir -p build

cd source

cobra -c -d -color -timeit \
    -copy-core \
    -out:../build/MyApp.exe \
    -pkg:gtk-sharp-2.0 \
    "$@" \
    lib/ObjectLister.cobra \
    models/Project.cobra \
    models/FileModel.cobra \
    models/Invoice.cobra \
    gtk/MyApp.cobra \
    gtk/Extensions.cobra \
    gtk/TextEditor.cobra \
    gtk/AppWide.cobra

Here is another example from the Cobra compiler itself:

#!/bin/bash
cd "`dirname "$0"`" ; cd ..
mono Snapshot/cobra.exe -compile -color -debug -ert:yes -timeit "$@" cobra.cobra -files:files-to-compile.text

In the above example, the -files option is used so that the list of source files can be maintained in a separate file, one per line:

Utils
IndentedWriter
Misc
SubversionUtils

CommandLine
TestifyRunner
BackEnd
Compiler
...

Complementary scripts named "clean", "test", etc. can also be created to help manage the project.

See Also