Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
7004d3de
Commit
7004d3de
authored
10 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Extract logging from the command class
parent
384c444b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/ENV/4.3/cc
+16
-42
16 additions, 42 deletions
Library/ENV/4.3/cc
with
16 additions
and
42 deletions
Library/ENV/4.3/cc
+
16
−
42
View file @
7004d3de
...
...
@@ -3,27 +3,6 @@
$:
.
unshift
Dir
[
"/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby/{1.8,2.0.0}"
].
first
require
'pathname'
require
'set'
require
'stringio'
class
Logger
def
initialize
@io
=
StringIO
.
new
end
def
puts
(
*
args
)
@io
.
puts
(
*
args
)
end
def
log!
return
unless
ENV
.
key?
'HOMEBREW_CC_LOG_PATH'
path
=
"
#{
ENV
[
'HOMEBREW_CC_LOG_PATH'
]
}
.cc"
puts
File
.
open
(
path
,
File
::
WRONLY
|
File
::
APPEND
|
File
::
CREAT
)
{
|
f
|
f
.
write
(
@io
.
string
)
}
end
end
LOGGER
=
Logger
.
new
class
Cmd
attr_reader
:config
,
:prefix
,
:cellar
,
:tmpdir
,
:sysroot
...
...
@@ -103,7 +82,7 @@ class Cmd
end
end
allflags
=
case
mode
case
mode
when
:ccld
cflags
+
args
+
cppflags
+
ldflags
when
:cxxld
...
...
@@ -119,8 +98,6 @@ class Cmd
when
:ld
ldflags
+
args
end
make_fuss
(
allflags
)
allflags
end
def
refurbished_args
...
...
@@ -260,20 +237,6 @@ class Cmd
%W{
#{
sysroot
}
/usr/lib /usr/local/lib}
end
def
make_fuss
args
return
unless
make_fuss?
dels
=
@args
-
args
adds
=
args
-
@args
LOGGER
.
puts
"superenv removed:
#{
dels
*
' '
}
"
unless
dels
.
empty?
LOGGER
.
puts
"superenv added:
#{
adds
*
' '
}
"
unless
adds
.
empty?
end
def
make_fuss?
refurbish_args?
&&
!
configure?
end
def
configure?
# configure scripts generated with autoconf 2.61 or later export as_nl
ENV
.
key?
'as_nl'
...
...
@@ -321,6 +284,20 @@ class Cmd
end
end
def
log
(
basename
,
argv
,
tool
,
args
)
return
unless
ENV
.
key?
(
"HOMEBREW_CC_LOG_PATH"
)
adds
=
args
-
argv
dels
=
argv
-
args
s
=
""
s
<<
"
#{
basename
}
called with:
#{
argv
.
join
(
" "
)
}
\n
"
s
<<
"superenv removed:
#{
dels
.
join
(
" "
)
}
\n
"
unless
dels
.
empty?
s
<<
"superenv added:
#{
adds
.
join
(
" "
)
}
\n
"
unless
adds
.
empty?
s
<<
"superenv executed:
#{
tool
}
#{
args
.
join
(
" "
)
}
\n\n
"
File
.
open
(
"
#{
ENV
[
"HOMEBREW_CC_LOG_PATH"
]
}
.cc"
,
"a+"
)
{
|
f
|
f
.
write
(
s
)
}
end
if
__FILE__
==
$PROGRAM_NAME
##################################################################### sanity
abort
"The build-tool has reset ENV. --env=std required."
unless
ENV
[
'HOMEBREW_BREW_FILE'
]
...
...
@@ -334,13 +311,10 @@ if __FILE__ == $PROGRAM_NAME
dirname
,
basename
=
File
.
split
(
$0
)
LOGGER
.
puts
"
#{
basename
}
called with:
#{
ARGV
.
join
(
" "
)
}
"
cmd
=
Cmd
.
new
(
basename
,
ARGV
)
tool
,
args
=
cmd
.
tool
,
cmd
.
args
LOGGER
.
puts
"superenv executed:
#{
tool
}
#{
args
.
join
(
" "
)
}
"
LOGGER
.
log!
log
(
basename
,
ARGV
,
tool
,
args
)
args
<<
{
:close_others
=>
false
}
if
RUBY_VERSION
>=
"2.0"
exec
"
#{
dirname
}
/xcrun"
,
tool
,
*
args
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment