mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 09:23:52 -05:00
Add the HandlerConfig type to the global handler config (#5858)
This commit is contained in:
9
app.ts
9
app.ts
@@ -73,9 +73,6 @@ import type {Language, LanguageKey} from './types/languages.interfaces.js';
|
||||
// Used by assert.ts
|
||||
global.ce_base_directory = new URL('.', import.meta.url);
|
||||
|
||||
// Used by d8.ts
|
||||
global.handlerConfig = null;
|
||||
|
||||
(nopt as any).invalidHandler = (key, val, types) => {
|
||||
logger.error(
|
||||
`Command line argument type error for "--${key}=${val}", expected ${types.map(t => typeof t).join(' | ')}`,
|
||||
@@ -566,7 +563,7 @@ async function main() {
|
||||
const healthCheckFilePath = ceProps('healthCheckFilePath', false);
|
||||
|
||||
// Exported to allow compilers to refer to other existing compilers.
|
||||
global.handlerConfig = {
|
||||
global.handler_config = {
|
||||
compileHandler,
|
||||
clientOptionsHandler,
|
||||
storageHandler,
|
||||
@@ -579,8 +576,8 @@ async function main() {
|
||||
contentPolicyHeader,
|
||||
};
|
||||
|
||||
const noscriptHandler = new NoScriptHandler(router, global.handlerConfig);
|
||||
const routeApi = new RouteAPI(router, global.handlerConfig);
|
||||
const noscriptHandler = new NoScriptHandler(router, global.handler_config);
|
||||
const routeApi = new RouteAPI(router, global.handler_config);
|
||||
|
||||
async function onCompilerChange(compilers) {
|
||||
if (JSON.stringify(prevCompilers) === JSON.stringify(compilers)) {
|
||||
|
||||
@@ -80,7 +80,7 @@ export class D8Compiler extends BaseCompiler {
|
||||
|
||||
// Instantiate Java or Kotlin compiler based on the current language.
|
||||
if (this.lang.id === 'android-java') {
|
||||
const javaCompiler = global.handlerConfig.compileHandler.findCompiler('java', this.javaId);
|
||||
const javaCompiler = global.handler_config.compileHandler.findCompiler('java', this.javaId);
|
||||
outputFilename = javaCompiler.getOutputFilename(preliminaryCompilePath);
|
||||
const javaOptions = _.compact(
|
||||
javaCompiler.prepareArguments(
|
||||
@@ -100,7 +100,7 @@ export class D8Compiler extends BaseCompiler {
|
||||
javaCompiler.getDefaultExecOptions(),
|
||||
);
|
||||
} else if (this.lang.id === 'android-kotlin') {
|
||||
const kotlinCompiler = global.handlerConfig.compileHandler.findCompiler('kotlin', this.kotlinId);
|
||||
const kotlinCompiler = global.handler_config.compileHandler.findCompiler('kotlin', this.kotlinId);
|
||||
outputFilename = kotlinCompiler.getOutputFilename(preliminaryCompilePath);
|
||||
const kotlinOptions = _.compact(
|
||||
kotlinCompiler.prepareArguments(
|
||||
|
||||
@@ -22,10 +22,14 @@
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import {HandlerConfig} from './handlers/route-api.js';
|
||||
|
||||
declare global {
|
||||
// var is required
|
||||
// eslint-disable-next-line no-var
|
||||
/* eslint-disable no-var */
|
||||
var ce_base_directory: URL;
|
||||
var handler_config: HandlerConfig;
|
||||
/* eslint-enable no-var */
|
||||
}
|
||||
|
||||
// Necessary because we're not exporting any actual symbols from this file
|
||||
|
||||
Reference in New Issue
Block a user