package: migrate to ES modules
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"name": "lyc",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.14.2",
|
||||
"typescript": "^5.5.2"
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { optFlag, undefList } from "./common";
|
||||
import { optFlag, undefList } from "./common.js";
|
||||
|
||||
export type CMakeDefinition = {
|
||||
name: string,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { optFlag, optMultiFlag, optSwitch, undefList } from "./common";
|
||||
import { optFlag, optMultiFlag, optSwitch, undefList } from "./common.js";
|
||||
|
||||
export interface GeneralOptions {
|
||||
output?: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { optFlag, optSwitch, undefList } from "./common";
|
||||
import { optFlag, optSwitch, undefList } from "./common.js";
|
||||
|
||||
export interface RunCPUOptions {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { optFlag, optSwitch } from "./common";
|
||||
import { optFlag, optSwitch } from "./common.js";
|
||||
|
||||
export interface SystemdRunOptions {
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HaveSPECObjects, SPECBenchData } from "./benchData";
|
||||
import { HaveSPECObjects, SPECBenchData } from "./benchData.js";
|
||||
|
||||
export const pop2: SPECBenchData & HaveSPECObjects = {
|
||||
objectNames: [
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -22,15 +22,11 @@
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
/* Modules */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
"module": "Node16", /* Specify what module code is generated. */
|
||||
"moduleResolution": "Node16",
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
"paths": {
|
||||
"lyc/*": [
|
||||
"./src/*"
|
||||
]
|
||||
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
@@ -54,7 +50,7 @@
|
||||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
"outDir": "out/lyc", /* Specify an output folder for all emitted files. */
|
||||
"outDir": "out", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
|
||||
Reference in New Issue
Block a user