107 lines
2.4 KiB
TypeScript
107 lines
2.4 KiB
TypeScript
import { RJLog } from "./library/RJLog";
|
|
|
|
const { argv } = require("process");
|
|
const path = require( "path" );
|
|
const fs = require( "node:fs/promises" );
|
|
const { exists } = require( "./library.js" );
|
|
|
|
|
|
let targetDirectory = "outputs";
|
|
let godotName = "godot-4.3-dev-rokojori";
|
|
let platform = "argv[ 2 ]";
|
|
let godotPlatformName = godotName + "-" + "argv[ 2 ]";
|
|
let platformTargetDirectory = path.join( targetDirectory, godotPlatformName );
|
|
|
|
async function main()
|
|
{
|
|
|
|
if ( argv.length !== 3 )
|
|
{
|
|
let platforms = [ "windows" ];
|
|
|
|
console.error( "Platform missing in the command. Add one of these to the command line:", platforms.join( ", " ) );
|
|
|
|
return;
|
|
}
|
|
|
|
platform = argv[ 2 ];
|
|
godotPlatformName = godotName + "-" + argv[ 2 ];
|
|
platformTargetDirectory = path.join( targetDirectory, godotPlatformName );
|
|
|
|
RJLog.log( "Creating output" );
|
|
|
|
await deleteOldDirectory();
|
|
await createDirectory();
|
|
|
|
|
|
RJLog.log( "Output done" );
|
|
}
|
|
|
|
|
|
async function deleteOldDirectory()
|
|
{
|
|
|
|
let directoryExists = await exists( platformTargetDirectory );
|
|
|
|
RJLog.log( "checking if old directory exists", directoryExists );
|
|
|
|
if ( directoryExists )
|
|
{
|
|
RJLog.log( `deleting previous directory: "${platformTargetDirectory}"` );
|
|
await fs.rm( platformTargetDirectory, { recursive: true } );
|
|
}
|
|
|
|
return Promise.resolve();
|
|
}
|
|
|
|
async function createDirectory()
|
|
{
|
|
RJLog.log( `creating directory: "${platformTargetDirectory}"` );
|
|
await fs.mkdir( platformTargetDirectory, { recursive: true } );
|
|
|
|
|
|
|
|
let godotFrom = "godot/bin";
|
|
let godotTo = path.join( platformTargetDirectory, "godot" );
|
|
|
|
RJLog.log( `copying godot: "${godotFrom}" >> "${godotTo}"` );
|
|
|
|
await fs.cp( godotFrom, godotTo, { recursive : true } );
|
|
|
|
|
|
|
|
let npFrom = "godot-rj-nuget-package";
|
|
let npTo = path.join( platformTargetDirectory, npFrom );
|
|
|
|
RJLog.log( `copying nupkg: "${npFrom}" >> "${npTo}"` );
|
|
|
|
await fs.cp( npFrom, npTo, { recursive : true } );
|
|
|
|
|
|
let installerFiles:{[index:string]:string[]} =
|
|
{
|
|
"windows" :
|
|
[
|
|
"install-godot-windows.bat",
|
|
"install-godot-windows-readme.txt"
|
|
]
|
|
};
|
|
|
|
let installers = installerFiles[ platform ];
|
|
|
|
for ( let installer of installers )
|
|
{
|
|
let installFrom = "install-scripts/" + installer;
|
|
|
|
let installTo = path.join( platformTargetDirectory, installer );
|
|
|
|
RJLog.log( `copying installer: "${installFrom}" >> "${installTo}"` );
|
|
|
|
await fs.cp( installFrom, installTo, { recursive : true } );
|
|
}
|
|
|
|
}
|
|
|
|
|
|
main();
|