Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
81c37bc
Ref resolving improvements (#1708)
olydis Jan 10, 2017
e20771a
tmp YAML merging override to unblock arm-recoveryservicesbackup (#1713)
olydis Jan 11, 2017
87162db
Added code to change the data type of ItemType (#1711)
sarangan12 Jan 11, 2017
6357e9a
Extension proposal (#1638)
fearthecowboy Jan 11, 2017
da94d34
[Ruby] Making credentials nil by default (#1677)
sarangan12 Jan 11, 2017
4262e85
[Linter Rules] M1005, M1006, M1007 & M1009 (#1706)
vishrutshah Jan 11, 2017
4ba4392
[linter Rules] Swagger rules M2005 - long running operation must have…
vishrutshah Jan 11, 2017
ce3aff4
Add insights swagger spec test, add vm extensions to swagger and sche…
Jan 12, 2017
e5b7c46
[Linter Rules] M2008 for x-ms-mutability extension (#1712)
vishrutshah Jan 13, 2017
e4e29d9
undo unblocking fix (#1718)
olydis Jan 13, 2017
fe833fb
Improvements for Mono & Docker users (#1714)
mandrean Jan 13, 2017
c60aa02
Better preprocessor and 3 bugfixes (#1717)
olydis Jan 13, 2017
7775505
added operationId and title as optional properties of the example sch…
amarzavery Jan 17, 2017
ceadb38
Fix NullReferenceException (#1722)
fearthecowboy Jan 18, 2017
6f49c0b
minor code cleanup in swagger validation rule file (#1724)
vishrutshah Jan 18, 2017
abc88d6
Generator should not flatten out parameters if they are polymorphic (…
fearthecowboy Jan 18, 2017
b0099f9
Changes to markdown file generation in AzureResourceSchema generator.…
jhendrixMSFT Jan 18, 2017
8aa53b1
Relaxing naming rules to accomodate suffix words in names
vishrutshah Jan 18, 2017
1f99f3b
[Go] Telemetry tiny detail (#1731)
mcardosos Jan 18, 2017
058715a
Fix for credentials switch (#1728)
annatisch Jan 20, 2017
fedab38
Fix for list and dict serialization (#1727)
annatisch Jan 20, 2017
33f5f6a
[Java] AutoRest changes by runtime changes (#1703)
jianghaolu Jan 24, 2017
3db4c82
Merge pull request #1732 from vishrutshah/swagger-rule-M1005-9
vishrutshah Jan 24, 2017
edd62e8
Fixed AutoRest.Python.Azure.Tests.AcceptanceTests.SampleTestForGenera…
olydis Jan 27, 2017
5acc2dd
Remove Azure extensions configuration from __init__ in Python (#1745)
lmazuel Jan 30, 2017
285ba60
Xml support (#1744)
olydis Jan 30, 2017
e41c947
Literate File Formats (#1743)
fearthecowboy Jan 31, 2017
cd3771b
Got rid of ReadOnly validation (#1749)
mcardosos Jan 31, 2017
c31497e
Fixed and improved UniqueResourcePaths linter rule (#1768)
olydis Jan 31, 2017
3ec6a17
cleaner code gen (less unnecessary code) (#1771)
olydis Jan 31, 2017
d7ac120
Make S.X.X a build-time dependency.
fearthecowboy Feb 1, 2017
84a1cb8
Fix #1738 (#1772)
fearthecowboy Feb 1, 2017
5788a5f
regex valitation for dictionary values (#1773)
olydis Feb 1, 2017
1fae9ec
Code changes to generate resources/subresources (#1769)
sarangan12 Feb 2, 2017
52f9a12
Removing sanitization for redable output paths
vishrutshah Feb 2, 2017
27a2135
Eliminate // in the Path output
vishrutshah Feb 2, 2017
27af724
Update SwaggerModelerCompareTests
vishrutshah Feb 2, 2017
af1de48
Fix generation of ARM markdown help files. (#1765)
jhendrixMSFT Feb 2, 2017
ae86c40
Adding new property for readable log output
vishrutshah Feb 3, 2017
019e58f
Merge pull request #1779 from vishrutshah/remove_sanitization
vishrutshah Feb 3, 2017
9e7956e
Linter Validation rules (#1751)
sarangan12 Feb 3, 2017
5f1c901
Merge remote-tracking branch 'azure/master' into coreclr
Feb 3, 2017
333e536
adjusted master's changes & used new razor tool
Feb 3, 2017
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
  •  
  •  
  •  
12 changes: 0 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ addons:
sources:
- deadsnakes
packages:
# Packages required for android build
- libc6-i386
- lib32stdc++6
- lib32gcc1
- lib32ncurses5
- lib32z1
# packages for python
- python3.5
before_install:
Expand All @@ -30,12 +24,6 @@ install:
- gem install bundler
- bundle install
- pip install --user tox
# Install android SDK
- mkdir android
- wget -qO- "http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz" | tar -zxv -C ./android
- echo y | ./android/android-sdk-linux/tools/android update sdk --all --filter platform-tools,android-23,build-tools-23.0.1 --no-ui --force
- echo y | ./android/android-sdk-linux/tools/android update sdk --all --filter extra-android-support,extra-android-m2repository,extra-google-m2repository --no-ui --force
- export ANDROID_HOME=`pwd`/android/android-sdk-linux
# Install NetCore RC2
- sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
- sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
Expand Down
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,35 @@ Alternatively it can be installed from [Chocolatey](https://chocolatey.org/) by
Nightlies are available via MyGet:
[![AutoRest MyGet](https://img.shields.io/myget/autorest/vpre/autorest.svg?style=flat-square)](https://www.myget.org/gallery/autorest)

AutoRest can be run on OSX and Unix using Mono or by running Docker container:

docker pull azuresdk/autorest:latest
AutoRest can be run on macOS and *nix using [Mono](http://www.mono-project.com/download):

# Download & Unpack Autorest
curl -LO https://github.com/Azure/autorest/releases/download/AutoRest-0.16.0/autorest.0.16.0.zip && \
unzip autorest.0.16.0.zip -d autorest/ && \
cd autorest && \

# Download Swagger.json example
curl -O https://raw.githubusercontent.com/Azure/autorest/master/Samples/petstore/petstore.json && \

# Run AutoRest using mono
mono AutoRest.exe \
-CodeGenerator CSharp \
-Input petstore.json \
-OutputDirectory CSharp_PetStore -Namespace PetStore

Or [Docker](https://docs.docker.com/engine/installation):

# Download Swagger.json example
curl -O https://raw.githubusercontent.com/Azure/autorest/master/Samples/petstore/petstore.json

# Download latest AutoRest Docker image
docker pull azuresdk/autorest:latest

# Run AutoRest using Docker, mounting the current folder (pwd) into /home inside the container
docker run -it --rm -v $(pwd):/home azuresdk/autorest:latest autorest \
-CodeGenerator CSharp \
-Input /home/petstore.json \
-OutputDirectory /home/CSharp_PetStore -Namespace PetStore

## Building AutoRest
AutoRest is developed primarily in C# but generates code for multiple languages. See [this link](docs/developer/guide/building-code.md) to build and test AutoRest.
Expand Down
90 changes: 90 additions & 0 deletions Samples/petstore/CSharp/Models/XmlSerialization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
namespace Petstore
{
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
internal static class XmlSerialization
{
internal delegate bool XmlRootDeserializer<T>( XElement root, out T result );
internal delegate bool XmlDeserializer<T>( XElement parent, string propertyName, out T result );
internal static XmlRootDeserializer<T> Root<T>( XmlDeserializer<T> deserializer ) =>
(XElement root, out T result) => deserializer(new XElement("artificialRoot", root), root.Name.LocalName, out result);
private static XmlDeserializer<T> Unroot<T>( XmlRootDeserializer<T> deserializer )
{
return (XElement parent, string propertyName, out T result) => {
result = default(T);
var element = parent.Element(propertyName);
if (element == null)
{
return false;
}
return deserializer(element, out result);
};
}
private static XmlRootDeserializer<T> ToRootDeserializer<T>( System.Func<XElement, T> unsafeDeserializer )
=> (XElement root, out T result) => {
try
{
result = unsafeDeserializer(root);
return true;
}
catch
{
result = default(T);
return false;
}};
internal static XmlDeserializer<T> ToDeserializer<T>( System.Func<XElement, T> unsafeDeserializer )
=> Unroot(ToRootDeserializer(unsafeDeserializer));
internal static XmlDeserializer<IList<T>> CreateListXmlDeserializer<T>( XmlDeserializer<T> elementDeserializer, string elementTagName = null /*if isWrapped = false*/ )
{
if (elementTagName != null)
{
// create non-wrapped deserializer and forward
var slave = CreateListXmlDeserializer( elementDeserializer );
return (XElement parent, string propertyName, out IList<T> result) => {
result = null;
var wrapper = parent.Element(propertyName);
return wrapper != null && slave(wrapper, elementTagName, out result);
};
}
var rootElementDeserializer = Root(elementDeserializer);
return (XElement parent, string propertyName, out IList<T> result) => {
result = new List<T>();
foreach (var element in parent.Elements(propertyName))
{
T elementResult;
if (!rootElementDeserializer(element, out elementResult))
{
return false;
}
result.Add(elementResult);
}
return true;
};
}
internal static XmlDeserializer<IDictionary<string, T>> CreateDictionaryXmlDeserializer<T>( XmlDeserializer<T> elementDeserializer )
{
return (XElement parent, string propertyName, out IDictionary<string, T> result) => {
result = null;
var childElement = parent.Element(propertyName);
if (childElement == null)
{
return false;
}
result = new Dictionary<string, T>();
foreach (var element in childElement.Elements())
{
T elementResult;
if (!elementDeserializer(childElement, element.Name.LocalName, out elementResult))
{
return false;
}
result.Add(element.Name.LocalName, elementResult);
}
return true;
};
}
}
}

22 changes: 11 additions & 11 deletions Tools/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
FROM mono:4.2

# all in one RUN to produce less, smaller layers
ARG AUTOREST_VERSION=0.16.0

ADD autorest /opt/autorest/autorest

# all-in-one RUN to produce smaller image with less layers
RUN apt-get -qqy update && \
apt-get -qqy upgrade && \
apt-get -qqy install wget unzip && \
apt-get -qqy install bsdtar && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN bash -c "\
mkdir /opt/autorest && \
cd /opt/autorest && \
wget https://github.com/Azure/autorest/releases/download/AutoRest-0.16.0/autorest.0.16.0.zip && \
unzip autorest.0.16.0.zip"
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \

ADD autorest /opt/autorest/autorest
curl -#SL https://github.com/Azure/autorest/releases/download/AutoRest-$AUTOREST_VERSION/autorest.$AUTOREST_VERSION.zip | \
bsdtar -xvf- -C /opt/autorest/ && \
chmod +x /opt/autorest/autorest

ENV PATH "$PATH:/opt/autorest/"

WORKDIR /opt/autorest/
WORKDIR /opt/autorest/
49 changes: 10 additions & 39 deletions Tools/setup-developerworkstation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,6 @@ write-host -fore Yellow "YES"
write-host -fore cyan "Info: making temp directory."
$null = mkdir -ea 0 c:\tmp

Function Get-AndroidHomeFromRegistry
{
if ([environment]::GetEnvironmentVariable("ProgramFiles(x86)")) {
$androidRegistryKey = "HKLM:\SOFTWARE\Wow6432Node\Android SDK Tools"
}
else {
$androidRegistryKey = "HKLM:\SOFTWARE\Android SDK Tools"
}

if (Test-Path $androidRegistryKey) {
$path = (Get-ItemProperty $androidRegistryKey Path).Path

if (-not (Test-Path -ea 0 $path)) {
$path = $null
}
}
return $path
}

function DiffPathFromRegistry {
$u = ([System.Environment]::GetEnvironmentVariable( "path", 'User'))
$m = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine'))
Expand Down Expand Up @@ -72,16 +53,6 @@ if( !(get-command -ea 0 java.exe) ) {
write-host -fore darkcyan " Setting JAVA_HOME environment key."
([System.Environment]::SetEnvironmentVariable('JAVA_HOME', (resolve-path "$((get-command -ea 0 javac).Source)..\..\..").Path , "Machine" ))

# install Android SDK
if( ! (Get-AndroidHomeFromRegistry) ) {
write-host -fore cyan "Info: Installing Android SDK."
$null = install-package -provider chocolatey android-sdk -force
if( ! (Get-AndroidHomeFromRegistry) ) { return write-error "No Android SDK Installed" }
# set the environment variable for the user.
}
write-host -fore darkcyan " setting ANDROID_HOME environment key."
([System.Environment]::SetEnvironmentVariable('ANDROID_HOME', (Get-AndroidHomeFromRegistry) ,'Machine'))

# Install node.js
if( !(get-command -ea 0 node.exe) ) {
write-host -fore cyan "Info: Installing NodeJS."
Expand Down Expand Up @@ -307,19 +278,19 @@ if( !(get-command -ea 0 tox.exe) ) {
if( !(get-command -ea 0 tox.exe) ) { return write-error "No TOX in PATH." }
}

# install gradle
if( !(get-command -ea 0 gradle.bat) ) {
write-host -fore cyan "Info: Downloading Gradle"
(New-Object System.Net.WebClient).DownloadFile("https://services.gradle.org/distributions/gradle-3.1-all.zip", "c:\tmp\gradle-3.1-all.zip" )
if( !(test-path -ea 0 "c:\tmp\gradle-3.1-all.zip") ) { return write-error "Unable to download Gradle" }
write-host -fore darkcyan " Unpacking Gradle."
Expand-Archive C:\tmp\gradle-3.1-all.zip -DestinationPath c:\
write-host -fore darkcyan " Adding gradle to system PATH."
# install maven
if( !(get-command -ea 0 mvn.cmd) ) {
write-host -fore cyan "Info: Downloading Maven"
(New-Object System.Net.WebClient).DownloadFile("http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip", "c:\tmp\apache-maven-3.3.9-bin.zip" )
if( !(test-path -ea 0 "c:\tmp\apache-maven-3.3.9-bin.zip") ) { return write-error "Unable to download Maven" }
write-host -fore darkcyan " Unpacking Maven."
Expand-Archive C:\tmp\apache-maven-3.3.9-bin.zip -DestinationPath c:\
write-host -fore darkcyan " Adding mvn to system PATH."
$p = ([System.Environment]::GetEnvironmentVariable( "path", 'Machine'))
$p = "$p;c:\gradle-3.1\bin"
$p = "$p;c:\apache-maven-3.3.9\bin"
([System.Environment]::SetEnvironmentVariable( "path", $p, 'Machine'))
ReloadPathFromRegistry
if( !(get-command -ea 0 gradle.bat) ) { return write-error "No Gradle in PATH." }
if( !(get-command -ea 0 mvn.cmd) ) { return write-error "No Maven in PATH." }
}

#install go
Expand Down
41 changes: 1 addition & 40 deletions Tools/verify-settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -203,32 +203,6 @@ function Find-OrAdd ( $cmd , $folders = @("${env:ProgramFiles(x86)}","${env:Prog
}
}

Function Get-AndroidHomeFromRegistry
{
# if ([Environment]::Is64BitOperatingSystem)
# powershell v1 doesn't have is 64 bit flag.
if ([environment]::GetEnvironmentVariable("ProgramFiles(x86)"))
{
$androidRegistryKey = "HKLM:\SOFTWARE\Wow6432Node\Android SDK Tools"
}
else
{
$androidRegistryKey = "HKLM:\SOFTWARE\Android SDK Tools"
}

if (Test-Path $androidRegistryKey)
{
$path = (Get-ItemProperty $androidRegistryKey Path).Path

if (-not (Test-Path $path))
{
$path = $null
}
}

return $path
}

find-orAdd "dotnet.exe" -hint "See: https://www.microsoft.com/net/core#windows"
find-orAdd "msbuild.exe" -hint "Install Visual studio 2015"

Expand All @@ -239,7 +213,7 @@ find-orAdd "gulp.cmd" -hint "maybe use 'npm install -g gulp'" -folders @("${env:

find-orAdd "ruby.exe" (@() + ((dir -ea 0 c:\ruby*).fullname) + @( "${env:ProgramFiles(x86)}","${env:ProgramFiles}","c:\tools")) -hint "see http://rubyinstaller.org/downloads/"

find-orAdd "gradle.bat" ( @( "${env:ProgramFiles(x86)}","${env:ProgramFiles}","c:\tools")) -hint "see http://gradle.org/gradle-download/"
find-orAdd "mvn.cmd" ( @( "${env:ProgramFiles(x86)}","${env:ProgramFiles}","c:\tools")) -hint "see https://maven.apache.org/download.cgi"

find-orAdd "python.exe" (@() + ((dir -ea 0 c:\python*).fullname) + @( "${env:ProgramFiles(x86)}","${env:ProgramFiles}","c:\tools")) -hint "https://www.python.org/downloads/"
find-orAdd "tox.exe" (@() + ((dir -ea 0 c:\python*).fullname) + @( "${env:ProgramFiles(x86)}","${env:ProgramFiles}","c:\tools")) -hint "maybe use 'pip install tox'"
Expand All @@ -259,19 +233,6 @@ if( (!$env:JAVA_HOME) -or (!(test-path -PathType Container $env:JAVA_HOME )) )
}
}

# use this to add the missing SDK
# .\Install-AndroidSDK.ps1 -RequestedAndroidPackages android-23 -apilevel 23

if( (!$env:ANDROID_HOME) -or (!(test-path -PathType Container $env:ANDROID_HOME )) ) {
$android = Get-AndroidHomeFromRegistry
if (! $android ) {
write-host -fore red "Environment variable ANDROID_HOME not set correctly."
$failing = $true
} else {
$env:ANDROID_HOME= $android
}
}

if( !$failing ) {
write-host -fore green "`n`nTools/Environment are OK"
} else {
Expand Down
2 changes: 2 additions & 0 deletions attic/build.proj.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
<!-- CodeGenerator projects that can be built into packages -->
<ItemGroup>
<PackageableLibraries Include="$(LibraryRoot)/src/core/AutoRest/project.json" />
<PackageableLibraries Include="$(LibraryRoot)/src/dev/AutoRest.Preview/project.json" />
</ItemGroup>

<!-- Our Custom Tasks -->
Expand Down Expand Up @@ -181,6 +182,7 @@
<-->
<ItemGroup>
<XProjFiles Include="src/core/AutoRest/AutoRest.xproj" />
<XProjFiles Include="src/dev/AutoRest.Preview/AutoRest.Preview.xproj" />
<XProjFiles Include="src/core/AutoRest.Core/AutoRest.Core.xproj" />
<XProjFiles Include="src/core/AutoRest.Core.Tests/AutoRest.Core.Tests.xproj" />
<XProjFiles Include="src/core/AutoRest.Extensions/AutoRest.Extensions.xproj" />
Expand Down
21 changes: 2 additions & 19 deletions attic/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,23 +361,6 @@ gulp.task('regenerate:expected:javaazurefluent', function(cb){
}, cb);
})

gulp.task('test:clientruntime:java:init', ['test:java:init'], function(){
return gulp.src('./').pipe(shell(basePathOrThrow() + '/gradlew :client-runtime:check'));
});
gulp.task('test:clientruntime:javaazure:init', ['test:clientruntime:java:init'], function(){
return gulp.src('./').pipe(shell(basePathOrThrow() + '/gradlew :azure-client-runtime:check'));
});

gulp.task('test:java:init', function(cb){
if(fs.existsSync(basePathOrThrow()+'/src/client')){
// clean the src/client dir
del.sync(['./src/client/'], cb);
}
fs.mkdir(basePathOrThrow()+'/src/client/');
//clone the Java ClientRuntime repo
return gulp.src('./').pipe(shell('git clone --branch v1.0.0-beta3 https://github.com/azure/autorest-clientruntime-for-java.git src/client/Java --depth=1'));
});

gulp.task('regenerate:expected:java', function(cb){
mappings = {};
for (var key in defaultMappings) {
Expand Down Expand Up @@ -792,8 +775,8 @@ gulp.task('test:ruby:azure', ['regenerate:expected:rubyazure'], shell.task('ruby
gulp.task('test:python', function(cb){ runAsync('tox', {cwd: './src/generator/AutoRest.Python.Tests/'}, cb) });
gulp.task('test:python:azure', function(cb){ runAsync('tox', {cwd: './src/generator/AutoRest.Python.Azure.Tests/'}, cb) });

gulp.task('test:java', ['test:java:init', 'test:clientruntime:java:init', 'test:clientruntime:javaazure:init'], shell.task(basePathOrThrow() + '/gradlew :codegen-tests:check', {cwd: './', verbosity: 3}));
gulp.task('test:java:azure', shell.task(basePathOrThrow() + '/gradlew :azure-codegen-tests:check', {cwd: './', verbosity: 3}));
gulp.task('test:java', shell.task('mvn test -pl src/generator/AutoRest.Java.Tests', {verbosity: 3}));
gulp.task('test:java:azure', shell.task('mvn test -pl src/generator/AutoRest.Java.Azure.Tests', {verbosity: 3}));

gulp.task('test:go', ['regenerate:expected:go'], shell.task([
'glide up',
Expand Down
Loading