@@ -19,6 +19,7 @@ const OTF2TTF = `otf2ttf`;
19
19
const OTFCCDUMP = `otfccdump` ;
20
20
const OTFCCBUILD = `otfccbuild` ;
21
21
const TTFAUTOHINT = `ttfautohint` ;
22
+ const SEVEN_ZIP = `7z` ;
22
23
23
24
build . setJournal ( `build/.verda-build-journal` ) ;
24
25
build . setSelfTracking ( ) ;
@@ -192,17 +193,18 @@ const Pass4Otd = file.make(
192
193
///////////////////////////////////////////////////////////////////////////////////////////////////
193
194
// Pass 5
194
195
195
- const PASS5 = `${ OUT } ` ;
196
+ const OutTtf = `${ OUT } /ttf` ;
197
+ const OutTtc = `${ OUT } /ttc` ;
196
198
const Pass5Ttf = file . make (
197
- ( init , weight ) => `${ PASS5 } /${ init } -${ weight } .ttf` ,
199
+ ( init , weight ) => `${ OutTtf } /${ init } -${ weight } .ttf` ,
198
200
async ( $ , output , init , weight ) => {
199
- await $ . need ( de ( PASS5 ) ) ;
201
+ await $ . need ( de ( OutTtf ) ) ;
200
202
const [ input ] = await $ . need ( Pass4Otd ( init , weight ) ) ;
201
203
await OtfccBuildAsIs ( input . full , output . full ) ;
202
204
}
203
205
) ;
204
206
const Pass5Group = file . make (
205
- ( init , weight ) => `${ PASS5 } /${ init } -${ weight } .ttc` ,
207
+ ( init , weight ) => `${ OutTtc } /${ init } -${ weight } .ttc` ,
206
208
async ( $ , output , init , weight ) => {
207
209
const [ config ] = await $ . need ( Config ) ;
208
210
const [ ttfs ] = await $ . need ( GroupFileNamesT ( config , weight , Pass5Ttf ) ) ;
@@ -220,6 +222,39 @@ const All = task(`all`, async $ => {
220
222
await $ . need ( config . weights . map ( w => Pass5Group ( config . prefix , w ) ) ) ;
221
223
} ) ;
222
224
225
+ const TTCArchive = file . make (
226
+ version => `${ OUT } /source-han-sans-ttc-${ version } .7z` ,
227
+ async ( t , target ) => {
228
+ await t . need ( All ) ;
229
+ await rm ( target . full ) ;
230
+ await cd ( `${ OUT } /ttc` ) . run (
231
+ [ SEVEN_ZIP , `a` ] ,
232
+ [ `-t7z` , `-mmt=on` , `-m0=LZMA:a=0:d=1536m:fb=256` ] ,
233
+ [ `../${ target . name } .7z` , `*.ttc` ]
234
+ ) ;
235
+ }
236
+ ) ;
237
+ const TTFArchive = file . make (
238
+ version => `${ OUT } /source-han-sans-ttf-${ version } .7z` ,
239
+ async ( t , target ) => {
240
+ const [ config ] = await t . need ( Config , de `${ OUT } /ttf` ) ;
241
+ await t . need ( All ) ;
242
+ await rm ( target . full ) ;
243
+ for ( const weight of config . weights ) {
244
+ await cd ( `${ OUT } /ttf` ) . run (
245
+ [ SEVEN_ZIP , `a` ] ,
246
+ [ `-t7z` , `-mmt=on` , `-m0=LZMA:a=0:d=1536m:fb=256` ] ,
247
+ [ `../${ target . name } .7z` , `*-${ weight } .ttf` ]
248
+ ) ;
249
+ }
250
+ }
251
+ ) ;
252
+
253
+ const Release = task ( `release` , async $ => {
254
+ const version = await $ . need ( Version ) ;
255
+ await $ . need ( TTFArchive ( version ) , TTCArchive ( version ) ) ;
256
+ } ) ;
257
+
223
258
async function OtfccBuildAsIs ( from , to ) {
224
259
await run ( OTFCCBUILD , from , [ `-o` , to ] , [ `-k` , `-s` , `--keep-average-char-width` , `-q` ] ) ;
225
260
}
@@ -229,4 +264,8 @@ async function OtfccBuildAsIs(from, to) {
229
264
const Config = oracle ( "config" , async ( ) => {
230
265
return await fs . readJSON ( __dirname + "/config.json" ) ;
231
266
} ) ;
267
+ const Version = oracle ( "oracles::version" , async ( ) => {
268
+ const pkg = await fs . readJSON ( __dirname + "/package.json" ) ;
269
+ return pkg . version ;
270
+ } ) ;
232
271
const JHint = oracle ( "hinting-jobs" , async ( ) => os . cpus ( ) . length ) ;
0 commit comments