Skip to content

Commit

Permalink
Initial Arcadeification (emscripten-core#1)
Browse files Browse the repository at this point in the history
* Initial Arcadeification
  • Loading branch information
directhex authored Apr 25, 2023
1 parent d6a773d commit b0f6437
Show file tree
Hide file tree
Showing 150 changed files with 11,884 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ coverage.xml

# Test output
/out/

# MSFT ignores
/.dotnet
/.packages
/artifacts
69 changes: 69 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<PropertyGroup Label="CalculateArch">
<_hostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant)</_hostArch>
<BuildArchitecture Condition="'$(BuildArchitecture)' == ''">$(_hostArch)</BuildArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'arm'">arm</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'armv6'">armv6</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'armel'">armel</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'arm64'">arm64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'loongarch64'">loongarch64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 's390x'">s390x</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(_hostArch)' == 'ppc64le'">ppc64le</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' and '$(TargetsMobile)' == 'true'">x64</TargetArchitecture>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<Platform Condition="'$(InferPlatformFromTargetArchitecture)' == 'true'">$(TargetArchitecture)</Platform>
<Platform Condition="'$(InferPlatformFromTargetArchitecture)' != 'true'">$(BuildArchitecture)</Platform>
</PropertyGroup>

<PropertyGroup>
<BuildArch>$(__BuildArch)</BuildArch>
<BuildArch Condition="'$(__BuildArch)'==''">x64</BuildArch>
<BuildArch Condition="'$(__BuildArch)' == 'amd64'">x64</BuildArch>

<BuildType>$(__BuildType)</BuildType>
<BuildType Condition="'$(__BuildType)'==''">Debug</BuildType>
<BuildType Condition="'$(__BuildType)' == 'debug'">Debug</BuildType>
<BuildType Condition="'$(__BuildType)' == 'release'">Release</BuildType>

<BuildOS>$(__BuildOS)</BuildOS>
<BuildOS Condition="'$(__BuildOS)' == '' And '$([MSBuild]::IsOSPlatform(Windows))' == 'true'">Windows_NT</BuildOS>
<BuildOS Condition="'$(__BuildOS)' == '' And '$([MSBuild]::IsOSPlatform(Linux))' == 'true'">Linux</BuildOS>
<BuildOS Condition="'$(__BuildOS)' == '' And '$([MSBuild]::IsOSPlatform(OSX))' == 'true'">OSX</BuildOS>

<!-- TODO: converge on one property for BuildOS and __BuildOS (and similar), and remove these extra lines. -->
<__BuildOS>$(BuildOS)</__BuildOS>
<__BuildArch>$(BuildArch)</__BuildArch>

<Configuration Condition="'$(Configuration)' == ''">$(BuildType)</Configuration>
<Platform Condition="'$(Platform)' == ''">$(BuildArch)</Platform>

<PlatformConfigPathPart>$(BuildOS).$(TargetArchitecture).$(Configuration)</PlatformConfigPathPart>
</PropertyGroup>

<!-- Common properties -->
<PropertyGroup>

<__ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)</__ProjectDir>
<ProjectDir>$(__ProjectDir)</ProjectDir>
<RootRepoDir>$(ProjectDir)</RootRepoDir>
<ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)</ProjectDir>

<BaseIntermediateOutputPath>$(RootRepoDir)artifacts\obj\$(PlatformConfigPathPart)\</BaseIntermediateOutputPath>

<SourceDir>$(__SourceDir)\</SourceDir>
<SourceDir Condition="'$(__SourceDir)'==''">$(ProjectDir)src\</SourceDir>

<RootBinDir>$(__RootBinDir)\</RootBinDir>
<RootBinDir Condition="'$(__RootBinDir)'==''">$(RootRepoDir)artifacts\</RootBinDir>

<BinDir>$(__BinDir)\</BinDir>
<BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)bin\$(PlatformConfigPathPart)\</BinDir>
</PropertyGroup>

<PropertyGroup>
<EmscriptenInstallDir>$(BinDir)emscripten\</EmscriptenInstallDir>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
</Project>
16 changes: 16 additions & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet8-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources>
<clear />
</disabledPackageSources>
</configuration>
8 changes: 8 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
setlocal

set _args=%*
if "%~1"=="-?" set _args=-help

powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0eng\build.ps1" %_args%
exit /b %ERRORLEVEL%
33 changes: 33 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

source="${BASH_SOURCE[0]}"

function is_cygwin_or_mingw()
{
case $(uname -s) in
CYGWIN*) return 0;;
MINGW*) return 0;;
*) return 1;;
esac
}

# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"

# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done

scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

if is_cygwin_or_mingw; then
# if bash shell running on Windows (not WSL),
# pass control to powershell build script.
scriptroot=$(cygpath -d "$scriptroot")
powershell -c "$scriptroot\\build.cmd" $@
else
"$scriptroot/eng/build.sh" $@
fi
37 changes: 37 additions & 0 deletions emscripten.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<Project Sdk="Microsoft.Build.Traversal">
<Target Name="LayoutEmscripten" BeforeTargets="Build">
<ItemGroup>
<EmscriptenFiles Include="$(ProjectDir)**" />
<EmscriptenFiles Remove="$(ProjectDir)\artifacts\**" />
<EmscriptenFiles Remove="$(ProjectDir)\eng\**" />
<EmscriptenFiles Remove="$(ProjectDir)\.gitignore" />
<EmscriptenFiles Remove="$(ProjectDir)\.gitmodules" />
<EmscriptenFiles Remove="$(ProjectDir)\build.*" />
<EmscriptenFiles Remove="$(ProjectDir)\emscripten.proj" />
<EmscriptenFiles Remove="$(ProjectDir)\global.json" />
<EmscriptenFiles Remove="$(ProjectDir)\Directory.Build.*" />
<EmscriptenFiles Remove="$(ProjectDir)\NuGet.config" />
<EmscriptenFiles Remove="$(ProjectDir)\.circleci\**" />
<EmscriptenFiles Remove="$(ProjectDir)\.dotnet\**" />
<EmscriptenFiles Remove="$(ProjectDir)\.git\**" />
<EmscriptenFiles Remove="$(ProjectDir)\.github\**" />
<EmscriptenFiles Remove="$(ProjectDir)\.packages\**" />
</ItemGroup>
<Copy SourceFiles="@(EmscriptenFiles)"
DestinationFiles="@(EmscriptenFiles->'$(EmscriptenInstallDir)\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<Target Name="WriteVersionFile" AfterTargets="LayoutEmscripten">
<PropertyGroup>
<EmscriptenEmsdkVersion>emscripten-$(VersionPrefix)-dotnet</EmscriptenEmsdkVersion>
</PropertyGroup>
<WriteLinesToFile File="$(EmscriptenInstallDir)\.emsdk_version"
Overwrite="true"
Lines="$(EmscriptenEmsdkVersion)" />
</Target>

<Target Name="Build" DependsOnTargets="LayoutEmscripten" />
<Target Name="ReallyPack" BeforeTargets="Pack">
<MSBuild Projects="eng/nuget/packages.builds" Targets="Build" />
</Target>
</Project>
6 changes: 6 additions & 0 deletions eng/Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectToBuild Include="$(MSBuildThisFileDirectory)..\emscripten.proj" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions eng/Publishing.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PublishingVersion>3</PublishingVersion>
</PropertyGroup>
</Project>
11 changes: 11 additions & 0 deletions eng/Tools.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<PropertyGroup>
<MSBuildTreatWarningsAsErrors>false</MSBuildTreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<!-- arcade -->
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingVersion)" />
</ItemGroup>
</Project>

13 changes: 13 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.23219.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>dca04a5ec44fe1e75535f51a4e0b9a7aa2318de7</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Packaging" Version="8.0.0-beta.23219.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>dca04a5ec44fe1e75535f51a4e0b9a7aa2318de7</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
11 changes: 11 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPrefix>8.0.0</VersionPrefix>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration>4</PreReleaseVersionIteration>
</PropertyGroup>
<PropertyGroup>
<MicrosoftDotNetBuildTasksPackagingVersion>8.0.0-beta.23219.2</MicrosoftDotNetBuildTasksPackagingVersion>
</PropertyGroup>
</Project>
93 changes: 76 additions & 17 deletions eng/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,77 @@
trigger:
 batch: true
 branches:
 include:
 - dotnet/main
pr:
 branches:
 include:
 - dotnet/main
pool:
 name: NetCore-Public
 demands: ImageOverride -equals build.ubuntu.2204.amd64.open
steps:
- script: echo Hello World
 displayName: 'Basic empty step which we can PR against'
batch: true
branches:
include:
- dotnet/main
- dotnet/release/*

pr:
branches:
include:
- dotnet/main
- dotnet/release/*

variables:
- template: /eng/common-variables.yml
- template: /eng/common/templates/variables/pool-providers.yml

stages:
- stage: build
displayName: Build
jobs:
- template: /eng/common/templates/jobs/jobs.yml
parameters:
enablePublishBuildArtifacts: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: true
jobs:

############ LINUX BUILD ############
- job: Build_Linux
displayName: Linux
timeoutInMinutes: 360
variables:
- _BuildConfig: Release
strategy:
matrix:
x64:
assetManifestOS: linux
assetManifestPlatform: x64
imagename: mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0
rootfs: /crossrootfs/x64
archflag: --arch x64
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: $(DncEngPublicBuildPool)
demands: ImageOverride -equals build.ubuntu.2204.amd64.open
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals build.ubuntu.2204.amd64
container:
image: $(imagename)
steps:
- script: |
git clean -ffdx
git reset --hard HEAD
displayName: 'Clean up working directory'
- bash: |
./build.sh --ci --restore --build --pack $(archflag) --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:RestoreUsingNuGetTargets=false
displayName: 'Build and package'
env:
ROOTFS_DIR: $(rootfs)
- bash:
./eng/common/build.sh --ci --restore --publish --configuration $(_BuildConfig) $(_InternalBuildArgs) /p:AssetManifestOS=$(assetManifestOS) /p:PlatformName=$(assetManifestPlatform) --projects $(Build.SourcesDirectory)/emscripten.proj
displayName: Publish packages
condition: and(succeeded(), ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))

############ POST BUILD ARCADE LOGIC ############
- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/common/templates/post-build/post-build.yml
parameters:
publishingInfraVersion: 3
enableSourceLinkValidation: false
enableSigningValidation: false
enableSymbolValidation: false
enableNugetValidation: true
Loading

0 comments on commit b0f6437

Please sign in to comment.