build and clean works via gulp and xbuild :: removed requirement for .ps1 build files

This commit is contained in:
David Justice 2015-07-05 22:34:15 -07:00
Родитель 1d470bd9f5
Коммит d0415f7432
8 изменённых файлов: 312 добавлений и 57 удалений

7
.gitignore поставляемый
Просмотреть файл

@ -1,7 +1,7 @@
## Ignore generated code
AutoRest/Generators/AcceptanceTests/NugetPackageTest/Generated
## Ignore user-specific files, temporary files, build results, etc.
## Ignore user-specific files, temporary files, build results, etc.
# User-specific files
*.suo
@ -143,7 +143,7 @@ target
*.pem
*.jks
# Backup & report files from converting a project to a new version of VS.
# Backup & report files from converting a project to a new version of VS.
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
@ -158,3 +158,6 @@ packages
# Windows #
Thumbs.db
# Mono
*dll.mdb
*exe.mdb

Просмотреть файл

@ -4,7 +4,7 @@
<PropertyGroup>
<CommonRoot>$(MsBuildThisFileDirectory)..</CommonRoot>
<CommonNugetPackageFolder>$(CommonRoot)\packages</CommonNugetPackageFolder>
<AssemblyOriginatorKeyFile Condition=" '$(AssemblyOriginatorKeyFile)' == '' ">$(CommonRoot)\tools\MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile Condition=" '$(AssemblyOriginatorKeyFile)' == '' ">$(CommonRoot)\Tools\MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Net45-Debug' or '$(Configuration)' == 'Net45-Release'">
@ -13,9 +13,9 @@
<PropertyGroup Condition=" '$(Configuration)' == 'Portable-Debug' or '$(Configuration)' == 'Portable-Release' ">
<LibraryFxTarget>portable</LibraryFxTarget>
</PropertyGroup>
<Import Project="references.$(LibraryFxTarget).props" />
<Import Project="references.$(LibraryFxTarget).props" />
<!--
Shared Project properties
-->
@ -27,8 +27,8 @@
<!-- Turn off XML documentation warnings. -->
<NoWarn Condition="'$(WarnOnMissingDocument)' == 'false'">1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet Condition="$(AutoRestTest) != 'true' ">$(CommonRoot)\tools\ManagedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="$(AutoRestTest) == 'true' ">$(CommonRoot)\tools\TestRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="$(AutoRestTest) != 'true' ">$(CommonRoot)\Tools\ManagedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet Condition="$(AutoRestTest) == 'true' ">$(CommonRoot)\Tools\TestRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
@ -41,7 +41,6 @@
<PropertyGroup Condition=" '$(LibraryFxTarget)' == 'portable'" >
<RestCustomConstants>PORTABLE</RestCustomConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Net45-Debug' or '$(Configuration)' == 'Portable-Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
@ -81,8 +80,8 @@
<!--Folder where nuget.exe gets xml and pdb files to create the package-->
<_BinariesDirectory>$(CommonRoot)\binaries\$(LibraryFxTarget)</_BinariesDirectory>
<!--
Folder where nuget.exe gets dll. If under codesign, we copy to 'unsigned' first,
codesign task will sign it and copy back to _BinariesDirectory.
Folder where nuget.exe gets dll. If under codesign, we copy to 'unsigned' first,
codesign task will sign it and copy back to _BinariesDirectory.
(Check out the SignBinariesForAFxTarget in build.proj)
-->
<_CodeSignDirectory Condition="'$(CodeSign)' != 'true'">$(_BinariesDirectory)</_CodeSignDirectory>
@ -90,40 +89,42 @@
</PropertyGroup>
<Message Text="Copying assembly files to $(_CodeSignDirectory)." />
<Message Text="Copying symbols and documentation files to $(_BinariesDirectory)." />
<MakeDir Directories="$(_CodeSignDirectory)" Condition="!Exists($(_CodeSignDirectory))" />
<MakeDir Directories="$(_CodeSignDirectory)" Condition="!Exists('$(_CodeSignDirectory)')" />
<ItemGroup>
<_AutoRestBinaries Include="$(ProjectDir)$(OutputPath)*.*"/>
</ItemGroup>
<Copy SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).xml;$(ProjectDir)$(OutputPath)$(AssemblyName).pdb"
DestinationFolder="$(_BinariesDirectory)"/>
<Copy SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).dll"
<Copy Condition=" '$(OS)' == 'Windows_NT'" ContinueOnError="True"
SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).xml;$(ProjectDir)$(OutputPath)$(AssemblyName).pdb"
DestinationFolder="$(_BinariesDirectory)"/>
<Copy Condition=" '$(OS)' != 'Windows_NT'" ContinueOnError="True"
SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).xml;$(ProjectDir)$(OutputPath)$(AssemblyName).dll.mdb"
DestinationFolder="$(_BinariesDirectory)"/>
<Copy SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).dll"
Condition="Exists('$(ProjectDir)$(OutputPath)$(AssemblyName).dll')"
DestinationFolder="$(_CodeSignDirectory)"/>
<!-- AutoRest.exe specific files -->
<Copy SourceFiles="@(_AutoRestBinaries)"
<Copy SourceFiles="@(_AutoRestBinaries)"
Condition=" $(AssemblyName) == 'AutoRest' "
DestinationFolder="$(_BinariesDirectory)"/>
<Copy SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).exe"
<Copy SourceFiles="$(ProjectDir)$(OutputPath)$(AssemblyName).exe"
Condition=" $(AssemblyName) == 'AutoRest' "
DestinationFolder="$(_CodeSignDirectory)"/>
</Target>
<Target Name="SyncPackageVersions" BeforeTargets="BeforeBuild">
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
<NuSpecSyncScript>$(CommonRoot)\tools\Sync-NuspecDependencies.ps1</NuSpecSyncScript>
<ProductSourceFolder Condition="$(ProductSourceFolder) == ''">$(CommonRoot)$(ProductSourceFolderPath)</ProductSourceFolder>
</PropertyGroup>
<!-- Update all explicit references to dependent versions. -->
<Exec Command="$(PowerShellExe) -NonInteractive -ExecutionPolicy bypass -Command &quot;&amp; { &amp;&apos;$(NuSpecSyncScript)&apos; &apos;$(MSBuildProjectDirectory)&apos; -BasePath &apos;$(ProductSourceFolder)&apos; }&quot;" />
<Exec Command="gulp syncDotNetDependencies --basePath &quot;$(MSBuildProjectDirectory)&quot;" />
</Target>
<Target Name="CompileRazorTemplates" BeforeTargets="BeforeBuild">
<PropertyGroup>
<RazorCommand Condition=" '$(OS)' == 'Windows_NT'">&quot;$(CommonRoot)\Tools\rzc.exe&quot;</RazorCommand>
<RazorCommand Condition=" '$(OS)' != 'Windows_NT'">mono &quot;$(CommonRoot)\Tools\rzc.exe&quot;</RazorCommand>
</PropertyGroup>
<Message Text="Compiling Razor templates for project $(MSBuildProjectDirectory)" />
<!-- Compile razor template. -->
<Exec Command="$(CommonRoot)\tools\rzc.exe &quot;$(MSBuildProjectDirectory)\Templates&quot; $(RootNamespace).Templates" />
<Exec Command="$(RazorCommand) &quot;$(MSBuildProjectDirectory)\Templates&quot; $(RootNamespace).Templates" />
</Target>
<Target Name="TurnOffCodeAnalysis">
@ -134,8 +135,8 @@
<RunCodeAnalysisOnThisProject>false</RunCodeAnalysisOnThisProject>
</PropertyGroup>
</Target>
<!--
<!--
StyleCop
-->
<PropertyGroup>
@ -160,4 +161,4 @@
<Error Condition="!Exists('$(StyleCopMSBuildTargetsFile)') And $(RestorePackages)==true And $(StyleCopTreatErrorsAsWarnings)==false" Text="$(StyleCopMSBuildMessageRestore)" />
<Error Condition="Exists('$(StyleCopMSBuildTargetsFile)') And $(RestorePackages)==true And $(StyleCopTreatErrorsAsWarnings)==false" Text="$(StyleCopMSBuildMessageRestored)" />
</Target>
</Project>
</Project>

Двоичные данные
Tools/NuGet.exe

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,65 @@
// through2 is a thin wrapper around node transform streams
var through = require('through2');
var gutil = require('gulp-util');
var xml2js = require('xml2js');
var path = require('path');
var glob = require('glob');
var fs = require('fs');
var PluginError = gutil.PluginError;
const PLUGIN_NAME = 'gulp-nuget-proj-sync';
function gulpNugetProjSync(opts) {
// Creating a stream through which each file will pass
return through.obj(function(file, enc, cb) {
var baseDir = path.dirname(file.path);
var nuprojPathes = glob.sync(path.join(baseDir, '../*.nuget.proj'));
var nuprojPath = null;
if (!nuprojPathes || nuprojPathes < 1) {
throw new PluginError({
plugin: PLUGIN_NAME,
message: 'There was no nuget.proj path found in: ' + baseDir
});
} else {
if (nuprojPathes.Length > 1) {
gutil.warn('Found more than one nuget.proj in ' + baseDir + '. Using first ' + nuprojPathes[0]);
}
nuprojPath = nuprojPathes[0];
}
var assemblyInfoContents = file.contents.toString();
var nuprojString = fs.readFileSync(nuprojPath).toString();
xml2js.parseString(nuprojString, function(err, nuprojXml) {
var packageVersion = nuprojXml['Project']['ItemGroup'][0]['SdkNuGetPackage'][0]['PackageVersion'][0];
var tokens = packageVersion.split('.')
var assemblyFileVersion = packageVersion;
if (tokens.Length == 3) {
assemblyFileVersion = packageVersion + '.0';
}
var fileVersionRegex = '\[assembly\:\s*AssemblyFileVersion\s*\(\s*"[\d\.\s]+"\s*\)\s*\]';
var fileVersionContent = '[assembly: AssemblyFileVersion(\"' + assemblyFileVersion + '\")]';
var assemblyVersion = tokens[0] + '.0.0.0';
if (tokens[0] == 0) {
assemblyVersion = opts.default_version || '0.0.1.0';
}
var versionRegex = '\[assembly\:\s*AssemblyVersion\s*\(\s*"[\d\.\s]+';
var versionContent = '[assembly: AssemblyVersion("' + assemblyVersion;
gutil.log("Updating AssemblyInfo.cs with path: " + file.path + 'with file version: ' +
assemblyFileVersion + ' and version: ' + assemblyVersion);
assemblyInfoContents.replace(fileVersionRegex, fileVersionContent);
assemblyInfoContents.replace(versionRegex, versionContent);
file.contents = new Buffer(assemblyInfoContents);
cb(null, file);
});
});
}
// Exporting the plugin main function
module.exports = gulpNugetProjSync;

Просмотреть файл

@ -0,0 +1,63 @@
// through2 is a thin wrapper around node transform streams
var through = require('through2');
var gutil = require('gulp-util');
var xml2js = require('xml2js');
var path = require('path');
var fs = require('fs');
var PluginError = gutil.PluginError;
const PLUGIN_NAME = 'gulp-nuspec-sync';
function gulpNuspecSync(opts) {
// Creating a stream through which each file will pass
return through.obj(function(file, enc, cb) {
var pkgConfigPath = path.join(path.dirname(file.path), 'packages.config');
var pkgConfigString = fs.readFileSync(pkgConfigPath).toString();
xml2js.parseString(pkgConfigString, function(err, pkgConfigXml) {
xml2js.parseString(file.contents.toString(), function(err, nuspecXml) {
gutil.log('Syncing .nuspec and packages.config for: ' + file.path + ' and ' + pkgConfigPath);
var pkgVersions = {};
var packages = pkgConfigXml['packages']['package'];
packages.forEach(function(package) {
pkgVersions[package.$.id] = package.$.version;
});
nuspecXml['package']['metadata'][0]['dependencies'].forEach(function(dependencies) {
var updateDep = function(depend) {
depend.forEach(function(dep) {
if (dep.$.id in pkgVersions) {
if(pkgVersions[dep.$.id] != dep.$.version){
gutil.log('Updating dependency: ' + dep.$.id + ' from: ' + pkgVersions[dep.$.id] + ' to: ' + dep.$.version)
dep.$.version = pkgVersions[dep.$.id]
} else {
gutil.log('Skipping dependency: ' + dep.$.id + ' at: ' + pkgVersions[dep.$.id]);
}
}
});
};
dependency = dependencies['dependency'];
if (dependency) {
updateDep(dependency);
} else {
var groupDependencies = dependencies['group'][0]['dependency'];
if (groupDependencies) {
updateDep(groupDependencies);
}
}
});
var builder = new xml2js.Builder();
var xml = builder.buildObject(nuspecXml);
file.contents = new Buffer(xml);
cb(null, file);
});
});
});
}
// Exporting the plugin main function
module.exports = gulpNuspecSync;

Просмотреть файл

@ -1,37 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
<!--
Targets:
/t:Clean
Removes temporary build outputs.
/t:Build
Builds assemblies.
/t:Test
Run unit tests.
/t:Package
/t:Package
Builds NuGet packages using the binaries folder contents.
The packages will drop to .\binaries\packages.
/t:Publish
Publishes the built packages. You will need to include your
publishing key when running. Include: /p:NuGetKey=YOUR_PUBLISHING_KEY
/t:CodeAnalysis
Run Code analysis.
Run Code analysis.
Properties of interest:
/p:Scope
/p:Scope
'All' : builds ClientRuntime and CodeGenerator solutions
'CodeGenerator': builds CodeGenerator solution only
'ClientRuntime': builds ClientRuntime solution only
By default, it builds all.
/P:CodeSign=True
Code sign binaries, mainly for official release
Code sign binaries, mainly for official release
/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally
@ -51,13 +51,13 @@
/p:NuGetSymbolPublishingSource=Uri
The NuGet Server to push symbol + source packages to.
-->
<PropertyGroup>
<ClientRuntimeSolution>ClientRuntime.sln</ClientRuntimeSolution>
<CodeGeneratorSolution>AutoRest.sln</CodeGeneratorSolution>
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
<LibrarySourceFolder>$(LibraryRoot)</LibrarySourceFolder>
<LibraryToolsFolder>$(LibraryRoot)tools</LibraryToolsFolder>
<LibraryToolsFolder>$(LibraryRoot)Tools</LibraryToolsFolder>
<BinariesFolder>$(LibraryRoot)binaries</BinariesFolder>
<PackageOutputDir>$(BinariesFolder)\packages</PackageOutputDir>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -66,17 +66,18 @@
<DelaySign Condition =" '$(DelaySign)' == '' ">false</DelaySign>
<Scope Condition=" '$(Scope)' == '' ">all</Scope>
</PropertyGroup>
<ItemGroup>
<LibraryFxTargetList Condition=" '$(FxTargetList)' == '' and '$(Scope)' == 'ClientRuntime' " Include="portable;net45" />
<LibraryFxTargetList Condition=" '$(FxTargetList)' == '' and '$(Scope)' == 'all' " Include="portable;net45" />
<LibraryFxTargetList Condition=" '$(FxTargetList)' == '' and '$(Scope)' == 'CodeGenerator' " Include="net45" />
<LibraryFxTargetList Condition=" '$(FxTargetList)' != '' " Include="$(FxTargetList)" />
</ItemGroup>
<PropertyGroup>
<NuGetCommand>&quot;$(LibraryToolsFolder)\nuget.exe&quot;</NuGetCommand>
</PropertyGroup>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">&quot;$(LibraryToolsFolder)\nuget.exe&quot;</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT'">mono &quot;$(LibraryToolsFolder)\nuget.exe&quot;</NuGetCommand>
</PropertyGroup>
<UsingTask AssemblyFile="tools\AutoRest.Build.Tasks.dll" TaskName="ValidateStrongNameSignatureTask" />
<UsingTask AssemblyFile="tools\AutoRest.Build.Tasks.dll" TaskName="RegexReplaceTask" />
@ -86,8 +87,8 @@
<ContinueOnPoliCheckError>false</ContinueOnPoliCheckError>
<!--OnPremiseBuildTasks is not a good name, but CI server is using that, will update across soon-->
<CIToolsPath>$(OnPremiseBuildTasks)</CIToolsPath>
<OnPremiseBuild Condition=" Exists($(OnPremiseBuildTasks)) ">true</OnPremiseBuild>
<OnPremiseBuild Condition=" ! Exists($(OnPremiseBuildTasks)) ">false</OnPremiseBuild>
<OnPremiseBuild Condition=" Exists('$(OnPremiseBuildTasks)') ">true</OnPremiseBuild>
<OnPremiseBuild Condition=" ! Exists('$(OnPremiseBuildTasks)') ">false</OnPremiseBuild>
</PropertyGroup>
<UsingTask Condition=" $(OnPremiseBuild) " TaskName="CodeSigningTask" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
<UsingTask Condition=" $(OnPremiseBuild) " TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
@ -131,13 +132,13 @@
Properties="Configuration=%(LibraryFxTargetList.Identity)-$(Configuration);Platform=Any CPU;RunCodeAnalysis=true;CodeAnalysisTreatWarningsAsErrors=true"
Targets="Rebuild"
Condition=" '$(Scope)' == 'all' or '$(Scope)' == 'ClientRuntime'" />
<MSBuild Projects="$(CodeGeneratorSolution)"
Properties="Configuration=Net45-$(Configuration);Platform=Any CPU;RunCodeAnalysis=true;CodeAnalysisTreatWarningsAsErrors=true"
Targets="Rebuild"
Condition=" '$(Scope)' == 'all' or '$(Scope)' == 'CodeGenerator'" />
</Target>
<!-- Run tests. -->
<UsingTask TaskName="Xunit.Runner.msbuild.xunit" AssemblyFile="packages\xunit.runner.msbuild.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.runner.msbuild.dll" />
<Target Name="Test">
@ -150,7 +151,7 @@
<ItemGroup>
<TestDlls Include="$(LibraryRoot)\ClientRuntimes\CSharp\*.Tests\bin\*\*Tests.dll" />
</ItemGroup>
<Message Text="@(TestDlls)" />
<MakeDir Directories="$(LibraryRoot)TestResults"/>
<xunit Assemblies="@(TestDlls)" Html="$(MSBuildProjectDirectory)\TestResults\xunit.results.html" ContinueOnError="false" />
@ -168,7 +169,7 @@
<TestDlls Include="$(LibraryRoot)\AutoRest\Generators\Ruby\Ruby.Tests\bin\Net45-$(Configuration)\AutoRest.Generator.Ruby.Tests.dll" />
<TestDlls Include="$(LibraryRoot)\AutoRest\Generators\Ruby\Azure.Ruby.Tests\bin\Net45-$(Configuration)\AutoRest.Generator.Azure.Ruby.Tests.dll" />
</ItemGroup>
<Message Text="@(TestDlls)" />
<MakeDir Directories="$(LibraryRoot)TestResults"/>
<Exec WorkingDirectory=".\ClientRuntimes\Ruby\" Command="UpdateRuntime"/>
@ -203,10 +204,10 @@
<xunit Assemblies="@(TestDlls)" />
<Exec WorkingDirectory="$(TestProjectDir)" Command="npm test"/>
</Target>
<PropertyGroup>
<!-- This property is used by the continuous intergration job.
Do not remove without first updating the CI job. Also due to a known limitation,
<!-- This property is used by the continuous intergration job.
Do not remove without first updating the CI job. Also due to a known limitation,
make sure pathes do not end with a backslash -->
<CorporateScanPaths>$(LibrarySourceFolder)ClientRuntimes;$(LibrarySourceFolder)AutoRest</CorporateScanPaths>
<BinscopeScanPath>$(BinariesFolder)</BinscopeScanPath>
@ -237,9 +238,9 @@
ToolsPath="$(CIToolsPath)"
Condition="!$(DelaySign)"/>
<!-- DelaySigned binaries copied locally for testing and not submitted to codesign service. -->
<Copy SourceFiles="@(DelaySignedAssembliesToValidate)" DestinationFolder="binaries\$(LibraryFxTarget)" Condition="$(DelaySign)" />
<Copy SourceFiles="@(DelaySignedAssembliesToValidate)" DestinationFolder="binaries\$(LibraryFxTarget)" Condition="$(DelaySign)" />
<ItemGroup>
<AfterSignedAssembliesToValidate Include="binaries\$(LibraryFxTarget)\*.dll;binaries\$(LibraryFxTarget)\*.exe"
<AfterSignedAssembliesToValidate Include="binaries\$(LibraryFxTarget)\*.dll;binaries\$(LibraryFxTarget)\*.exe"
Exclude="binaries\$(LibraryFxTarget)\Newtonsoft.*.dll" />
</ItemGroup>
<ValidateStrongNameSignatureTask
@ -247,17 +248,17 @@
Assembly="%(AfterSignedAssembliesToValidate.Identity)"
ExpectedTokenSignature="$(StrongNameToken)"
ExpectedDelaySigned="false"
ContinueOnError="false"
ContinueOnError="false"
Condition="!$(DelaySign)"/>
<RemoveDir Directories="binaries\$(LibraryFxTarget)\unsigned;" ContinueOnError="true" />
</Target>
<Target Name="CodeSignBinaries">
<Error Condition=" !$(OnPremiseBuild) and !$(DelaySign) " Text="No CI tools path available, the code sign will be unable to continue. $(CIToolsPath)" />
<Message Text="Code signing" Importance="high" />
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="SignBinariesForAFxTarget"
Properties="LibraryFxTarget=%(LibraryFxTargetList.Identity);StrongNameToken=$(StrongNameToken)">
Properties="LibraryFxTarget=%(LibraryFxTargetList.Identity);StrongNameToken=$(StrongNameToken)">
</MSBuild>
<CallTarget Targets="ValidateCorporateCompliance" Condition="!$(DelaySign)"/>
</Target>
@ -278,7 +279,7 @@
<Exec Command="$(NuGetCommand) restore $(ClientRuntimeSolution)" ContinueOnError="false" Condition=" '$(Scope)' == 'all' or '$(Scope)' == 'ClientRuntime'" />
<Exec Command="$(NuGetCommand) restore $(CodeGeneratorSolution)" ContinueOnError="false" Condition=" '$(Scope)' == 'all' or '$(Scope)' == 'CodeGenerator'" />
</Target>
<!-- Official releases require tools only available on corp network. -->
<Target Name="ValidateCorporateCompliance">
<Error Text="This target must be run in an on-premise build server." Condition=" '$(OnPremiseBuild)'=='false' " />

90
gulpfile.js Normal file
Просмотреть файл

@ -0,0 +1,90 @@
var gulp = require('gulp');
var path = require('path');
var debug = require('gulp-debug');
var glob = require('glob');
var spawn = require('child_process').spawn;
var assemblyInfo = require('gulp-dotnet-assembly-info');
var nuspecSync = require('./Tools/gulp/gulp-nuspec-sync');
var nugetProjSync = require('./Tools/gulp/gulp-nuget-proj-sync');
var gutil = require('gulp-util');
var isWin = /^win/.test(process.platform);
const DEFAULT_ASSEMBLY_VERSION = '0.9.0.0'
var csharpBuild = isWin ? 'msbuild' : 'xbuild';
function basePathOrThrow() {
if (!gutil.env.basePath) {
throw new Error('Must provide a --basePath argument upon execution');
}
return gutil.env.basePath;
}
function handleProcess(child, cb){
var stdout = '';
var stderr = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(data) {
stdout += data;
gutil.log(data);
});
child.stderr.setEncoding('utf8');
child.stderr.on('data', function(data) {
stderr += data;
gutil.log(gutil.colors.red(data));
gutil.beep();
});
child.on('close', function(code) {
gutil.log("Done with exit code", code);
cb();
});
}
gulp.task('clean', function(cb) {
var child = spawn(csharpBuild, ['build.proj', '/t:clean']);
handleProcess(child, cb);
});
gulp.task('build', function(cb) {
var child = spawn(csharpBuild, ['build.proj', '/p:WarningsNotAsErrors=0219']);
handleProcess(child, cb);
});
gulp.task('syncNugetProjs', function() {
var dirs = glob.sync(path.join(basePathOrThrow(), '/**/*.nuget.proj'))
.map(function(filePath) {
return path.dirname(filePath);
});
gulp.src(dirs.map(function(dir) {
return path.join(dir, '/**/AssemblyInfo.cs');
}), {
base: './'
})
.pipe(nugetProjSync({
default_version: DEFAULT_ASSEMBLY_VERSION
}))
.pipe(gulp.dest('.'))
})
gulp.task('syncNuspecs', function() {
var dirs = glob.sync(path.join(basePathOrThrow(), '/**/packages.config'))
.map(function(filePath) {
return path.dirname(filePath);
});
gulp.src(dirs.map(function(dir) {
return path.join(dir, '/**/*.nuspec');
}), {
base: './'
})
.pipe(nuspecSync())
.pipe(gulp.dest('.'))
});
gulp.task('syncDotNetDependencies', ['syncNugetProjs', 'syncNuspecs']);

32
package.json Normal file
Просмотреть файл

@ -0,0 +1,32 @@
{
"name": "autorest-build",
"version": "0.0.1",
"description": "Tools for AutoRest build processes",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/autorest.git"
},
"keywords": [
"autorest"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/autorest/issues"
},
"homepage": "https://github.com/Azure/autorest#readme",
"devDependencies": {
"glob": "^5.0.13",
"gulp": "^3.9.0",
"gulp-debug": "^2.0.1",
"gulp-dotnet-assembly-info": "^0.1.10",
"gulp-spawn": "^0.3.0",
"gulp-util": "^3.0.6",
"through2": "^2.0.0",
"xml2js": "^0.4.9"
}
}