forked from Azure/azure-sdk-for-net
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generating management sdk from nuget spec.
- Loading branch information
Chris Tavares
committed
Dec 4, 2013
1 parent
078f52b
commit da8bc01
Showing
16 changed files
with
245 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,3 +113,6 @@ packages | |
|
||
# Mac development | ||
.DS_Store | ||
|
||
# Specification DLLs | ||
*.Specification.dll |
Binary file added
BIN
+197 KB
...Hydra.Generator.1.0.5085.22928-prerelease/Hydra.Generator.1.0.5085.22928-prerelease.nupkg
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
...ydra.Generator.1.0.5085.22928-prerelease/Hydra.Generator.1.0.5085.22928-prerelease.nuspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd"> | ||
<metadata> | ||
<id>Hydra.Generator</id> | ||
<version>1.0.5085.22928-prerelease</version> | ||
<title>Hydra.Generator</title> | ||
<authors>Microsoft Corporation</authors> | ||
<owners>Microsoft Corporation</owners> | ||
<licenseUrl>http://go.microsoft.com/fwlink/?LinkId=235170</licenseUrl> | ||
<projectUrl>https://github.com/WindowsAzure/hydra</projectUrl> | ||
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</iconUrl> | ||
<requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
<description>Advanced code generation for REST APIs, package for spec consumers.</description> | ||
<summary>Advanced code generation for REST APIs, package for spec consumers.</summary> | ||
<releaseNotes>Experimental prerelease</releaseNotes> | ||
<copyright>Copyright 2013</copyright> | ||
</metadata> | ||
</package> |
48 changes: 48 additions & 0 deletions
48
packages/Hydra.Generator.1.0.5085.22928-prerelease/build/Hydra.Generator.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
|
||
<PropertyGroup Condition="$(GetSpecFromNuGet) == ''"> | ||
<SpecAssemblyPath>..\$(SpecAssemblyProjectDirName)\bin\$(Configuration)\$(SpecAssemblyFileName)</SpecAssemblyPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="$(GetSpecFromNuGet) != ''"> | ||
<RestoreConfigFile>restore.config</RestoreConfigFile> | ||
<RestoreConfigSwitch Condition="$(UsePrivateFeed) != ''">-ConfigFile $(RestoreConfigFile)</RestoreConfigSwitch> | ||
<RestoreConfigSwitch Condition="$(UsePrivateFeed) == ''"></RestoreConfigSwitch> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<HydraExePath Condition="$(HydraExePath)==''">$(MSBuildThisFileDirectory)\..\tools\Hydra.exe</HydraExePath> | ||
<!-- support running hydra either on Windows or under mono --> | ||
<HydraCommand Condition="$(OS) == 'Windows_NT'">"$(HydraExePath)"</HydraCommand> | ||
<HydraCommand Condition="$(OS) != 'Windows_NT'">mono --runtime=v4.0.30319 $(HydraExePath)</HydraCommand> | ||
</PropertyGroup> | ||
|
||
<Target Name="EnsureEnvironment"> | ||
<Error Text="The PRIVATE_FEED_URL property is not set. Either set it in the environment or specify it on the msbuild command line" | ||
Condition="'$(PRIVATE_FEED_URL)'==''" ContinueOnError="ErrorAndContinue" /> | ||
<Error Text="The PRIVATE_FEED_USER_NAME property is not set. Either set it in the environment or specify it on the msbuild command line." | ||
Condition="'$(PRIVATE_FEED_USER_NAME)'==''" ContinueOnError="ErrorAndContinue" /> | ||
<Error Text="The PRIVATE_FEED_PASSWORD property is not set. Either set it in the environment or specify it on the msbuild command line." | ||
Condition="'$(PRIVATE_FEED_PASSWORD)'==''" ContinueOnError="ErrorAndContinue" /> | ||
</Target> | ||
|
||
<Target Name="CreateRestoreConfig" DependsOnTargets="EnsureEnvironment" Condition="'$(UsePrivateFeed)'!=''"> | ||
<Exec Command='$(NuGetCommand) sources Add -Name Target -Source $(PRIVATE_FEED_URL) $(RestoreConfigSwitch)' /> | ||
<Exec Command='$(NuGetCommand) sources Update -Name Target -UserName $(PACKAGE_PUBLISHING_USER_NAME) -Password $(PACKAGE_PUBLISHING_PASSWORD) $(RestoreConfigSwitch)' | ||
EchoOff="true"/> | ||
</Target> | ||
|
||
<Target Name="UpdateSpecDll" DependsOnTargets="CreateRestoreConfig" Condition="$(GetSpecFromNuGet)!=''"> | ||
<Exec Command="$(NuGetCommand) update $(PackagesConfig) $(RestoreConfigSwitch)" ContinueOnError="ErrorAndContinue" /> | ||
<Delete Files="$(RestoreConfigFile)" Condition="'$(UsePrivateFeed)'!=''" /> | ||
</Target> | ||
|
||
<Target Name="UpdateSpecDll" Condition="$(GetSpecFromNuGet)==''"> | ||
<Copy SourceFiles="$(SpecAssemblyPath)" DestinationFolder="$(OutputPath)" /> | ||
</Target> | ||
|
||
<Target Name="GenerateCodeFromSpecs" DependsOnTargets="UpdateSpecDll"> | ||
<Exec Command="$(HydraCommand)" /> | ||
</Target> | ||
</Project> |
36 changes: 36 additions & 0 deletions
36
packages/Hydra.Generator.1.0.5085.22928-prerelease/content/GenerateCode.props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
|
||
<PropertyGroup> | ||
<!-- | ||
Is the spec being generated from being retrieved via NuGet or from a local project? | ||
If this is a project that uses the spec from the same solution (for example, a test | ||
project) then set this property to blank (or just remove it completely) | ||
--> | ||
<GetSpecFromNuGet>1</GetSpecFromNuGet> | ||
</PropertyGroup> | ||
|
||
<!-- User settable properties to control how specs are found in the same solution --> | ||
<PropertyGroup Condition="$(GetSpecFromNuGet) == ''"> | ||
<!-- name of project directory which builds the spec dll --> | ||
<SpecAssemblyProjectDirName>MySpec</SpecAssemblyProjectDirName> | ||
|
||
<!-- The filename for the generated spec assembly --> | ||
<SpecAssemblyFileName>$(SpecAssemblyProjectDirName).dll</SpecAssemblyFileName> | ||
</PropertyGroup> | ||
|
||
<!-- User settable properties to control how specs are retrieved from NuGet --> | ||
<PropertyGroup Condition="$(GetSpecFromNuGet) != ''"> | ||
<!-- Set this to use a private feed, with credentials pulled from the environment --> | ||
<UsePrivateFeed>true</UsePrivateFeed> | ||
<!-- Where's the private feed to pull from? --> | ||
<PRIVATE_FEED_URL>https://www.myget.org/F/hydra/</PRIVATE_FEED_URL> | ||
<!-- | ||
The following two properties also need to be available. It is recommended that | ||
you set them as environment variables rather than setting them here. | ||
<PRIVATE_FEED_USER_NAME>User name for access to private feed</PRIVATE_FEED_USER_NAME> | ||
<PRIVATE_FEED_PASSWORD>Password for access to private feed</PRIVATE_FEED_PASSWORD> | ||
--> | ||
</PropertyGroup> | ||
</Project> |
15 changes: 15 additions & 0 deletions
15
packages/Hydra.Generator.1.0.5085.22928-prerelease/content/hydra.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Hydra> | ||
<Assembly>Spec assembly name goes here</Assembly> | ||
<OutputDirectory>Generated</OutputDirectory> | ||
|
||
<Specification> | ||
<Type>REST Client type name goes here</Type> | ||
|
||
<Platform> | ||
<Flavor>CSharp.Azure</Flavor> | ||
<OutputPath>Output file name goes here</OutputPath> | ||
</Platform> | ||
|
||
</Specification> | ||
</Hydra> |
Binary file added
BIN
+518 KB
packages/Hydra.Generator.1.0.5085.22928-prerelease/tools/Hydra.Core.dll
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
packages/Hydra.Generator.1.0.5085.22928-prerelease/tools/Install.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
param($installPath, $toolsPath, $package, $project) | ||
# This is the MSBuild targets file to add | ||
$targetsFile = [System.IO.Path]::Combine($toolsPath, 'BuildPackages.targets') | ||
|
||
# Need to load MSBuild assembly if it's not loaded yet. | ||
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' | ||
|
||
# Grab the loaded MSBuild project for the project | ||
$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 | ||
|
||
# Add import of GenerateCode.props. Must be done before the targets file that was automatically loaded | ||
$targetsImport = $msbuild.Xml.Imports | Where-Object { $_.Project.EndsWith('Hydra.Generator.targets') } | Select-Object -First 1 | ||
$msbuild.Xml.InsertBeforeChild($msbuild.Xml.CreateImportElement("GenerateCode.props"), $targetsImport) | ||
|
||
# Add BeforeBuild target to run the code generation | ||
$target = $msbuild.Xml.AddTarget("BeforeBuild") | ||
$target.DependsOnTargets = "RestorePackages;GenerateCodeFromSpecs" | ||
|
||
$project.Save() |
25 changes: 25 additions & 0 deletions
25
packages/Hydra.Generator.1.0.5085.22928-prerelease/tools/Uninstall.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
param($installPath, $toolsPath, $package, $project) | ||
|
||
# Need to load MSBuild assembly if it's not loaded yet. | ||
Add-Type -AssemblyName 'Microsoft.Build, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' | ||
|
||
# Grab the loaded MSBuild project for the project | ||
$msbuild = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.GetLoadedProjects($project.FullName) | Select-Object -First 1 | ||
|
||
# Find all the imports and targets added by this package. | ||
$itemsToRemove = @() | ||
|
||
# Allow many in case a past package was incorrectly uninstalled | ||
$itemsToRemove += $msbuild.Xml.Imports | Where-Object { $_.Project.EndsWith('GenerateCode.props') } | ||
$itemsToRemove += $msbuild.Xml.Targets | Where-Object { $_.Name -eq 'BeforeBuild' -and $_.DependsOnTargets.Contains('GenerateCodeFromSpecs') } | ||
|
||
# Remove the elements and save the project | ||
if ($itemsToRemove -and $itemsToRemove.length) | ||
{ | ||
foreach ($itemToRemove in $itemsToRemove) | ||
{ | ||
$msbuild.Xml.RemoveChild($itemToRemove) | out-null | ||
} | ||
|
||
$project.Save() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | ||
|
||
<PropertyGroup> | ||
<!-- | ||
Is the spec being generated from being retrieved via NuGet or from a local project? | ||
If this is a project that uses the spec from the same solution (for example, a test | ||
project) then set this property to blank (or just remove it completely) | ||
--> | ||
<GetSpecFromNuGet>1</GetSpecFromNuGet> | ||
</PropertyGroup> | ||
|
||
<!-- User settable properties to control how specs are found in the same solution --> | ||
<PropertyGroup Condition="$(GetSpecFromNuGet) == ''"> | ||
<!-- name of project directory which builds the spec dll --> | ||
<SpecAssemblyProjectDirName>MySpec</SpecAssemblyProjectDirName> | ||
|
||
<!-- The filename for the generated spec assembly --> | ||
<SpecAssemblyFileName>$(SpecAssemblyProjectDirName).dll</SpecAssemblyFileName> | ||
</PropertyGroup> | ||
|
||
<!-- User settable properties to control how specs are retrieved from NuGet --> | ||
<PropertyGroup Condition="$(GetSpecFromNuGet) != ''"> | ||
<!-- Set this to use a private feed, with credentials pulled from the environment --> | ||
<UsePrivateFeed>true</UsePrivateFeed> | ||
<!-- Where's the private feed to pull from? --> | ||
<PRIVATE_FEED_URL>https://www.myget.org/F/hydra/</PRIVATE_FEED_URL> | ||
<!-- | ||
The following two properties also need to be available. It is recommended that | ||
you set them as environment variables rather than setting them here. | ||
<PRIVATE_FEED_USER_NAME>User name for access to private feed</PRIVATE_FEED_USER_NAME> | ||
<PRIVATE_FEED_PASSWORD>Password for access to private feed</PRIVATE_FEED_PASSWORD> | ||
--> | ||
</PropertyGroup> | ||
</Project> |
2 changes: 1 addition & 1 deletion
2
src/Management/ManagementClient.cs → src/Management/Generated/ManagementClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Hydra> | ||
<Assembly>Microsoft.WindowsAzure.Management.Specification.dll</Assembly> | ||
<OutputDirectory>Generated</OutputDirectory> | ||
|
||
<Specification> | ||
<Type>Microsoft.WindowsAzure.Management.ManagementClient</Type> | ||
|
||
<Platform> | ||
<Flavor>CSharp.Azure</Flavor> | ||
<OutputPath>ManagementClient.cs</OutputPath> | ||
</Platform> | ||
|
||
</Specification> | ||
</Hydra> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Hydra.Generator" version="1.0.5085.22928-prerelease" targetFramework="portable-net45+sl50+wp80+win" /> | ||
<package id="Microsoft.Bcl" version="1.1.3" targetFramework="portable-net45+sl50+wp80+win" /> | ||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="portable-net45+sl50+wp80+win" /> | ||
<package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="portable-net45+sl50+wp80+win" /> | ||
<package id="Microsoft.Net.Http" version="2.2.15" targetFramework="portable-net45+sl50+wp80+win" /> | ||
<package id="Microsoft.WindowsAzure.Management.Specification" version="1.0.5085.30254-prerelease" targetFramework="portable-net45+sl50+wp80+win" /> | ||
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="portable-net45+sl50+wp80+win" /> | ||
</packages> |