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B,QAAvB,EAA/E,CAAP;AACD,CAJH,E","sourcesContent":["import { readJson, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { UploadTask, Arch, Packager, PackagerOptions, PublishOptions } from \"..\"\nimport { InvalidConfigurationError } from \"builder-util\"\nimport SnapTarget from \"../targets/snap\"\n\nif (process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG == null) {\n process.env.BUILDER_REMOVE_STAGE_EVEN_IF_DEBUG = \"true\"\n}\n\nasync function doBuild(data: BuildTask): Promise<void> {\n if (process.env.APP_BUILDER_TMP_DIR == null) {\n throw new InvalidConfigurationError(\"Env APP_BUILDER_TMP_DIR must be set for builder process\")\n }\n\n const projectDir = process.env.PROJECT_DIR\n if (projectDir == null) {\n throw new InvalidConfigurationError(\"Env PROJECT_DIR must be set for builder process\")\n }\n\n const targets = data.targets\n if (data.platform == null) {\n throw new InvalidConfigurationError(\"platform not specified\")\n }\n if (targets == null) {\n throw new InvalidConfigurationError(\"targets path not specified\")\n }\n if (!Array.isArray(targets)) {\n throw new InvalidConfigurationError(\"targets must be array of target name\")\n }\n\n const infoFile = projectDir + path.sep + \"info.json\"\n const info = await readJson(infoFile)\n\n const projectOutDir = process.env.PROJECT_OUT_DIR\n if (projectDir == null) {\n throw new InvalidConfigurationError(\"Env PROJECT_OUT_DIR must be set for builder process\")\n }\n\n // yes, for now we expect the only target\n const prepackaged = projectDir + path.sep + targets[0].unpackedDirName\n // do not use build function because we don't need to publish artifacts\n const options: PackagerOptions & PublishOptions = {\n prepackaged,\n projectDir,\n [data.platform]: targets.map(it => it.name + \":\" + it.arch),\n publish: \"never\",\n }\n const packager = new Packager(options)\n\n const artifacts: Array<ArtifactInfo> = []\n const relativePathOffset = projectOutDir!!.length + 1\n packager.artifactCreated(event => {\n if (event.file == null) {\n return\n }\n\n artifacts.push({\n file: event.file.substring(relativePathOffset),\n target: event.target == null ? null : event.target.name,\n arch: event.arch,\n safeArtifactName: event.safeArtifactName,\n isWriteUpdateInfo: event.isWriteUpdateInfo === true,\n updateInfo: event.updateInfo,\n })\n })\n\n packager.stageDirPathCustomizer = (target, packager, arch) => {\n // snap creates a lot of files and so, we cannot use tmpfs to avoid out of memory error\n const parentDir = target.name === \"snap\" && !(target as SnapTarget).isUseTemplateApp ? projectOutDir : projectDir\n return parentDir + path.sep + `__${target.name}-${Arch[arch]}`\n }\n\n // _build method expects final effective configuration - packager.options.config is ignored\n await packager._build({\n ...info.configuration,\n publish: null,\n beforeBuild: null,\n afterPack: null,\n afterSign: null,\n afterAllArtifactBuild: null,\n onNodeModuleFile: null,\n directories: {\n output: projectOutDir,\n buildResources: projectDir + path.sep + info.buildResourceDirName\n },\n }, info.metadata, info.devMetadata, info.repositoryInfo)\n\n // writeJson must be not used because it adds unwanted \\n as last file symbol\n await writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!!, \"__build-result.json\"), JSON.stringify(artifacts))\n}\n\ndoBuild(JSON.parse(process.argv[2]))\n .catch(error => {\n process.exitCode = 0\n return writeFile(path.join(process.env.APP_BUILDER_TMP_DIR!!, \"__build-result.json\"), (error.stack || error).toString())\n })\n\ninterface TargetInfo {\n name: string\n arch: string\n unpackedDirName: string\n}\n\ninterface ArtifactInfo extends UploadTask {\n target: string | null\n\n readonly isWriteUpdateInfo?: boolean\n readonly updateInfo?: any\n}\n\ninterface BuildTask {\n platform: string\n targets: Array<TargetInfo>\n}"],"sourceRoot":""}
|