Merge pull request #637 from KillahPotatoes/v0.96.5-build-tool
v0.96.5 - Update build tool
This commit is contained in:
commit
158721a209
|
@ -29,6 +29,7 @@
|
|||
"sourceFolder": "kp_liberation.Chernarus_Winter",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "Chernarus_Winter",
|
||||
"mapDisplay": "Chernarus Winter",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 6,
|
||||
|
@ -42,6 +43,7 @@
|
|||
"sourceFolder": "kp_liberation.Enoch",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "Enoch",
|
||||
"mapDisplay": "Livonia",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 27,
|
||||
|
@ -55,6 +57,7 @@
|
|||
"sourceFolder": "kp_liberation.gm_weferlingen_summer",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "gm_weferlingen_summer",
|
||||
"mapDisplay": "Weferlingen Summer",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 9,
|
||||
|
@ -68,6 +71,7 @@
|
|||
"sourceFolder": "kp_liberation.gm_weferlingen_winter",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "gm_weferlingen_winter",
|
||||
"mapDisplay": "Weferlingen Winter",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 10,
|
||||
|
@ -81,6 +85,7 @@
|
|||
"sourceFolder": "kp_liberation.lythium",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "lythium",
|
||||
"mapDisplay": "Lythium",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 7,
|
||||
|
@ -107,6 +112,7 @@
|
|||
"sourceFolder": "kp_liberation.panthera3",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "panthera3",
|
||||
"mapDisplay": "Panthera",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 17,
|
||||
|
@ -120,6 +126,7 @@
|
|||
"sourceFolder": "kp_liberation.pja310",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "pja310",
|
||||
"mapDisplay": "Al Rayak",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 6,
|
||||
|
@ -133,6 +140,7 @@
|
|||
"sourceFolder": "kp_liberation.Sara",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "Sara",
|
||||
"mapDisplay": "Sahrani",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 6,
|
||||
|
@ -185,6 +193,7 @@
|
|||
"sourceFolder": "kp_liberation.xcam_taunus",
|
||||
"missionName": "kp_liberation",
|
||||
"map": "xcam_taunus",
|
||||
"mapDisplay": "Taunus",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 4,
|
||||
|
@ -198,6 +207,7 @@
|
|||
"sourceFolder": "kp_liberation.gm_weferlingen_summer",
|
||||
"missionName": "kp_liberation_east",
|
||||
"map": "gm_weferlingen_summer",
|
||||
"mapDisplay": "Weferlingen Summer",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 11,
|
||||
|
@ -211,6 +221,7 @@
|
|||
"sourceFolder": "kp_liberation.gm_weferlingen_winter",
|
||||
"missionName": "kp_liberation_east",
|
||||
"map": "gm_weferlingen_winter",
|
||||
"mapDisplay": "Weferlingen Winter",
|
||||
"configFile": "kp_liberation_config.sqf",
|
||||
"variables": {
|
||||
"KP_liberation_preset_blufor": 12,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import * as gulp from "gulp";
|
||||
import * as gulpReplace from "gulp-replace";
|
||||
import * as gulpPbo from "gulp-armapbo";
|
||||
import * as gulpModify from "gulp-modify-file";
|
||||
import * as gulpZip from "gulp-zip";
|
||||
import * as vinylPaths from "vinyl-paths";
|
||||
import * as del from "del";
|
||||
|
@ -13,7 +14,7 @@ import { Preset, FolderStructureInfo } from "./src";
|
|||
|
||||
const presets: Preset[] = require('./_presets.json');
|
||||
|
||||
/**
|
||||
/**
|
||||
* Mission folders configuration
|
||||
*/
|
||||
const paths: FolderStructureInfo = {
|
||||
|
@ -39,32 +40,49 @@ for (let preset of presets) {
|
|||
|
||||
gulp.task('mission_' + taskName, gulp.series(
|
||||
/** Copy mission framework to output dir */
|
||||
() => {
|
||||
function frameworkCopy () {
|
||||
return gulp.src(mission.getFrameworkPath().concat('/**/*'))
|
||||
.pipe(gulp.dest(mission.getOutputDir()));
|
||||
},
|
||||
|
||||
|
||||
/** Copy mission.sqm to output dir */
|
||||
() => {
|
||||
function missionSqmCopy () {
|
||||
return gulp.src(mission.getMissionSqmPath())
|
||||
.pipe(gulp.dest(mission.getOutputDir()));
|
||||
},
|
||||
|
||||
/** Replace variables values in configuration file */
|
||||
() => {
|
||||
function configReplace () {
|
||||
let src = gulp.src(mission.getMissionConfigFilePath());
|
||||
|
||||
|
||||
const variables = Object.getOwnPropertyNames(preset.variables);
|
||||
for (let variable of variables) {
|
||||
// https://regex101.com/r/YknC8r/1
|
||||
const regex = new RegExp(`(${variable} += +)(?:\\d+|".+")`, 'ig');
|
||||
const value = JSON.stringify(preset.variables[variable]);
|
||||
|
||||
|
||||
// replace variable value
|
||||
src = src.pipe(gulpReplace(regex, `$1${value}`));
|
||||
}
|
||||
|
||||
|
||||
return src.pipe(gulp.dest(mission.getOutputDir()));
|
||||
},
|
||||
|
||||
/** Replace values in stringtable */
|
||||
function stringTableReplace () {
|
||||
// I know, replacing XML with regex... :|
|
||||
// https://regex101.com/r/TSfish/2
|
||||
const versionRegex = /<Key ID="STR_MISSION_VERSION">\s*<Original>(?<version>.+)<\/Original>/;
|
||||
const nameRegex = /(<Key ID="STR_MISSION_TITLE">\s*<Original>)(?<name>.+)(<\/Original>)/;
|
||||
|
||||
return gulp.src(mission.getFrameworkPath().concat('/stringtable.xml'))
|
||||
.pipe(gulpModify((content: string) => {
|
||||
const version: string = content.match(versionRegex)['groups']['version'];
|
||||
|
||||
return content.replace(nameRegex, `$1CTI 34 KP Liberation ${preset.mapDisplay || preset.map} ${version}$3`);
|
||||
}))
|
||||
.pipe(gulp.dest(mission.getOutputDir(), { overwrite: true, }))
|
||||
;
|
||||
}
|
||||
));
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,19 +4,20 @@
|
|||
"node": ">=7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/del": "^3.0.0",
|
||||
"@types/gulp": "^4.0.5",
|
||||
"@types/del": "^3.0.1",
|
||||
"@types/gulp": "^4.0.6",
|
||||
"@types/gulp-replace": "0.0.31",
|
||||
"@types/gulp-zip": "^4.0.0",
|
||||
"@types/vinyl-paths": "0.0.31",
|
||||
"del": "^3.0.0",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-armapbo": "^1.1.3",
|
||||
"gulp-modify-file": "^1.0.1",
|
||||
"gulp-replace": "^0.6.1",
|
||||
"gulp-zip": "^4.1.0",
|
||||
"gulp-zip": "^4.2.0",
|
||||
"smart-zip": "0.0.9",
|
||||
"ts-node": "^4.1.0",
|
||||
"typescript": "^2.7.1",
|
||||
"typescript": "^2.9.2",
|
||||
"vinyl-paths": "^2.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
export interface Preset {
|
||||
/**
|
||||
/**
|
||||
* Path to folder with mission.sqm relative to "missionsFolder".
|
||||
* If mission.sqm is in root of "missionsFolder" should be empty string.
|
||||
*
|
||||
*
|
||||
* @see FolderStructureInfo.missionsFolder
|
||||
*/
|
||||
readonly sourceFolder: string;
|
||||
|
||||
/**
|
||||
* Path to file with mission configuration.
|
||||
/**
|
||||
* Path to file with mission configuration.
|
||||
* Replacement of variables will be applied here.
|
||||
*/
|
||||
readonly configFile: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Name of mission (part before mapname)
|
||||
*/
|
||||
readonly missionName: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Map name
|
||||
*/
|
||||
readonly map: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Display name for map
|
||||
*/
|
||||
readonly mapDisplay: string | undefined;
|
||||
|
||||
/**
|
||||
* key=>val of values to replace in config file
|
||||
* @see {VariablesReplacements}
|
||||
*/
|
||||
|
@ -36,21 +41,21 @@ export interface VariablesReplacements {
|
|||
}
|
||||
|
||||
export interface FolderStructureInfo {
|
||||
/**
|
||||
/**
|
||||
* Folder of folders with mission.sqm.
|
||||
* Value of "sourceFolder" from Preset will be appended to this path.
|
||||
*
|
||||
*
|
||||
* @see {Preset}
|
||||
*/
|
||||
readonly missionsFolder: string;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Path to folder with mission framework files.
|
||||
*/
|
||||
readonly frameworkFolder: string;
|
||||
|
||||
/**
|
||||
* Directory containing built missions
|
||||
|
||||
/**
|
||||
* Directory containing built missions
|
||||
*/
|
||||
readonly workDir: string;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue