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

Interop ts_library with closure_js_binary. #76

Closed
wants to merge 2 commits into from

Conversation

mrmeku
Copy link
Contributor

@mrmeku mrmeku commented Nov 20, 2017

Every the ts_library impl now returns a struct named "closure_js_library" needed by both closure_js_library and closure_js_binary. This struct contains the srcs of the ts_library transpiled to es6 as well as the path prefixes which should be stripped off of import statements in order to find the imported file within the file system.

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@@ -329,3 +365,12 @@ def ts_providers_dict_to_struct(d):
if type(value) == type({}):
d[key] = struct(**value)
return struct(**d)

def collect_js(ctx, deps):
Copy link
Member

Choose a reason for hiding this comment

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

This is extracted from rules_closure. What would you think about moving this around in the rules_closure repo to make it an importable function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its heavily modified from the rules_closure implementation (and the rules closure implementation was within a directory named private). Also I'm not sure that its completely wise to make rules_typescript directly depend upon rules_closure since it'll cause user's of these rules to have to clone an entire repo they won't necessarily use

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for copying in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -301,6 +329,14 @@ def compile_ts(ctx,
collect_default=True,
collect_data=True,
),
"closure_js_library": struct(
Copy link
Member

Choose a reason for hiding this comment

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

I know you like brevity, but when I'm implementing a spec, I want as much context as physically possible. Since we are implementing the rules_closure closure_js_library interface, I think we should leave the original comments along with a link to the original source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Donezo

@mrmeku mrmeku force-pushed the closure_compiler branch 2 times, most recently from 1fc865e to 9683ffe Compare November 21, 2017 04:02
Copy link
Contributor

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

how does this PR relate to #74 ?

remote = "https://github.com/bazelbuild/rules_nodejs",
tag = "0.1.11",
commit = "f6eb823e1140da6eafbf77f56a249f72bb89416e",
remote = "https://github.com/achew22/rules_nodejs",
Copy link
Contributor

Choose a reason for hiding this comment

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

do you have a separate PR to get that change upstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its already merged :)

root_without_prefix = root
prefixes_to_remove = [
# Bazel < 0.8.0.
"bazel-out/local-fastbuild/bin/",
Copy link
Contributor

Choose a reason for hiding this comment

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

use ctx.bin_bir.path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

print(file_path)
rooted_file = ctx.actions.declare_file(file_path)

ctx.actions.run_shell(
Copy link
Contributor

Choose a reason for hiding this comment

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

note, we want to support Windows soon. I am not sure if this will work, it might rely on Posix cp command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Donezo

@@ -329,3 +365,12 @@ def ts_providers_dict_to_struct(d):
if type(value) == type({}):
d[key] = struct(**value)
return struct(**d)

def collect_js(ctx, deps):
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for copying in this case

@@ -329,3 +374,12 @@ def ts_providers_dict_to_struct(d):
if type(value) == type({}):
d[key] = struct(**value)
return struct(**d)

def collect_js(ctx, deps):
"""Aggregates transitive JavaScript source files from unfurled deps."""
Copy link
Contributor

Choose a reason for hiding this comment

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

I have no idea what it means to unfurl a dep :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed!

@codesuki codesuki mentioned this pull request Nov 22, 2017
@mrmeku mrmeku force-pushed the closure_compiler branch 3 times, most recently from e2b6102 to f822a15 Compare November 22, 2017 20:57
@mrmeku
Copy link
Contributor Author

mrmeku commented Nov 22, 2017

FYI: This PR was based off PR #74 (and includes the commit it contained) but fixes some bugs and cleans up the code a bit.

@mrmeku mrmeku force-pushed the closure_compiler branch 4 times, most recently from 3fd754b to e61df25 Compare November 23, 2017 04:31
Months of teath nashing later...
@mrmeku mrmeku force-pushed the closure_compiler branch 2 times, most recently from e90829c to d5cf86f Compare November 23, 2017 04:37
Every the ts_library impl now returns a struct named
"closure_js_library" needed by both closure_js_library and
closure_js_binary. This struct contains the srcs of the ts_library
transpiled to es6 as well as the path prefixes which should be stripped
off of import statements in order to find the imported file within the
file system.
@mrmeku
Copy link
Contributor Author

mrmeku commented Nov 23, 2017

We are switching back to PR #74

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.

None yet

4 participants