Re: Run Script Build Phase & Linking
Re: Run Script Build Phase & Linking
- Subject: Re: Run Script Build Phase & Linking
- From: Fritz Anderson <email@hidden>
- Date: Wed, 4 Jan 2006 16:28:27 -0600
This doesn't directly answer your question, and perhaps I do not
fully understand what your script does but isn't
elsif (File.stat(source_file).mtime != File.stat(dest_file).mtime)
going to evaluate as true even if dest_file is up-to-date? You take
special trouble to set the dest_file's mtime to 1 + the source_file's
mtime.
-- F
On 4 Jan 2006, at 3:22 PM, David Dolinar wrote:
Hi,
I have a project which links *every* *single* *time* I choose
"Build & Run" regardless of if I have made changes or not. I have
tracked down the cause of the excessive linking to a Run Script
build phase which takes one input file and one output file. The
script is ran EVERY TIME even though the output file has a newer
modification date then the input file. As I understand it XCode
should not be doing this. Is this a known bug or am I doing
something wrong? Any help would be appreciated.
Here is the ruby script:
def update_library(source_file, dest_file)
name = File.basename(source_file)
# print "Base name: #{name}\n"
# if source file doesn't exist return an error
if (!File.exists?(source_file))
print "Error: #{source_file} doesn't exist"
return 1
end
# see if we need to update
if (!File.exists?(dest_file))
# ranlib file doesn't exist
needs_update = true
print "#{name} needs to be copied...\n"
elsif (File.stat(source_file).mtime != File.stat(dest_file).mtime)
# ranlib
needs_update = true
print "#{name} needs to be updated...\n"
print "removing #{dest_file}\n"
File.delete(dest_file)
else
print "#{name} is up to date\n"
needs_update = false
end
# update library into build directory
if (needs_update)
print "copying #{source_file}\n"
system("cp '#{source_file}' '#{dest_file}'")
print "running ranlib on #{dest_file}\n"
system("ranlib '#{dest_file}'")
source_atime = File.atime(source_file)
source_mtime = File.mtime(source_file)
File.utime(source_atime, source_mtime+1, dest_file)
end
return 0
end
error = 0
num_files = ENV['SCRIPT_INPUT_FILE_COUNT'].to_i
# print "#{num_files}\n"
num_files.times do |i|
source_file = ENV['SCRIPT_INPUT_FILE_' + i.to_s]
dest_file = ENV['SCRIPT_OUTPUT_FILE_' + i.to_s]
# print "Updating #{source_file} to #{dest_file}\n"
if (error == 0)
error = update_library(source_file, dest_file)
end
end
exit(error)
-- David Dolinar, Software Developer
-- Directory Resources, LLC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40manoverboard.org
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden