Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code model #1444

Merged
merged 31 commits into from
Oct 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
500b0ed
CodeModel Refactoring - Moved/Renamed Files
fearthecowboy Sep 20, 2016
6b48185
CodeModel Refactoring - Changes to AutoRest/AutoRest.Core
fearthecowboy Sep 20, 2016
922e3b1
CodeModel Refactoring - Core Tests changes
fearthecowboy Sep 20, 2016
da5d334
CodeModel Refactoring - AutoRest.Extensions changes
fearthecowboy Sep 20, 2016
c4a2a05
CodeModel Refactoring - AutoRest.Extensions Tests changes
fearthecowboy Sep 20, 2016
e70e115
CodeModel Refactoring - Fix compiler warnign
fearthecowboy Sep 20, 2016
b2149b8
CodeModel Refactoring - CSharp Generator
fearthecowboy Sep 20, 2016
b65871a
CodeModel Refactoring - CSharp Azure Generator
fearthecowboy Sep 20, 2016
651ef2e
CodeModel Refactoring - CSharp Tests Changes
fearthecowboy Sep 20, 2016
f6d9fe5
CodeModel Refactoring - NodeJS changes
fearthecowboy Sep 20, 2016
1adfd12
CodeModel Refactoring - NodeJS Azure changes
fearthecowboy Sep 20, 2016
88129d6
CodeModel Refactoring - Modeler changes
fearthecowboy Sep 20, 2016
210a8e4
Fix/enable all tests
fearthecowboy Sep 20, 2016
aa267c9
Fix up c# unit tests
fearthecowboy Sep 20, 2016
376b61d
small fixes in Moder
fearthecowboy Sep 20, 2016
db2b5bd
Some last-minute tweaks to the generators to pass tests
fearthecowboy Sep 20, 2016
eeeed5a
Changes to finish getting all the tests to run (in core)
fearthecowboy Sep 20, 2016
fb9ebf8
Extensions tests cleanup
fearthecowboy Sep 20, 2016
387921e
Resharper settings
fearthecowboy Sep 20, 2016
e501ef6
Tweaking the build to build and test ok via gulp
fearthecowboy Sep 20, 2016
e35776d
accidentally overwrote fix for in memory assemblies
fearthecowboy Sep 21, 2016
6bb826e
Fixed glitch in builing
fearthecowboy Sep 22, 2016
f57c415
Tweaking build for linux
fearthecowboy Sep 22, 2016
1024baf
cleaning up small issues and removing superflous junk
fearthecowboy Sep 28, 2016
e83a0b7
cleaned up stuff around nullability (and some other minor cleanups)
fearthecowboy Sep 30, 2016
5a55903
cleaned up stuff around nullability (and some other minor cleanups) - c#
fearthecowboy Sep 30, 2016
f28a27b
Regenerated Tests Expected files
fearthecowboy Sep 30, 2016
d885d3e
small code cleanups
fearthecowboy Sep 30, 2016
2329858
Adding compare script to validate against rest-api-specs repo
fearthecowboy Sep 30, 2016
4dae652
added report generation to compare script (requires Araxis Merge inst…
fearthecowboy Sep 30, 2016
d9c926a
fixed use of clientproperty == null (should use !IsClientProperty)
fearthecowboy Oct 1, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ src/generator/AutoRest.NodeJS.Tests/AcceptanceTests/*.js
## Ignore user-specific files, temporary files, build results, etc.
AutoRest/**/Templates/*.cs
src/**/Templates/*.cs
compare-results/*

# User-specific files
*.suo
Expand Down
12 changes: 12 additions & 0 deletions AutoRest.sln
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoRest.Tooling.CSharp.Compiler", "src\dev\AutoRest.Tooling.CSharp.Compiler\AutoRest.Tooling.CSharp.Compiler.xproj", "{42DC6C97-6E79-4D0A-9A1D-DD34C99248E2}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoRest.Go", "src\generator\AutoRest.Go\AutoRest.Go.xproj", "{BEDCF556-6CEA-4EAE-ACE3-8B9EFE0818E5}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoRest.CSharp.Azure.Fluent", "src\generator\AutoRest.CSharp.Azure.Fluent\AutoRest.CSharp.Azure.Fluent.xproj", "{8464A22C-0C8D-4C84-85A8-0ACE787BDC75}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoRest.CSharp.Azure.Fluent.Tests", "src\generator\AutoRest.CSharp.Azure.Fluent.Tests\AutoRest.CSharp.Azure.Fluent.Tests.xproj", "{947EA2A0-1730-4CC2-B042-C5471DAB78F1}"
Expand All @@ -138,6 +139,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AutoRest.CSharp.Azure.Fluen
{8464A22C-0C8D-4C84-85A8-0ACE787BDC75} = {8464A22C-0C8D-4C84-85A8-0ACE787BDC75}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{AB891A22-A69D-46E1-8C75-DB69641D3BBD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Go", "Go", "{11FF910A-E4B5-4037-B6A9-D4E26A64C16C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -293,6 +298,9 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{C876085F-9DC3-41F0-B7B4-17022CD84684} = {AB891A22-A69D-46E1-8C75-DB69641D3BBD}
{F589D8B7-1B0F-4182-842B-09866A4A2CEB} = {AB891A22-A69D-46E1-8C75-DB69641D3BBD}
{31E6BAA3-C606-4D44-B0D7-46BE7AFAC656} = {AB891A22-A69D-46E1-8C75-DB69641D3BBD}
{9517265E-5127-460C-9DDE-FE017D73121C} = {02144BF6-4489-4AFC-9B2D-0306C3DD3C19}
{C6C4E139-D7AF-486C-95BA-2B879F58F18D} = {02144BF6-4489-4AFC-9B2D-0306C3DD3C19}
{4899B527-6815-4E89-84B3-DD5A507B205A} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
Expand All @@ -305,6 +313,7 @@ Global
{DE95444A-F6FD-46DC-BBDC-A1A6886A6F2D} = {EF9E346D-70C6-45F5-8FF9-9B734F4A1298}
{A7780698-3072-486E-A105-81EDDF552598} = {DE95444A-F6FD-46DC-BBDC-A1A6886A6F2D}
{31931998-7543-41DA-9E58-D9670D810352} = {DE95444A-F6FD-46DC-BBDC-A1A6886A6F2D}
{04E8E124-852C-4B5D-83EB-0B8ADDE825CB} = {87F4BC36-8A28-4BF7-B9C4-3EE2CD9731CD}
{5989E210-AE15-4DF4-8CEE-DEE609740FD2} = {04E8E124-852C-4B5D-83EB-0B8ADDE825CB}
{9750C692-C2D0-4D0F-9F73-D45DB9E906CE} = {5989E210-AE15-4DF4-8CEE-DEE609740FD2}
{A9C01442-1E93-4C2D-9182-B61C9F53C3FF} = {EF9E346D-70C6-45F5-8FF9-9B734F4A1298}
Expand Down Expand Up @@ -332,7 +341,10 @@ Global
{784D4B45-F12A-4B8F-A86C-35A080814A19} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{43DFEF27-2FD7-4827-A669-DFD2DD1CBBCC} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{8192BAA3-C606-4D44-B0D7-46BE7AFA4096} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{42DC6C97-6E79-4D0A-9A1D-DD34C99248E2} = {AB891A22-A69D-46E1-8C75-DB69641D3BBD}
{BEDCF556-6CEA-4EAE-ACE3-8B9EFE0818E5} = {11FF910A-E4B5-4037-B6A9-D4E26A64C16C}
{8464A22C-0C8D-4C84-85A8-0ACE787BDC75} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{947EA2A0-1730-4CC2-B042-C5471DAB78F1} = {03E75B1D-A443-4A12-B31F-860DB2B45140}
{11FF910A-E4B5-4037-B6A9-D4E26A64C16C} = {EF9E346D-70C6-45F5-8FF9-9B734F4A1298}
EndGlobalSection
EndGlobal
241 changes: 240 additions & 1 deletion AutoRest.sln.DotSettings

Large diffs are not rendered by default.

Binary file added Tools/all-specs
Binary file not shown.
192 changes: 192 additions & 0 deletions Tools/compare.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
param( $lastAutorest, $newAutoRest , [switch]$noclean , $swagger, [switch]$notrim)

function get-fullpath( $path ) {
$result = resolve-path $path -ea 0 -ErrorVariable e
if( $e ) {
return $e.TargetPath
}
return $result
}

$baseFolder = get-fullpath "$PSScriptRoot\..\compare-results"
$lastRoot = get-fullpath "$baseFolder\Last"
$newRoot = get-fullpath "$baseFolder\New"

if( !$noclean ) {
# remove last run and create folders
$null = rmdir -recurse -force -ea 0 $baseFolder
$null = mkdir $baseFolder
} else {
$null = rmdir -recurse -force -ea 0 $lastRoot
$null = rmdir -recurse -force -ea 0 $newRoot
$lastAutoRest = (dir "$baseFolder\autorest*\tools\AutoRest.exe").FullName
}

$null = mkdir -ea 0 $lastRoot
$null = mkdir -ea 0 $newRoot

if( -not $lastAutorest ) {
# install last nightly build.
write-host -fore green "Installing latest nightly autorest."
$null = &"$PSScriptRoot\NuGet.exe" install autorest -source https://www.myget.org/F/autorest/api/v3/index.json -prerelease -outputdirectory $baseFolder

# get autorest nightly exe
$lastAutoRest = (dir "$baseFolder\autorest*\tools\AutoRest.exe").FullName
}

if( -not (resolve-path $lastAutoRest -ea 0 )) {
return write-error "Can't find last autorest exe at $lastAutoRest"
}

if( -not $newAutoRest ) {
$newAutorest = (dir "$PSScriptRoot\..\src\core\AutoRest\bin\Debug\net451\win7-x64\AutoRest.exe").FullName
}

if( -not (resolve-path $newAutorest -ea 0 )) {
return write-error "Can't find new autorest exe at $newAutoRest"
}

Write-host -fore green "Last: $lastAutorest"
Write-host -fore green "New : $newAutorest"

$procs = get-process -ea 0 autorest
if( $procs ) {
write-host -fore red "Ensuring all previous jobs are completed."
$procs.Kill()
}
Get-Job | remove-job -force

function ProcessBackgroundJobs() {
Get-Job -state Completed |% {
receive-job $_
remove-job $_
}
}

$scrp = {
param($lastexe, $newexe, $commonFolder,$uniqueName ,$spec, $gen, $modeler, $notrim)
$output = "$lastexe `n-Namespace Test.NameSpace -OutputDirectory ""$commonFolder\Last\$uniqueName\$gen"" -input $spec -CodeGenerator $gen -verbose -modeler $modeler`n"
$output += &$lastexe -Namespace Test.NameSpace -OutputDirectory "$commonFolder\Last\$uniqueName\$gen" -input $spec -CodeGenerator $gen -verbose -modeler $modeler
set-content -value $output -path "$commonFolder\last\$uniqueName\output-$gen.txt"

$output = "$newexe `n-Namespace Test.NameSpace -OutputDirectory ""$commonFolder\New\$uniqueName\$gen"" -input $spec -CodeGenerator $gen -verbose -modeler $modeler`n"
$output += &$newexe -Namespace Test.NameSpace -OutputDirectory "$commonFolder\New\$uniqueName\$gen" -input $spec -CodeGenerator $gen -verbose -modeler $modeler
set-content -value $output -path "$commonFolder\new\$uniqueName\output-$gen.txt"

if( !$notrim ) {
(dir "$commonFolder\Last\$uniqueName\" -recurse -file).FullName |% {
$ref = $_
if( $ref ) {
$cur = $ref -replace "\\Last\\","\New\"

if( (test-path $ref ) -and (test-path $cur) ) {
$r = get-content $ref
$c = get-content $cur
if( $r -and $c ) {
$v = compare-object $r $c
if( !$v ) {
erase $ref
erase $cur
}
}
}
}
}
}
}

@("Azure.NodeJS", "Azure.CSharp") |% {
$gen = $_;


if( $swagger ) {
$name = $swagger -replace ".json","" -replace ".*\\","" -replace ".*\/",""
$uniquename = $name -replace "\\","_" -replace "//","_" -replace ".json",""
$specfile = $swagger

$modeler = "Swagger"
if( $name -match "composite" ) {
$modeler = "CompositeSwagger"
}
$j = Start-Job -ScriptBlock $scrp -arg $lastAutorest, $newAutorest, $baseFolder, $uniqueName, $specfile, $gen, $modeler, $notrim

} else {


get-content "$psscriptroot\all-specs" |% {
$spec = $_
$uniquename = $spec -replace "\\","_" -replace ".json",""
# $filename = (dir $spec ).Name
$name = $spec -replace ".json","" -replace ".*\\",""
# $specfile = (resolve-path $spec).Path
$specfile = "https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/$spec" -replace "\\","/"

$modeler = "Swagger"
if( $name -match "composite" ) {
$modeler = "CompositeSwagger"
}
write-host -fore darkGray "Processing $name : $gen "

$j = Start-Job -ScriptBlock $scrp -arg $lastAutorest, $newAutorest, $baseFolder, $uniqueName, $specfile, $gen, $modeler, $notrim
sleep -milliseconds 25

# process output of completed jobs too
ProcessBackgroundJobs

# throttle to 10 background jobs at a time.
While((Get-Job -State 'Running').Count -ge 6) {
sleep -milliseconds 100
# remove any files that are perfect matches.
}
}
}
}

write-host -fore green -nonewline "Finishing Up..."
While((Get-Job -State 'Running').Count -ge 1) {
write-host -fore darkgreen -nonewline "."
ProcessBackgroundJobs
sleep -milliseconds 250
}

# wait for the last of the jobs to run.
Get-Job |% {
receive-job $_
remove-job $_
}

try {
$app = New-Object -ComObject "Merge70.Application"
if( $app ) {

$fc = $app.FolderComparison
$completed = $false;

$fc.Compare("$baseFolder\Last", "$baseFolder\New");

write-host -nonewline "`nComparing files..."
while ($fc.Busy)
{
sleep -milliseconds 250
write-host -nonewline "."
}

write-host -fore green "`nWriting report: $baseFolder\report.html "

$fc.Report("html", 0, "$baseFolder\report.html");

while ($fc.Busy)
{
sleep -milliseconds 250
write-host -nonewline "."
}

$fc.Close()
$app.Close()

$app = $null
$fc = $null
}
} catch {
write-host -fore red "Araxis Merge not installed (report skipped)"
}
3 changes: 2 additions & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@

<!-- .xproj files (used for clean and razor compile tasks -->
<ItemGroup>
<XProjFiles Include="src/**/*.xproj" />
<XProjFiles Include="src/**/*.xproj" Exclude="src/**/node_modules/**/*.xproj" Condition=" '$(OS)' == 'Windows_NT'" />
<XProjFiles Include="src/**/*.xproj" Condition=" '$(OS)' != 'Windows_NT'" />
</ItemGroup>

<!-- Our Custom Tasks -->
Expand Down
41 changes: 21 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,13 @@ var xunitTestsDlls = [
];

var xunitNetCoreXproj = [
'src/client/Microsoft.Rest.ClientRuntime.Azure.Tests/project.json',
'src/client/Microsoft.Rest.ClientRuntime.Tests/project.json',
// 'src/client/Microsoft.Rest.ClientRuntime.Azure.Tests/project.json',
// 'src/client/Microsoft.Rest.ClientRuntime.Tests/project.json',
'src/core/AutoRest.Core.Tests/project.json',
'src/core/AutoRest.Extensions.Azure.Tests/project.json',
'src/core/AutoRest.Extensions.Tests/project.json',
'src/generator/AutoRest.AzureResourceSchema.Tests/project.json',
// Disabling until merged into the new model.
// 'src/generator/AutoRest.AzureResourceSchema.Tests/project.json',
'src/generator/AutoRest.CSharp.Azure.Tests/project.json',
'src/generator/AutoRest.CSharp.Tests/project.json',
'src/generator/AutoRest.CSharp.Unit.Tests/project.json',
Expand Down Expand Up @@ -885,32 +886,32 @@ gulp.task('test', function(cb){
if (isWindows) {
runSequence(
'test:xunit',
'test:clientruntime',
// DISABLE 'test:nugetPackages:xunit',
// 'test:clientruntime',
'test:node',
'test:node:azure',
// DISABLE 'test:nugetPackages:npm',
'test:ruby',
'test:ruby:azure',
'test:java',
'test:java:azure',
'test:python',
'test:python:azure',
'test:go',
// DISABLING TESTS FOR LANGUAGES UNTIL MERGED INTO NEW MODEL
// 'test:ruby',
// 'test:ruby:azure',
// 'test:java',
// 'test:java:azure',
// 'test:python',
// 'test:python:azure',
// 'test:go',
cb);
} else {
runSequence(
// 'test:xunit',
// 'test:clientruntime',
'test:node',
'test:node:azure',
'test:ruby',
'test:ruby:azure',
'test:java',
'test:java:azure',
'test:python',
'test:python:azure',
'test:go',
// DISABLING TESTS FOR LANGUAGES UNTIL MERGED INTO NEW MODEL
// 'test:ruby',
// 'test:ruby:azure',
// 'test:java',
// 'test:java:azure',
// 'test:python',
// 'test:python:azure',
// 'test:go',
cb);
}
});
Expand Down
Loading