| 1 | = Build Script = |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | For example, here is a bash script in a bin/ subdirectory of a project: |
| 6 | |
| 7 | {{{ |
| 8 | #!sh |
| 9 | #!/bin/bash |
| 10 | |
| 11 | # change to the directory of the script |
| 12 | cd "`dirname "$0"`" |
| 13 | # backup |
| 14 | cd .. |
| 15 | |
| 16 | mkdir -p build |
| 17 | |
| 18 | cd source |
| 19 | |
| 20 | cobra -c -d -color -timeit \ |
| 21 | -copy-core \ |
| 22 | -out:../build/MyApp.exe \ |
| 23 | -pkg:gtk-sharp-2.0 \ |
| 24 | "$@" \ |
| 25 | lib/ObjectLister.cobra \ |
| 26 | models/Project.cobra \ |
| 27 | models/FileModel.cobra \ |
| 28 | models/Invoice.cobra \ |
| 29 | gtk/MyApp.cobra \ |
| 30 | gtk/Extensions.cobra \ |
| 31 | gtk/TextEditor.cobra \ |
| 32 | gtk/AppWide.cobra |
| 33 | }}} |
| 34 | |
| 35 | Here is another example from the Cobra compiler itself: |
| 36 | |
| 37 | {{{ |
| 38 | #!sh |
| 39 | #!/bin/bash |
| 40 | cd "`dirname "$0"`" ; cd .. |
| 41 | mono Snapshot/cobra.exe -compile -color -debug -ert:yes -timeit "$@" cobra.cobra -files:files-to-compile.text |
| 42 | }}} |
| 43 | |
| 44 | 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: |
| 45 | |
| 46 | {{{ |
| 47 | Utils |
| 48 | IndentedWriter |
| 49 | Misc |
| 50 | SubversionUtils |
| 51 | |
| 52 | CommandLine |
| 53 | TestifyRunner |
| 54 | BackEnd |
| 55 | Compiler |
| 56 | ... |
| 57 | }}} |
| 58 | |
| 59 | Complementary scripts named "clean", "test", etc. can also be created to help manage the project. |
| 60 | |
| 61 | == See Also == |
| 62 | |
| 63 | * BuildTools |
| 64 | * RelatedProjects |
| 65 | * LibraryTopics |
| 66 | * LanguageTopics |