MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / getPlatformBuiltins

Method getPlatformBuiltins

tools/mcpack.js:1057–1101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1055 return builtins;
1056 }
1057 getPlatformBuiltins() {
1058 const version = this.getToolsVersion();
1059 const platform = this.platform;
1060 let cachePath = this.createDirectories(this.outputPath, "tmp", platform);
1061 if (this.subplatform)
1062 cachePath = this.createDirectories(cachePath, this.subplatform);
1063 else if ((platform == "lin") || (platform == "mac") || (platform == "win"))
1064 cachePath = this.createDirectories(cachePath, "mc");
1065 cachePath += this.slash + "mcpack-cache.json";
1066// if (this.isDirectoryOrFile(cachePath) == 1) {
1067// try {
1068// const cacheBuffer = this.readFileString(cachePath);
1069// const cacheJSON = JSON.parse(cacheBuffer);
1070// if (cacheJSON.version == version) {
1071// return cacheJSON.builtins;
1072// }
1073// }
1074// catch {
1075// }
1076// }
1077
1078 const currentDirectory = this.currentDirectory;
1079 this.manifests = [];
1080 this.manifests.already = {};
1081 const bases = [
1082 this.examplesPath + this.slash + "manifest_base.json",
1083 this.examplesPath + this.slash + "manifest_commodetto.json",
1084 this.examplesPath + this.slash + "manifest_piu.json",
1085 this.examplesPath + this.slash + "manifest_net.json",
1086 this.modulesPath + this.slash + "network" + this.slash + "ble" + this.slash + "manifest_client.json",
1087 this.modulesPath + this.slash + "network" + this.slash + "ble" + this.slash + "manifest_server.json",
1088 this.modulesPath + this.slash + "io" + this.slash + "manifest.json",
1089 ];
1090 for (let base of bases)
1091 this.parseManifest(base, base);
1092 this.recurseDirectory(this.modulesPath, this.filterManifestFile, this.parseManifest);
1093 const builtins = this.getBuiltins(this.manifests);
1094 this.currentDirectory = currentDirectory;
1095
1096 const cacheJSON = { version, builtins };
1097 const cacheBuffer = JSON.stringify(cacheJSON, null, "\t");
1098 this.writeFileString(cachePath, cacheBuffer);
1099
1100 return builtins;
1101 }
1102 includeManifest(include, from, directory) {
1103 this.currentDirectory = directory;
1104 if ("string" !== typeof include)

Callers 1

runMethod · 0.80

Calls 4

recurseDirectoryMethod · 0.80
getBuiltinsMethod · 0.80
createDirectoriesMethod · 0.45
parseManifestMethod · 0.45

Tested by

no test coverage detected