Skip to content
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

Provide an npm package.json to build the file. #73

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
obj/
*.taskkey
bin/
*/node_modules/
node_modules
typings.json
*/typings/
deploy-gae-build-task/#task.json#
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ Questions can be asked on StackOverflow
- [PowerShell][PowerShell]: Installed by default on modern windows platforms.
- [Node.js][Node]: Download and install from the website.
- [npm][npm]: Installed along with Node.js.
- [TypeScript][TypeScript]: Install with `npm install -g typescript`
- [tfx][tfs-cli]: The tfs cli. Install with `npm install -g tfx-cli`
- [mocha][mocha]: A JavaScript test runner. `npm install -g mocha`
- [ts-node]: Used by mocha to run TypeScript directly. `npm install -g ts-node`
- [nyc][nyc]: The Istanbul code coverage tool. Install with `npm install -g nyc`
- [MSBuild][https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2019]: Installed with Visual Studio. Visual Studio does not add MSBuild to the path. You can make msbuild resolve in powershell by doing this:

```
New-Alias vswhere "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$msbuildPath = (ls ((vswhere -latest -property InstallationPath) + "\MSBuild\*\Bin\MSBuild.exe"))[0].FullName
New-Alias msbuild $msbuildPath
```

### Build Script

Execute build script `./build/BuildExtension.ps1`. It will download needed
Execute build script `npm run-script build`. It will download needed
modules, build the common files and build tasks, and then package everything
into `./bin/Google Cloud Tools.google-cloud-tfs-<version>.vsix`.

Expand Down
33 changes: 17 additions & 16 deletions build/BuildExtension.ps1
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
<##
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##>
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[CmdletBinding()]
Param(
[string[]]$TasksToTest,
[switch]$SkipInit,
[switch]$SkipCompile,
[switch]$SkipTest,
[switch]$SkipPackage,
[string]$Publisher,
[string]$Version
)
Set-StrictMode -Version 3.0
$ErrorActionPreference = "Stop"

$env:PATH = "$PSScriptRoot\..\node_modules\.bin\;${env:PATH}"

pushd (Join-Path $MyInvocation.MyCommand.Path ..)
$functionsModule = Import-Module ./BuildFunctions.psm1 -PassThru -Verbose:$false -ArgumentList $VerbosePreference
Expand Down Expand Up @@ -67,5 +69,4 @@ try {
}
} finally {
popd
$functionsModule | Remove-Module -Verbose:$false
}
38 changes: 20 additions & 18 deletions build/BuildFunctions.psm1
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<##
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##>
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Param(
$VerbosePreference
)

$env:PATH = "$PSScriptRoot\..\node_modules\.bin\;${env:PATH}"

function Initialize-All([string[]]$tasks) {
Write-Host "Initialize modules and tasks"
Initialize-PsTask "install-cloud-sdk-build-task"
Expand Down Expand Up @@ -77,8 +78,9 @@ function Invoke-MochaTest([string]$task, [string]$reporter) {
if ($reporter) {
$nycArgs += "--reporter", $reporter
}
Write-Verbose "Running: nyc $nycArgs"
nyc $nycArgs

Write-Host "Running: nyc $nycArgs"
nyc @nycArgs

if ($LASTEXITCODE -ne 0) {
throw "mocha failed for task $task"
Expand Down Expand Up @@ -178,7 +180,7 @@ function Merge-ExtensionPackage([string] $publisher, [string] $version) {
$tfxArgs += "--overrides-file", $overridesFile
}
Write-Verbose "Running: tfx $tfxArgs"
tfx $tfxArgs
& tfx @tfxArgs
if ($overridesFile) {
rm $overridesFile
}
Expand Down
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "GoogleCloudPlatform.google-cloud-tfs",
"version": "0.0.9",
"description": "A collection of TFS build tasks to run Google Cloud Platform tools.",
"license": "Apache-2.0",
"author": "Google Cloud Tools",
"repository": "https://github.com/GoogleCloudPlatform/google-cloud-tfs.git",
"main": "run.js",
"dependencies": {
"typescript": "^3.6.4"
},
"scripts": {
"build": "pwsh ./build/BuildExtension.ps1"
},
"devDependencies": {
"typescript": "^3.6.4",
"tfx-cli": "^0.7",
"ts-node": "^8.4.1",
"@types/mocha": "^2.2.40",
"@types/mockery": "^1.4.29",
"@types/node": "^7.0.6",
"@types/q": "0.0.32",
"mocha": "^3.2.0",
"mockery": "^2.1.0",
"typemoq": "^2.0.1",
"nyc": "^14.1.1"
}
}