|
1 | 1 | import * as fs from 'fs'; |
2 | 2 | import { BuildActivity } from './BuildActivity.js'; |
3 | 3 | import { CompilerCallbacks, CompilerOptions, KeymanFileTypes } from '@keymanapp/common-types'; |
4 | | -import { writeModelMetadataFile } from '@keymanapp/kmc-model-info'; |
| 4 | +import { ModelInfoCompiler } from '@keymanapp/kmc-model-info'; |
5 | 5 | import { KmpCompiler } from '@keymanapp/kmc-package'; |
6 | 6 | import { loadProject } from '../../util/projectLoader.js'; |
7 | 7 | import { InfrastructureMessages } from '../../messages/infrastructureMessages.js'; |
8 | 8 | import { calculateSourcePath } from '../../util/calculateSourcePath.js'; |
9 | | -import { getLastGitCommitDate } from 'src/util/getLastGitCommitDate.js'; |
| 9 | +import { getLastGitCommitDate } from '../../util/getLastGitCommitDate.js'; |
10 | 10 |
|
11 | 11 | export class BuildModelInfo extends BuildActivity { |
12 | 12 | public get name(): string { return 'Lexical model metadata'; } |
@@ -57,19 +57,16 @@ export class BuildModelInfo extends BuildActivity { |
57 | 57 | } |
58 | 58 |
|
59 | 59 | const lastCommitDate = getLastGitCommitDate(project.projectPath); |
60 | | - |
61 | | - const data = writeModelMetadataFile( |
62 | | - callbacks, |
63 | | - { |
64 | | - model_id: callbacks.path.basename(project.projectPath, KeymanFileTypes.Source.Project), |
65 | | - kmpJsonData, |
66 | | - sourcePath: calculateSourcePath(infile), |
67 | | - modelFileName: project.resolveOutputFilePath(model, KeymanFileTypes.Source.Model, KeymanFileTypes.Binary.Model), |
68 | | - kmpFileName: project.resolveOutputFilePath(kps, KeymanFileTypes.Source.Package, KeymanFileTypes.Binary.Package), |
69 | | - kpsFilename: project.resolveInputFilePath(kps), |
70 | | - lastCommitDate |
71 | | - } |
72 | | - ); |
| 60 | + const compiler = new ModelInfoCompiler(callbacks); |
| 61 | + const data = compiler.writeModelMetadataFile({ |
| 62 | + model_id: callbacks.path.basename(project.projectPath, KeymanFileTypes.Source.Project), |
| 63 | + kmpJsonData, |
| 64 | + sourcePath: calculateSourcePath(infile), |
| 65 | + modelFileName: project.resolveOutputFilePath(model, KeymanFileTypes.Source.Model, KeymanFileTypes.Binary.Model), |
| 66 | + kmpFileName: project.resolveOutputFilePath(kps, KeymanFileTypes.Source.Package, KeymanFileTypes.Binary.Package), |
| 67 | + kpsFilename: project.resolveInputFilePath(kps), |
| 68 | + lastCommitDate |
| 69 | + }); |
73 | 70 |
|
74 | 71 | if(data == null) { |
75 | 72 | // Error messages have already been emitted by writeModelMetadataFile |
|
0 commit comments