Skip to content

Commit

Permalink
Merge branch 'release/0.9.0'
Browse files Browse the repository at this point in the history
* release/0.9.0: (35 commits)
  (GH-58) Added Debug Configuration for Mono
  (doc) Updated command information
  Updated command names.
  Added support for installing Cake.Bakery.
  (GH-35) Added information to readme
  (GH-42) Minor tweaks
  Adds debug command as option to guided install. Initial refactoring for opening gen'd file in workspace.
  (GH-52) Removed syntax highlighting
  (maint) Switch to released version of Cake.VsCode
  (GH-50) Switch to prerelease version of Cake.VsCode
  (GH-50) Removed usage of solutioninfo.cs
  (GH-50) Switch language so that mono is installed
  (GH-50) Made build.sh executable
  (GH-50) Added build.sh file
  (GH-50) Added Travis Yml File
  (maint) Switch to https
  (maint) Whitespace changes
  (maint) Renamed functions for consistency
  (maint) Removed explicit use strict from files
  (maint) whitespace changes
  ...
  • Loading branch information
gep13 committed Oct 26, 2017
2 parents 19f2544 + aaa7112 commit 8a0cb13
Show file tree
Hide file tree
Showing 36 changed files with 3,896 additions and 901 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ tools/nuget.exe
tools/gitreleasemanager/
tools/GitVersion.CommandLine/
tools/Addins/
tools/packages.config.md5sum
tools/packages.config.md5sum

# until we move to Yarn
yarn.lock
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: csharp

os:
- osx
- linux

script:
- ./build.sh --verbosity diagnostic
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) .NET Foundation and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,56 @@ This addin brings language support for [Cake](https://cakebuild.net) build scrip
In addition to integrated editing features, the extension also provides commands in the Command Palette for working with Cake files:

* `Cake: Install a bootstrapper` to install a Cake bootstrapper for Windows, OS X or Linux in the root folder.
* `Cake: Install to workspace` will run through all of the available commands at once, to save having to run them one by one
* `Cake: Install debug dependencies` to download the Cake.CoreCLR NuGet Package into the tools folder, ready for enabling debugging
* `Cake: Install sample build file` to install a sample Cake File that contains Setup and Teardown actions, a sample task, and argument parsing.
* `Cake: Install a configuration file` to install the default Cake Configuration file for controlling internal components of Cake.
* `Cake: Install intellisense support` to download the Cake.Bakery NuGet Package into the tools folder, which in conjunction with OmniSharp provides intellisense support for Cake Files.

### Snippets

* `cake-addin`
* Provides a basic addin pre-processor directive, where the package name and version can be changed
* **Default Value:** `#addin "nuget:?package=Cake.Foo&version=1.2.3"`
* `cake-addin-full`
* Provides a more complete addin pre-processor directive, where source, package name and version can be changed
* **Default Value:** `#addin "nuget:https://www.nuget.org/api/v2?package=Cake.Foo&version=1.2.3"`
* `cake-argument`
* Provides code for basic input argument parsing, where variable name, argument name and default value can be changed
* **Default Value:** `var target = Argument("target", "Default");`
* `cake-load`
* Provides a basic load pre-processor directive, where the path to the .cake file can be changed
* **Default Value:** `#load "scripts/utilities.cake"`
* `cake-load-nuget`
* Provides a more complex load pre-processor directive, where source, package name and version can be changed
* **Default Value:** `#load "nuget:https://www.nuget.org/api/v2?package=Cake.Foo&version=1.2.3"`
* `cake-reference`
* Provides a basic reference pre-processor directive, where path to the assembly can be changed
* **Default Value:** `#reference "bin/myassembly.dll"`
* `cake-sample`
* Provides a complete sample Build Cake Script including Setup and Teardown actions, a single task, and argument parsing
* `cake-tool`
* Provides a basic tool pre-processor directive, where the package name and version can be changed
* **Default Value:** `#tool "nuget:?package=Cake.Foo&version=1.2.3"`
* `cake-tool-full`
* Provides a more complete tool pre-processor directive, where source, package name and version can be changed
* **Default Value:** `#tool "nuget:https://www.nuget.org/api/v2?package=Cake.Foo&version=1.2.3"`
* `task`
* Provides a basic task definition, where the name of the task can be changed
* **Default Value:** `Task("name");`
* `task` (With Action)
* Provides a more complex task definition, including an .Does body, where the name of the task can be changed

### Task Provider

The extension will also parse all `*.cake` files in the workspace and make them executable via the built in `Tasks: Run Task` command.

There are a number of configuration options which allow you to control how the Task Provider works:

* `cake.taskRunner.autoDetect`: a boolean value which toggles auto detection of Tasks on or off. Default value is `true`
* `cake.taskRunner.scriptsIncludePattern`: a glob pattern which specifies how to detect `.cake` files in the current workspace. Default value is `**/*.cake`.
* `cake.taskRunner.scriptsExcludePattan`: a glob pattern which specifies all files and folders that shouldn't be included in search of current workspace. Default value is `""`.
* `cake.taskRunner.taskRegularExpression` a regular expression pattern which is used to identify Tasks within the `*.cake` files. Default value is `Task\\s*?\\(\\s*?\"(.*?)\"\\s*?\\)`

## What is Cake?

Expand All @@ -16,3 +65,9 @@ Cake (C# Make) is a cross platform build automation system with a C# DSL to do t
## Learn more

For more information about Cake, please see the [Cake website](https://cakebuild.net) or the Cake [source code repository](https://github.com/cake-build/cake).

## Resource Video

There is a short introduction video to the Visual Studio Code Extension for Cake here:

[![Introduction to Visual Studio Extension for Cake](https://img.youtube.com/vi/zzZuysl3xSg/0.jpg)](https://www.youtube.com/watch?v=zzZuysl3xSg)
4 changes: 2 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//////////////////////////////////////////////////////////////////////

#addin "nuget:?package=MagicChunks&version=1.2.0.58"
#addin "nuget:?package=Cake.VsCode&version=0.7.0"
#addin "nuget:?package=Cake.VsCode&version=0.8.0"
#addin "nuget:?package=Cake.Npm&version=0.10.0"

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -177,4 +177,4 @@ Task("ReleaseNotes")
// EXECUTION
//////////////////////////////////////////////////////////////////////

RunTarget(parameters.Target);
RunTarget(parameters.Target);
43 changes: 41 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ if(!$PSScriptRoot){
}

$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"

# Should we use mono?
$UseMono = "";
Expand Down Expand Up @@ -130,7 +134,7 @@ if (!(Test-Path $PACKAGES_CONFIG)) {
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) }
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
Expand Down Expand Up @@ -175,6 +179,41 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

# Restore addins from NuGet
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Push-Location
Set-Location $ADDINS_DIR

Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occured while restoring NuGet addins."
}

Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

# Restore modules from NuGet
if (Test-Path $MODULES_PACKAGES_CONFIG) {
Push-Location
Set-Location $MODULES_DIR

Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occured while restoring NuGet modules."
}

Write-Verbose -Message ($NuGetOutput | out-string)

Pop-Location
}

Expand All @@ -186,4 +225,4 @@ if (!(Test-Path $CAKE_EXE)) {
# Start Cake
Write-Host "Running build script..."
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
exit $LASTEXITCODE
exit $LASTEXITCODE
131 changes: 131 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/env bash

##########################################################################
# This is the Cake bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################

# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
ADDINS_DIR=$TOOLS_DIR/Addins
MODULES_DIR=$TOOLS_DIR/Modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config

# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
if [[ "$(uname -s)" == "Darwin" ]]; then
MD5_EXE="md5 -r"
else
MD5_EXE="md5sum"
fi

# Define default arguments.
SCRIPT="build.cake"
TARGET="Default"
CONFIGURATION="Release"
VERBOSITY="verbose"
DRYRUN=
SHOW_VERSION=false
SCRIPT_ARGUMENTS=()

# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
-t|--target) TARGET="$2"; shift ;;
-c|--configuration) CONFIGURATION="$2"; shift ;;
-v|--verbosity) VERBOSITY="$2"; shift ;;
-d|--dryrun) DRYRUN="-dryrun" ;;
--version) SHOW_VERSION=true ;;
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
*) SCRIPT_ARGUMENTS+=("$1") ;;
esac
shift
done

# Make sure the tools folder exist.
if [ ! -d "$TOOLS_DIR" ]; then
mkdir "$TOOLS_DIR"
fi

# Make sure that packages.config exist.
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
echo "Downloading packages.config..."
curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
if [ $? -ne 0 ]; then
echo "An error occured while downloading packages.config."
exit 1
fi
fi

# Download NuGet if it does not exist.
if [ ! -f "$NUGET_EXE" ]; then
echo "Downloading NuGet..."
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ $? -ne 0 ]; then
echo "An error occured while downloading nuget.exe."
exit 1
fi
fi

# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
find . -type d ! -name . | xargs rm -rf
fi

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet tools."
exit 1
fi

$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"

popd >/dev/null

# Restore addins from NuGet.
if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
pushd "$ADDINS_DIR" >/dev/null

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet addins."
exit 1
fi

popd >/dev/null
fi

# Restore modules from NuGet.
if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
pushd "$MODULES_DIR" >/dev/null

mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet modules."
exit 1
fi

popd >/dev/null
fi

# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
exit 1
fi

# Start Cake
if $SHOW_VERSION; then
exec mono "$CAKE_EXE" -version
else
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
fi
7 changes: 3 additions & 4 deletions build/version.cake
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ public class BuildVersion

if (string.IsNullOrEmpty(version) || string.IsNullOrEmpty(semVersion))
{
context.Information("Fetching verson from SolutionInfo");
var assemblyInfo = context.ParseAssemblyInfo("./src/SolutionInfo.cs");
version = assemblyInfo.AssemblyVersion;
semVersion = assemblyInfo.AssemblyInformationalVersion;
context.Information("Hardcoding version number, as GitVersion didn't execute...");
version = "0.1.0";
semVersion = "0.1.0";
milestone = string.Concat("v", version);
}

Expand Down
11 changes: 0 additions & 11 deletions config/cake.configuration.json

This file was deleted.

Loading

0 comments on commit 8a0cb13

Please sign in to comment.