Merge pull request #449 from krwq/ci_build_add_packaging
Fix versions bug when creating NuPkg
This commit is contained in:
commit
1115fc22fa
14 changed files with 56 additions and 32 deletions
2
build.sh
2
build.sh
|
@ -43,7 +43,7 @@ LAST_COMMIT_TIMESTAMP=$(git log -1 --format=%ct)
|
|||
major=1
|
||||
minor=0
|
||||
# no. of days since epoch
|
||||
build=$(($LAST_COMMIT_TIMESTAMP/3600/24))
|
||||
build=0
|
||||
revision=$LAST_COMMIT_TIMESTAMP
|
||||
|
||||
export DOTNET_BUILD_VERSION=$major.$minor.$build.$revision
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"maintainer_name":"Microsoft",
|
||||
"maintainer_email": "dotnetcore@microsoft.com",
|
||||
|
||||
"package_name": "dotnet",
|
||||
"package_name": "dotnet-dev",
|
||||
|
||||
"short_description": ".NET Core & command line tools",
|
||||
"long_description": ".NET Core is a cross-platform implementation of .NET Framework, a modern, modular platform\n for building diverse kinds of applications, from command-line applications to microservices and \n modern websites.\n This package contains the tools you will need to start writing applications for .NET Core. It includes \n compilers, package managers and other utilities that developers need.",
|
||||
|
|
|
@ -25,7 +25,8 @@ $Projects = @(
|
|||
"Microsoft.DotNet.ProjectModel",
|
||||
"Microsoft.DotNet.ProjectModel.Workspaces",
|
||||
"Microsoft.DotNet.Runtime",
|
||||
"Microsoft.Extensions.Testing.Abstractions"
|
||||
"Microsoft.Extensions.Testing.Abstractions",
|
||||
"Microsoft.DotNet.ProjectModel.Loader"
|
||||
)
|
||||
|
||||
foreach ($ProjectName in $Projects) {
|
||||
|
|
|
@ -26,12 +26,12 @@ if (!$env:DOTNET_BUILD_VERSION) {
|
|||
|
||||
$majorVersion = 1
|
||||
$minorVersion = 0
|
||||
$buildnumber = $commitTime.Days
|
||||
$buildnumber = 0
|
||||
$revnumber = $commitTime.TotalSeconds
|
||||
|
||||
$VersionSuffix = "$buildnumber.$revnumber"
|
||||
$VersionSuffix = "dev-$revnumber"
|
||||
|
||||
$env:DOTNET_BUILD_VERSION = "$majorVersion.$minorVersion.$VersionSuffix"
|
||||
$env:DOTNET_BUILD_VERSION = "$majorVersion.$minorVersion.$buildnumber.$revnumber"
|
||||
}
|
||||
|
||||
Write-Host -ForegroundColor Green "*** Building dotnet tools version $($env:DOTNET_BUILD_VERSION) - $Configuration ***"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
@echo off
|
||||
|
||||
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
@echo off
|
||||
|
||||
REM Get absolute path
|
||||
pushd %1
|
||||
set BIN_DIR=%CD%\bin
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"NETStandard.Library": "1.0.0-rc2-23608",
|
||||
|
|
|
@ -11,7 +11,6 @@ using NuGet.Frameworks;
|
|||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
{
|
||||
// NOTE(anurse): Copied from ApplicationHostContext in DNX. This name seemed more appropriate for this :)
|
||||
public class ProjectContext
|
||||
{
|
||||
public GlobalSettings GlobalSettings { get; }
|
||||
|
@ -83,7 +82,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
/// <summary>
|
||||
/// Creates a project context for each framework located in the project at <paramref name="projectPath"/>
|
||||
/// </summary>
|
||||
public static IEnumerable<ProjectContext> CreateContextForEachFramework(string projectPath, ProjectReader.Settings settings = null)
|
||||
public static IEnumerable<ProjectContext> CreateContextForEachFramework(string projectPath, ProjectReaderSettings settings = null)
|
||||
{
|
||||
if (!projectPath.EndsWith(Project.FileName))
|
||||
{
|
||||
|
@ -96,6 +95,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
yield return new ProjectContextBuilder()
|
||||
.WithProject(project)
|
||||
.WithTargetFramework(framework.FrameworkName)
|
||||
.WithReaderSettings(settings)
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
|
||||
private Func<string, LockFile> LockFileResolver { get; set; }
|
||||
|
||||
private ProjectReaderSettings Settings { get; set; }
|
||||
|
||||
public ProjectContextBuilder()
|
||||
{
|
||||
ProjectResolver = ResolveProject;
|
||||
|
@ -109,6 +111,12 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
return this;
|
||||
}
|
||||
|
||||
public ProjectContextBuilder WithReaderSettings(ProjectReaderSettings settings)
|
||||
{
|
||||
Settings = settings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IEnumerable<ProjectContext> BuildAllTargets()
|
||||
{
|
||||
ProjectDirectory = Project?.ProjectDirectory ?? ProjectDirectory;
|
||||
|
@ -165,7 +173,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
}
|
||||
|
||||
var libraries = new Dictionary<LibraryKey, LibraryDescription>();
|
||||
var projectResolver = new ProjectDependencyProvider();
|
||||
var projectResolver = new ProjectDependencyProvider(Settings);
|
||||
|
||||
var mainProject = projectResolver.GetDescription(TargetFramework, Project);
|
||||
|
||||
|
|
|
@ -16,12 +16,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
{
|
||||
public class ProjectReader
|
||||
{
|
||||
public class Settings
|
||||
{
|
||||
public string VersionSuffix = null;
|
||||
}
|
||||
|
||||
public static bool TryGetProject(string path, out Project project, ICollection<DiagnosticMessage> diagnostics = null)
|
||||
public static bool TryGetProject(string path, out Project project, ICollection<DiagnosticMessage> diagnostics = null, ProjectReaderSettings settings = null)
|
||||
{
|
||||
project = null;
|
||||
|
||||
|
@ -55,7 +50,7 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
using (var stream = File.OpenRead(projectPath))
|
||||
{
|
||||
var reader = new ProjectReader();
|
||||
project = reader.ReadProject(stream, projectName, projectPath, diagnostics);
|
||||
project = reader.ReadProject(stream, projectName, projectPath, diagnostics, settings);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -66,12 +61,12 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
return true;
|
||||
}
|
||||
|
||||
public static Project GetProject(string projectFile, Settings settings = null)
|
||||
public static Project GetProject(string projectFile, ProjectReaderSettings settings = null)
|
||||
{
|
||||
return GetProject(projectFile, new List<DiagnosticMessage>(), settings);
|
||||
}
|
||||
|
||||
public static Project GetProject(string projectFile, ICollection<DiagnosticMessage> diagnostics, Settings settings = null)
|
||||
public static Project GetProject(string projectFile, ICollection<DiagnosticMessage> diagnostics, ProjectReaderSettings settings = null)
|
||||
{
|
||||
var name = Path.GetFileName(Path.GetDirectoryName(projectFile));
|
||||
using (var stream = new FileStream(projectFile, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
|
@ -80,9 +75,9 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
}
|
||||
}
|
||||
|
||||
public Project ReadProject(Stream stream, string projectName, string projectPath, ICollection<DiagnosticMessage> diagnostics, Settings settings = null)
|
||||
public Project ReadProject(Stream stream, string projectName, string projectPath, ICollection<DiagnosticMessage> diagnostics, ProjectReaderSettings settings = null)
|
||||
{
|
||||
settings = settings ?? new Settings();
|
||||
settings = settings ?? new ProjectReaderSettings();
|
||||
var project = new Project();
|
||||
|
||||
var reader = new StreamReader(stream);
|
||||
|
|
12
src/Microsoft.DotNet.ProjectModel/ProjectReaderSettings.cs
Normal file
12
src/Microsoft.DotNet.ProjectModel/ProjectReaderSettings.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
{
|
||||
public class ProjectReaderSettings
|
||||
{
|
||||
public string VersionSuffix = null;
|
||||
}
|
||||
}
|
|
@ -15,15 +15,18 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
|||
public class ProjectDependencyProvider
|
||||
{
|
||||
private Func<string, Project> _resolveProject;
|
||||
private ProjectReaderSettings _settings;
|
||||
|
||||
public ProjectDependencyProvider()
|
||||
public ProjectDependencyProvider(ProjectReaderSettings settings = null)
|
||||
{
|
||||
_resolveProject = ResolveProject;
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public ProjectDependencyProvider(Func<string, Project> projectCacheResolver)
|
||||
public ProjectDependencyProvider(Func<string, Project> projectCacheResolver, ProjectReaderSettings settings = null)
|
||||
{
|
||||
_resolveProject = projectCacheResolver;
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
public ProjectDescription GetDescription(string name,
|
||||
|
@ -87,7 +90,7 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
|||
private Project ResolveProject(string path)
|
||||
{
|
||||
Project project;
|
||||
if (ProjectReader.TryGetProject(path, out project))
|
||||
if (ProjectReader.TryGetProject(path, out project, settings: _settings))
|
||||
{
|
||||
return project;
|
||||
}
|
||||
|
|
|
@ -60,10 +60,10 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
return 1;
|
||||
}
|
||||
|
||||
ProjectReader.Settings settings = null;
|
||||
ProjectReaderSettings settings = null;
|
||||
if (versionSuffix.HasValue())
|
||||
{
|
||||
settings = new ProjectReader.Settings();
|
||||
settings = new ProjectReaderSettings();
|
||||
settings.VersionSuffix = versionSuffix.Value();
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
|||
}
|
||||
}
|
||||
|
||||
private static bool TryBuildPackage(string path, string configuration, string outputValue, string intermediateOutputValue, ProjectReader.Settings settings = null)
|
||||
private static bool TryBuildPackage(string path, string configuration, string outputValue, string intermediateOutputValue, ProjectReaderSettings settings = null)
|
||||
{
|
||||
var contexts = ProjectContext.CreateContextForEachFramework(path, settings);
|
||||
var project = contexts.First().ProjectFile;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"profiles": {
|
||||
"dotnet pack": {
|
||||
"executablePath": "..\\..\\artifacts\\win7-x64\\stage2\\bin\\dotnet-pack.exe"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,10 +10,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"Newtonsoft.Json": "7.0.1",
|
||||
"Microsoft.DotNet.ProjectModel": {
|
||||
"version": "1.0.0",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"Microsoft.Extensions.Compilation.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-*",
|
||||
"System.Runtime.Serialization.Primitives": "4.0.11-rc2-23608"
|
||||
|
|
Loading…
Add table
Reference in a new issue