-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b35be8
commit 2d9b1d9
Showing
7 changed files
with
390 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 0.1.0 | ||
|
||
- Initial release | ||
- Random numbers (#6) | ||
- Arithmetic functions (#2) | ||
- Simple interpretation (#1) |
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,207 @@ | ||
/* **************************************** | ||
Publishing workflow | ||
------------------- | ||
- Update CHANGELOG.md | ||
- Run a normal build with Cake | ||
- Push to devel and FF merge to master | ||
- Switch to master | ||
- Run a Publish build with Cake | ||
- Switch back to devel branch | ||
**************************************** */ | ||
|
||
#addin "Cake.FileHelpers" | ||
#addin "Octokit" | ||
using Octokit; | ||
|
||
var target = Argument("target", "Default"); | ||
var configuration = Argument("configuration", "Release"); | ||
var isLocal = BuildSystem.IsLocalBuild; | ||
var isRunningOnUnix = IsRunningOnUnix(); | ||
var isRunningOnWindows = IsRunningOnWindows(); | ||
var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor; | ||
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest; | ||
var buildNumber = AppVeyor.Environment.Build.Number; | ||
var releaseNotes = ParseReleaseNotes("./CHANGELOG.md"); | ||
var version = releaseNotes.Version.ToString(); | ||
var buildDir = Directory("./src/Mages.Core/bin") + Directory(configuration); | ||
var buildResultDir = Directory("./bin") + Directory(version); | ||
var nugetRoot = buildResultDir + Directory("nuget"); | ||
|
||
// Initialization | ||
// ---------------------------------------- | ||
|
||
Setup(() => | ||
{ | ||
Information("Building version {0} of MAGES.", version); | ||
Information("For the publish target the following environment variables need to be set:"); | ||
Information(" NUGET_API_KEY, GITHUB_API_TOKEN"); | ||
}); | ||
|
||
// Tasks | ||
// ---------------------------------------- | ||
|
||
Task("Clean") | ||
.Does(() => | ||
{ | ||
CleanDirectories(buildDirs.OfType<DirectoryPath>().Concat(new DirectoryPath[] { buildResultDir, nugetRoot })); | ||
}); | ||
|
||
Task("Restore-Packages") | ||
.IsDependentOn("Clean") | ||
.Does(() => | ||
{ | ||
NuGetRestore("./src/Mages.sln"); | ||
}); | ||
|
||
Task("Build") | ||
.IsDependentOn("Restore-Packages") | ||
.Does(() => | ||
{ | ||
if (isRunningOnWindows) | ||
{ | ||
MSBuild("./src/Mages.sln", new MSBuildSettings() | ||
.SetConfiguration(configuration) | ||
.SetVerbosity(Verbosity.Minimal) | ||
); | ||
} | ||
else | ||
{ | ||
XBuild("./src/Mages.sln", new XBuildSettings() | ||
.SetConfiguration(configuration) | ||
.SetVerbosity(Verbosity.Minimal) | ||
); | ||
} | ||
}); | ||
|
||
Task("Run-Unit-Tests") | ||
.IsDependentOn("Build") | ||
.Does(() => | ||
{ | ||
var settings = new NUnit3Settings | ||
{ | ||
Work = buildResultDir.Path.FullPath | ||
}; | ||
|
||
if (isRunningOnAppVeyor) | ||
{ | ||
settings.Where = "cat != ExcludeFromAppVeyor"; | ||
} | ||
|
||
NUnit3("./src/**/bin/" + configuration + "/*.Tests.dll", settings); | ||
}); | ||
|
||
Task("Copy-Files") | ||
.IsDependentOn("Build") | ||
.Does(() => | ||
{ | ||
var target = nugetRoot + Directory("lib") + Directory("net35"); | ||
CreateDirectory(target); | ||
CopyFiles(new FilePath[] | ||
{ | ||
buildDir + File("Mages.Core.dll"), | ||
buildDir + File("Mages.Core.xml") | ||
}, target); | ||
CopyFiles(new FilePath[] { "src/Mages.nuspec" }, nugetRoot); | ||
}); | ||
|
||
Task("Create-Package") | ||
.IsDependentOn("Copy-Files") | ||
.Does(() => | ||
{ | ||
var nugetExe = GetFiles("./tools/**/nuget.exe").FirstOrDefault() | ||
?? (isRunningOnAppVeyor ? GetFiles("C:\\Tools\\NuGet3\\nuget.exe").FirstOrDefault() : null); | ||
|
||
if (nugetExe == null) | ||
{ | ||
throw new InvalidOperationException("Could not find nuget.exe."); | ||
} | ||
|
||
var nuspec = nugetRoot + File("Mages.nuspec"); | ||
|
||
NuGetPack(nuspec, new NuGetPackSettings | ||
{ | ||
Version = version, | ||
OutputDirectory = nugetRoot, | ||
Symbols = false, | ||
Properties = new Dictionary<String, String> { { "Configuration", configuration } } | ||
}); | ||
}); | ||
|
||
Task("Publish-Package") | ||
.IsDependentOn("Create-Package") | ||
.WithCriteria(() => isLocal) | ||
.Does(() => | ||
{ | ||
var apiKey = EnvironmentVariable("NUGET_API_KEY"); | ||
|
||
if (String.IsNullOrEmpty(apiKey)) | ||
{ | ||
throw new InvalidOperationException("Could not resolve the NuGet API key."); | ||
} | ||
|
||
foreach (var nupkg in GetFiles(nugetRoot.Path.FullPath + "/*.nupkg")) | ||
{ | ||
NuGetPush(nupkg, new NuGetPushSettings | ||
{ | ||
Source = "https://nuget.org/api/v2/package", | ||
ApiKey = apiKey | ||
}); | ||
} | ||
}); | ||
|
||
Task("Publish-Release") | ||
.IsDependentOn("Publish-Package") | ||
.WithCriteria(() => isLocal) | ||
.Does(() => | ||
{ | ||
var githubToken = EnvironmentVariable("GITHUB_API_TOKEN"); | ||
|
||
if (String.IsNullOrEmpty(githubToken)) | ||
{ | ||
throw new InvalidOperationException("Could not resolve AngleSharp GitHub token."); | ||
} | ||
|
||
var github = new GitHubClient(new ProductHeaderValue("MagesCakeBuild")) | ||
{ | ||
Credentials = new Credentials(githubToken) | ||
}; | ||
|
||
github.Release.Create("FlorianRappl", "Mages", new NewRelease("v" + version) | ||
{ | ||
Name = version, | ||
Body = String.Join(Environment.NewLine, releaseNotes.Notes), | ||
Prerelease = false, | ||
TargetCommitish = "master" | ||
}).Wait(); | ||
}); | ||
|
||
Task("Update-AppVeyor-Build-Number") | ||
.WithCriteria(() => isRunningOnAppVeyor) | ||
.Does(() => | ||
{ | ||
AppVeyor.UpdateBuildVersion(version); | ||
}); | ||
|
||
// Targets | ||
// ---------------------------------------- | ||
|
||
Task("Package") | ||
.IsDependentOn("Run-Unit-Tests") | ||
.IsDependentOn("Create-Package"); | ||
|
||
Task("Default") | ||
.IsDependentOn("Package"); | ||
|
||
Task("Publish") | ||
.IsDependentOn("Publish-Package") | ||
.IsDependentOn("Publish-Release"); | ||
|
||
Task("AppVeyor") | ||
.IsDependentOn("Run-Unit-Tests") | ||
.IsDependentOn("Update-AppVeyor-Build-Number"); | ||
|
||
// Execution | ||
// ---------------------------------------- | ||
|
||
RunTarget(target); |
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,69 @@ | ||
Param( | ||
[string]$Script = "build.cake", | ||
[string]$Target = "Default", | ||
[ValidateSet("Release", "Debug")] | ||
[string]$Configuration = "Release", | ||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] | ||
[string]$Verbosity = "Verbose", | ||
[switch]$Experimental, | ||
[switch]$WhatIf, | ||
[switch]$Mono, | ||
[switch]$SkipToolPackageRestore, | ||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] | ||
[string[]]$ScriptArgs | ||
) | ||
|
||
$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition; | ||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools" | ||
$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" | ||
|
||
# Should we use experimental build of Roslyn? | ||
$UseExperimental = ""; | ||
if($Experimental.IsPresent) { | ||
$UseExperimental = "-experimental" | ||
} | ||
|
||
# Is this a dry run? | ||
$UseDryRun = ""; | ||
if($WhatIf.IsPresent) { | ||
$UseDryRun = "-dryrun" | ||
} | ||
|
||
# Should we use mono? | ||
$UseMono = ""; | ||
if($Mono.IsPresent) { | ||
$UseMono = "-mono" | ||
} | ||
|
||
# Try download NuGet.exe if do not exist. | ||
if (!(Test-Path $NUGET_EXE)) { | ||
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE) | ||
} | ||
|
||
# Make sure NuGet exists where we expect it. | ||
if (!(Test-Path $NUGET_EXE)) { | ||
Throw "Could not find NuGet.exe" | ||
} | ||
|
||
# Restore tools from NuGet? | ||
if(-Not $SkipToolPackageRestore.IsPresent) | ||
{ | ||
Push-Location | ||
Set-Location $TOOLS_DIR | ||
Invoke-Expression "$NUGET_EXE install -ExcludeVersion" | ||
Pop-Location | ||
if ($LASTEXITCODE -ne 0) { | ||
exit $LASTEXITCODE | ||
} | ||
} | ||
|
||
# Make sure that Cake has been installed. | ||
if (!(Test-Path $CAKE_EXE)) { | ||
Throw "Could not find Cake.exe" | ||
} | ||
|
||
# Start Cake | ||
Invoke-Expression "$CAKE_EXE `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs" | ||
exit $LASTEXITCODE |
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,82 @@ | ||
#!/usr/bin/env bash | ||
############################################################### | ||
# This is the Cake bootstrapper script that is responsible for | ||
# downloading Cake and all specified tools from NuGet. | ||
############################################################### | ||
|
||
# Define directories. | ||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
TOOLS_DIR=$SCRIPT_DIR/tools | ||
NUGET_EXE=$TOOLS_DIR/nuget.exe | ||
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe | ||
|
||
# Define default arguments. | ||
SCRIPT="build.cake" | ||
TARGET="Travis" | ||
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 http://cakebuild.net/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 | ||
mono $NUGET_EXE install -ExcludeVersion | ||
if [ $? -ne 0 ]; then | ||
echo "Could not restore NuGet packages." | ||
exit 1 | ||
fi | ||
popd >/dev/null | ||
|
||
# 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 |
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,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package> | ||
<metadata> | ||
<id>Mages</id> | ||
<version>$version$</version> | ||
<authors>Florian Rappl</authors> | ||
<owners>Florian Rappl</owners> | ||
<licenseUrl>https://github.com/FlorianRappl/Mages/blob/master/LICENSE</licenseUrl> | ||
<projectUrl>https://github.com/FlorianRappl/Mages</projectUrl> | ||
<iconUrl>https://raw.github.com/FlorianRappl/Mages/master/logo.png</iconUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>MAGES is a very simple, yet powerful, expression parser and interpreter.</description> | ||
<releaseNotes>For all changes see: https://github.com/FlorianRappl/Mages/blob/master/CHANGELOG.md.</releaseNotes> | ||
<copyright>Copyright 2016, Florian Rappl.</copyright> | ||
<tags>interpreter mages expression scripting language mathematics performance</tags> | ||
<dependencies> | ||
<group targetFramework="net35"></group> | ||
</dependencies> | ||
</metadata> | ||
</package> |
Oops, something went wrong.