Skip to content

Commit

Permalink
Allowing a way to sepcify test publish location on CI server. Able to…
Browse files Browse the repository at this point in the history
… publish non-netcore projects within a scope
  • Loading branch information
shahabhijeet committed Jan 26, 2017
1 parent 876bdb3 commit 1a474e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,15 @@
<Exec Command="dotnet build --configuration $(Configuration)" WorkingDirectory="%(NetCore_AutoRestLibraries.Test)" Condition=" '$(Configuration)' != 'Release' and '%(NetCore_AutoRestLibraries.Test)' != '' "/>
</Target>

<Target Name="Clean" DependsOnTargets="BuildMsBuildTask;PrepareForAutoRestLibraries;RestoreNugetPackages;">
<Target Name="Clean" DependsOnTargets="BuildMsBuildTask;PrepareForAutoRestLibraries;RestoreNugetPackages">
<!--<MSBuild Projects="@(NonAutoRestLibraries)"
Properties="Configuration=%(LibraryFxTargetList.Identity)-$(Configuration);Platform=Any CPU"
Targets="Clean" />-->

<MSBuild Projects="@(Non_NetCore_AutoRestLibraries)"
Properties="Configuration=%(AutoRestLibraryFxTargetList.Identity)-$(Configuration);Platform=Any CPU;$(_ExtraPropertyList)"
Targets="Clean" />

<RemoveDir Directories="$(BinariesFolder)" />
</Target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ public class FilterOutAutoRestLibraries : Task

public override bool Execute()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach (ITaskItem sln in AllLibraries)
{
sb.AppendFormat("{0},", sln.GetMetadata("FullPath"));
}

Log.LogMessage(MessageImportance.High, "We have found {0}", sb.ToString());

var nonNetCoreAutoRestLibraries = new List<ITaskItem>();
var netCoreAutoRestLibraries = new List<ITaskItem>();
var netCoreLibraryTestOnes = new List<ITaskItem>();
Expand Down Expand Up @@ -95,9 +103,11 @@ public override bool Execute()
if (nPkgsList != null)
{
//We need to filter out projects from the final output to build and publish limited set of projects
string projectDirPath = Path.GetDirectoryName(nugetProjects[0]);
string projectDirName = Path.GetFileName(projectDirPath);
string match = nPkgsList.Find((pn) => pn.Equals(projectDirName, System.StringComparison.OrdinalIgnoreCase));
//Here we need to get to the name of the nuget.proj file with .nuget.proj
string nugetProjName = Path.GetFileName(nugetProjects[0]);
string projNameWithoutExt = Path.GetFileNameWithoutExtension(nugetProjName);
projNameWithoutExt = Path.GetFileNameWithoutExtension(projNameWithoutExt);
string match = nPkgsList.Find((pn) => pn.Equals(projNameWithoutExt, System.StringComparison.OrdinalIgnoreCase));
if (!string.IsNullOrEmpty(match))
{
nonNetCoreAutoRestLibraries.Add(solution);
Expand Down
4 changes: 3 additions & 1 deletion tools/nuget.targets
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@

<Target Name="Publish" DependsOnTargets="PrepareForAutoRestLibraries">
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />

<Message Text="Trying to Create directory $(NuGetPublishingSource)" Condition="!Exists($(NuGetPublishingSource))" />
<MakeDir Directories="$(NuGetPublishingSource)" Condition="!Exists($(NuGetPublishingSource)) AND !$([System.Text.RegularExpressions.Regex]::IsMatch('$(NuGetPublishingSource)', '^(?i)http'))" />
<Message Text="Publishing directory detected $(NuGetPublishingSource)" Condition="Exists($(NuGetPublishingSource))" />
<PropertyGroup>
<ActualSource Condition=" '$(NuGetPublishingSource)' == '' "></ActualSource>
<ActualSource Condition=" '$(NuGetPublishingSource)' != '' "> -Source $(NuGetPublishingSource)</ActualSource>
Expand Down

0 comments on commit 1a474e6

Please sign in to comment.