Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
956c8eed
Kaydet (Commit)
956c8eed
authored
Mar 05, 2013
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
world's lamest code for generating graphviz from module deps.
üst
0e838cea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
8 deletions
+97
-8
Makefile.in
Makefile.in
+1
-1
module-deps.pl
bin/module-deps.pl
+96
-7
No files found.
Makefile.in
Dosyayı görüntüle @
956c8eed
...
...
@@ -405,7 +405,7 @@ findunusedcode:
check
:
dev-install subsequentcheck
dump-deps
:
$(SRCDIR)
/bin/module-deps.pl
$(GNUMAKE)
$(SRCDIR)
/Makefile.gbuild
@
$(SRCDIR)
/bin/module-deps.pl
$(GNUMAKE)
$(SRCDIR)
/Makefile.gbuild
subsequentcheck
:
| $(if $(filter-out subsequentcheck
,
$(MAKECMDGOALS))
,
dev-install)
$(GNUMAKE)
-j
$(CHECK_PARALLELISM)
$(GMAKE_OPTIONS)
-f
$(SRCDIR)
/Makefile.gbuild
$@
...
...
bin/module-deps.pl
Dosyayı görüntüle @
956c8eed
...
...
@@ -11,8 +11,8 @@ sub read_deps()
my
$invalid_tolerance
=
100
;
my
$line_count
=
0
;
my
%
deps
;
open
(
$p
,
"ENABLE_PRINT_DEPS=1 $gnumake -n -f $makefile_build all|"
)
||
die
"can't launch make: $!"
;
#
open ($p, "/tmp/deps") || die "can't read deps: $!";
#
open ($p, "ENABLE_PRINT_DEPS=1 $gnumake -n -f $makefile_build all|") || die "can't launch make: $!";
open
(
$p
,
"/tmp/deps"
)
||
die
"can't read deps: $!"
;
$|
=
1
;
print
STDERR
"reading deps "
;
while
(
<
$p
>
)
{
...
...
@@ -43,10 +43,19 @@ sub read_deps()
return
\%
deps
;
}
# graphviz etc. don't like some names
sub
clean_name
($)
{
my
$name
=
shift
;
$name
=~
s/[\-\/\.]/_/g
;
return
$name
;
}
# first create nodes for each entry
sub
build
_tree
($)
sub
clean
_tree
($)
{
my
$deps
=
shift
;
my
%
tree
;
for
my
$name
(
sort
keys
%
{
$deps
})
{
my
$need_str
=
$deps
->
{
$name
};
$need_str
=~
s/^\s+//g
;
...
...
@@ -54,15 +63,94 @@ sub build_tree($)
my
@needs
=
split
/\s+/
,
$need_str
;
$name
=~
m/^([^_]+)_(\S+)$/
||
die
"invalid target name: '$name'"
;
my
$type
=
$1
;
my
$target
=
$2
;
my
$target
=
clean_name
(
$2
)
;
$type
eq
'Executable'
||
$type
eq
'Library'
||
$type
eq
'CppunitTest'
||
die
"Unknown type '$type'"
;
print
"$target ($type): "
.
join
(
','
,
@needs
)
.
"\n"
;
my
%
result
;
$result
{
type
}
=
$type
;
$result
{
target
}
=
$target
;
$result
{
generation
}
=
0
;
my
@clean_needs
;
for
my
$need
(
@needs
)
{
push
@clean_needs
,
clean_name
(
$need
);
}
$result
{
deps
}
=
\
@clean_needs
;
if
(
defined
$tree
{
$target
})
{
print
STDERR
"warning -duplicate target: '$target'\n"
;
}
$tree
{
$target
}
=
\%
result
;
# print "$target ($type): " . join (',', @clean_needs) . "\n";
}
return
\%
tree
;
}
sub
is_existing_child
($$$$);
sub
is_existing_child
($$$$)
{
my
(
$tree
,
$search
,
$name
,
$generation
)
=
@_
;
my
$node
=
$tree
->
{
$name
};
# print STDERR "\tis $search a child of $name ?\n";
# cyclic check ...
if
(
$node
->
{
generation
}
==
$generation
)
{
# print STDERR "probable cyclic dependency graph hunting for $search in $name\n";
}
$node
->
{
generation
}
=
$generation
;
for
my
$child
(
@
{
$node
->
{
deps
}})
{
if
(
$child
eq
$search
)
{
return
1
;
}
return
1
if
(
is_existing_child
(
$tree
,
$search
,
$child
,
$generation
));
}
return
0
;
}
sub
dump_graphviz
($)
{
my
$tree
=
shift
;
my
$generation
=
1
;
print
"digraph LibreOffice {\n"
;
for
my
$name
(
sort
keys
%
{
$tree
})
{
my
$result
=
$tree
->
{
$name
};
if
(
$result
->
{
type
}
eq
'CppunitTest'
||
(
$result
->
{
type
}
eq
'Executable'
&&
$result
->
{
target
}
ne
'soffice_bin'
))
{
next
;
# de-bloat the tree
}
# print STDERR "minimising deps for $result->{target}\n";
my
@newdeps
;
for
my
$dep
(
@
{
$result
->
{
deps
}})
{
my
$print
=
1
;
# is this implied by any other child ?
# print STDERR "checking if '$dep' is redundant\n";
for
my
$other_dep
(
@
{
$result
->
{
deps
}})
{
$generation
++
;
next
if
(
$other_dep
eq
$dep
);
if
(
is_existing_child
(
$tree
,
$dep
,
$other_dep
,
$generation
))
{
$print
=
0
;
# print STDERR "$dep is implied by $other_dep - ignoring\n";
}
}
print
"$name -> $dep;\n"
if
(
$print
);
push
@newdeps
,
$dep
;
}
# re-write the shrunk set to accelerate things
$result
->
{
deps
}
=
\
@newdeps
;
}
print
"}\n"
;
}
my
$graphviz
=
1
;
while
(
my
$arg
=
shift
@ARGV
)
{
if
(
!
defined
$gnumake
)
{
if
(
$arg
eq
'--graph'
||
$arg
eq
'-g'
)
{
$graphviz
=
1
;
}
elsif
(
!
defined
$gnumake
)
{
$gnumake
=
$arg
;
}
elsif
(
!
defined
$makefile_build
)
{
$makefile_build
=
$arg
;
...
...
@@ -75,5 +163,6 @@ $gnumake = 'make' if (!defined $gnumake);
$makefile_build
=
'Makefile.gbuild'
if
(
!
defined
$makefile_build
);
my
$deps
=
read_deps
();
my
$tree
=
build
_tree
(
$deps
);
my
$tree
=
clean
_tree
(
$deps
);
dump_graphviz
(
$tree
);
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