@@ -96,6 +96,65 @@ static void Build(BuildManagerSettings settings, BuildSequence sequence) {
96
96
}
97
97
98
98
static void PostBuild ( BuildSequence sequence ) {
99
+ bool isNeedChangelogFile = usedChangelog . versions . Count != 0 ;
100
+ bool isNeedReadmeFile = ! string . IsNullOrEmpty ( usedChangelog . readme ) ;
101
+ string changelogContent = "" ;
102
+ string readmeContent = usedChangelog . readme ;
103
+
104
+ if ( isNeedChangelogFile ) {
105
+ StringBuilder sb = new StringBuilder ( ) ;
106
+
107
+ ChangelogData . ChangelogEntryType lastType ;
108
+ ChangelogData . ChangelogEntryScope lastScope ;
109
+
110
+
111
+ for ( int i = usedChangelog . versions . Count - 1 ; i >= 0 ; -- i ) {
112
+ lastType = ( ChangelogData . ChangelogEntryType ) 255 ;
113
+ lastScope = ( ChangelogData . ChangelogEntryScope ) 255 ;
114
+ ChangelogData . ChangelogVersionEntry version = usedChangelog . versions [ i ] ;
115
+
116
+ if ( i != usedChangelog . versions . Count - 1 ) {
117
+ sb . Append ( "---------- \n " ) ;
118
+
119
+ }
120
+ sb . Append ( "# " ) ;
121
+ sb . Append ( version . GetVersionHeader ( ) ) ;
122
+ sb . Append ( "\n " ) ;
123
+
124
+ sb . Append ( version . descriptionText ) ;
125
+ sb . Append ( "\n \n " ) ;
126
+
127
+ for ( int j = 0 ; j < version . notes . Count ; ++ j ) {
128
+ ChangelogData . ChangelogNoteEntry note = version . notes [ j ] ;
129
+
130
+ if ( lastType != note . type ) {
131
+ if ( lastType != ( ChangelogData . ChangelogEntryType ) 255 )
132
+ sb . Append ( "\n " ) ;
133
+ lastType = note . type ;
134
+ lastScope = ( ChangelogData . ChangelogEntryScope ) 255 ;
135
+ sb . Append ( "## " ) ;
136
+ sb . Append ( note . type ) ;
137
+ sb . Append ( ": \n " ) ;
138
+ }
139
+
140
+ if ( lastScope != note . scope ) {
141
+ lastScope = note . scope ;
142
+ sb . Append ( "### " ) ;
143
+ sb . Append ( note . scope ) ;
144
+ sb . Append ( ": \n " ) ;
145
+ }
146
+
147
+ sb . Append ( " * " ) ;
148
+ sb . Append ( note . text ) ;
149
+ sb . Append ( "\n " ) ;
150
+ }
151
+
152
+ sb . Append ( "\n " ) ;
153
+ }
154
+
155
+ changelogContent = sb . ToString ( ) ;
156
+ }
157
+
99
158
for ( byte i = 0 ; i < sequence . builds . Count ; ++ i ) {
100
159
if ( ! sequence . builds [ i ] . isEnabled )
101
160
continue ;
@@ -125,6 +184,25 @@ static void PostBuild(BuildSequence sequence) {
125
184
process . Start ( ) ;
126
185
}
127
186
#endif
187
+
188
+ if ( sequence . builds [ i ] . targetGroup == BuildTargetGroup . Standalone ) {
189
+ string path = Path . Combine ( sequence . builds [ i ] . outputRoot + GetPathWithVars ( sequence . builds [ i ] , sequence . builds [ i ] . middlePath ) ) . Replace ( @"/" , @"\" ) ;
190
+ path = path . Substring ( 0 , path . LastIndexOf ( "\\ " ) ) ;
191
+
192
+ if ( isNeedChangelogFile ) {
193
+ File . WriteAllText (
194
+ Path . Combine ( path , "Changelog.txt" ) ,
195
+ changelogContent
196
+ ) ;
197
+ }
198
+
199
+ if ( isNeedReadmeFile ) {
200
+ File . WriteAllText (
201
+ Path . Combine ( path , "Readme.txt" ) ,
202
+ readmeContent
203
+ ) ;
204
+ }
205
+ }
128
206
}
129
207
}
130
208
}
0 commit comments