You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by lo...@apache.org on 2012/01/24 08:14:48 UTC
[lucy-commits] svn commit: r1235147 - /incubator/lucy/trunk/ruby/Rakefile
Author: logie
Date: Tue Jan 24 07:14:47 2012
New Revision: 1235147
URL: http://svn.apache.org/viewvc?rev=1235147&view=rev
Log:
LUCY-210
Added build_clownfish task that does the following:
1. Builds clownfish itself.
2. Runs the autogenerate code.
Modified:
incubator/lucy/trunk/ruby/Rakefile
Modified: incubator/lucy/trunk/ruby/Rakefile
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/ruby/Rakefile?rev=1235147&r1=1235146&r2=1235147&view=diff
==============================================================================
--- incubator/lucy/trunk/ruby/Rakefile (original)
+++ incubator/lucy/trunk/ruby/Rakefile Tue Jan 24 07:14:47 2012
@@ -16,6 +16,9 @@
require 'rbconfig'
require 'rake/clean'
+gem 'rake-compiler'
+require 'rake/extensiontask'
+
def exe_path(*args)
File.join(args).ext(RbConfig::CONFIG["EXEEXT"])
end
@@ -76,10 +79,34 @@ def run_make(dir, params)
end
IS_DISTRO_NOT_DEVEL = File.directory?('core')
+AUTOGEN_DIR = "autogen"
BASE_DIR = File.absolute_path(IS_DISTRO_NOT_DEVEL ? '.' : '..')
CHARMONIZER_ORIG_DIR = File.join(BASE_DIR, "charmonizer")
CHARMONIZE_EXE_PATH = exe_path(CHARMONIZER_ORIG_DIR, 'charmonize')
+CLOWNFISH_PATH = File.join(BASE_DIR,"clownfish","ruby")
CHARMONY_PATH = "charmony.h"
+CORE_SOURCE_DIR = File.join(BASE_DIR, "core")
+
+desc "Build clownfish"
+task :clownfish => [:charmonizer_tests] do
+ puts "Building clownfish...\n"
+ build_cfc
+
+ require_relative File.join(CLOWNFISH_PATH,"ext","Clownfish","CFC")
+
+ puts "Parsing Clownfish files...\n";
+ hierarchy_obj = compile_clownfish
+ core_binding_obj = Clownfish::CFC::Binding::Core.new(
+ hierarchy_obj,
+ AUTOGEN_DIR,
+ autogen_header,
+ '',
+ )
+
+ puts "Writing Clownfish autogenerated files...\n"
+ modified = core_binding_obj.write_all_modified
+
+end
desc "Build the charmonize executable"
task :charmonize do
@@ -138,3 +165,49 @@ task :test => [:charmonizer_tests] do
end
end
+def autogen_header
+ return <<"END_AUTOGEN";
+/***********************************************
+
+ !!!! DO NOT EDIT !!!!
+
+ This file was auto-generated by Rakefile
+
+ ***********************************************/
+
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+END_AUTOGEN
+
+end
+
+def compile_clownfish
+ hierarchy_obj = Clownfish::CFC::Hierarchy.new(CORE_SOURCE_DIR, AUTOGEN_DIR)
+ hierarchy_obj.build
+
+ return hierarchy_obj
+end
+
+def build_cfc
+ Dir.chdir(CLOWNFISH_PATH) do
+ if system('rake clownfish').nil?
+ abort "Failed to make clownfish"
+ end
+ end
+end
+
+