Skip to content

Commit b605b4f

Browse files
authored
Merge pull request #89 from tomvanenckevort/upgrade-jint-v3
Upgraded to Jint v3
2 parents 1a9cd80 + 7634f87 commit b605b4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1701
-664
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,6 @@ pip-log.txt
194194

195195
# Mac crap
196196
.DS_Store
197+
198+
# Nuke build tool
199+
.nuke/temp

.nuke/build.schema.json

+134
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "Build Schema",
4+
"$ref": "#/definitions/build",
5+
"definitions": {
6+
"build": {
7+
"type": "object",
8+
"properties": {
9+
"Configuration": {
10+
"type": "string",
11+
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
12+
"enum": [
13+
"Debug",
14+
"Release"
15+
]
16+
},
17+
"Continue": {
18+
"type": "boolean",
19+
"description": "Indicates to continue a previously failed build attempt"
20+
},
21+
"Help": {
22+
"type": "boolean",
23+
"description": "Shows the help text for this build assembly"
24+
},
25+
"Host": {
26+
"type": "string",
27+
"description": "Host for execution. Default is 'automatic'",
28+
"enum": [
29+
"AppVeyor",
30+
"AzurePipelines",
31+
"Bamboo",
32+
"Bitbucket",
33+
"Bitrise",
34+
"GitHubActions",
35+
"GitLab",
36+
"Jenkins",
37+
"Rider",
38+
"SpaceAutomation",
39+
"TeamCity",
40+
"Terminal",
41+
"TravisCI",
42+
"VisualStudio",
43+
"VSCode"
44+
]
45+
},
46+
"NoLogo": {
47+
"type": "boolean",
48+
"description": "Disables displaying the NUKE logo"
49+
},
50+
"Partition": {
51+
"type": "string",
52+
"description": "Partition to use on CI"
53+
},
54+
"Plan": {
55+
"type": "boolean",
56+
"description": "Shows the execution plan (HTML)"
57+
},
58+
"Profile": {
59+
"type": "array",
60+
"description": "Defines the profiles to load",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"ReleaseNotesFilePath": {
66+
"type": "string",
67+
"description": "ReleaseNotesFilePath - To determine the SemanticVersion"
68+
},
69+
"Root": {
70+
"type": "string",
71+
"description": "Root directory during build execution"
72+
},
73+
"Skip": {
74+
"type": "array",
75+
"description": "List of targets to be skipped. Empty list skips all dependencies",
76+
"items": {
77+
"type": "string",
78+
"enum": [
79+
"Clean",
80+
"Compile",
81+
"CopyFiles",
82+
"CreatePackage",
83+
"Default",
84+
"Package",
85+
"PrePublish",
86+
"Publish",
87+
"PublishPackage",
88+
"PublishPreRelease",
89+
"PublishRelease",
90+
"Restore",
91+
"RunUnitTests"
92+
]
93+
}
94+
},
95+
"Solution": {
96+
"type": "string",
97+
"description": "Path to a solution file that is automatically loaded"
98+
},
99+
"Target": {
100+
"type": "array",
101+
"description": "List of targets to be invoked. Default is '{default_target}'",
102+
"items": {
103+
"type": "string",
104+
"enum": [
105+
"Clean",
106+
"Compile",
107+
"CopyFiles",
108+
"CreatePackage",
109+
"Default",
110+
"Package",
111+
"PrePublish",
112+
"Publish",
113+
"PublishPackage",
114+
"PublishPreRelease",
115+
"PublishRelease",
116+
"Restore",
117+
"RunUnitTests"
118+
]
119+
}
120+
},
121+
"Verbosity": {
122+
"type": "string",
123+
"description": "Logging verbosity during build execution. Default is 'Normal'",
124+
"enum": [
125+
"Minimal",
126+
"Normal",
127+
"Quiet",
128+
"Verbose"
129+
]
130+
}
131+
}
132+
}
133+
}
134+
}

.nuke/parameters.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./build.schema.json",
3+
"Solution": "src/AngleSharp.Js.sln"
4+
}

build.cake

-14
This file was deleted.

build.cmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
:; set -eo pipefail
2+
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
3+
:; ${SCRIPT_DIR}/build.sh "$@"
4+
:; exit $?
5+
6+
@ECHO OFF
7+
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*

build.ps1

+51-63
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,69 @@
1+
[CmdletBinding()]
12
Param(
2-
[string]$Script = "build.cake",
3-
[string]$Target = "Default",
4-
[ValidateSet("Release", "Debug")]
5-
[string]$Configuration = "Release",
6-
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
7-
[string]$Verbosity = "Verbose",
8-
[switch]$Experimental,
9-
[switch]$WhatIf,
10-
[switch]$Mono,
11-
[switch]$SkipToolPackageRestore,
123
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
13-
[string[]]$ScriptArgs
4+
[string[]]$BuildArguments
145
)
156

16-
$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition;
17-
$UseDryRun = "";
18-
$UseMono = "";
19-
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
20-
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
21-
$NUGET_OLD_EXE = Join-Path $TOOLS_DIR "nuget_old.exe"
22-
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
23-
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
24-
$NUGET_OLD_URL = "https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe"
7+
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
258

26-
# Should we use experimental build of Roslyn?
27-
$UseExperimental = "";
28-
if ($Experimental.IsPresent) {
29-
$UseExperimental = "--experimental"
30-
}
9+
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
10+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
3111

32-
# Is this a dry run?
33-
if ($WhatIf.IsPresent) {
34-
$UseDryRun = "--dryrun"
35-
}
12+
###########################################################################
13+
# CONFIGURATION
14+
###########################################################################
3615

37-
# Should we use mono?
38-
if ($Mono.IsPresent) {
39-
$UseMono = "--mono"
40-
}
16+
$BuildProjectFile = "$PSScriptRoot\nuke\_build.csproj"
17+
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
4118

42-
# Try download NuGet.exe if do not exist.
43-
if (!(Test-Path $NUGET_EXE)) {
44-
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
45-
}
19+
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
20+
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
21+
$DotNetChannel = "Current"
4622

47-
# Try download NuGet.exe if do not exist.
48-
if (!(Test-Path $NUGET_OLD_URL)) {
49-
(New-Object System.Net.WebClient).DownloadFile($NUGET_OLD_URL, $NUGET_OLD_EXE)
50-
}
23+
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
24+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
25+
$env:DOTNET_MULTILEVEL_LOOKUP = 0
5126

52-
# Make sure NuGet (latest) exists where we expect it.
53-
if (!(Test-Path $NUGET_EXE)) {
54-
Throw "Could not find nuget.exe"
27+
###########################################################################
28+
# EXECUTION
29+
###########################################################################
30+
31+
function ExecSafe([scriptblock] $cmd) {
32+
& $cmd
33+
if ($LASTEXITCODE) { exit $LASTEXITCODE }
5534
}
5635

57-
# Make sure NuGet (v3.5.0) exists where we expect it.
58-
if (!(Test-Path $NUGET_OLD_EXE)) {
59-
Throw "Could not find nuget_old.exe"
36+
# If dotnet CLI is installed globally and it matches requested version, use for execution
37+
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
38+
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
39+
$env:DOTNET_EXE = (Get-Command "dotnet").Path
6040
}
41+
else {
42+
# Download install script
43+
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
44+
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
45+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
46+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
6147

62-
# Restore tools from NuGet?
63-
if (-Not $SkipToolPackageRestore.IsPresent)
64-
{
65-
Push-Location
66-
Set-Location $TOOLS_DIR
67-
Invoke-Expression "$NUGET_EXE install -ExcludeVersion"
68-
Pop-Location
69-
if ($LASTEXITCODE -ne 0) {
70-
exit $LASTEXITCODE
48+
# If global.json exists, load expected version
49+
if (Test-Path $DotNetGlobalFile) {
50+
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
51+
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
52+
$DotNetVersion = $DotNetGlobal.sdk.version
53+
}
7154
}
72-
}
7355

74-
# Make sure that Cake has been installed.
75-
if (!(Test-Path $CAKE_EXE)) {
76-
Throw "Could not find Cake.exe"
56+
# Install by channel or version
57+
$DotNetDirectory = "$TempDirectory\dotnet-win"
58+
if (!(Test-Path variable:DotNetVersion)) {
59+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
60+
} else {
61+
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
62+
}
63+
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
7764
}
7865

79-
# Start Cake
80-
Invoke-Expression "$CAKE_EXE `"$Script`" --target=`"$Target`" --configuration=`"$Configuration`" --verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
81-
exit $LASTEXITCODE
66+
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
67+
68+
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
69+
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }

0 commit comments

Comments
 (0)