Skip to content

Commit

Permalink
Merge branch 'master' into invalid-cast-classInspector-components
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzik committed Sep 18, 2020
2 parents 89ee23a + 8431c02 commit f773fae
Show file tree
Hide file tree
Showing 24 changed files with 66 additions and 336 deletions.
91 changes: 13 additions & 78 deletions build.cake
Expand Up @@ -15,16 +15,12 @@ var SrcProjects = new [] { "FluentNHibernate" };
var TestProjects = new [] { "FluentNHibernate.Testing" };
var SpecProjects = new [] { "FluentNHibernate.Specs" };

var NHibernateNuspecXPath = "/package/meta:metadata/meta:dependencies/meta:dependency[@id='NHibernate']/@version";
var NHibernateNuspecXPathWithGroup = "/package/meta:metadata/meta:dependencies/meta:group/meta:dependency[@id='NHibernate']/@version";

Setup((context) =>
{
parameters.Initialize(context);
Information("FluentNHibernate");
Information($"SemVersion: {parameters.Version.SemVersion}");
Information($"NHibernateVersion: {parameters.MsBuildShared.NHibernatePackageVersion}");
Information($"IsLocalBuild: {parameters.IsLocalBuild}");
Information($"IsTagged: {parameters.IsTagged}");
Information($"IsPullRequest: {parameters.IsPullRequest}");
Expand Down Expand Up @@ -156,13 +152,11 @@ Task("Zip-Files")
Task("Create-NuGet-Packages")
.IsDependentOn("Copy-Files")
.Does(() =>
{
{
PackProjects(
SrcProjects,
parameters.Paths.Directories.NuspecRoot.FullPath,
parameters.Paths.Directories.NugetRoot.FullPath,
parameters.Paths.Directories.ArtifactsBin.FullPath,
parameters.Version.SemVersion);
parameters.Configuration,
parameters.Paths.Directories.NugetRoot.FullPath);
});

Task("Publish-Nuget")
Expand Down Expand Up @@ -246,21 +240,11 @@ Task("Upload-AppVeyor-Artifacts")
}
});

Task("Update-Nuspec-Files")
.Does(() =>
{
UpdateNuspecs(
SrcProjects,
parameters.Paths.Directories.NuspecRoot.FullPath,
parameters.MsBuildShared.NHibernatePackageVersion);
});

Task("Release-Notes")
.IsDependentOn("Create-Release-Notes");

Task("Package")
.IsDependentOn("Zip-Files")
.IsDependentOn("Update-Nuspec-Files")
.IsDependentOn("Create-NuGet-Packages");

Task("AppVeyor")
Expand Down Expand Up @@ -334,66 +318,17 @@ private void PublishProjects(

private void PackProjects(
IEnumerable<string> projectNames,
string nuspecDir,
string nugetDir,
string basePath,
string semVersion)
string configuration,
string nugetDir)
{
foreach(var project in projectNames)
{
// symbols
NuGetPack($"{nuspecDir}/{project}.symbols.nuspec", new NuGetPackSettings {
Version = semVersion,
// ReleaseNotes = releaseNotes.Notes.ToArray(),
BasePath = basePath,
OutputDirectory = nugetDir,
Symbols = true,
NoPackageAnalysis = true
});

var fullBasePath = MakeAbsolute((FilePath)basePath).FullPath;
var fullBasePathLength = fullBasePath.Length + 1;

// normal
NuGetPack($"{nuspecDir}/{project}.nuspec", new NuGetPackSettings {
Version = semVersion,
// ReleaseNotes = releaseNotes.Notes.ToArray(),
BasePath = fullBasePath,
foreach(var project in projectNames) {
var projectPath = File($"./src/{project}/{project}.csproj");
DotNetCorePack(projectPath.ToString(), new DotNetCorePackSettings
{
Configuration = configuration,
MSBuildSettings = msBuildSettings,
OutputDirectory = nugetDir,
Symbols = false,
NoPackageAnalysis = true
// Files = GetFiles(fullBasePath + "/**/*")
// .Where(file => file.FullPath.IndexOf("/runtimes/", StringComparison.OrdinalIgnoreCase) < 0)
// .Select(file => file.FullPath.Substring(fullBasePathLength))
// .Select(file =>
// new NuSpecContent
// {
// Source = file,
// Target = file
// })
// .ToArray()
IncludeSymbols = true
});
}
}

private void UpdateNuspecs(
IEnumerable<string> projectNames,
string nuspecDir,
string nHibernateVersion)
{
foreach(var project in projectNames)
{
// symbols
XmlPoke($"{nuspecDir}/{project}.symbols.nuspec", $"({NHibernateNuspecXPathWithGroup}|{NHibernateNuspecXPath})", nHibernateVersion,
new XmlPokeSettings {
Namespaces = new Dictionary<string, string> {{ "meta", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" }}
});

// normal
XmlPoke($"{nuspecDir}/{project}.nuspec", $"({NHibernateNuspecXPathWithGroup}|{NHibernateNuspecXPath})", nHibernateVersion,
new XmlPokeSettings {
Namespaces = new Dictionary<string, string> {{ "meta", "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" }}
});
}
}

}
3 changes: 0 additions & 3 deletions build/parameters.cake
@@ -1,7 +1,6 @@
#load "./paths.cake"
#load "./version.cake"
#load "./credentials.cake"
#load "./shared.cake"

public class BuildParameters
{
Expand All @@ -21,7 +20,6 @@ public class BuildParameters
public BuildNuGet NuGet { get; private set; }
public BuildVersion Version { get; private set; }
public BuildPaths Paths { get; private set; }
public MsBuildShared MsBuildShared { get; private set; }

public bool ShouldPublish =>
!IsLocalBuild &&
Expand All @@ -35,7 +33,6 @@ public class BuildParameters
Version = BuildVersion.Calculate(context, this);

Paths = BuildPaths.GetPaths(context, Configuration, Version.SemVersion);
MsBuildShared = MsBuildShared.GetShared(context, "./src/Shared.msbuild");
}

public static BuildParameters GetParameters(ICakeContext context)
Expand Down
5 changes: 0 additions & 5 deletions build/paths.cake
Expand Up @@ -27,7 +27,6 @@ public class BuildPaths
var artifactsBinNetStandard20 = artifactsBinDir.Combine("netstandard2.0");
var artifactsBinNetCoreapp2 = artifactsBinDir.Combine("netcoreapp2.0");
var testResultsDir = artifactsDir.Combine("test-results");
var nuspecRoot = (DirectoryPath)"nuspec";
var nugetRoot = artifactsDir.Combine("nuget");

var zipArtifactPathDesktop = artifactsDir.CombineWithFilePath($"FluentHibernate-net461-v{semVersion}.zip");
Expand All @@ -36,7 +35,6 @@ public class BuildPaths
var buildDirectories = new BuildDirectories(
artifactsDir,
testResultsDir,
nuspecRoot,
nugetRoot,
artifactsBinDir,
artifactsBinFullFx,
Expand Down Expand Up @@ -72,7 +70,6 @@ public class BuildDirectories
{
public DirectoryPath Artifacts { get; private set; }
public DirectoryPath TestResults { get; private set; }
public DirectoryPath NuspecRoot { get; private set; }
public DirectoryPath NugetRoot { get; private set; }
public DirectoryPath ArtifactsBin { get; private set; }
public DirectoryPath ArtifactsBinFullFx { get; private set; }
Expand All @@ -83,7 +80,6 @@ public class BuildDirectories
public BuildDirectories(
DirectoryPath artifactsDir,
DirectoryPath testResultsDir,
DirectoryPath nuspecRoot,
DirectoryPath nugetRoot,
DirectoryPath artifactsBinDir,
DirectoryPath artifactsBinFullFx,
Expand All @@ -93,7 +89,6 @@ public class BuildDirectories
{
Artifacts = artifactsDir;
TestResults = testResultsDir;
NuspecRoot = nuspecRoot;
NugetRoot = nugetRoot;
ArtifactsBin = artifactsBinDir;
ArtifactsBinFullFx = artifactsBinFullFx;
Expand Down
27 changes: 0 additions & 27 deletions build/shared.cake

This file was deleted.

21 changes: 1 addition & 20 deletions build/version.cake
Expand Up @@ -23,8 +23,7 @@ public class BuildVersion
if (!parameters.IsLocalBuild || parameters.IsPublishBuild || parameters.IsReleaseBuild)
{
context.GitVersion(new GitVersionSettings{
UpdateAssemblyInfoFilePath = "./src/CommonAssemblyInfo.cs",
UpdateAssemblyInfo = true,
UpdateAssemblyInfo = false,
OutputType = GitVersionOutput.BuildServer
});

Expand All @@ -45,14 +44,6 @@ public class BuildVersion
context.Information("Calculated Semantic Version: {0}", semVersion);
}

if (string.IsNullOrEmpty(version) || string.IsNullOrEmpty(semVersion))
{
context.Information("Fetching version from first CommonAssemblyInfo...");
version = ReadCommonAssemblyInfoVersion(context);
semVersion = version;
milestone = string.Concat("v", version);
}

var appVersion = typeof(ICakeContext).Assembly.GetName().Version.ToString();

return new BuildVersion
Expand All @@ -64,14 +55,4 @@ public class BuildVersion
AppVersion = appVersion
};
}

public static string ReadCommonAssemblyInfoVersion(ICakeContext context)
{
var solutionInfo = context.ParseAssemblyInfo("./src/CommonAssemblyInfo.cs");
if (!string.IsNullOrEmpty(solutionInfo.AssemblyVersion))
{
return solutionInfo.AssemblyVersion;
}
throw new CakeException("Could not parse version.");
}
}
2 changes: 1 addition & 1 deletion global.json
@@ -1,6 +1,6 @@
{
"projects": [ "src" ],
"sdk": {
"version": "2.1.4"
"version": "2.1.700"
}
}
37 changes: 0 additions & 37 deletions nuspec/FluentNHibernate.nuspec

This file was deleted.

32 changes: 0 additions & 32 deletions nuspec/FluentNHibernate.symbols.nuspec

This file was deleted.

8 changes: 0 additions & 8 deletions src/CommonAssemblyInfo.cs

This file was deleted.

0 comments on commit f773fae

Please sign in to comment.