Skip to content

Commit

Permalink
Merge branch 'flybywiresim:master' into fix-fma-clb-armed
Browse files Browse the repository at this point in the history
  • Loading branch information
BravoMike99 authored Oct 13, 2023
2 parents c7c4207 + c3755f7 commit 25ca54a
Show file tree
Hide file tree
Showing 101 changed files with 9,941 additions and 30,182 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ fbw-a380x/out/*
# TODO: these need to be more granular
fbw-a32nx/src/base/*
fbw-a380x/src/base/*
fbw-a32nx/bundles/*
fbw-a380x/bundles/*
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
1. [FMS] Use station declination when appropriate for fix info and place/bearing radials - @tracernz (Mike)
1. [MCDU] Fixed the FMGC annunciator light not illuminating - @tracernz (Mike)
1. [COND] Add Air Conditioning systems failures - @mjuhe (Miquel Juhe)
1. [COND] Fixed Temp-Indication on CRZ page showing cockpit temperature for fwd and aft cabin - @cptnuss-ops (Lukas)

## 0.10.0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
echo VITE_BUILD=false >> .env
- name: Build A32NX
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/setup.sh --clean
./scripts/dev-env/run.sh ./scripts/build_a32nx.sh --no-tty -j 4
- name: Build ZIP files
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ingamepanels-checklist-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

jobs:
build-ingamepanels-checklist-fix:
# Prevent running this on forks
# Prevent running this on forks
if: github.repository_owner == 'flybywiresim'
name: 'Build InGamePanels Checklist Fix'
runs-on: ubuntu-latest
Expand All @@ -38,7 +38,7 @@ jobs:
echo LOCALAZY_READ_KEY=${{ secrets.LOCALAZY_READ_KEY }} >> .env
- name: Build In-Game Panels Checklist Fix
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/setup.sh --clean
./scripts/dev-env/run.sh ./scripts/build_ingamepanels_checklist_fix.sh --no-tty -j 4
- name: Build ZIP files
run: |
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ jobs:
echo VITE_BUILD=false >> .env
- name: Build A32NX
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/setup.sh --clean
./scripts/dev-env/run.sh ./scripts/build_a32nx.sh --no-tty -j 4
rm -rf fbw-a32nx/src
docker system prune -af
- name: Build ZIP files
run: |
df -h
./scripts/dev-env/run.sh node ./scripts/fragment_a32nx.js
node ./scripts/fragment_a32nx.js
cp ./fbw-a32nx/out/build-modules/modules.json ./fbw-a32nx/out/flybywire-aircraft-a320-neo/install.json
./scripts/dev-env/run.sh node ./scripts/install-source_a32nx.js
node ./scripts/install-source_a32nx.js
mkdir ./${{ env.BUILD_DIR_NAME }}
cd ./fbw-a32nx/out/
zip -r ../../${{ env.BUILD_DIR_NAME }}/${{ env.MASTER_ZIP_NAME }} ./flybywire-aircraft-a320-neo/
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: install
run: ./scripts/dev-env/run.sh ./scripts/setup.sh
run: ./scripts/dev-env/run.sh ./scripts/setup.sh --clean
- name: npm run lint
run: ./scripts/dev-env/run.sh npm run lint
- name: lint-rust.sh
Expand All @@ -37,7 +37,7 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- name: npm install
run: ./scripts/dev-env/run.sh ./scripts/setup.sh
run: ./scripts/dev-env/run.sh ./scripts/setup.sh --clean
- name: npm test
run: npm test
build:
Expand All @@ -52,6 +52,7 @@ jobs:
- name: Create .env file
run: |
echo A32NX_PRODUCTION_BUILD=1 >> fbw-a32nx/.env
echo FBW_TYPECHECK=1 >> fbw-a32nx/.env
echo CLIENT_ID=\"${{ secrets.NAVIGRAPH_CLIENT_ID }}\" >> fbw-a32nx/.env
echo CLIENT_SECRET=\"${{ secrets.NAVIGRAPH_CLIENT_SECRET }}\" >> fbw-a32nx/.env
echo CHARTFOX_SECRET=\"${{ secrets.CHARTFOX_SECRET }}\" >> fbw-a32nx/.env
Expand All @@ -61,17 +62,17 @@ jobs:
cat fbw-a32nx/.env
- name: Build A32NX
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/setup.sh --clean
./scripts/dev-env/run.sh ./scripts/build.sh --no-tty -j 4
rm -rf fbw-a32nx/src
docker system prune -af
- name: Generate install.json
if: github.event.pull_request.auto_merge == false
run: |
df -h
./scripts/dev-env/run.sh node ./scripts/fragment_a32nx.js
node ./scripts/fragment_a32nx.js
cp ./fbw-a32nx/out/build-modules/modules.json ./fbw-a32nx/out/flybywire-aircraft-a320-neo/install.json
./scripts/dev-env/run.sh node ./scripts/install-source_a32nx.js
node ./scripts/install-source_a32nx.js
- name: Upload PR artifact
uses: actions/upload-artifact@v2
if: github.event.pull_request.auto_merge == false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
echo VITE_BUILD=false >> .env
- name: Build A32NX
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/setup.sh --clean
./scripts/dev-env/run.sh ./scripts/build.sh --no-tty -j 4
- name: Build ZIP file
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
echo VITE_BUILD=false >> .env
- name: Build A32NX
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/setup.sh --clean
./scripts/dev-env/run.sh ./scripts/build.sh --no-tty -j 4
- name: Build ZIP file
run: |
Expand Down
88 changes: 85 additions & 3 deletions build-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const dotenv = require('dotenv');
const dotenv = require("dotenv");
const path = require("path");
const childProcess = require("child_process");
const fs = require("fs");

function defineEnvVars() {
dotenv.config({ path: '.env.local' });
Expand Down Expand Up @@ -32,8 +34,11 @@ module.exports.defineEnvVars = defineEnvVars;
* @param globalName {string|undefined} the name of the global to define in the output IIFE
* @param entryPoint {string} the entrypoint path, as an absolute path
* @param outFile {string} the output file path, as a path relative to the root of the repository
* @param tsConfigDir {string?} the directory containing the tsconfig.json file to use, optionally
*
* @returns {import('esbuild').BuildOptions}
*/
function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile) {
function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile, tsConfigDir) {
const isProductionBuild = process.env.A32NX_PRODUCTION_BUILD === '1';

process.chdir(projectRoot);
Expand All @@ -43,6 +48,12 @@ function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile) {

define: { DEBUG: 'false', ...defineEnvVars() },

plugins: [
typecheckingPlugin(),
],

tsconfig: tsConfigDir !== undefined ? path.join(tsConfigDir, 'tsconfig.json') : undefined,

entryPoints: [entryPoint],
bundle: true,
treeShaking: false,
Expand All @@ -60,4 +71,75 @@ function esbuildModuleBuild(projectRoot, globalName, entryPoint, outFile) {
};
}

module.exports.esbuildModuleBuild = esbuildModuleBuild;
module.exports.createModuleBuild = esbuildModuleBuild;

/**
* Returns an esbuild plugin which runs `tsc` typechecking
*
* @returns {import('esbuild').Plugin}
*/
function typecheckingPlugin() {
return {
name: 'typecheck',
/**
* @param build {import('esbuild').PluginBuild}
*/
setup(build) {
build.onStart(() => {
if (!(process.env.FBW_TYPECHECK === '1' || process.env.FBW_TYPECHECK?.toLowerCase() === 'true')) {
return;
}

const { entryPoints } = build.initialOptions;
const entryPointDir = path.dirname(entryPoints[0]);

const tsConfigInEntryPointDir = fs.existsSync(path.join(entryPointDir, 'tsconfig.json'));

let tsConfigDir;
if (tsConfigInEntryPointDir) {
tsConfigDir = entryPointDir;
} else if (build.initialOptions.tsconfig !== undefined) {
tsConfigDir = path.dirname(build.initialOptions.tsconfig);
}

if (tsConfigDir === undefined) {
throw new Error(`Cannot run typechecking: no tsconfig.json file found in '${entryPointDir}' and tsconfig path not specified`);
}

/**
* @type {import('esbuild').PartialMessage[]}
*/
const errors = []

try {
childProcess.execSync('npx tsc --noEmit -p .', { cwd: tsConfigDir });
} catch (e) {
if (!('stdout' in e) || !e.stdout) {
throw e;
}

const tscErrors = e.stdout.toString().split('\n').filter((err) => err.trim() !== '');

errors.push(...tscErrors.map((err) => {
const match = /(.+)\((\d+),(\d+)\):\s+(.+)/.exec(err.trim());

if (match) {
const [, file, line, column, text] = match;

const filePath = path.resolve(tsConfigDir, file);
const lineText = fs.readFileSync(filePath).toString().split('\n')[line - 1];

return { text, location: { file, line: parseInt(line), column: parseInt(column) - 1, lineText } }
} else {
return { text: err };
}
}));
}

return { errors };
})
}
}
}

module.exports.typecheckingPlugin = typecheckingPlugin;
4 changes: 4 additions & 0 deletions fbw-a32nx/mach.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const postCssPlugin = require('esbuild-style-plugin');
const tailwind = require('tailwindcss');
const postCssColorFunctionalNotation = require('postcss-color-functional-notation');
const postCssInset = require('postcss-inset');
const { typecheckingPlugin } = require("#build-utils");

// process.env.FBW_TYPECHECK = "1";

/** @type { import('@synaptic-simulations/mach').MachConfig } */
module.exports = {
Expand All @@ -24,6 +27,7 @@ module.exports = {
],
}
}),
typecheckingPlugin(),
],
instruments: [
msfsAvionicsInstrument('PFD'),
Expand Down
8 changes: 5 additions & 3 deletions fbw-a32nx/src/systems/atsu/common/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

const esbuild = require('esbuild');
const path = require('path');
const { esbuildModuleBuild } = require('#build-utils');
const { createModuleBuild } = require('#build-utils');

const rootDir = path.join(__dirname, '..', '..', '..', '..');
const rootDir = path.join(__dirname, '..', '..', '..', '..', '..');
const outFile = 'fbw-a32nx/out/flybywire-aircraft-a320-neo/html_ui/JS/fbw-a32nx/atsu/common.js';

esbuild.build(esbuildModuleBuild('fbw-a32nx', 'AtsuCommon', path.join(rootDir, '../fbw-common/src/systems/datalink/common/src/index.ts'), outFile));
const srcDir = 'fbw-common/src/systems/datalink/common';

esbuild.build(createModuleBuild('fbw-a32nx', 'AtsuCommon', path.join(rootDir, srcDir, '/src/index.ts'), outFile, path.join(rootDir, srcDir)));
4 changes: 2 additions & 2 deletions fbw-a32nx/src/systems/atsu/fmsclient/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

const esbuild = require('esbuild');
const path = require('path');
const { esbuildModuleBuild } = require('#build-utils');
const { createModuleBuild } = require('#build-utils');

const outFile = 'fbw-a32nx/out/flybywire-aircraft-a320-neo/html_ui/JS/fbw-a32nx/atsu/fmsclient.js';

esbuild.build(esbuildModuleBuild('fbw-a32nx', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile));
esbuild.build(createModuleBuild('fbw-a32nx', 'AtsuFmsClient', path.join(__dirname, 'src/index.ts'), outFile, __dirname));
8 changes: 4 additions & 4 deletions fbw-a32nx/src/systems/atsu/fmsclient/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ export class FmsClient {
});
}

public getDatalinkStatus(value: string): DatalinkStatusCode {
public getDatalinkStatus(value: 'vhf' | 'satcom' | 'hf'): DatalinkStatusCode {
switch (value) {
case 'vhf':
return this.datalinkStatus.vhf;
Expand All @@ -491,11 +491,11 @@ export class FmsClient {
case 'hf':
return this.datalinkStatus.hf;
default:
return 99;
return DatalinkStatusCode.NotInstalled;
}
}

public getDatalinkMode(value: string): DatalinkModeCode {
public getDatalinkMode(value: 'vhf' | 'satcom' | 'hf'): DatalinkModeCode {
switch (value) {
case 'vhf':
return this.datalinkMode.vhf;
Expand All @@ -504,7 +504,7 @@ export class FmsClient {
case 'hf':
return this.datalinkMode.hf;
default:
return 99;
return DatalinkModeCode.None;
}
}
}
4 changes: 2 additions & 2 deletions fbw-a32nx/src/systems/extras-host/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

const esbuild = require('esbuild');
const path = require('path');
const { esbuildModuleBuild } = require('#build-utils');
const { createModuleBuild } = require('#build-utils');

const outFile = 'fbw-a32nx/out/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/A32NX/ExtrasHost/index.js';

esbuild.build(esbuildModuleBuild('fbw-a32nx', undefined, path.join(__dirname, './index.ts'), outFile));
esbuild.build(createModuleBuild('fbw-a32nx', undefined, path.join(__dirname, './index.ts'), outFile, __dirname));
28 changes: 16 additions & 12 deletions fbw-a32nx/src/systems/extras-host/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
{
"extends": "../tsconfig.json",

"compilerOptions": {
"incremental": false /* Enables incremental builds */,
"target": "es2017" /* Specifies the ES2017 target, compatible with Coherent GT */,
"module": "es2015" /* Ensures that modules are at least es2015 */,
"strict": false /* Enables strict type checking, highly recommended but optional */,
"esModuleInterop": true /* Emits additional JS to work with CommonJS modules */,
"skipLibCheck": true /* Skip type checking on library .d.ts files */,
"forceConsistentCasingInFileNames": true /* Ensures correct import casing */,
"moduleResolution": "node" /* Enables compatibility with MSFS SDK bare global imports */,
"jsxFactory": "FSComponent.buildComponent" /* Required for FSComponent framework JSX */,
"jsxFragmentFactory": "FSComponent.Fragment" /* Required for FSComponent framework JSX */,
"jsx": "react" /* Required for FSComponent framework JSX */
"paths": {
"@datalink/aoc": ["../../../fbw-common/src/systems/datalink/aoc/src/index.ts"],
"@datalink/atc": ["../../../fbw-common/src/systems/datalink/atc/src/index.ts"],
"@datalink/common": ["../../../fbw-common/src/systems/datalink/common/src/index.ts"],
"@datalink/router": ["../../../fbw-common/src/systems/datalink/router/src/index.ts"],
"@failures": ["./failures/src/index.ts"],
"@fmgc/*": ["./fmgc/src/*"],
"@instruments/common/*": ["./instruments/src/Common/*"],
"@localization/*": ["../localization/*"],
"@sentry/*": ["./sentry-client/src/*"],
"@simbridge/*": ["./simbridge-client/src/*"],
"@shared/*": ["./shared/src/*"],
"@tcas/*": ["./tcas/src/*"],
"@typings/*": ["../../../fbw-common/src/typings/*"],
"@flybywiresim/fbw-sdk": ["../../../fbw-common/src/systems/index-no-react.ts"]
}
}
}
4 changes: 2 additions & 2 deletions fbw-a32nx/src/systems/fmgc/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

const esbuild = require('esbuild');
const path = require('path');
const { esbuildModuleBuild } = require('#build-utils');
const { createModuleBuild } = require('#build-utils');

const outFile = 'fbw-a32nx/out/flybywire-aircraft-a320-neo/html_ui/JS/fbw-a32nx/fmgc/fmgc.js';

esbuild.build(esbuildModuleBuild('fbw-a32nx', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile));
esbuild.build(createModuleBuild('fbw-a32nx', 'Fmgc', path.join(__dirname, 'src/index.ts'), outFile, __dirname));
5 changes: 4 additions & 1 deletion fbw-a32nx/src/systems/fmgc/src/components/EfisLabels.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { FlightLevel } from '@fmgc/guidance/vnav/verticalFlightPlan/VerticalFlightPlan';
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

import { FlightPlanManager } from '@fmgc/wtsdk';
import { FmgcComponent } from './FmgcComponent';

Expand Down
Loading

0 comments on commit 25ca54a

Please sign in to comment.