diff options
-rw-r--r-- | etc/config/cppx_gold.defaults.properties | 2 | ||||
-rw-r--r-- | etc/config/fortran.defaults.properties | 2 | ||||
-rw-r--r-- | etc/config/hlsl.defaults.properties | 4 | ||||
-rw-r--r-- | etc/config/modula2.defaults.properties | 6 | ||||
-rw-r--r-- | lib/compiler-finder.ts | 95 | ||||
-rw-r--r-- | lib/properties.ts | 4 |
6 files changed, 104 insertions, 9 deletions
diff --git a/etc/config/cppx_gold.defaults.properties b/etc/config/cppx_gold.defaults.properties index 7c0acfe4d..b5f37d715 100644 --- a/etc/config/cppx_gold.defaults.properties +++ b/etc/config/cppx_gold.defaults.properties @@ -1,5 +1,5 @@ # Default settings for cppx-gold -compilers=&clang +compilers=&gcc group.gcc.compilers=golddefault compiler.golddefault.exe=/usr/bin/clang-gold diff --git a/etc/config/fortran.defaults.properties b/etc/config/fortran.defaults.properties index 42e6507da..9c777d743 100644 --- a/etc/config/fortran.defaults.properties +++ b/etc/config/fortran.defaults.properties @@ -7,7 +7,7 @@ compilerType=fortran ############################### # GCC for x86 -group.gfortran_86.compilers=gfortran412:gfortran447:gfortran453:gfortran464:gfortran471:gfortran472:gfortran473:gfortran474:gfortran481:gfortran482:gfortran483:gfortran484:gfortran485:gfortran490:gfortran491:gfortran492:gfortran493:gfortran494def:gfortran48:gfortran510:gfortran520:gfortran530:gfortran540:gfortran550def:gfortran5:gfortran62:gfortran63def:gfortran6:gfortran71def:gfortran72def:gfortran73def:gfortran7:gfortran8:gfortran81def:gfortran9:gfortran10:gfortran11:gfortran +group.gfortran_86.compilers=gfortran412:gfortran447:gfortran453:gfortran464:gfortran471:gfortran472:gfortran473:gfortran474:gfortran481:gfortran482:gfortran483:gfortran484:gfortran485:gfortran490:gfortran491:gfortran492:gfortran493:gfortran494def:gfortran48:gfortran4:gfortran510:gfortran520:gfortran530:gfortran540:gfortran550def:gfortran5:gfortran62:gfortran63def:gfortran6:gfortran71def:gfortran72def:gfortran73def:gfortran7:gfortran8:gfortran81def:gfortran9:gfortran10:gfortran11:gfortran group.gfortran_86.groupName=GCC x86-64 compiler.gfortran412.exe=/usr/bin/gfortran-4.1.2 compiler.gfortran412.name=gfortran 4.1.2 diff --git a/etc/config/hlsl.defaults.properties b/etc/config/hlsl.defaults.properties index fbea80d70..63ed7540b 100644 --- a/etc/config/hlsl.defaults.properties +++ b/etc/config/hlsl.defaults.properties @@ -12,8 +12,8 @@ compiler.rga_default.dxcPath=/usr/dxc-artifacts/bin/dxc group.clang.compilers=hlsl_clang_default group.clang.compilerType=clang -compiler.clang.exe=/usr/bin/clang-trunk -compiler.clang.options=-emit-llvm +compiler.hlsl_clang_default.exe=/usr/bin/clang-trunk +compiler.hlsl_clang_default.options=-emit-llvm defaultCompiler=dxc supportsBinary=false diff --git a/etc/config/modula2.defaults.properties b/etc/config/modula2.defaults.properties index f06e83dfb..63fdc5691 100644 --- a/etc/config/modula2.defaults.properties +++ b/etc/config/modula2.defaults.properties @@ -9,7 +9,7 @@ supportsBinaryObject=true binaryHideFuncRe=^(__.*|_(init|start|fini)|(de)?register_tm_clones|call_gmon_start|frame_dummy|\.plt.*)$ supportsLibraryCodeFilter=true -group.gcc.compilers=cgdefault -compiler.cgdefault.exe=/usr/bin/gm2 -compiler.cgdefault.name=gcc default +group.gcc.compilers=m2gdefault +compiler.m2gdefault.exe=/usr/bin/gm2 +compiler.m2gdefault.name=gcc default diff --git a/lib/compiler-finder.ts b/lib/compiler-finder.ts index 6a4a1b134..241f5c21b 100644 --- a/lib/compiler-finder.ts +++ b/lib/compiler-finder.ts @@ -34,12 +34,12 @@ import urljoin from 'url-join'; import type {CompilerInfo, PreliminaryCompilerInfo} from '../types/compiler.interfaces.js'; import type {Language, LanguageKey} from '../types/languages.interfaces.js'; -import {unwrap, assert} from './assert.js'; +import {unwrap, assert, unwrapString} from './assert.js'; import {InstanceFetcher} from './aws.js'; import {CompileHandler} from './handlers/compile.js'; import {logger} from './logger.js'; import {ClientOptionsHandler, OptionHandlerArguments} from './options-handler.js'; -import {CompilerProps} from './properties.js'; +import {CompilerProps, getRawProperties} from './properties.js'; import type {PropertyGetter} from './properties.interfaces.js'; import {basic_comparator, remove} from './common-utils.js'; import {getPossibleGccToolchainsFromCompilerInfo} from './toolchain-utils.js'; @@ -59,6 +59,7 @@ export class CompilerFinder { languages: Record<string, Language>; awsPoller: InstanceFetcher | null = null; optionsHandler: ClientOptionsHandler; + //visitedCompilers = new Set<string>(); constructor( compileHandler: CompileHandler, @@ -470,7 +471,97 @@ export class CompilerFinder { } } + checkOrphanedProperties() { + // Quickly check for any orphaned compilers + let error = false; + for (const domains of [ + ['amazon', 'amazonwin', 'gpu'], + ['defaults', 'local'], + ]) { + const compilers = new Set<string>(); + // duplicate groups across languages is ok, so storing lang.group in the set + const groups = new Set<string>(); + const reachableCompilers = new Set<string>(); + const reachableGroups = new Set<string>(); + const rawProps = getRawProperties(); + for (const [prop, props] of Object.entries(rawProps)) { + const [lang, domain] = prop.split('.'); + if (domains.includes(domain)) { + if (domain === 'defaults' && `${lang}.local` in rawProps) { + continue; // let .local override + } + for (const [prop, value] of Object.entries(props)) { + const propParts = prop.split('.'); + if (prop === 'compilers') { + for (const compiler of unwrapString(value).split(':')) { + if (compiler.startsWith('&')) { + reachableGroups.add(`${lang}.${compiler.slice(1)}`); + } else { + reachableCompilers.add(compiler); + } + } + } + if (propParts[0] === 'group') { + if (propParts[2] === 'compilers') { + // should appear exactly once + const fullGroup = `${lang}.${propParts[1]}`; + if (groups.has(fullGroup)) { + const [lang, realGroup] = fullGroup.split('.'); + logger.error( + `Duplicate group id ${realGroup} for ${lang} in domain ${domains.join(',')}`, + ); + error = true; + } + groups.add(fullGroup); + for (const compiler of unwrapString(value).split(':')) { + if (compiler.startsWith('&')) { + reachableGroups.add(`${lang}.${compiler.slice(1)}`); + } else { + reachableCompilers.add(compiler); + } + } + } + } + if (propParts[0] === 'compiler') { + if (propParts[2] === 'exe') { + // should appear exactly once + if (compilers.has(propParts[1])) { + logger.error( + `Duplicate compiler id ${propParts[1]} in domain ${domains.join(',')}`, + ); + error = true; + } + compilers.add(propParts[1]); + } + } + } + } + } + for (const group of groups) { + if (!reachableGroups.has(group)) { + const [lang, realGroup] = group.split('.'); + logger.error( + `Group ${realGroup} is orphaned from the language compilers list for ` + + `${lang} in domain ${domains.join(',')}`, + ); + error = true; + } + } + for (const compiler of compilers) { + if (!reachableCompilers.has(compiler)) { + logger.error(`Compiler ${compiler} is not part of any group in domain ${domains.join(',')}`); + error = true; + } + } + } + if (error) { + assert(false); + } + } + async find() { + this.checkOrphanedProperties(); + const compilerList = await this.getCompilers(); const toolchains = await getPossibleGccToolchainsFromCompilerInfo(compilerList); diff --git a/lib/properties.ts b/lib/properties.ts index 09b9d4533..d3cea1d35 100644 --- a/lib/properties.ts +++ b/lib/properties.ts @@ -281,3 +281,7 @@ export function setDebug(debug: boolean) { export function fakeProps(fake: Record<string, PropertyValue>): PropertyGetter { return (prop, def) => (fake[prop] === undefined ? def : fake[prop]); } + +export function getRawProperties() { + return properties; +} |