"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JavaExporter = void 0; const fs = require("fs-extra"); const path = require("path"); const KhaExporter_1 = require("./KhaExporter"); const ImageTool_1 = require("../ImageTool"); class JavaExporter extends KhaExporter_1.KhaExporter { constructor(options) { super(options); } haxeOptions(name, targetOptions, defines) { const sources = path.join(this.options.to, this.sysdir(), 'Sources'); if (fs.existsSync(sources)) { fs.removeSync(sources); } defines.push('no-compilation'); defines.push('sys_' + this.options.target); defines.push('sys_g1'); defines.push('sys_g2'); defines.push('sys_a1'); defines.push('kha_' + this.options.target); if (this.options.target !== 'java') { defines.push('kha_java'); defines.push('kha_' + this.options.target + '_java'); } defines.push('kha_g1'); defines.push('kha_g2'); defines.push('kha_a1'); return { from: this.options.from, to: path.join(this.sysdir(), 'Sources'), sources: this.sources, libraries: this.libraries, defines: defines, parameters: this.parameters, haxeDirectory: this.options.haxe, system: this.sysdir(), language: 'java', width: this.width, height: this.height, name: name, main: this.options.main, }; } async export(name, targetOptions, haxeOptions) { fs.ensureDirSync(path.join(this.options.to, this.sysdir())); this.exportEclipseProject(); } backend() { return 'Java'; } exportEclipseProject() { this.writeFile(path.join(this.options.to, this.sysdir(), '.classpath')); this.p(''); this.p(''); this.p('\t'); this.p('\t'); this.p('\t'); this.p(''); this.closeFile(); this.writeFile(path.join(this.options.to, this.sysdir(), '.project')); this.p(''); this.p(''); this.p('\t' + path.parse(this.options.to).name + ''); this.p('\t'); this.p('\t'); this.p('\t'); this.p('\t'); this.p('\t\t'); this.p('\t\t\torg.eclipse.jdt.core.javabuilder'); this.p('\t\t\t'); this.p('\t\t\t'); this.p('\t\t'); this.p('\t'); this.p('\t'); this.p('\t\torg.eclipse.jdt.core.javanature'); this.p('\t'); this.p(''); this.closeFile(); } /*copyMusic(platform, from, to, encoders) { this.copyFile(from, this.directory.resolve(this.sysdir()).resolve(to + '.wav')); callback([to + '.wav']); }*/ async copySound(platform, from, to) { fs.copySync(from.toString(), path.join(this.options.to, this.sysdir(), to + '.wav'), { overwrite: true }); return { files: [to + '.wav'], sizes: [1] }; } async copyImage(platform, from, to, asset, cache) { let format = await (0, ImageTool_1.exportImage)(this.options.kha, this.options.kraffiti, from, path.join(this.options.to, this.sysdir(), to), asset, undefined, false, false, cache); return { files: [to + '.' + format], sizes: [1] }; } async copyBlob(platform, from, to) { fs.copySync(from.toString(), path.join(this.options.to, this.sysdir(), to), { overwrite: true }); return { files: [to], sizes: [1] }; } async copyVideo(platform, from, to) { return { files: [to], sizes: [1] }; } } exports.JavaExporter = JavaExporter; //# sourceMappingURL=JavaExporter.js.map