-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add '_scope' to task configuration #4452
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { inject, injectable } from 'inversify'; | ||
import { TaskConfiguration } from '../common/task-protocol'; | ||
import { TaskProviderRegistry } from './task-contribution'; | ||
|
||
@injectable() | ||
export class ProvidedTaskConfigurations { | ||
|
||
/** | ||
* Map of source (name of extension, or path of root folder that the task config comes from) and `task config map`. | ||
* For the inner map (i.e., `task config map`), the key is task label and value TaskConfiguration | ||
*/ | ||
protected tasksMap = new Map<string, Map<string, TaskConfiguration>>(); | ||
|
||
@inject(TaskProviderRegistry) | ||
protected readonly taskProviderRegistry: TaskProviderRegistry; | ||
|
||
/** returns a list of provided tasks */ | ||
async getTasks(): Promise<TaskConfiguration[]> { | ||
const providedTasks: TaskConfiguration[] = []; | ||
const providers = this.taskProviderRegistry.getProviders(); | ||
for (const provider of providers) { | ||
providedTasks.push(...await provider.provideTasks()); | ||
} | ||
this.cacheTasks(providedTasks); | ||
return providedTasks; | ||
} | ||
|
||
/** returns the task configuration for a given source and label or undefined if none */ | ||
getTask(source: string, taskLabel: string): TaskConfiguration | undefined { | ||
const labelConfigMap = this.tasksMap.get(source); | ||
if (labelConfigMap) { | ||
return labelConfigMap.get(taskLabel); | ||
} | ||
} | ||
|
||
protected cacheTasks(tasks: TaskConfiguration[]): void { | ||
for (const task of tasks) { | ||
const label = task.label; | ||
const source = task._source; | ||
if (this.tasksMap.has(source)) { | ||
this.tasksMap.get(source)!.set(label, task); | ||
} else { | ||
const labelTaskMap = new Map<string, TaskConfiguration>(); | ||
labelTaskMap.set(label, task); | ||
this.tasksMap.set(source, labelTaskMap); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's 0.5.0
i'm fine with that, please be conscious when you break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right. i will put it back. Thank you !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 more breaking changes in this PR.
I'm fine with 0.5.0 for next. There are PRs, like refactoring git to scm extension, for which it is not avoidable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akosyakov just thinking about API breaking going under the radar, would there be a strategy to adopt in order to catch any API breakage?
I guess this could be done with our test suite, but despite all the tests we have, it seems to not be enough. Is there something that should be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of any tools for TS allowing to check it. Even if there are I am not sure that we want to use them, since we are fine with breaking and updating the major version. It would cause a lot of noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put
taskConfigurations
back and commentedTo be removed in 0.5.0
. We could leave it here for the release where other breaking changes are made. What do you think ?