Skip to content

Commit 2dc50d7

Browse files
author
pgilmorepf
committed
Moving the model file deletion into the make.js script
Summary: This ensures that Arc-diff jobs will actually work, and removes the dependency on the bat files, which are only supposed to be a utility helper for customers. Test Plan: Jenker! Reviewers: Marco.Williams Subscribers: jenkins, #sdkdiff-actionscriptsdk Differential Revision: https://phab.playfabdev.com/D3012
1 parent 1431a5f commit 2dc50d7

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

SDKBuildScripts/actionscript_build.bat

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
rem === Cleaning existing files from ActionScriptSDK ===
2-
pushd ..\..\sdks\ActionScriptSDK\PfApiTest\com\playfab
3-
pushd AdminModels
4-
del *.as >nul 2>&1
5-
popd
6-
pushd ClientModels
7-
del *.as >nul 2>&1
8-
popd
9-
pushd MatchmakerModels
10-
del *.as >nul 2>&1
11-
popd
12-
pushd ServerModels
13-
del *.as >nul 2>&1
14-
popd
15-
popd
16-
171
pushd ..
182
if [%1] == [] (
193
rem === BUILDING ActionScriptSDK ===

targets/actionscript/make.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
var path = require("path");
1+
var fs = require("fs");
22
var ejs = require("ejs");
3+
var path = require("path");
34

45
exports.putInRoot = true;
56

67
exports.makeCombinedAPI = function (apis, sourceDir, apiOutputDir) {
7-
console.log("Generating ActionScript3 combined SDK to " + apiOutputDir);
8-
98
apiOutputDir = path.resolve(apiOutputDir, "PfApiTest"); // This is an oddity in the ActionScriptSDK which we shouldn't resolve until we do a major revision number change
9+
10+
console.log("Generating ActionScript3 combined SDK to " + apiOutputDir);
11+
12+
RemoveExcessFiles(apiOutputDir);
1013
copyTree(path.resolve(sourceDir, "source"), apiOutputDir);
1114

1215
for (var i = 0; i < apis.length; i++) {
@@ -17,6 +20,25 @@ exports.makeCombinedAPI = function (apis, sourceDir, apiOutputDir) {
1720
GenerateSimpleFiles(apis, sourceDir, apiOutputDir);
1821
}
1922

23+
function RemoveFilesInDir(dirPath, searchFilter) {
24+
var files;
25+
try { files = fs.readdirSync(dirPath); }
26+
catch (e) { return; }
27+
if (files.length > 0)
28+
for (var i = 0; i < files.length; i++) {
29+
var filePath = path.resolve(dirPath, files[i]);
30+
if (fs.statSync(filePath).isFile() && (!searchFilter || filePath.contains(searchFilter)))
31+
fs.unlinkSync(filePath);
32+
}
33+
};
34+
35+
function RemoveExcessFiles(apiOutputDir) {
36+
RemoveFilesInDir(path.resolve(apiOutputDir, "com/playfab/AdminModels"), ".as");
37+
RemoveFilesInDir(path.resolve(apiOutputDir, "com/playfab/ClientModels"), ".as");
38+
RemoveFilesInDir(path.resolve(apiOutputDir, "com/playfab/MatchmakerModels"), ".as");
39+
RemoveFilesInDir(path.resolve(apiOutputDir, "com/playfab/ServerModels"), ".as");
40+
}
41+
2042
function GetBaseTypeSyntax(datatype) {
2143
// The model-inheritance feature was removed.
2244
// However in the future, we may still use some inheritance links for request/result baseclasses, for other sdk features

0 commit comments

Comments
 (0)