Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Windows fixes #158

Closed
wants to merge 7 commits into from
Closed

Conversation

gregmagolan
Copy link
Contributor

@gregmagolan
Copy link
Contributor Author

Curated and improved fixes from #155

@gregmagolan gregmagolan force-pushed the windows-fixes-v3 branch 3 times, most recently from 80c5e1c to 1ab2d36 Compare March 1, 2018 05:57
# programs produce source-mapped stack traces.
RULES_NODEJS_VERSION = "926349cea4cd360afcd5647ccdd09d2d2fb471aa"
# Using a pre-release snapshot to pick up a fix for puppeteer
RULES_NODEJS_VERSION = "0162fdbe8ed986c9b5d5b79e53c98385ddaf6edd"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think you need this anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean switch to git_repository from the skylark rules?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, this is just a fast-forward of master

const fs = require('fs');
const tmp = require('tmp');

process.env.CHROME_BIN = require('puppeteer').executablePath();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory the ts_web_test should allow the user to select one or more browsers,
https://github.com/bazelbuild/rules_typescript/blob/master/internal/karma/ts_web_test.bzl#L22

just to keep in mind, that anything hard-coded will need to be revisited

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a comment to that line explaining it a bit. Karma will just look for CHROME_BIN in the environment if it is configured to use Chrome. If another browser is selected then that value is not used.

throw new Error(`File not found in MANIFEST: ${f}`);
}
});
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to support a case where there is no MANIFEST?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as comment below. build_bazel_rules_typescript/external/ prefix is what is needed to match in the manifest and that needs to be dropped so it matches on runfiles.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add a comment here that explains this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up. No MANIFEST case is not needed.


let requireFiles = [
TMPL_files
].map((f) => f.replace('build_bazel_rules_typescript/external/', ''));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is rules_typescript special here? Could there be other external repos in the files?

Copy link
Contributor Author

@gregmagolan gregmagolan Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is to handle the two files from ts_web_test.bzl:

files_entries += [
    "build_bazel_rules_typescript/external/build_bazel_rules_typescript_karma_deps/node_modules/requirejs/require.js",
    "build_bazel_rules_typescript/external/build_bazel_rules_typescript_karma_deps/node_modules/karma-requirejs/lib/adapter.js",
  ]

I think its correct. build_bazel_rules_typescript/external/ prefix is what is needed to match in the manifest and that needs to be dropped so it matches on runfiles. in the case of the two files from ts_web_test.bz, the external workspace is build_bazel_rules_typescript_karma_deps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I took a closer look at the MANIFEST file. I think this code can be improved to get rid the build_bazel_rules_typescript/external/ bit. Will try it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned this up. No build_bazel_rules_typescript/external/ prefix is necessary.

TMPL_files
]

// files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. a bit redundant. there was a comment before every other property and I didn't know what else to put.

@@ -17,6 +17,7 @@

import * as path from 'path';
import * as ts from 'typescript';
import {relative} from './path';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, import * as path from 'path'

Copy link
Contributor Author

@gregmagolan gregmagolan Mar 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is importing from the local ./path.ts which provides versions of the four path functions that were introducing forward slashes. the new versions maintain backslashes. you think it would be better as import * as path from './path'? may be a bit confusing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's what I meant, that way we see the familiar path.relative below, and makes this delta smaller

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm. this will conflict with the existing path imports and uses in compiler_host.ts and tsconfig.ts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can just re-export the functions used out of './path'. That will be pretty clean.

@@ -12,6 +11,7 @@ import {PLUGIN as strictDepsPlugin} from './strict_deps';
import {BazelOptions, parseTsconfig} from './tsconfig';
import {fixUmdModuleDeclarations} from './umd_module_declaration_transform';
import {debug, log, runAsWorker, runWorkerLoop} from './worker';
import {resolve} from './path';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again

@@ -17,6 +17,7 @@

import * as path from 'path';
import * as ts from 'typescript';
import {resolve, normalize} from './path';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again

import * as ts from 'typescript';

import {parseTsconfig} from './tsconfig';
import {resolve} from './path';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again

@@ -1,4 +1,4 @@
import * as path from 'path';
import {resolve} from './path';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again

@alexeagle alexeagle requested a review from mprobst March 1, 2018 21:41
@achew22
Copy link
Member

achew22 commented Mar 2, 2018

@gregmagolan, does this address #152?

@gregmagolan
Copy link
Contributor Author

@gregmagolan, does this address #152?

Nope. Although there is a fix for that that @alexeagle has submitted internally

@gregmagolan
Copy link
Contributor Author

@achew22 Its been merged in. Fixed on rules_typescript master now. Commit is: Workaround for microsoft/TypeScript#22208

@gregmagolan gregmagolan mentioned this pull request Mar 2, 2018
@alexeagle
Copy link
Contributor

Okay I got @mprobst on chat, here is the code review:

  1. split into two PRs, one for tsc_wrapped and one for karma.
  2. for tsc_wrapped, copy this function https://github.com/Microsoft/TypeScript/blob/a564912d9a335fe67ce7c5e4dabce46015bad8d4/src/compiler/core.ts#L1943 into compiler_host.ts
    and then call it only in the minimal places required to make Windows green - things like the change in worker.ts are only error reporting so that can't be strictly required.

@gregmagolan
Copy link
Contributor Author

Replaced by #160, #161 and #162

@gregmagolan gregmagolan closed this Mar 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants