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5B,CAAiC,iBAAtD,CAAnB;AAYP;;AAVD,MAAI,OAAJ,GAAW;AACT,WAAO,KAAK,MAAL,CAAY,OAAnB;AACD;;AAED,MAAI,MAAJ,GAAU;AACR,WAAO,KAAK,MAAL,CAAY,MAAnB;AACD;;AAMD,QAAM,WAAN,GAAiB;AACf,UAAM,KAAK,gBAAL,CAAsB,UAAtB,EAAN;AACA,UAAM,KAAK,aAAL,CAAmB,KAAnB,EAAN;AACD;;AAED,EAAA,KAAK,CAAC,SAAD,EAAoB,IAApB,EAA8B;AACjC,UAAM,OAAO,GAAG,KAAK,OAAL,CAAa,SAAb,EAAwB,IAAxB,CAAhB;AACA,SAAK,gBAAL,CAAsB,OAAtB,CAA8B,OAA9B;AACA,WAAO,OAAP;AACD;;AAEO,QAAM,OAAN,CAAc,SAAd,EAAiC,IAAjC,EAA2C;AACjD,uBAAI,IAAJ,CAAS;AAAC,MAAA,MAAM,EAAE,KAAK,MAAL,CAAY,IAArB;AAA2B,MAAA,IAAI,EAAE,oBAAK,IAAL;AAAjC,KAAT,EAAuD,yBAAvD;;AACA,UAAM,KAAK,MAAL,CAAY,YAAZ,EAAN;AACA,SAAK,aAAL,CAAmB,aAAnB,CAAiC,KAAK,MAAtC,EAA8C,IAA9C,EAAoD,SAApD;AACD;;AA9B8B;;AAiC3B,SAAU,oBAAV,CAA+B,IAA/B,EAAyC;AAC7C,UAAQ,IAAR;AACE,SAAK,oBAAK,GAAV;AACE,aAAO,QAAP;;AACF,SAAK,oBAAK,IAAV;AACE,aAAO,MAAP;;AACF,SAAK,oBAAK,MAAV;AACE,aAAO,KAAP;;AACF,SAAK,oBAAK,KAAV;AACE,aAAO,aAAP;;AAEF;AACE,YAAM,IAAI,KAAJ,CAAU,oBAAoB,IAAI,EAAlC,CAAN;AAXJ;AAaD,C","sourcesContent":["import { Arch, AsyncTaskManager, log } from \"builder-util\"\nimport sanitizeFileName from \"sanitize-filename\"\nimport { DIR_TARGET, Platform, Target, TargetSpecificOptions } from \"./core\"\nimport { LinuxConfiguration } from \"./options/linuxOptions\"\nimport { Packager } from \"./packager\"\nimport { PlatformPackager } from \"./platformPackager\"\nimport { RemoteBuilder } from \"./remoteBuilder/RemoteBuilder\"\nimport AppImageTarget from \"./targets/AppImageTarget\"\nimport FpmTarget from \"./targets/fpm\"\nimport { LinuxTargetHelper } from \"./targets/LinuxTargetHelper\"\nimport SnapTarget from \"./targets/snap\"\nimport { createCommonTarget } from \"./targets/targetFactory\"\n\nexport class LinuxPackager extends PlatformPackager<LinuxConfiguration> {\n readonly executableName: string\n\n constructor(info: Packager) {\n super(info, Platform.LINUX)\n\n const executableName = this.platformSpecificBuildOptions.executableName\n this.executableName = executableName == null ? this.appInfo.sanitizedName.toLowerCase() : sanitizeFileName(executableName)\n }\n\n get defaultTarget(): Array<string> {\n return [\"snap\", \"appimage\"]\n }\n\n createTargets(targets: Array<string>, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n let helper: LinuxTargetHelper | null\n const getHelper = () => {\n if (helper == null) {\n helper = new LinuxTargetHelper(this)\n }\n return helper\n }\n\n let remoteBuilder: RemoteBuilder | null = null\n\n for (const name of targets) {\n if (name === DIR_TARGET) {\n continue\n }\n\n const targetClass: typeof AppImageTarget | typeof SnapTarget | typeof FpmTarget | null = (() => {\n switch (name) {\n case \"appimage\":\n return require(\"./targets/AppImageTarget\").default\n case \"snap\":\n return require(\"./targets/snap\").default\n case \"deb\":\n case \"rpm\":\n case \"sh\":\n case \"freebsd\":\n case \"pacman\":\n case \"apk\":\n case \"p5p\":\n return require(\"./targets/fpm\").default\n default:\n return null\n }\n })()\n\n mapper(name, outDir => {\n if (targetClass === null) {\n return createCommonTarget(name, outDir, this)\n }\n\n const target = new targetClass(name, this, getHelper(), outDir)\n if (process.platform === \"win32\" || process.env._REMOTE_BUILD) {\n if (remoteBuilder == null) {\n remoteBuilder = new RemoteBuilder(this)\n }\n // return remoteBuilder.buildTarget(this, arch, appOutDir, this.packager)\n return new RemoteTarget(target, remoteBuilder)\n }\n return target\n })\n }\n }\n}\n\nclass RemoteTarget extends Target {\n private buildTaskManager = new AsyncTaskManager(this.remoteBuilder.packager.info.cancellationToken)\n\n get options(): TargetSpecificOptions | null | undefined {\n return this.target.options\n }\n\n get outDir(): string {\n return this.target.outDir\n }\n\n constructor(private readonly target: Target, private readonly remoteBuilder: RemoteBuilder) {\n super(target.name, true /* all must be scheduled in time (so, on finishBuild RemoteBuilder will have all targets added - so, we must set isAsyncSupported to true (resolved promise is returned)) */)\n }\n\n async finishBuild() {\n await this.buildTaskManager.awaitTasks()\n await this.remoteBuilder.build()\n }\n\n build(appOutDir: string, arch: Arch) {\n const promise = this.doBuild(appOutDir, arch)\n this.buildTaskManager.addTask(promise)\n return promise\n }\n\n private async doBuild(appOutDir: string, arch: Arch) {\n log.info({target: this.target.name, arch: Arch[arch]}, \"scheduling remote build\")\n await this.target.checkOptions()\n this.remoteBuilder.scheduleBuild(this.target, arch, appOutDir)\n }\n}\n\nexport function toAppImageOrSnapArch(arch: Arch): string {\n switch (arch) {\n case Arch.x64:\n return \"x86_64\"\n case Arch.ia32:\n return \"i386\"\n case Arch.armv7l:\n return \"arm\"\n case Arch.arm64:\n return \"arm_aarch64\"\n\n default:\n throw new Error(`Unsupported arch ${arch}`)\n }\n}"],"sourceRoot":""}
|