Fix/windows builds (#764)
* Fix windows path issues * Few script changes to support windows * Update build scripts * remove duplicate call * changelog * Fix for telnet test runner
This commit is contained in:
1 parent
388cad36be
commit
112bad5d42
15 files changed
+130
-88
No files matched your search
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Build scripts and tools on windows
|
||||
|
||||
## [0.42.5] - 2025-10-21
|
||||
|
||||
### Fixed
|
||||
|
||||
Generated
+28
-10
@@ -34,6 +34,7 @@
|
||||
"rounded-rect-9patch": "^1.1.2",
|
||||
"semver": "^7.7.3",
|
||||
"shelljs": "^0.10.0",
|
||||
"telnet-client": "^2.2.6",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "5.9.3",
|
||||
"xml2js": "^0.6.2",
|
||||
@@ -6044,6 +6045,13 @@
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/roku-debug/node_modules/bluebird": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/roku-debug/node_modules/brighterscript": {
|
||||
"version": "0.68.5",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.68.5.tgz",
|
||||
@@ -6252,6 +6260,22 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/roku-debug/node_modules/telnet-client": {
|
||||
"version": "1.4.11",
|
||||
"resolved": "https://registry.npmjs.org/telnet-client/-/telnet-client-1.4.11.tgz",
|
||||
"integrity": "sha512-m15pRh7F74ZzWmqjUtOg3SYp8iSnH7xY1lD9hWk8icjuLRSItABPk1vRJFwSM7op6TgZuEXOWOSbiK9nknloSw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.5.4",
|
||||
"net": "^1.0.2",
|
||||
"stream": "^0.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/kozjak"
|
||||
}
|
||||
},
|
||||
"node_modules/roku-debug/node_modules/type-fest": {
|
||||
"version": "0.20.2",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
|
||||
@@ -7272,12 +7296,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/telnet-client": {
|
||||
"version": "1.4.11",
|
||||
"resolved": "https://registry.npmjs.org/telnet-client/-/telnet-client-1.4.11.tgz",
|
||||
"integrity": "sha512-m15pRh7F74ZzWmqjUtOg3SYp8iSnH7xY1lD9hWk8icjuLRSItABPk1vRJFwSM7op6TgZuEXOWOSbiK9nknloSw==",
|
||||
"version": "2.2.6",
|
||||
"resolved": "https://registry.npmjs.org/telnet-client/-/telnet-client-2.2.6.tgz",
|
||||
"integrity": "sha512-ZUYrLsPtQupQww3eSEORDVOb6ztdtKEghya6TVXPo2tg/UQq2pn5rHhvwuUvyYpbnsoqdNY1fyD1GNkXHR8dYA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.5.4",
|
||||
"net": "^1.0.2",
|
||||
"stream": "^0.0.2"
|
||||
},
|
||||
@@ -7286,12 +7310,6 @@
|
||||
"url": "https://paypal.me/kozjak"
|
||||
}
|
||||
},
|
||||
"node_modules/telnet-client/node_modules/bluebird": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/temp-dir": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz",
|
||||
|
||||
+5
-4
@@ -30,6 +30,7 @@
|
||||
"shelljs": "^0.10.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "5.9.3",
|
||||
"telnet-client": "^2.2.6",
|
||||
"xml2js": "^0.6.2",
|
||||
"yaml": "^2.8.1"
|
||||
},
|
||||
@@ -38,10 +39,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"dev:web": "cd playlet-web && npm run dev",
|
||||
"prebuild": "rm -rf dist",
|
||||
"build:dev": "npm run build:web && npm run build:lib:dev && npm run build:app:dev",
|
||||
"build:prod": "npm run build:web && npm run build:lib:prod && npm run build:app:prod",
|
||||
"build:release": "npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
||||
"prebuild": "node tools/rm.js dist",
|
||||
"build:dev": "npm run prebuild && npm run build:web && npm run build:lib:dev && npm run build:app:dev",
|
||||
"build:prod": "npm run prebuild && npm run build:web && npm run build:lib:prod && npm run build:app:prod",
|
||||
"build:release": "npm run prebuild && npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
||||
"build:app:dev": "cd playlet-app && npm run build:dev",
|
||||
"build:app:prod": "cd playlet-app && npm run build:prod",
|
||||
"build:lib:dev": "cd playlet-lib && npm run build:dev",
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
"version": "0.42.5",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-app",
|
||||
"prebuild": "node ../tools/rm.js ../build/playlet-app",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"prebuild:prod": "npm run prebuild",
|
||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||
"postbuild:prod": "mkdir -p ../release && cp ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
||||
"postbuild:prod": "node ../tools/mkdir.js ../release && node ../tools/cp.js ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet.zip --out-file ../release/playlet.squashfs.zip",
|
||||
"sign-package": "node ../tools/sign-package.js --out-file playlet.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-app",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
"version": "0.42.5",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-lib",
|
||||
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"prebuild:prod": "npm run prebuild",
|
||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||
"postbuild": "mkdir -p ../release && mkdir -p ../playlet-app/src/lib && cp ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
||||
"postbuild": "node ../tools/mkdir.js ../release && node ../tools/mkdir.js ../playlet-app/src/lib && node ../tools/cp.js ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
||||
"postbuild:dev": "npm run postbuild",
|
||||
"postbuild:prod": "npm run postbuild && cp ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
||||
"postbuild:prod": "npm run postbuild && node ../tools/cp.js ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet-lib.zip --out-file ../release/playlet-lib.squashfs.zip",
|
||||
"sign-package": "node ../tools/sign-package.js --out-file playlet-lib.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-lib",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
isBrsFile,
|
||||
} from 'brighterscript';
|
||||
import { existsSync } from 'fs-extra';
|
||||
import path from 'path';
|
||||
|
||||
export class ImportValidationPlugin implements CompilerPlugin {
|
||||
public name = 'ImportValidationPlugin';
|
||||
@@ -33,13 +34,13 @@ export class ImportValidationPlugin implements CompilerPlugin {
|
||||
}
|
||||
|
||||
generateXmlComponent(file: BscFile) {
|
||||
const path = file.pkgPath;
|
||||
const name = path.split('/').pop().replace('.bs', '') + `TestComponent${path.length}`;
|
||||
const pkgPath = file.pkgPath;
|
||||
const name = path.basename(pkgPath, '.bs') + `TestComponent${pkgPath.length}`;
|
||||
const content = `<component name="${name}" extends="Node">
|
||||
<script type="text/brightscript" uri="pkg:/${file.pkgPath}" />
|
||||
<script type="text/brightscript" uri="pkg:/${pkgPath}" />
|
||||
</component>`
|
||||
|
||||
file.program.setFile(`${path}.TestComponent.xml`, content);
|
||||
file.program.setFile(`${pkgPath}.TestComponent.xml`, content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
FunctionStatement,
|
||||
DiagnosticSeverity,
|
||||
} from 'brighterscript';
|
||||
import path from 'path';
|
||||
|
||||
export class JobSystemPlugin implements CompilerPlugin {
|
||||
public name = 'JobSystemPlugin';
|
||||
@@ -29,7 +30,7 @@ export class JobSystemPlugin implements CompilerPlugin {
|
||||
}
|
||||
|
||||
const xml = this.generateJobXml(jobName, file.pkgPath)
|
||||
const xmlFile = `components/JobSystem/generated/${jobName}.xml`
|
||||
const xmlFile = path.join('components', 'JobSystem', 'generated', `${jobName}.xml`);
|
||||
|
||||
if (program.hasFile(xmlFile)) {
|
||||
const currentContent = program.getFile(xmlFile).fileContents
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
} from 'brighterscript';
|
||||
import path from 'path';
|
||||
|
||||
const loggingFilePath = 'source/utils/Logging.bs';
|
||||
const loggingFilePath = path.join('source', 'utils', 'Logging.bs');
|
||||
const logFunctions = {
|
||||
LogError: {
|
||||
stringLevel: 'ERROR',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// This plugin generates a file containing functions for type checking and type casting.
|
||||
import { CompilerPlugin, Program, SourceObj } from "brighterscript";
|
||||
import path from "path";
|
||||
|
||||
const types = [
|
||||
{ name: 'Bool', interface: 'ifBoolean', type: 'boolean', defaultValue: 'false' },
|
||||
@@ -16,7 +17,7 @@ const types = [
|
||||
|
||||
const generatedCodeHeader = `' The rest of this file is generated by the TypeGenPlugin`
|
||||
|
||||
const typesFilePath = 'source/utils/Types.bs';
|
||||
const typesFilePath = path.join("source", "utils", "Types.bs");
|
||||
|
||||
const isTypeTemplate = (name: string, _interface: string) => {
|
||||
return `' Returns true if the given object is of type ${name}, false otherwise
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const [src, dest] = process.argv.slice(2);
|
||||
if (!src || !dest) {
|
||||
console.error('Usage: node tools/cp.js <source> <destination>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
fs.copySync(src, dest, { overwrite: true });
|
||||
@@ -0,0 +1,9 @@
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const dirs = process.argv.slice(2);
|
||||
if (dirs.length === 0) {
|
||||
console.error('Usage: node tools/mkdir.js <dir1> [dir2] ...');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
dirs.forEach(dir => fs.ensureDirSync(dir));
|
||||
@@ -0,0 +1,9 @@
|
||||
const fs = require('fs-extra');
|
||||
|
||||
const targets = process.argv.slice(2);
|
||||
if (targets.length === 0) {
|
||||
console.error('Usage: node tools/rm.js <target1> [target2] ...');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
targets.forEach(target => fs.removeSync(target));
|
||||
+45
-60
@@ -6,7 +6,7 @@ const getEnvVars = require('./get-env-vars');
|
||||
const rokuDeploy = require('roku-deploy');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const spawn = require('child_process').spawn;
|
||||
const { Telnet } = require('telnet-client');
|
||||
|
||||
function getArgumentParser() {
|
||||
const parser = new ArgumentParser({
|
||||
@@ -20,33 +20,19 @@ function getArgumentParser() {
|
||||
return parser;
|
||||
}
|
||||
|
||||
const childProcesses = [];
|
||||
|
||||
function processCleanup() {
|
||||
childProcesses.forEach(function (child) {
|
||||
try {
|
||||
child.kill();
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function exitHandler(options, exitCode) {
|
||||
if (options.cleanup) {
|
||||
processCleanup();
|
||||
}
|
||||
if (options.exit) {
|
||||
process.exit(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
process.on('exit', exitHandler.bind(null, { cleanup: true }));
|
||||
process.on('SIGINT', exitHandler.bind(null, { exit: true }));
|
||||
process.on('SIGUSR1', exitHandler.bind(null, { exit: true }));
|
||||
process.on('SIGUSR2', exitHandler.bind(null, { exit: true }));
|
||||
process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
process.exit(1); // Exit on Ctrl+C
|
||||
});
|
||||
process.on('SIGUSR1', () => {
|
||||
process.exit(1); // Exit on SIGUSR1
|
||||
});
|
||||
process.on('SIGUSR2', () => {
|
||||
process.exit(1); // Exit on SIGUSR2
|
||||
});
|
||||
process.on('uncaughtException', (error, origin) => {
|
||||
console.error(error);
|
||||
process.exit(1); // Exit on uncaught exceptions
|
||||
});
|
||||
|
||||
(async () => {
|
||||
let success = false;
|
||||
@@ -86,14 +72,14 @@ process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
|
||||
// ignored
|
||||
}
|
||||
|
||||
console.log('Starting telnet process');
|
||||
telnet = await startTelnetProcessAsync(options.host, options.telnetPort);
|
||||
console.log('Starting telnet client');
|
||||
telnet = await startTelnetClientAsync(options.host, options.telnetPort);
|
||||
|
||||
console.log('Publishing package');
|
||||
await rokuDeploy.publish(options);
|
||||
|
||||
console.log('Waiting for test to finish');
|
||||
let data = await readFromProcessUntil(telnet, timeout);
|
||||
let data = await readFromTelnetUntil(telnet, timeout);
|
||||
|
||||
if (reportOnly) {
|
||||
data = parseTestReport(data);
|
||||
@@ -107,7 +93,7 @@ process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
|
||||
console.error(error);
|
||||
}
|
||||
finally {
|
||||
telnet?.kill();
|
||||
telnet?.end();
|
||||
}
|
||||
if (success) {
|
||||
console.log('Tests passed!');
|
||||
@@ -117,31 +103,36 @@ process.on('uncaughtException', exitHandler.bind(null, { exit: true }));
|
||||
process.exit(success ? 0 : 1);
|
||||
})();
|
||||
|
||||
function startTelnetProcessAsync(host, port, timeoutSeconds = 2) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const telnet = spawn('telnet', [host, port]);
|
||||
childProcesses.push(telnet);
|
||||
function startTelnetClientAsync(host, port, timeoutSeconds = 2) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const connection = new Telnet();
|
||||
|
||||
let timeoutID;
|
||||
function timeoutReached() {
|
||||
resolve(telnet);
|
||||
}
|
||||
const params = {
|
||||
host: host,
|
||||
port: port,
|
||||
negotiationMandatory: false,
|
||||
timeout: timeoutSeconds * 1000
|
||||
};
|
||||
|
||||
telnet.stdout.on('data', (data) => {
|
||||
clearTimeout(timeoutID);
|
||||
timeoutID = setTimeout(timeoutReached, timeoutSeconds * 1000);
|
||||
connection.on('close', function () {
|
||||
console.log('connection closed');
|
||||
});
|
||||
|
||||
telnet.stderr.on('data', (data) => {
|
||||
console.error(`stderr: ${data}`);
|
||||
reject()
|
||||
})
|
||||
connection.on('error', function (error) {
|
||||
console.error('telnet connection error:', error);
|
||||
reject(error);
|
||||
});
|
||||
|
||||
timeoutID = setTimeout(timeoutReached, timeoutSeconds * 1000);
|
||||
try {
|
||||
await connection.connect(params);
|
||||
resolve(connection);
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function readFromProcessUntil(proc, timeoutSeconds = 20, endToken = 'AppExitComplete') {
|
||||
function readFromTelnetUntil(connection, timeoutSeconds = 20, endToken = 'AppExitComplete') {
|
||||
return new Promise((resolve, reject) => {
|
||||
let data = '';
|
||||
|
||||
@@ -149,28 +140,22 @@ function readFromProcessUntil(proc, timeoutSeconds = 20, endToken = 'AppExitComp
|
||||
|
||||
function timeoutReached() {
|
||||
reject(`Timeout of ${timeoutSeconds} seconds waiting for ${endToken}`);
|
||||
proc.kill();
|
||||
connection.end();
|
||||
}
|
||||
|
||||
proc.stdout.on('data', (chunk) => {
|
||||
process.stdout.write(chunk);
|
||||
connection.on('data', (chunk) => {
|
||||
process.stdout.write(chunk.toString());
|
||||
clearTimeout(timeoutID);
|
||||
|
||||
data += chunk;
|
||||
data += chunk.toString();
|
||||
if (data.includes(endToken)) {
|
||||
resolve(data);
|
||||
proc.kill();
|
||||
connection.end();
|
||||
return;
|
||||
}
|
||||
timeoutID = setTimeout(timeoutReached, timeoutSeconds * 1000);
|
||||
});
|
||||
|
||||
proc.stderr.on('data', (data) => {
|
||||
clearTimeout(timeoutID);
|
||||
console.error(`stderr: ${data}`);
|
||||
reject()
|
||||
})
|
||||
|
||||
timeoutID = setTimeout(timeoutReached, timeoutSeconds * 1000);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const shell = require('shelljs');
|
||||
const path = require('path');
|
||||
|
||||
if (!shell.which('git')) {
|
||||
shell.echo('Sorry, this script requires git');
|
||||
@@ -18,7 +19,7 @@ if (gitStatus.stdout !== '') {
|
||||
|
||||
const gitCommitHash = shell.exec('git rev-parse --short HEAD').stdout.trim();
|
||||
|
||||
["playlet-app/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
|
||||
[path.join("playlet-app", "src", "manifest"), path.join("playlet-lib", "src", "manifest")].forEach(function (manifestPath) {
|
||||
let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
|
||||
|
||||
const gitHashPattern = /git_commit_sha=(\w+)/;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// as well as the package.json files in the playlet-app/playlet-lib/playlet-web folders.
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
const semverParse = require('semver/functions/parse');
|
||||
@@ -13,7 +14,7 @@ const packageJson = JSON.parse(packageJsonContent);
|
||||
const version = packageJson.version;
|
||||
const parsedVersion = semverParse(version);
|
||||
|
||||
["playlet-app/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
|
||||
[path.join("playlet-app", "src", "manifest"), path.join("playlet-lib", "src", "manifest")].forEach(function (manifestPath) {
|
||||
let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
|
||||
|
||||
const majorPattern = /major_version=(\d+)/;
|
||||
|
||||
Reference in new issue
Block a user