aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/all_dev.ts
blob: afdc24924ef761a35143e21e2f014c80a69835fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only

import * as path from 'path';
import { execSync } from 'child_process';
import { program } from 'commander';

function main() {
  program.option('--profile <string>', 'Profile to install package');
  program.option('--extension <string>', 'Extension to generate package');
  program.parse(process.argv);
  const options = program.opts();
  const targetExtension = options.extension as string;
  const profile = options.profile as string;
  const extensionRoot = path.resolve(__dirname, '../');
  const targetExtensionRoot = path.join(extensionRoot, targetExtension);

  if (targetExtension === 'all') {
    execSync(`npm run ci:qt-lib`, {
      cwd: extensionRoot,
      stdio: 'inherit'
    });
    execSync(`npm run compile:qt-lib`, {
      cwd: extensionRoot,
      stdio: 'inherit'
    });
  }
  execSync(`npm run ci:${targetExtension}`, {
    cwd: extensionRoot,
    stdio: 'inherit'
  });
  execSync(`npm run pretest:${targetExtension}`, {
    cwd: extensionRoot,
    stdio: 'inherit'
  });
  execSync(`npm run package:${targetExtension}`, {
    cwd: extensionRoot,
    stdio: 'inherit'
  });

  let profileArg = '';
  if (profile) {
    profileArg = ` --profile="${profile}"`;
  }
  const script = path.join(extensionRoot, 'scripts', 'install-ext.ts');
  if (targetExtension === 'all') {
    const extensions = ['qt-core', 'qt-cpp', 'qt-qml', 'qt-ui'];
    for (const ext of extensions) {
      const targetRoot = path.join(extensionRoot, ext);
      execSync(
        `ts-node ${script} --dir="${targetRoot}" --name="${ext}"${profileArg}`,
        {
          cwd: extensionRoot,
          stdio: 'inherit'
        }
      );
    }
  } else {
    execSync(
      `ts-node ${script} --dir="${targetExtensionRoot}" --name="${targetExtension}"${profileArg}`,
      {
        cwd: extensionRoot,
        stdio: 'inherit'
      }
    );
  }
}

main();