This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Move to old-code

svn path=/old-code/; revision=156216
  • Loading branch information...
migueldeicaza committed Apr 27, 2010
1 parent 0a6b999 commit 795f1c965f53d07ef54bf6340d37bcb7ee12af06
View
@@ -0,0 +1,8 @@
+assembly = "bake.exe"
+sources = wildcard ("src/Bake/*.boo")
+
+booc_target (assembly, sources, { "debug" : true })
+
+target ("clean") do:
+ delete (wildcard ("*.exe*"))
+
View
@@ -0,0 +1,7 @@
+Copyright (C) 2008 Novell, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,22 @@
+2008-01-25 Aaron Bockover <abockover@novell.com>
+
+ * src/Bake/Exec.boo: Define a sweet _ exec command that munges everything
+ together; make exec return stdout
+
+ * src/Bake/Files.boo: Allow delete to take params of object, convert
+ to a list and flatten; added ch_ext, changes an extension on a list
+ of files
+
+ * src/Bake/Lang.boo: Added each and flatten methods
+
+ * src/Bake/Paths.boo: Properly escape '.' as '\.'
+
+ * src/Bake/PkgConfig.boo: Added basic pkg-config support
+
+ * src/Bake/Target.boo: Added make % style rule support for expanding
+ to multiple targets based on dependency input
+
+2008-01-22 Aaron Bockover <abockover@novell.com>
+
+ * Bake: initial project checkin
+
View
@@ -0,0 +1,8 @@
+BAKE = bake.exe
+SOURCES = $(wildcard src/Bake/*.boo)
+
+$(BAKE): $(SOURCES)
+ booc -nologo -o:$@ $(SOURCES)
+
+clean:
+ rm -f *.exe*
View
@@ -0,0 +1,23 @@
+Bake is a make replacement written in Boo. Bakefiles replace Makefiles, and
+are also written in Boo. The concept of targets, dependencies, and actions
+make up the core of Bake, just like make.
+
+Bake has a full function library including many helper functions and targets
+for building Mono/.NET projects.
+
+
+Building Bake
+=============
+
+Bake is able to build itself, but Bake is simple enough that typically we
+just build it with make to avoid bootstrap overhead. Therefore, to build
+Bake, just type "make".
+
+To bootstrap Bake however, run "make", and then source in the bakestrap file
+into BASH:
+
+$ make
+$ . bakestrap
+$ touch src/Bake/Bake.boo
+$ bake
+
View
@@ -0,0 +1,7 @@
+# Source this file into your BASH environment
+# $ . bakestrap
+# Then you will be able to run "bake"
+
+bakedir=$PWD
+alias bake='mono --debug $bakedir/bake.exe'
+
View
@@ -0,0 +1,41 @@
+//
+// AutoBake.boo
+//
+// Author:
+// Aaron Bockover <abockover@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Bake
+
+class AutoBakeInst:
+
+ [property (SUBDIRS)]
+ subdirs = []
+
+static class AutoBake:
+
+ static SUBDIRS as List:
+ get: return Context.Current.AutoBake.SUBDIRS
+ set: Context.Current.AutoBake.SUBDIRS = value
+
View
@@ -0,0 +1,61 @@
+//
+// Bake.boo
+//
+// Author:
+// Aaron Bockover <abockover@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Bake
+
+import System
+
+def die (message as string):
+ log (message)
+ Environment.Exit (1)
+
+def log (message as string):
+ print "bake: ${message}"
+
+def log_action (message as string):
+ print message if Globals.LogActions
+
+def bake ():
+ for subdir as string in AutoBake.SUBDIRS:
+ pushd (subdir)
+ Context (array (string, Globals.TargetArgs))
+ popd ()
+
+ if Globals.TargetArgs.Count > 0:
+ for target_name in Globals.TargetArgs:
+ target as Target = Target.Find (target_name)
+ if not target:
+ die ("No rule to bake target `${target_name}'.")
+ target.Update ()
+ elif Target.First:
+ Target.First.Update ()
+ elif not AutoBake.SUBDIRS or AutoBake.SUBDIRS.Count == 0:
+ die ("No targets.")
+
+Context (argv)
+
View
@@ -0,0 +1,71 @@
+//
+// Booc.boo
+//
+// Author:
+// Aaron Bockover <abockover@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Bake
+
+class Booc (NetCompiler):
+
+ def constructor ():
+ pass
+
+ def constructor (args as Hash):
+ PopulateFromHash (args)
+
+ override Compiler as string:
+ get: return "booc"
+
+ protected override def GenerateCustomArgs () as string:
+ return "-nologo "
+
+ protected override def GenerateDebugArg () as string:
+ if Debug:
+ return "-debug+ "
+ return "-debug- "
+
+def booc_target (output as string, sources as List):
+ booc_target (output, sources, null)
+
+def booc_target (output as string, sources as List, action as callable):
+ booc_target (output, sources, null, action)
+
+def booc_target (output as string, sources as List, extra_args as Hash):
+ booc_target (output, sources, extra_args, null)
+
+def booc_target (output as string, sources as List, extra_args as Hash, action as callable):
+ if not extra_args:
+ extra_args = Hash ()
+ extra_args["out"] = output
+ extra_args["sources"] = sources
+ booc_target (extra_args, action)
+
+def booc_target (args as Hash):
+ booc_target (args, null)
+
+def booc_target (args as Hash, action as callable):
+ net_compile_target (typeof (Booc), args, action)
+
View
@@ -0,0 +1,120 @@
+//
+// Context.boo
+//
+// Author:
+// Aaron Bockover <abockover@novell.com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Bake
+
+import System
+import System.IO
+import System.Text
+import System.Reflection
+import System.Collections
+
+import Boo.Lang.Compiler
+import Boo.Lang.Compiler.IO
+import Boo.Lang.Compiler.Pipelines
+
+class Context:
+
+ bakefile as string
+ args = []
+
+ [getter (AutoBake)]
+ autobake = AutoBakeInst ()
+
+ [getter (Targets)]
+ targets = []
+
+ [property (CurrentTarget)]
+ current_target as Target
+
+ [property (Stack)]
+ public static stack = Stack ()
+
+ public static Current as Context:
+ get:
+ if Stack.Count > 0:
+ return Stack.Peek () as Context
+ return null
+
+ def constructor (argv as (string)):
+ args = List (argv)
+ bf_index = args.IndexOf ("-f")
+
+ if bf_index >= 0 and args.Count > bf_index + 1:
+ bakefile = args[bf_index + 1]
+ args.RemoveAt (bf_index)
+ args.RemoveAt (bf_index)
+ elif bf_index >= 0:
+ die ("No bakefile specified for -f.")
+ elif File.Exists ("Bakefile"):
+ bakefile = "Bakefile"
+ elif File.Exists ("bakefile"):
+ bakefile = "bakefile"
+
+ if not bakefile or not File.Exists (bakefile):
+ die ("No targets specified and no Bakefile found.")
+
+ booc_input as duck
+
+ if "-pure" in args:
+ booc_input = FileInput (bakefile)
+ else:
+ builder = StringBuilder ()
+ builder.Append ("import Bake\n\n")
+ using file = File.OpenText (bakefile):
+ line as string
+ while true:
+ line = file.ReadLine ()
+ if not line:
+ break
+ builder.Append (line)
+ builder.Append ("\n")
+
+ builder.Append ("\nbake ()")
+ booc_input = StringInput (bakefile, builder.ToString ())
+
+ _booc = BooCompiler ()
+ _booc.Parameters.Input.Add (booc_input)
+ _booc.Parameters.Pipeline = CompileToMemory ()
+ _booc.Parameters.Ducky = true
+
+ for assembly as Assembly in AppDomain.CurrentDomain.GetAssemblies ():
+ _booc.Parameters.References.Add (assembly)
+
+ context = _booc.Run ()
+
+ if context.GeneratedAssembly is null:
+ print join (e for e in context.Errors, "\n")
+ else:
+ if not Globals.CommandLineArgs:
+ Globals.CommandLineArgs = array (string, args)
+
+ Stack.Push (self)
+ entry = context.GeneratedAssembly.EntryPoint
+ entry.Invoke (null, array (object, entry.GetParameters ().Length))
+ Stack.Pop ()
Oops, something went wrong.

0 comments on commit 795f1c9

Please sign in to comment.