aboutsummaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'build.py')
-rw-r--r--build.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/build.py b/build.py
index 753ede7..3a4d4e3 100644
--- a/build.py
+++ b/build.py
@@ -137,6 +137,7 @@ class BuildTarget():
self.process_kwargs(kwargs, environment)
if len(self.sources) == 0 and len(self.generated) == 0:
raise InvalidArguments('Build target %s has no sources.' % name)
+ self.validate_sources()
def process_objectlist(self, objects):
assert(isinstance(objects, list))
@@ -164,6 +165,14 @@ class BuildTarget():
else:
raise InvalidArguments('Bad source in target %s.' % self.name)
+ def validate_sources(self):
+ if len(self.sources) > 0:
+ first = os.path.split(self.sources[0])[1]
+ (base, suffix) = os.path.splitext(first)
+ if suffix == '.rs':
+ if self.name != base:
+ raise InvalidArguments('In Rust targets, the first source file must be named projectname.rs.')
+
def get_original_kwargs(self):
return self.kwargs