Skip to content

Commit

Permalink
Merge branch 'release/0.14.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
devlead committed Sep 18, 2019
2 parents 087029d + 2d20227 commit f358392
Show file tree
Hide file tree
Showing 8 changed files with 179 additions and 95 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ branches:
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
dev(elop)?(ment)?$:
develop:
mode: ContinuousDeployment
tag: alpha
increment: Minor
Expand Down
18 changes: 16 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Install modules
#module nuget:?package=Cake.DotNetTool.Module&version=0.3.0

#tool "nuget:https://api.nuget.org/v3/index.json?package=GitVersion.CommandLine&version=3.6.2"
// Install tools
#tool nuget:?package=NUnit.ConsoleRunner&version=3.4.0

// Install .NET Core Global tools.
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.0.1"

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -56,7 +61,16 @@ Setup(ctx =>
if(!IsRunningOnWindows())
{
var frameworkPathOverride = new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
var frameworkPathOverride = ctx.Environment.Runtime.IsCoreClr
? new []{
new DirectoryPath("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono"),
new DirectoryPath("/usr/lib/mono"),
new DirectoryPath("/usr/local/lib/mono")
}
.Select(directory =>directory.Combine("4.5"))
.FirstOrDefault(directory => ctx.DirectoryExists(directory))
?.FullPath + "/"
: new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
// Use FrameworkPathOverride when not running on Windows.
Information("Build will use FrameworkPathOverride={0} since not building on Windows.", frameworkPathOverride);
Expand Down
3 changes: 3 additions & 0 deletions build.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
CAKE_VERSION=0.34.1
DOTNET_VERSION=3.0.100-rc1-014190
170 changes: 102 additions & 68 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,120 +1,154 @@
$CakeVersion = "0.25.0"
$DotNetChannel = "LTS";
$DotNetVersion = "2.1.4";
$IsRunningOnUnix = [System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Unix
#!/usr/bin/env pwsh
$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1';
$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh'
$DotNetChannel = 'LTS'
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent

[string] $CakeVersion = ''
[string] $DotNetVersion= ''
foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config'))
{
if ($line -like 'CAKE_VERSION=*') {
$CakeVersion = $line.SubString(13)
}
elseif ($line -like 'DOTNET_VERSION=*') {
$DotNetVersion =$line.SubString(15)
}
}


if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) {
'Failed to parse Cake / .NET Core SDK Version'
exit 1
}

# Make sure tools folder exists
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$ToolPath = Join-Path $PSScriptRoot "tools"
if (!(Test-Path $ToolPath)) {
Write-Verbose "Creating tools directory..."
New-Item -Path $ToolPath -Type directory | out-null
New-Item -Path $ToolPath -Type Directory -Force | out-null
}


if ($PSVersionTable.PSEdition -ne 'Core') {
# Attempt to set highest encryption available for SecurityProtocol.
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
# will typically produce a message for PowerShell v2 (just an info
# message though)
try {
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
# installed (.NET 4.5 is an in-place upgrade).
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
} catch {
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
}
}

###########################################################################
# INSTALL .NET CORE CLI
###########################################################################

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
$env:DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=1


Function Remove-PathVariable([string]$VariableToRemove)
{
$SplitChar = ';'
if ($IsMacOS -or $IsLinux) {
$SplitChar = ':'
}

$path = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($path -ne $null)
{
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User")
}

$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
if ($path -ne $null)
{
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process")
}
}

# Get .NET Core CLI path if installed.
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
$FoundDotNetCliVersion = $null


$FoundDotNetCliVersion = $null;
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
$FoundDotNetCliVersion = dotnet --version
$FoundDotNetCliVersion = dotnet --version;
}

if($FoundDotNetCliVersion -ne $DotNetVersion)
{
if($FoundDotNetCliVersion -ne $DotNetVersion) {
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
Remove-PathVariable "$InstallPath"
$env:PATH = "$InstallPath;$env:PATH"

if (!(Test-Path $InstallPath)) {
New-Item -ItemType Directory -Force $InstallPath | Out-Null;
New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null;
}

[string] $InstalledDotNetVersion = Get-ChildItem -Path ./.dotnet -File `
| Where-Object { $_.Name -eq 'dotnet' -or $_.Name -eq 'dotnet.exe' } `
| ForEach-Object { &$_.FullName --version }
if ($IsMacOS -or $IsLinux) {
$ScriptPath = Join-Path $InstallPath 'dotnet-install.sh'
(New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath);
& bash $ScriptPath --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path

if ($InstalledDotNetVersion -eq $DotNetVersion)
{
}
elseif ($IsRunningOnUnix)
{
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.sh";
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath/dotnet-install.sh");
sudo bash "$InstallPath/dotnet-install.sh" --version $DotNetVersion --install-dir "$InstallPath" --no-path
Remove-PathVariable "$InstallPath"
$env:PATH = "$($InstallPath):$env:PATH"
}
else
{
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.ps1";
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
else {
$ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1'
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath);
& $ScriptPath -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;

Remove-PathVariable "$InstallPath"
$env:PATH = "$InstallPath;$env:PATH"
}
$env:DOTNET_ROOT=$InstallPath
}

###########################################################################
# INSTALL CAKE
###########################################################################

Add-Type -AssemblyName System.IO.Compression.FileSystem
Function Unzip
{
param([string]$zipfile, [string]$outpath)
# Make sure Cake has been installed.
[string] $CakeExePath = ''
[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version}

[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
if ($CakeInstalledVersion -eq $CakeVersion) {
# Cake found locally
$CakeExePath = (Get-Command dotnet-cake).Source
}
else {
$CakePath = [System.IO.Path]::Combine($ToolPath,'.store', 'cake.tool', $CakeVersion) # Old PowerShell versions Join-Path only supports one child path

$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)

# Make sure Cake has been installed.
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion"
$CakeExePath = Join-Path $CakePath "Cake.exe"
$CakeZipPath = Join-Path $ToolPath "Cake.zip"
if (!(Test-Path $CakeExePath)) {
Write-Host "Installing Cake $CakeVersion..."
(New-Object System.Net.WebClient).DownloadFile("https://www.nuget.org/api/v2/package/Cake/$CakeVersion", $CakeZipPath)
Unzip $CakeZipPath $CakePath
Remove-Item $CakeZipPath

if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) {

if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf))
{
& dotnet tool uninstall --tool-path $ToolPath Cake.Tool
}

& dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool
if ($LASTEXITCODE -ne 0)
{
'Failed to install cake'
exit 1
}
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)
}
}

###########################################################################
# RUN BUILD SCRIPT
###########################################################################
if ($IsRunningOnUnix)
& "$CakeExePath" ./build.cake --bootstrap
if ($LASTEXITCODE -eq 0)
{
& mono "$CakeExePath" --bootstrap
if ($LASTEXITCODE -eq 0)
{
& mono "$CakeExePath" $args
}
exit $LASTEXITCODE
& "$CakeExePath" ./build.cake $args
}
else
{
& "$CakeExePath" --bootstrap
if ($LASTEXITCODE -eq 0)
{
& "$CakeExePath" $args
}
exit $LASTEXITCODE
}
exit $LASTEXITCODE
67 changes: 44 additions & 23 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env bash
# Define varibles
CAKE_VERSION=0.25.0
DOTNET_SDK_VERSION=2.1.4
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
source $SCRIPT_DIR/build.config
TOOLS_DIR=$SCRIPT_DIR/tools
CAKE_EXE=$TOOLS_DIR/Cake.$CAKE_VERSION/Cake.exe
CAKE_EXE=$TOOLS_DIR/dotnet-cake
CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION

if [ "$CAKE_VERSION" = "" ] || [ "$DOTNET_VERSION" = "" ]; then
echo "An error occured while parsing Cake / .NET Core SDK version."
exit 1
fi

# Make sure the tools folder exist.
if [ ! -d "$TOOLS_DIR" ]; then
Expand All @@ -15,40 +20,56 @@ fi
# INSTALL .NET CORE CLI
###########################################################################

echo "Installing .NET CLI..."
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
mkdir "$SCRIPT_DIR/.dotnet"
fi
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://raw.githubusercontent.com/dotnet/cli/v$DOTNET_SDK_VERSION/scripts/obtain/dotnet-install.sh
sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_SDK_VERSION --install-dir .dotnet --no-path
export PATH="$SCRIPT_DIR/.dotnet":$PATH
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
"$SCRIPT_DIR/.dotnet/dotnet" --info
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2

DOTNET_INSTALLED_VERSION=$(dotnet --version 2>&1)

if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then
echo "Installing .NET CLI..."
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
mkdir "$SCRIPT_DIR/.dotnet"
fi
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path
export PATH="$SCRIPT_DIR/.dotnet":$PATH
export DOTNET_ROOT="$SCRIPT_DIR/.dotnet"
fi

###########################################################################
# INSTALL CAKE
###########################################################################

if [ ! -f "$CAKE_EXE" ]; then
echo "Installing Cake $CAKE_VERSION..."
curl -Lsfo Cake.zip "https://www.nuget.org/api/v2/package/Cake/$CAKE_VERSION" && unzip -q Cake.zip -d "$TOOLS_DIR/Cake.$CAKE_VERSION" && rm -f Cake.zip
if [ $? -ne 0 ]; then
echo "An error occured while installing Cake."
exit 1
CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1)

if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then
if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then
if [ -f "$CAKE_EXE" ]; then
dotnet tool uninstall --tool-path $TOOLS_DIR Cake.Tool
fi

echo "Installing Cake $CAKE_VERSION..."
dotnet tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool
if [ $? -ne 0 ]; then
echo "An error occured while installing Cake."
exit 1
fi
fi
fi

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

###########################################################################
# RUN BUILD SCRIPT
###########################################################################

# Start Cake
(exec mono "$CAKE_EXE" --bootstrap) && (exec mono "$CAKE_EXE" "$@")
(exec "$CAKE_EXE" build.cake --bootstrap) && (exec "$CAKE_EXE" build.cake "$@")
8 changes: 8 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"projects": [
"src"
],
"sdk": {
"version": "3.0.100-rc1-014190"
}
}
6 changes: 5 additions & 1 deletion src/LitJson/LitJSON.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ It's quick and lean, without external dependencies.</Description>
<Authors>Leonardo Boshell, Mattias Karlsson and contributors</Authors>
<Company>Leonardo Boshell, Mattias Karlsson and contributors</Company>
<PackageLicenseExpression>Unlicense</PackageLicenseExpression>
<PackageIconUrl>https://litjson.net/assets/img/logo.png</PackageIconUrl>
<PackageIcon>litjson.png</PackageIcon>
<RepositoryUrl>https://github.com/LitJSON/litjson</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>JSON;Serializer</PackageTags>
<IncludeSource>true</IncludeSource>
</PropertyGroup>

<ItemGroup>
<None Include="litjson.png" Pack="true" PackagePath="" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net20' ">
<DefineConstants>$(DefineConstants);LEGACY</DefineConstants>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net20' and '$(OS)' == 'Windows_NT'">C:\Windows\Microsoft.NET\Framework\v2.0.50727</FrameworkPathOverride>
Expand Down
Binary file added src/LitJson/litjson.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f358392

Please sign in to comment.