Skip to content

Commit

Permalink
Merge pull request #306 from PomeloFoundation/dev
Browse files Browse the repository at this point in the history
Upgrade to 2.0.0-preview2
  • Loading branch information
caleblloyd authored Jul 3, 2017
2 parents 302ff5d + 8b38885 commit fe78d72
Show file tree
Hide file tree
Showing 257 changed files with 5,608 additions and 4,556 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,6 @@ paket-files/
# JetBrains Rider
.idea/
*.sln.iml

# vscode
.vscode
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ branches:

before_install:
- docker run --name mysql -e MYSQL_ROOT_PASSWORD=Password12! -d mysql:5.7
- docker run -v $(pwd):/dotnet/:rw -e 'CI=True' --name dotnet --link mysql:mysql -d microsoft/dotnet:1.1.1-sdk sh -c 'while true; do sleep 0.1; done'
- docker run -v $(pwd):/dotnet/:rw -e 'CI=True' --name dotnet --link mysql:mysql -d microsoft/dotnet:2.0.0-preview2-sdk sh -c 'while true; do sleep 0.1; done'

script:
- docker exec -it dotnet sh -c 'cd /dotnet && dotnet restore'
- docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.Tests && dotnet test -c Release'
- echo "Building migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && cp config.json.example config.json && sed -i "s/127.0.0.1/mysql/g" config.json && ./scripts/rebuild.sh'
- echo "Test applying migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && dotnet run -c Release testMigrate'
- echo "Test scaffolding" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && ./scripts/scaffold.sh; rc=$?; rm -rf Scaffold; exit $rc'
- echo "Test with EF_BATCH_SIZE=1" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && dotnet test -c Release'
- echo "Test with EF_BATCH_SIZE=10" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && export EF_BATCH_SIZE=10 && dotnet test -c Release'
- echo "Building migrations with EF_DATABASE=pomelo_test2" && docker exec -it mysql sh -c 'mysql -uroot -pPassword12! -e "CREATE SCHEMA IF NOT EXISTS pomelo_test2;"' && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && export EF_SCHEMA=pomelo_test2 && ./scripts/rebuild.sh'
- echo "Test with EF_SCHEMA=pomelo_test2" && docker exec -it dotnet sh -c 'cd /dotnet/test/Pomelo.EntityFrameworkCore.MySql.PerfTests && export EF_SCHEMA=pomelo_test2 && dotnet test -c Release'
- docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.Tests && dotnet test -c Release'
- echo "Building migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& cp config.json.example config.json && sed -i "s/127.0.0.1/mysql/g" config.json && ./scripts/rebuild.sh'
- echo "Test applying migrations" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& dotnet run -c Release testMigrate'
- echo "Test scaffolding" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& ./scripts/scaffold.sh; rc=$?; rm -rf Scaffold; exit $rc'
- echo "Test with EF_BATCH_SIZE=1" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& dotnet test -c Release'
- echo "Test with EF_BATCH_SIZE=10" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& export EF_BATCH_SIZE=10 && dotnet test -c Release'
- echo "Building migrations with EF_DATABASE=pomelo_test2" && docker exec -it mysql sh -c 'mysql -uroot -pPassword12! -e "CREATE SCHEMA IF NOT EXISTS pomelo_test2;"' && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& export EF_SCHEMA=pomelo_test2 && ./scripts/rebuild.sh'
- echo "Test with EF_SCHEMA=pomelo_test2" && docker exec -it dotnet sh -c 'cd /dotnet/test/EFCore.MySql.FunctionalTests&& export EF_SCHEMA=pomelo_test2 && dotnet test -c Release'

notifications:
email: false
42 changes: 0 additions & 42 deletions .vscode/launch.json

This file was deleted.

16 changes: 0 additions & 16 deletions .vscode/tasks.json

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Code Comb™ Co., Ltd.
Copyright (c) 2017 Pomelo Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--<add key="aspnetcore-dev" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json" />-->
<add key="Pomelo" value="https://www.myget.org/F/pomelo/api/v3/index.json" />
<add key="nuget.org" value="https://www.nuget.org/api/v2" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
</configuration>
21 changes: 7 additions & 14 deletions Pomelo.EntityFrameworkCore.MySql.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
VisualStudioVersion = 15.0.26621.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7E8380DB-F015-407B-99C2-26404E551673}"
EndProject
Expand All @@ -21,15 +21,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{212DAE3C-D991-4213-AC4B-E23E923F2DC7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.MySql", "src\EFCore.MySql\EFCore.MySql.csproj", "{FC2779F0-2A2A-4BE2-B5A8-FDA31A4A404A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql", "src\Pomelo.EntityFrameworkCore.MySql\Pomelo.EntityFrameworkCore.MySql.csproj", "{FC2779F0-2A2A-4BE2-B5A8-FDA31A4A404A}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.MySql.Tests", "test\EFCore.MySql.Tests\EFCore.MySql.Tests.csproj", "{DE5212AE-4C17-4702-851D-0F1FC0D32E3C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql.Tests", "test\Pomelo.EntityFrameworkCore.MySql.Tests\Pomelo.EntityFrameworkCore.MySql.Tests.csproj", "{DE5212AE-4C17-4702-851D-0F1FC0D32E3C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql.PerfTests", "test\Pomelo.EntityFrameworkCore.MySql.PerfTests\Pomelo.EntityFrameworkCore.MySql.PerfTests.csproj", "{E7D9C7D9-1CDD-4745-975D-9752AE095418}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pomelo.EntityFrameworkCore.MySql.Design", "src\Pomelo.EntityFrameworkCore.MySql.Design\Pomelo.EntityFrameworkCore.MySql.Design.csproj", "{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EFCore.MySql.FunctionalTests", "test\EFCore.MySql.FunctionalTests\EFCore.MySql.FunctionalTests.csproj", "{E7D9C7D9-1CDD-4745-975D-9752AE095418}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -49,19 +45,16 @@ Global
{E7D9C7D9-1CDD-4745-975D-9752AE095418}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7D9C7D9-1CDD-4745-975D-9752AE095418}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7D9C7D9-1CDD-4745-975D-9752AE095418}.Release|Any CPU.Build.0 = Release|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{212DAE3C-D991-4213-AC4B-E23E923F2DC7} = {7E8380DB-F015-407B-99C2-26404E551673}
{FC2779F0-2A2A-4BE2-B5A8-FDA31A4A404A} = {7E8380DB-F015-407B-99C2-26404E551673}
{DE5212AE-4C17-4702-851D-0F1FC0D32E3C} = {6EC4A4AA-D865-4EF9-BD52-C2D0AA075CDF}
{E7D9C7D9-1CDD-4745-975D-9752AE095418} = {6EC4A4AA-D865-4EF9-BD52-C2D0AA075CDF}
{CC1EECC1-34F9-4183-B630-CE41AC07D4D0} = {7E8380DB-F015-407B-99C2-26404E551673}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48E34212-4B35-4A81-92F9-3C25D4E76D6C}
EndGlobalSection
EndGlobal
67 changes: 33 additions & 34 deletions build-run.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$ErrorActionPreference = "Stop"

function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
{
while($true)
{
Expand All @@ -19,7 +19,7 @@ function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $ret
Start-Sleep -Seconds 10

}
else
else
{
$exception = $_.Exception
throw $exception
Expand All @@ -28,12 +28,10 @@ function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $ret
}
}

cd $PSScriptRoot

$repoFolder = $PSScriptRoot
$env:REPO_FOLDER = $repoFolder

$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/1.0.0-msbuild-rtm.zip"
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/rel/2.0.0-preview2.zip"
if ($env:KOREBUILD_ZIP)
{
$koreBuildZip=$env:KOREBUILD_ZIP
Expand All @@ -42,18 +40,18 @@ if ($env:KOREBUILD_ZIP)
$buildFolder = ".build"

if (!(Test-Path $buildFolder)) {
Write-Host "Downloading KoreBuild from $koreBuildZip"
Write-Host "Downloading KoreBuild from $koreBuildZip"

$tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid()
New-Item -Path "$tempFolder" -Type directory | Out-Null

$localZipFile="$tempFolder\korebuild.zip"

DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6

Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)

New-Item -Path "$buildFolder" -Type directory | Out-Null
copy-item "$tempFolder\**\build\*" $buildFolder -Recurse

Expand All @@ -63,29 +61,39 @@ if (!(Test-Path $buildFolder)) {
}
}

$dotnetVersion = "1.0.0"
$dotnetChannel = "rel-1.0.0"
$dotnetSharedRuntimeVersion = "1.1.1"
$dotnetSharedRuntimeChannel = "rel-1.0.0"
$dotnetArch = 'x64'
$dotnetChannel = "preview"
$dotnetVersion = "2.0.0-preview2-006484"

$dotnetLocalInstallFolder = $env:DOTNET_INSTALL_DIR
if (!$dotnetLocalInstallFolder)
{
$dotnetLocalInstallFolder = "$env:LOCALAPPDATA\Microsoft\dotnet\"
}

function InstallSharedRuntime([string] $version, [string] $channel)
{
$sharedRuntimePath = [IO.Path]::Combine($dotnetLocalInstallFolder, 'shared', 'Microsoft.NETCore.App', $version)
# Avoid redownloading the CLI if it's already installed.
if (!(Test-Path $sharedRuntimePath))
{
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $channel `
-SharedRuntime `
-Version $version `
-Architecture $dotnetArch `
-InstallDir $dotnetLocalInstallFolder
}
}

# Sometimes, MyGet re-uses a build server, clean SDK before attempting to install
if ($env:BuildRunner -eq "MyGet"){
Remove-Item -Force -Recurse $dotnetLocalInstallFolder
}

& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $dotnetChannel -Version $dotnetVersion -Architecture x64
# Avoid redownloading the CLI if it's already installed.
$sharedRuntimePath = [IO.Path]::Combine($dotnetLocalInstallFolder, 'shared', 'Microsoft.NETCore.App', $dotnetSharedRuntimeVersion)
if (!(Test-Path $sharedRuntimePath))
{
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $dotnetSharedRuntimeChannel -SharedRuntime -Version $dotnetSharedRuntimeVersion -Architecture x64
}
& "$buildFolder\dotnet\dotnet-install.ps1" -Channel $dotnetChannel -Version $dotnetVersion -Architecture $dotnetArch
InstallSharedRuntime -version "1.1.2" -channel "release/1.1.0"

dotnet --info

##########################
# BEGIN REPOSITORY TESTS
Expand All @@ -98,23 +106,23 @@ if ($LASTEXITCODE -ne 0){
exit $LASTEXITCODE;
}

# build .NET 451 to verify no build errors
cd (Join-Path $repoFolder (Join-Path "src" "Pomelo.EntityFrameworkCore.MySql"))
# build to verify no build errors
cd (Join-Path $repoFolder (Join-Path "src" "EFCore.MySql"))
dotnet build -c Release
if ($LASTEXITCODE -ne 0){
exit $LASTEXITCODE;
}

# run unit tests
cd (Join-Path $repoFolder (Join-Path "test" "Pomelo.EntityFrameworkCore.MySql.Tests"))
cd (Join-Path $repoFolder (Join-Path "test" "EFCore.MySql.Tests"))
dotnet test -c Release
if ($LASTEXITCODE -ne 0){
exit $LASTEXITCODE;
}

# run functional tests if not on MyGet
if ($env:BuildRunner -ne "MyGet"){
cd (Join-Path $repoFolder (Join-Path "test" "Pomelo.EntityFrameworkCore.MySql.PerfTests"))
cd (Join-Path $repoFolder (Join-Path "test" "EFCore.MySql.FunctionalTests"))
cp config.json.example config.json

echo "Building Migrations"
Expand Down Expand Up @@ -145,16 +153,7 @@ if ($env:BuildRunner -ne "MyGet"){
##########################

# MyGet expects nuget packages to be build
cd (Join-Path $repoFolder (Join-Path "src" "Pomelo.EntityFrameworkCore.MySql"))
if ($env:BuildRunner -eq "MyGet"){
dotnet pack -c Release
if ($LASTEXITCODE -ne 0){
exit $LASTEXITCODE;
}
}

# MyGet expects nuget packages to be build
cd (Join-Path $repoFolder (Join-Path "src" "Pomelo.EntityFrameworkCore.MySql.Design"))
cd (Join-Path $repoFolder (Join-Path "src" "EFCore.MySql"))
if ($env:BuildRunner -eq "MyGet"){
dotnet pack -c Release
if ($LASTEXITCODE -ne 0){
Expand Down
32 changes: 32 additions & 0 deletions src/EFCore.MySql/Design/Internal/MySqlAnnotationCodeGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Pomelo Foundation. All rights reserved.
// Licensed under the MIT. See LICENSE in the project root for license information.

using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.Design.Internal
{
public class MySqlAnnotationCodeGenerator : AnnotationCodeGenerator
{
public MySqlAnnotationCodeGenerator([NotNull] AnnotationCodeGeneratorDependencies dependencies)
: base(dependencies)
{
}

public override bool IsHandledByConvention(IModel model, IAnnotation annotation)
{
return true;
}

public override string GenerateFluentApi(IIndex index, IAnnotation annotation, string language)
{
Check.NotNull(index, nameof(index));
Check.NotNull(annotation, nameof(annotation));
Check.NotNull(language, nameof(language));

return null;
}
}
}
23 changes: 23 additions & 0 deletions src/EFCore.MySql/Design/Internal/MySqlDesignTimeServices.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Pomelo Foundation. All rights reserved.
// Licensed under the MIT. See LICENSE in the project root for license information.

using Microsoft.EntityFrameworkCore.Scaffolding;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.EntityFrameworkCore.Design.Internal
{
public class MySqlDesignTimeServices : IDesignTimeServices
{
public void ConfigureDesignTimeServices(IServiceCollection serviceCollection)
{
serviceCollection
.AddSingleton<IScaffoldingProviderCodeGenerator, MySqlScaffoldingCodeGenerator>()
.AddSingleton<IDatabaseModelFactory, MySqlDatabaseModelFactory>()
.AddSingleton<IAnnotationCodeGenerator, MySqlAnnotationCodeGenerator>()
.AddSingleton<IRelationalTypeMapper, MySqlTypeMapper>();
}
}
}
Loading

0 comments on commit fe78d72

Please sign in to comment.