File tree Expand file tree Collapse file tree
jig-cli/src/main/java/org/dddjava/jig/cli
jig-core/src/main/java/org/dddjava/jig
jig-gradle-plugin/src/main/java/org/dddjava/jig/gradle Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import org .dddjava .jig .HandleResult ;
44import org .dddjava .jig .JigExecutor ;
5+ import org .dddjava .jig .JigResult ;
56import org .dddjava .jig .domain .model .sources .filesystem .SourceBasePaths ;
67import org .dddjava .jig .infrastructure .configuration .Configuration ;
78import org .slf4j .Logger ;
@@ -33,12 +34,17 @@ void run() {
3334 long startTime = System .currentTimeMillis ();
3435 SourceBasePaths sourceBasePaths = cliConfig .rawSourceLocations ();
3536
36- List <HandleResult > handleResultList = JigExecutor .standard (configuration , sourceBasePaths ).listResult ();
37+ JigResult jigResult = JigExecutor .standard (configuration , sourceBasePaths );
38+ List <HandleResult > handleResultList = jigResult .listResult ();
3739
3840 String resultLog = handleResultList .stream ()
3941 .filter (HandleResult ::success )
4042 .map (handleResult -> handleResult .jigDocument () + " : " + handleResult .outputFilePathsText ())
4143 .collect (joining ("\n " ));
44+ if (!resultLog .isBlank ()) {
45+ resultLog += "\n " ;
46+ }
47+ resultLog += "index : [ " + jigResult .indexFilePath () + " ]" ;
4248 logger .info ("-- Output Complete {} ms -------------------------------------------\n {}\n ------------------------------------------------------------" ,
4349 System .currentTimeMillis () - startTime ,
4450 resultLog );
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ public interface JigResult {
1010
1111 JigSummary summary ();
1212
13+ java .nio .file .Path indexFilePath ();
14+
1315 /**
1416 * 集計
1517 */
@@ -25,4 +27,3 @@ public static JigSummary empty() {
2527 }
2628 }
2729}
28-
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public JigResult generate(JigRepository jigRepository) {
7777
7878 generateIndex (handleResults );
7979 generateAssets ();
80- return new JigResultData (handleResults );
80+ return new JigResultData (handleResults , IndexView . indexFilePath ( outputDirectory ) );
8181 }
8282
8383 private void prepareOutputDirectory () {
Original file line number Diff line number Diff line change 33import org .dddjava .jig .HandleResult ;
44import org .dddjava .jig .JigResult ;
55
6+ import java .nio .file .Path ;
67import java .util .Collection ;
78import java .util .Comparator ;
89import java .util .List ;
910
10- record JigResultData (Collection <HandleResult > handleResults ) implements JigResult {
11+ record JigResultData (Collection <HandleResult > handleResults , Path indexFilePath ) implements JigResult {
1112
1213 @ Override
1314 public List <HandleResult > listResult () {
@@ -20,4 +21,9 @@ public List<HandleResult> listResult() {
2021 public JigSummary summary () {
2122 throw new UnsupportedOperationException ();
2223 }
24+
25+ @ Override
26+ public Path indexFilePath () {
27+ return indexFilePath ;
28+ }
2329}
Original file line number Diff line number Diff line change 1515import java .util .*;
1616
1717public class IndexView {
18+ static final String INDEX_FILE_NAME = "index.html" ;
1819
1920 private final Map <String , Object > contextMap ;
2021 private final TemplateEngine templateEngine ;
@@ -53,7 +54,7 @@ private void write(Path outputDirectory) {
5354 contextMap .put ("jigVersion" , resolveJigVersion ());
5455 contextMap .put ("timestamp" , ZonedDateTime .now ().truncatedTo (ChronoUnit .SECONDS ));
5556
56- Path outputFilePath = outputDirectory . resolve ( "index.html" );
57+ Path outputFilePath = indexFilePath ( outputDirectory );
5758 try (OutputStream out = Files .newOutputStream (outputFilePath );
5859 OutputStream outputStream = new BufferedOutputStream (out );
5960 Writer writer = new java .io .OutputStreamWriter (outputStream , StandardCharsets .UTF_8 )
@@ -64,6 +65,10 @@ private void write(Path outputDirectory) {
6465 }
6566 }
6667
68+ public static Path indexFilePath (Path outputDirectory ) {
69+ return outputDirectory .resolve (INDEX_FILE_NAME );
70+ }
71+
6772 class DiagramComponent {
6873 JigDocument jigDocument ;
6974 List <String > srcList ;
Original file line number Diff line number Diff line change 22
33import org .dddjava .jig .HandleResult ;
44import org .dddjava .jig .JigExecutor ;
5+ import org .dddjava .jig .JigResult ;
56import org .dddjava .jig .domain .model .sources .filesystem .SourceBasePaths ;
67import org .dddjava .jig .infrastructure .configuration .Configuration ;
78import org .gradle .api .DefaultTask ;
@@ -30,12 +31,17 @@ void outputReports() {
3031 long startTime = System .currentTimeMillis ();
3132 SourceBasePaths sourceBasePaths = new GradleProject (project ).rawSourceLocations ();
3233
33- List <HandleResult > handleResultList = JigExecutor .standard (configuration , sourceBasePaths ).listResult ();
34+ JigResult jigResult = JigExecutor .standard (configuration , sourceBasePaths );
35+ List <HandleResult > handleResultList = jigResult .listResult ();
3436
3537 String resultLog = handleResultList .stream ()
3638 .filter (HandleResult ::success )
3739 .map (handleResult -> handleResult .jigDocument () + " : " + handleResult .outputFilePathsText ())
3840 .collect (joining ("\n " ));
41+ if (!resultLog .isBlank ()) {
42+ resultLog += "\n " ;
43+ }
44+ resultLog += "index : [ " + jigResult .indexFilePath () + " ]" ;
3945 getLogger ().info ("-- Output Complete {} ms -------------------------------------------\n {}\n ------------------------------------------------------------" ,
4046 System .currentTimeMillis () - startTime , resultLog );
4147 }
You can’t perform that action at this time.
0 commit comments