Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
6c56c5bd
Commit
6c56c5bd
authored
Jul 21, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Look for largest build info file rather than most recently modified
parent
64dc3554
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
772 additions
and
198 deletions
+772
-198
source_ids.go
op-bindings/bindings/source_ids.go
+763
-187
main.go
op-bindings/gen/main.go
+9
-11
No files found.
op-bindings/bindings/source_ids.go
View file @
6c56c5bd
This diff is collapsed.
Click to expand it.
op-bindings/gen/main.go
View file @
6c56c5bd
...
@@ -12,7 +12,6 @@ import (
...
@@ -12,7 +12,6 @@ import (
"regexp"
"regexp"
"strings"
"strings"
"text/template"
"text/template"
"time"
"github.com/ethereum-optimism/optimism/op-bindings/ast"
"github.com/ethereum-optimism/optimism/op-bindings/ast"
"github.com/ethereum-optimism/optimism/op-bindings/foundry"
"github.com/ethereum-optimism/optimism/op-bindings/foundry"
...
@@ -210,7 +209,7 @@ func main() {
...
@@ -210,7 +209,7 @@ func main() {
log
.
Printf
(
"wrote file %s
\n
"
,
outfile
.
Name
())
log
.
Printf
(
"wrote file %s
\n
"
,
outfile
.
Name
())
}
}
mostRecentBuildInfo
,
err
:=
get
MostRecentlyModifiedFile
(
f
.
ForgeBuildInfo
)
mostRecentBuildInfo
,
err
:=
get
LargestInDir
(
f
.
ForgeBuildInfo
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Fatalf
(
"Error getting most recently modified build info file: %v"
,
err
)
log
.
Fatalf
(
"Error getting most recently modified build info file: %v"
,
err
)
}
}
...
@@ -260,10 +259,10 @@ func main() {
...
@@ -260,10 +259,10 @@ func main() {
log
.
Printf
(
"wrote file %s
\n
"
,
outfile
.
Name
())
log
.
Printf
(
"wrote file %s
\n
"
,
outfile
.
Name
())
}
}
// get
MostRecentlyModifiedFile returns the path of the most recently modified file in the given
directory.
// get
LargestInDir returns the path of the largest file in a
directory.
func
get
MostRecentlyModifiedFile
(
dirPath
string
)
(
string
,
error
)
{
func
get
LargestInDir
(
dirPath
string
)
(
string
,
error
)
{
var
mostRecen
tFile
string
var
larges
tFile
string
var
mostRecentModTime
time
.
Time
var
largestSize
int64
err
:=
filepath
.
Walk
(
dirPath
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
err
:=
filepath
.
Walk
(
dirPath
,
func
(
path
string
,
info
os
.
FileInfo
,
err
error
)
error
{
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -272,17 +271,16 @@ func getMostRecentlyModifiedFile(dirPath string) (string, error) {
...
@@ -272,17 +271,16 @@ func getMostRecentlyModifiedFile(dirPath string) (string, error) {
// Check if the current path is a regular file and not a directory
// Check if the current path is a regular file and not a directory
if
!
info
.
IsDir
()
{
if
!
info
.
IsDir
()
{
modTime
:=
info
.
ModTime
()
if
info
.
Size
()
>
largestSize
{
if
modTime
.
After
(
mostRecentModTime
)
{
largestFile
=
path
mostRecentModTime
=
modTime
largestSize
=
info
.
Size
()
mostRecentFile
=
path
}
}
}
}
return
nil
return
nil
})
})
return
mostRecen
tFile
,
err
return
larges
tFile
,
err
}
}
var
tmpl
=
`// Code generated - DO NOT EDIT.
var
tmpl
=
`// Code generated - DO NOT EDIT.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment