Skip to content

Commit

Permalink
Merge branch 'master' into apu-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Saschl authored Oct 20, 2023
2 parents 4c79054 + 638b15e commit 47ec041
Show file tree
Hide file tree
Showing 201 changed files with 12,853 additions and 30,395 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/*
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
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)
1. [FMS] Show ILS ident and frequency on ARRIVAL page - @tracernz (Mike)
1. [EFB/ATSU] Use MSFS METAR data rather than FSX cloud data from FBW API - @tracernz (Mike)
1. [APU] Added xfeed APU fuel capabilities - @Taz5150 (TazX [Z+1]#0405)

## 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
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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;
6 changes: 5 additions & 1 deletion 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,10 +27,11 @@ module.exports = {
],
}
}),
typecheckingPlugin(),
],
instruments: [
msfsAvionicsInstrument('PFD'),
msfsAvionicsInstrument('ND', 'NDv2'),
msfsAvionicsInstrument('ND'),
msfsAvionicsInstrument('EWD'),
msfsAvionicsInstrument('Clock'),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class CDUAvailableArrivalsPage {
runwayCourse = Utils.leadingZeros(Math.round(A32NX_Util.trueToMagnetic(runway.direction, magVar)), 3);
}
rows[2 * i] = [`{cyan}{${approach.name.padEnd(9)}{end}` + runwayLength.padStart(5) + "{small}" + NXUnits.userDistanceUnit().padEnd(2) + "{end}[color]cyan", "", ""];
rows[2 * i + 1] = ["{sp}{sp}{sp}" + runwayCourse + "[color]cyan"];
const hasIls = approach.approachType === ApproachType.APPROACH_TYPE_ILS && runway.primaryILSFrequency.freqMHz > 0;
const ilsText = hasIls ? `${WayPoint.formatIdentFromIcao(runway.primaryILSFrequency.icao).padStart(6)}/${runway.primaryILSFrequency.freqMHz.toFixed(2)}` : '';
rows[2 * i + 1] = [`{cyan}{sp}{sp}{sp}${runwayCourse}${ilsText}{end}`];
mcdu.onLeftInput[i + 2] = () => {
mcdu.setApproachIndex(approach.index, () => {
mcdu.flightPlanManager.setDestinationRunwayIndexFromApproach();
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));
Loading

0 comments on commit 47ec041

Please sign in to comment.