Skip to content

Commit 2d20227

Browse files
committed
Merge branch 'devlead-feature/packageicon' into develop
2 parents 033f8bc + 03b069a commit 2d20227

8 files changed

Lines changed: 179 additions & 95 deletions

File tree

GitVersion.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ branches:
55
increment: Patch
66
prevent-increment-of-merged-branch-version: true
77
track-merge-target: false
8-
dev(elop)?(ment)?$:
8+
develop:
99
mode: ContinuousDeployment
1010
tag: alpha
1111
increment: Minor

build.cake

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
// Install modules
2+
#module nuget:?package=Cake.DotNetTool.Module&version=0.3.0
13

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

7+
// Install .NET Core Global tools.
8+
#tool "dotnet:https://api.nuget.org/v3/index.json?package=GitVersion.Tool&version=5.0.1"
9+
510
///////////////////////////////////////////////////////////////////////////////
611
// ARGUMENTS
712
///////////////////////////////////////////////////////////////////////////////
@@ -56,7 +61,16 @@ Setup(ctx =>
5661

5762
if(!IsRunningOnWindows())
5863
{
59-
var frameworkPathOverride = new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
64+
var frameworkPathOverride = ctx.Environment.Runtime.IsCoreClr
65+
? new []{
66+
new DirectoryPath("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono"),
67+
new DirectoryPath("/usr/lib/mono"),
68+
new DirectoryPath("/usr/local/lib/mono")
69+
}
70+
.Select(directory =>directory.Combine("4.5"))
71+
.FirstOrDefault(directory => ctx.DirectoryExists(directory))
72+
?.FullPath + "/"
73+
: new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
6074

6175
// Use FrameworkPathOverride when not running on Windows.
6276
Information("Build will use FrameworkPathOverride={0} since not building on Windows.", frameworkPathOverride);

build.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
CAKE_VERSION=0.34.1
3+
DOTNET_VERSION=3.0.100-rc1-014190

build.ps1

Lines changed: 102 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,154 @@
1-
$CakeVersion = "0.25.0"
2-
$DotNetChannel = "LTS";
3-
$DotNetVersion = "2.1.4";
4-
$IsRunningOnUnix = [System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Unix
1+
#!/usr/bin/env pwsh
2+
$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1';
3+
$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh'
4+
$DotNetChannel = 'LTS'
5+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
6+
7+
[string] $CakeVersion = ''
8+
[string] $DotNetVersion= ''
9+
foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config'))
10+
{
11+
if ($line -like 'CAKE_VERSION=*') {
12+
$CakeVersion = $line.SubString(13)
13+
}
14+
elseif ($line -like 'DOTNET_VERSION=*') {
15+
$DotNetVersion =$line.SubString(15)
16+
}
17+
}
18+
19+
20+
if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) {
21+
'Failed to parse Cake / .NET Core SDK Version'
22+
exit 1
23+
}
524

625
# Make sure tools folder exists
7-
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
826
$ToolPath = Join-Path $PSScriptRoot "tools"
927
if (!(Test-Path $ToolPath)) {
1028
Write-Verbose "Creating tools directory..."
11-
New-Item -Path $ToolPath -Type directory | out-null
29+
New-Item -Path $ToolPath -Type Directory -Force | out-null
30+
}
31+
32+
33+
if ($PSVersionTable.PSEdition -ne 'Core') {
34+
# Attempt to set highest encryption available for SecurityProtocol.
35+
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
36+
# will typically produce a message for PowerShell v2 (just an info
37+
# message though)
38+
try {
39+
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
40+
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
41+
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
42+
# installed (.NET 4.5 is an in-place upgrade).
43+
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
44+
} catch {
45+
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'
46+
}
1247
}
1348

1449
###########################################################################
1550
# INSTALL .NET CORE CLI
1651
###########################################################################
1752

53+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
54+
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
55+
$env:DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=1
56+
57+
1858
Function Remove-PathVariable([string]$VariableToRemove)
1959
{
60+
$SplitChar = ';'
61+
if ($IsMacOS -or $IsLinux) {
62+
$SplitChar = ':'
63+
}
64+
2065
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
2166
if ($path -ne $null)
2267
{
23-
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
24-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
68+
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
69+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User")
2570
}
2671

2772
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
2873
if ($path -ne $null)
2974
{
30-
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
31-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
75+
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
76+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process")
3277
}
3378
}
3479

3580
# Get .NET Core CLI path if installed.
36-
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
37-
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
38-
$FoundDotNetCliVersion = $null
39-
40-
81+
$FoundDotNetCliVersion = $null;
4182
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
42-
$FoundDotNetCliVersion = dotnet --version
83+
$FoundDotNetCliVersion = dotnet --version;
4384
}
4485

45-
if($FoundDotNetCliVersion -ne $DotNetVersion)
46-
{
86+
if($FoundDotNetCliVersion -ne $DotNetVersion) {
4787
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
48-
Remove-PathVariable "$InstallPath"
49-
$env:PATH = "$InstallPath;$env:PATH"
50-
5188
if (!(Test-Path $InstallPath)) {
52-
New-Item -ItemType Directory -Force $InstallPath | Out-Null;
89+
New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null;
5390
}
5491

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

59-
if ($InstalledDotNetVersion -eq $DotNetVersion)
60-
{
61-
}
62-
elseif ($IsRunningOnUnix)
63-
{
64-
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.sh";
65-
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath/dotnet-install.sh");
66-
sudo bash "$InstallPath/dotnet-install.sh" --version $DotNetVersion --install-dir "$InstallPath" --no-path
97+
Remove-PathVariable "$InstallPath"
98+
$env:PATH = "$($InstallPath):$env:PATH"
6799
}
68-
else
69-
{
70-
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.ps1";
71-
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
72-
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
100+
else {
101+
$ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1'
102+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath);
103+
& $ScriptPath -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
104+
105+
Remove-PathVariable "$InstallPath"
106+
$env:PATH = "$InstallPath;$env:PATH"
73107
}
108+
$env:DOTNET_ROOT=$InstallPath
74109
}
75110

76111
###########################################################################
77112
# INSTALL CAKE
78113
###########################################################################
79114

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

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

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

89-
# Make sure Cake has been installed.
90-
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion"
91-
$CakeExePath = Join-Path $CakePath "Cake.exe"
92-
$CakeZipPath = Join-Path $ToolPath "Cake.zip"
93-
if (!(Test-Path $CakeExePath)) {
94-
Write-Host "Installing Cake $CakeVersion..."
95-
(New-Object System.Net.WebClient).DownloadFile("https://www.nuget.org/api/v2/package/Cake/$CakeVersion", $CakeZipPath)
96-
Unzip $CakeZipPath $CakePath
97-
Remove-Item $CakeZipPath
128+
129+
if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) {
130+
131+
if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf))
132+
{
133+
& dotnet tool uninstall --tool-path $ToolPath Cake.Tool
134+
}
135+
136+
& dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool
137+
if ($LASTEXITCODE -ne 0)
138+
{
139+
'Failed to install cake'
140+
exit 1
141+
}
142+
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)
143+
}
98144
}
99145

100146
###########################################################################
101147
# RUN BUILD SCRIPT
102148
###########################################################################
103-
if ($IsRunningOnUnix)
149+
& "$CakeExePath" ./build.cake --bootstrap
150+
if ($LASTEXITCODE -eq 0)
104151
{
105-
& mono "$CakeExePath" --bootstrap
106-
if ($LASTEXITCODE -eq 0)
107-
{
108-
& mono "$CakeExePath" $args
109-
}
110-
exit $LASTEXITCODE
152+
& "$CakeExePath" ./build.cake $args
111153
}
112-
else
113-
{
114-
& "$CakeExePath" --bootstrap
115-
if ($LASTEXITCODE -eq 0)
116-
{
117-
& "$CakeExePath" $args
118-
}
119-
exit $LASTEXITCODE
120-
}
154+
exit $LASTEXITCODE

build.sh

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#!/usr/bin/env bash
22
# Define varibles
3-
CAKE_VERSION=0.25.0
4-
DOTNET_SDK_VERSION=2.1.4
53
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
4+
source $SCRIPT_DIR/build.config
65
TOOLS_DIR=$SCRIPT_DIR/tools
7-
CAKE_EXE=$TOOLS_DIR/Cake.$CAKE_VERSION/Cake.exe
6+
CAKE_EXE=$TOOLS_DIR/dotnet-cake
7+
CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION
8+
9+
if [ "$CAKE_VERSION" = "" ] || [ "$DOTNET_VERSION" = "" ]; then
10+
echo "An error occured while parsing Cake / .NET Core SDK version."
11+
exit 1
12+
fi
813

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

18-
echo "Installing .NET CLI..."
19-
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
20-
mkdir "$SCRIPT_DIR/.dotnet"
21-
fi
22-
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://raw.githubusercontent.com/dotnet/cli/v$DOTNET_SDK_VERSION/scripts/obtain/dotnet-install.sh
23-
sudo bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_SDK_VERSION --install-dir .dotnet --no-path
24-
export PATH="$SCRIPT_DIR/.dotnet":$PATH
2523
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
2624
export DOTNET_CLI_TELEMETRY_OPTOUT=1
27-
"$SCRIPT_DIR/.dotnet/dotnet" --info
25+
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
26+
export DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=2
2827

28+
DOTNET_INSTALLED_VERSION=$(dotnet --version 2>&1)
29+
30+
if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then
31+
echo "Installing .NET CLI..."
32+
if [ ! -d "$SCRIPT_DIR/.dotnet" ]; then
33+
mkdir "$SCRIPT_DIR/.dotnet"
34+
fi
35+
curl -Lsfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://dot.net/v1/dotnet-install.sh
36+
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --version $DOTNET_VERSION --install-dir .dotnet --no-path
37+
export PATH="$SCRIPT_DIR/.dotnet":$PATH
38+
export DOTNET_ROOT="$SCRIPT_DIR/.dotnet"
39+
fi
2940

3041
###########################################################################
3142
# INSTALL CAKE
3243
###########################################################################
3344

34-
if [ ! -f "$CAKE_EXE" ]; then
35-
echo "Installing Cake $CAKE_VERSION..."
36-
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
37-
if [ $? -ne 0 ]; then
38-
echo "An error occured while installing Cake."
39-
exit 1
45+
CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1)
46+
47+
if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then
48+
if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then
49+
if [ -f "$CAKE_EXE" ]; then
50+
dotnet tool uninstall --tool-path $TOOLS_DIR Cake.Tool
51+
fi
52+
53+
echo "Installing Cake $CAKE_VERSION..."
54+
dotnet tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool
55+
if [ $? -ne 0 ]; then
56+
echo "An error occured while installing Cake."
57+
exit 1
58+
fi
4059
fi
41-
fi
4260

43-
# Make sure that Cake has been installed.
44-
if [ ! -f "$CAKE_EXE" ]; then
45-
echo "Could not find Cake.exe at '$CAKE_EXE'."
46-
exit 1
61+
# Make sure that Cake has been installed.
62+
if [ ! -f "$CAKE_EXE" ]; then
63+
echo "Could not find Cake.exe at '$CAKE_EXE'."
64+
exit 1
65+
fi
66+
else
67+
CAKE_EXE="dotnet-cake"
4768
fi
4869

4970
###########################################################################
5071
# RUN BUILD SCRIPT
5172
###########################################################################
5273

5374
# Start Cake
54-
(exec mono "$CAKE_EXE" --bootstrap) && (exec mono "$CAKE_EXE" "$@")
75+
(exec "$CAKE_EXE" build.cake --bootstrap) && (exec "$CAKE_EXE" build.cake "$@")

global.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"projects": [
3+
"src"
4+
],
5+
"sdk": {
6+
"version": "3.0.100-rc1-014190"
7+
}
8+
}

src/LitJson/LitJSON.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,17 @@ It's quick and lean, without external dependencies.</Description>
2424
<Authors>Leonardo Boshell, Mattias Karlsson and contributors</Authors>
2525
<Company>Leonardo Boshell, Mattias Karlsson and contributors</Company>
2626
<PackageLicenseExpression>Unlicense</PackageLicenseExpression>
27-
<PackageIconUrl>https://litjson.net/assets/img/logo.png</PackageIconUrl>
27+
<PackageIcon>litjson.png</PackageIcon>
2828
<RepositoryUrl>https://github.com/LitJSON/litjson</RepositoryUrl>
2929
<RepositoryType>git</RepositoryType>
3030
<PackageTags>JSON;Serializer</PackageTags>
3131
<IncludeSource>true</IncludeSource>
3232
</PropertyGroup>
3333

34+
<ItemGroup>
35+
<None Include="litjson.png" Pack="true" PackagePath="" />
36+
</ItemGroup>
37+
3438
<PropertyGroup Condition="'$(TargetFramework)' == 'net20' ">
3539
<DefineConstants>$(DefineConstants);LEGACY</DefineConstants>
3640
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net20' and '$(OS)' == 'Windows_NT'">C:\Windows\Microsoft.NET\Framework\v2.0.50727</FrameworkPathOverride>

src/LitJson/litjson.png

3.28 KB
Loading

0 commit comments

Comments
 (0)