-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkettle
executable file
·85 lines (76 loc) · 4 KB
/
kettle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/python3
# Copyright 2016 Andreas Cord-Landwehr <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#!/usr/bin/python
import sys
import argparse
from symbol import argument
from kettlelib import *
# command line arguments
parser = argparse.ArgumentParser(description='Semi-automatic build tool for triggering project builds')
parser.add_argument('--project', type=str)
parser.add_argument('--platform', type=str, default='linux')
parser.add_argument('--compiler', type=str, choices=['gcc', 'clang'], default='gcc')
parser.add_argument('--no-src', action='store_true')
parser.add_argument('--refresh-build', action='store_true')
arguments = parser.parse_args()
# initial status information
print(PrintColors.Header + "Kettle Multi-Platform Building" + PrintColors.End)
if arguments.project is None:
sys.exit(PrintColors.Error + "no project specified, use \"--project=\"" + PrintColors.End)
print("project: " + PrintColors.Bold + arguments.project + PrintColors.End)
print("platform: " + PrintColors.Bold + arguments.platform + PrintColors.End + "\n")
# initializing manager prints environment
manager = BuildManager(arguments.project, arguments.platform)
# Update sources
print(PrintColors.Header + "## Update Project Sources" + PrintColors.End)
if arguments.no_src:
print(PrintColors.Info + "skipping source update" + PrintColors.End)
else:
if not manager.update_sources():
sys.exit("Configuration exited with non-zero code, assuming failure to configure for project %s." % arguments.project)
print()
# Configure the build system configuration
print(PrintColors.Header + "## Configure Build" + PrintColors.End)
if arguments.refresh_build:
print("purge build directory: " + PrintColors.Bold + manager.buildDirectory + PrintColors.End)
if not manager.purge_build_directory():
sys.exit(PrintColors.Error + "Could not purge build directory %s." % manager.buildDirectory + PrintColors.End)
else:
print(PrintColors.Info + "directory purged" + PrintColors.End)
print()
print("configure build directory: " + PrintColors.Bold + manager.buildDirectory + PrintColors.End)
if not manager.configure_build():
sys.exit("Configuration exited with non-zero code, assuming failure to configure for project %s." % arguments.project)
else:
print(PrintColors.Info + "build configured" + PrintColors.End)
print()
# Perform the build
print(PrintColors.Header + "## Perform Build" + PrintColors.End)
if not manager.perform_build():
sys.exit(PrintColors.Error + "Building exited with non-zero code, assuming failure to build the project %s." % arguments.project + PrintColors.End)
print()
# Perform the install step
print(PrintColors.Header + "## Perform Install" + PrintColors.End)
if not manager.perform_install():
sys.exit("Building exited with non-zero code, assuming failure to install the project %s." % arguments.project)