rungen revision 4632
3973N/A#!/usr/bin/env ruby
3973N/A#
3973N/A# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3973N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3973N/A#
3973N/A# This code is free software; you can redistribute it and/or modify it
3973N/A# under the terms of the GNU General Public License version 2 only, as
3973N/A# published by the Free Software Foundation. Oracle designates this
3973N/A# particular file as subject to the "Classpath" exception as provided
3973N/A# by Oracle in the LICENSE file that accompanied this code.
3973N/A#
3973N/A# This code is distributed in the hope that it will be useful, but WITHOUT
3973N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3973N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3973N/A# version 2 for more details (a copy is included in the LICENSE file that
3973N/A# accompanied this code).
3973N/A#
3973N/A# You should have received a copy of the GNU General Public License version
3973N/A# 2 along with this work; if not, write to the Free Software Foundation,
3973N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3973N/A#
3973N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3973N/A# or visit www.oracle.com if you need additional information or have any
3973N/A# questions.
3973N/A#
3973N/A#
3973N/A
3973N/AxcodeAction = ARGV[0]
3973N/A
3973N/Aexit unless xcodeAction == "install"
3973N/A
3973N/AJOBJC_JAR = ARGV[1]
3973N/ALIBPATH = ARGV[2]
3973N/AOBJROOT = ARGV[3]
3973N/AARCHS = ARGV[4]
3973N/ASTABLE_GEN_DIR = ARGV[5]
3973N/A
3973N/AourJavaHome = ENV['JAVA_HOME']
3973N/AourJavaVersion = `java -fullversion 2>&1`
3973N/A$stderr.puts "ENV['JAVA_HOME'] = #{ourJavaHome}"
3973N/A$stderr.puts "java -fullversion = #{ourJavaVersion}"
3973N/A
3973N/A$stderr.puts "jobjc_jar = #{JOBJC_JAR}"
3973N/A$stderr.puts "libpath = #{LIBPATH}"
3973N/A$stderr.puts "objroot = #{OBJROOT}"
3973N/A$stderr.puts "ARCHS = #{ARCHS}"
3973N/A$stderr.puts "STABLE_GEN_DIR = #{STABLE_GEN_DIR}"
3973N/A
3973N/Ajarch = if ARCHS =~ /x86_64/ then "-d64" else "-d32" end
3973N/A
3973N/A# compute the boot class path, but remove the JObjC jar file that may have been installed in the boot jdk
3973N/A
3973N/Abootclasspathcmd = "java -classpath #{OBJROOT}/bin/core:#{OBJROOT}/bin/generator com.apple.internal.jobjc.generator.BootClassPathMinus #{JOBJC_JAR}"
3973N/A$stderr.puts bootclasspathcmd
3973N/Abootclasspath = `#{bootclasspathcmd}`
3973N/A
3973N/A$stderr.puts "bootclasspath is: "
3973N/A$stderr.puts bootclasspath
3973N/A
3973N/A# we run the generator with our newly created JObjC. The installed version (if available) has been removed from
3973N/A# the boot class path, so we are building with everything newly created.
3973N/Acmd = "java #{jarch} -Xms128m -Xmx512m -Djava.library.path=#{LIBPATH} -Xbootclasspath:#{bootclasspath.chomp} -classpath #{OBJROOT}/bin/core:#{OBJROOT}/bin/generator -ea com.apple.internal.jobjc.generator.Generator dst=#{OBJROOT}/src/jobjc frameworks=#{STABLE_GEN_DIR}"
3973N/A
3973N/A$stderr.puts cmd
3973N/Aputs `#{cmd} 2>&1`
3973N/A
3973N/Araise $?.to_i if $?.to_i != 0
3973N/A