package: migrate to ES modules

This commit is contained in:
2024-07-16 21:20:46 +08:00
parent 67728beefe
commit bac9f8be6d
13 changed files with 30 additions and 24 deletions

View File

@@ -1,8 +1,8 @@
import path from "path";
import { GeneralVariable, LLVMVariable, command, variable } from "lyc/commands/cmake";
import { projectRoot } from "lyc/environment";
import { PackagePlatform, PackageTask } from "./build";
import { promisifySpawn } from "lyc/cli";
import { GeneralVariable, LLVMVariable, command, variable } from "../commands/cmake.js";
import { projectRoot } from "../environment/index.js";
import { PackagePlatform, PackageTask } from "./build.js";
import { promisifySpawn } from "../cli.js";
import os from "os";
import { SpawnOptions, spawn } from "child_process";

View File

@@ -1,4 +1,4 @@
import { optFlag, undefList } from "./common";
import { optFlag, undefList } from "./common.js";
export type CMakeDefinition = {
name: string,

View File

@@ -1,4 +1,4 @@
import { optFlag, optMultiFlag, optSwitch, undefList } from "./common";
import { optFlag, optMultiFlag, optSwitch, undefList } from "./common.js";
export interface GeneralOptions {
output?: string;

View File

@@ -1,4 +1,4 @@
import { optFlag, optSwitch, undefList } from "./common";
import { optFlag, optSwitch, undefList } from "./common.js";
export interface RunCPUOptions {
/**

View File

@@ -1,4 +1,4 @@
import { optFlag, optSwitch } from "./common";
import { optFlag, optSwitch } from "./common.js";
export interface SystemdRunOptions {
/**

View File

@@ -1,6 +1,6 @@
import fs from 'fs';
import { projectRoot } from 'lyc/environment';
import path from 'path';
import { projectRoot } from '../environment/index.js';
const cpubenchTemplate = fs.readFileSync(path.resolve(projectRoot, 'assets', 'CPUBenchTemplate.ini')).toString('utf-8');

View File

@@ -2,7 +2,7 @@ import path from "path";
export const SYSROOT_PREFIX = "/usr/sw/standard-830-6b-test";
export const projectRoot = path.join(__dirname, "..", "..", "..");
export const projectRoot = path.join(import.meta.dirname, "..", "..");
export const local = path.resolve(projectRoot, "local");
export interface HaveSPEC2017 {

View File

@@ -1,5 +1,5 @@
import { spawn } from 'child_process';
import * as cmake from 'lyc/commands/cmake';
import * as cmake from './commands/cmake.js';
import path from 'path';
export interface TestSuiteConfigOptions {

View File

@@ -4,10 +4,9 @@ import { promisify } from "util";
import { ChildProcessByStdio } from 'child_process';
import { Readable, Writable } from 'stream';
import { createInterface } from 'readline';
import { projectRoot } from 'lyc/environment';
import { SPECBenchData, benchpath, buildpath, exepath } from './benchData';
import { projectRoot } from '../environment/index.js';
import { SPECBenchData, benchpath, exepath, buildpath } from './benchData.js';
export{ pop2 } from './pop2';
export function getEnvironment(specdir: string): NodeJS.ProcessEnv {

View File

@@ -1,4 +1,4 @@
import { HaveSPECObjects, SPECBenchData } from "./benchData";
import { HaveSPECObjects, SPECBenchData } from "./benchData.js";
export const pop2: SPECBenchData & HaveSPECObjects = {
objectNames: [

View File

@@ -1,7 +1,7 @@
import { spawn } from 'child_process';
import { promisifySpawn } from 'lyc/cli';
import { generalCommand, extractCommand } from 'lyc/commands/compiler';
import path from 'path';
import { promisifySpawn } from '../cli.js';
import { generalCommand, extractCommand } from '../commands/compiler.js';
export interface Toolchain {
/**
@@ -37,6 +37,15 @@ export function llvmToolchain(prefix: string) {
};
}
export function gccToolchain(prefix: string) {
const bin = path.resolve(prefix, "bin");
return {
CC: path.resolve(bin, "gcc"),
CXX: path.resolve(bin, "g++"),
FC: path.resolve(bin, "gfortran"),
};
}
/**
* Give an LLVM toolchain, and a desired IR, a list of function names.
* Generate a function that takes vFnPath and sFnPath, used for path calculation.