Skip to content

Fix a bug in how "rush build --from" calculates dependents. - #392

Merged
QZ (qz2017) merged 1 commit into
masterfrom
qz2017/fix_build
Oct 12, 2017
Merged

QZ (qz2017) merged 1 commit into
masterfrom
qz2017/fix_build

Conversation

@qz2017

Copy link
Copy Markdown
Contributor

No description provided.

@octogonz

Pete Gonzalez (octogonz) commented Oct 12, 2017 •

Copy link
Copy Markdown
Collaborator

private _dependentList: Map<string, Set>;

Please clarify this data structure... the name is really strange. Something like:

// For a given project name, this data structure stores a set of other
// project names that are its dependents, i.e. must be built afterwards.
// The project names are case-sensitive strings including the NPM scope.
private _dependentSetsForProjects

#ByDesign


Refers to: apps/rush/src/actions/RebuildAction.ts:40 in 3db232b. [](commit_id = 3db232b, deletion_comment = False)

private _collectAllDependents(project: string): Set<string> {
const deps: Set<string> = new Set<string>();
this._dependentList.get(project)!.forEach((dep) => {
(this._dependentList.get(project) || new Set<string>()).forEach((dep) => {

@octogonz Pete Gonzalez (octogonz) Oct 12, 2017 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

new Set() [](start = 41, length = 17)

This is a little clunky. Compare with:

const dependentSet: Set<string> = this._dependentSetsForProjects.get(project);

if (dependentSet) {
  for (const dependent of dependentSet) {
     . . .
  }
}

(Less lines of code does not generally imply better readability.) #WontFix

@octogonz

Pete Gonzalez (octogonz) commented Oct 12, 2017 •

Copy link
Copy Markdown
Collaborator

private _dependentList: Map<string, Set>;

OMG I am actually losing my mind trying to understand Nick's terminology here ("dependent" vs "dependency"). I would expect the definitions to be like this:

  • If A is a dependency for B (i.e. A needs be built first), then:
  • B is a "dependentProject" or just "dependent"
  • A is a "dependencyProject" or just "dependency"

This is backed up by the English dictionary:

  • dependent: a person who depends on or needs someone or something

Could we just write these definitions in a code comment for the benefit of someone else trying to understand this file?


In reply to: 336221542 [](ancestors = 336221542)


Refers to: apps/rush/src/actions/RebuildAction.ts:40 in 3db232b. [](commit_id = 3db232b, deletion_comment = False)

@octogonz

Copy link
Copy Markdown
Collaborator

private _dependentList: Map<string, Set>;

Also please fix up all the places where it says "dep" because that is super ambiguous. Our coding standards require full English words


In reply to: 336225259 [](ancestors = 336225259,336221542)


Refers to: apps/rush/src/actions/RebuildAction.ts:40 in 3db232b. [](commit_id = 3db232b, deletion_comment = False)

@octogonz Pete Gonzalez (octogonz) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

:shipit:

@qz2017 QZ (qz2017) changed the title Fix a bug in how rush build action calculates dependents. Fix a bug in how "rush build --from" calculates dependents. Oct 12, 2017
@qz2017

Copy link
Copy Markdown
Contributor Author

private _dependentList: Map<string, Set>;

This is dependent set list, meaning the set of things that need to be build after the key package.


In reply to: 336225259 [](ancestors = 336225259,336221542)


Refers to: apps/rush/src/actions/RebuildAction.ts:40 in 3db232b. [](commit_id = 3db232b, deletion_comment = False)

@qz2017
QZ (qz2017) merged commit 9ed9bbd into master Oct 12, 2017
@qz2017
QZ (qz2017) deleted the qz2017/fix_build branch October 12, 2017 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants