summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-09-12 10:19:33 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-09-12 10:21:13 (GMT)
commitcc4ce85b1d5a4d0fe47690c2aa0748cc964a6cae (patch)
tree976cacfdd06542a24f22f891e950374ef7508025 /BuildTools/SCons/Tools
parent6fc3f55d26748c277ce5f90d2d1cf89ed777a46e (diff)
downloadswift-contrib-cc4ce85b1d5a4d0fe47690c2aa0748cc964a6cae.zip
swift-contrib-cc4ce85b1d5a4d0fe47690c2aa0748cc964a6cae.tar.bz2
Added SLOCCount to scons.
Diffstat (limited to 'BuildTools/SCons/Tools')
-rw-r--r--BuildTools/SCons/Tools/SLOCCount.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/BuildTools/SCons/Tools/SLOCCount.py b/BuildTools/SCons/Tools/SLOCCount.py
new file mode 100644
index 0000000..fd09abe
--- /dev/null
+++ b/BuildTools/SCons/Tools/SLOCCount.py
@@ -0,0 +1,17 @@
+import SCons.Util, os.path, os
+
+def generate(env) :
+ def createSLOCCount(env, source) :
+ myenv = env.Clone()
+ myenv["ENV"]["HOME"] = os.environ["HOME"]
+ source = myenv.Dir(source)
+ target = myenv.File("#/" + source.path + ".sloccount")
+ # FIXME: There's probably a better way to force building the .sc
+ if os.path.exists(target.abspath) :
+ os.unlink(target.abspath)
+ return myenv.Command(target, source, [SCons.Action.Action("sloccount --duplicates --wide --details " + source.path + " > $TARGET", cmdstr = "$GENCOMSTR")])
+
+ env.AddMethod(createSLOCCount, "SLOCCount")
+
+def exists(env) :
+ return True