Skip to content

Commit 03fcc83

Browse files
authored
Merge pull request microsoft#1412 from iclanton/ianc/rush-buildxl
[rush] Add rush-buildxl package.
2 parents 3137bf1 + 9b0a72f commit 03fcc83

14 files changed

Lines changed: 256 additions & 50 deletions

File tree

apps/rush-buildxl/LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@microsoft/rush-lib
2+
3+
Copyright (c) Microsoft Corporation. All rights reserved.
4+
5+
MIT License
6+
7+
Permission is hereby granted, free of charge, to any person obtaining
8+
a copy of this software and associated documentation files (the
9+
"Software"), to deal in the Software without restriction, including
10+
without limitation the rights to use, copy, modify, merge, publish,
11+
distribute, sublicense, and/or sell copies of the Software, and to
12+
permit persons to whom the Software is furnished to do so, subject to
13+
the following conditions:
14+
15+
The above copyright notice and this permission notice shall be
16+
included in all copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

apps/rush-buildxl/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## @microsoft/rush-buildxl
2+
3+
This is an experimental companion package for the Rush tool. See the
4+
[@microsoft/rush](https://www.npmjs.com/package/@microsoft/rush)
5+
package for details.
6+
7+
The **rush-buildxl** package provides support for BuildXL in Rush.

apps/rush-buildxl/config/jest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"isEnabled": true
3+
}

apps/rush-buildxl/gulpfile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict';
2+
3+
const build = require('@microsoft/node-library-build');
4+
5+
build.initialize(require('gulp'));

apps/rush-buildxl/package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "@microsoft/rush-buildxl",
3+
"version": "5.10.3",
4+
"description": "An experimental tool that connects Rush and BuildXL",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/Microsoft/web-build-tools/tree/master/apps/rush-buildxl"
8+
},
9+
"engines": {
10+
"node": ">=5.6.0"
11+
},
12+
"engineStrict": true,
13+
"homepage": "https://rushjs.io",
14+
"tsdoc": {
15+
"tsdocFlavor": "AEDoc"
16+
},
17+
"scripts": {
18+
"build": "gulp test --clean"
19+
},
20+
"license": "MIT",
21+
"dependencies": {
22+
"@microsoft/node-core-library": "3.13.0",
23+
"@microsoft/rush-lib": "5.10.3",
24+
"@microsoft/ts-command-line": "4.2.6"
25+
},
26+
"devDependencies": {
27+
"@microsoft/node-library-build": "6.1.0",
28+
"@microsoft/rush-stack-compiler-3.4": "0.1.13",
29+
"@types/jest": "23.3.11",
30+
"@types/node": "8.5.8",
31+
"gulp": "~4.0.2"
32+
}
33+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import { CommandLineParser } from '@microsoft/ts-command-line';
5+
import { Terminal } from '@microsoft/node-core-library';
6+
import { GenerateAction } from './actions/GenerateAction';
7+
8+
export class RushBuildXLCommandLineParser extends CommandLineParser {
9+
private _terminal: Terminal;
10+
11+
constructor(terminal: Terminal) {
12+
super({
13+
toolFilename: 'rush-buildlx',
14+
toolDescription: 'This experimental tool allows Rush to interact with BuildXL.'
15+
});
16+
17+
this._terminal = terminal;
18+
19+
this.addAction(new GenerateAction(this._terminal));
20+
}
21+
22+
protected onDefineParameters(): void { /* no global parameters */ }
23+
24+
protected onExecute(): Promise<void> { // override
25+
return super.onExecute().catch((error) => {
26+
this._terminal.writeErrorLine();
27+
this._terminal.writeErrorLine('ERROR: ' + error.message.trim());
28+
29+
process.exitCode = 1;
30+
});
31+
}
32+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import {
5+
CommandLineStringParameter,
6+
CommandLineAction
7+
} from '@microsoft/ts-command-line';
8+
9+
import { Terminal } from '@microsoft/node-core-library';
10+
11+
export class GenerateAction extends CommandLineAction {
12+
private _terminal: Terminal;
13+
14+
private _exampleOption: CommandLineStringParameter;
15+
16+
constructor(terminal: Terminal) {
17+
super({
18+
actionName: 'generate',
19+
summary: 'Generates a BuildXL configuration for the current Rush repository.',
20+
documentation: 'Generates a BuildXL configuration for the current Rush repository.'
21+
});
22+
23+
this._terminal = terminal;
24+
}
25+
26+
public onDefineParameters(): void {
27+
this._exampleOption = this.defineStringParameter({
28+
parameterLongName: '--example-parameter',
29+
argumentName: 'STRING',
30+
description: 'Am example paramter'
31+
});
32+
}
33+
34+
protected async onExecute(): Promise<void> {
35+
this._terminal.writeLine('Example terminal output');
36+
37+
this._terminal.writeLine(`The value of ${this._exampleOption.longName} is "${this._exampleOption.value}".`);
38+
}
39+
}

apps/rush-buildxl/src/start.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
import {
5+
Terminal,
6+
ConsoleTerminalProvider
7+
} from '@microsoft/node-core-library';
8+
9+
import { RushBuildXLCommandLineParser } from './cli/RushBuildXLCommandLineParser';
10+
11+
const terminal: Terminal = new Terminal(new ConsoleTerminalProvider({ verboseEnabled: true }));
12+
const parser: RushBuildXLCommandLineParser = new RushBuildXLCommandLineParser(terminal);
13+
parser.execute().catch((error) => terminal.writeErrorLine(error));
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
2+
// See LICENSE in the project root for license information.
3+
4+
describe('Example Test', () => {
5+
it('does stuff', () => {
6+
expect(true).toBe(true);
7+
});
8+
});

apps/rush-buildxl/tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./node_modules/@microsoft/rush-stack-compiler-3.4/includes/tsconfig-node.json",
3+
"compilerOptions": {
4+
"types": [
5+
"jest",
6+
"node"
7+
]
8+
}
9+
}

0 commit comments

Comments
 (0)