#!/usr/bin/ruby =begin pkg-build Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. Contact: Taejun Ha Jiil Hyoun Donghyuk Yang DongHee Yang Licensed 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. Contributors: - S-Core Co., Ltd =end $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common" $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/pkg_server" $LOAD_PATH.unshift File.dirname(__FILE__)+"/src/builder" require "utils" require "packageServer" require "Builder" require "optionparser" option = parse #generate server when local package server is not set # if "--os" is not specified, use host os type if option[:os].nil? then option[:os] = Utils::HOST_OS else if not option[:os] =~ /^(linux|windows|darwin)$/ then puts "We have no plan to Buld OS \"#{option[:os]}\" \n please check your option OS " exit 1 end end path = Dir.pwd if not File.exist? "package" then puts "current dirctory \"#{path}\" is not package root directory" exit 1 end # if url specified if not option[:url].nil? then begin builder = Builder.get("default") if builder.pkgserver_url != option[:url] then puts "Package server URL has been changed! Creating new builder..." builder = Builder.create("default", option[:url], nil) end rescue puts "Default builder does not exist! Creating new builder..." builder = Builder.create("default", option[:url], nil) end else # if url is not specified begin builder = Builder.get("default") rescue puts "Default builder does not exist! Creating new builder..." builder = Builder.create("default", "http://172.21.111.132/pkgserver/unstable",nil) end end #build project if not builder.build( Utils::WORKING_DIR, option[:os], option[:clean], option[:rev], [], []) then puts "Build Failed!" else puts "Build Succeeded!" end