Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ dotnet publish \
--runtime linux-x64 \
--self-contained true \
--configuration Release \
-p:Version=0.6.0 \
-p:Version=0.7.0 \
--output build \
src/nuget-inspector/nuget-inspector.csproj
2 changes: 1 addition & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
rm -rf release/
mkdir release

VERSION=0.6.0
VERSION=0.7.0

TARGET_BASE=nuget-inspector-$(git describe)

Expand Down
93 changes: 50 additions & 43 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,64 +1,71 @@
[bumpversion]
commit = False
tag = False
current_version = 0.7.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
serialize =
{major}.{minor}.{patch}-{release}
{major}.{minor}.{patch}

[bumpversion:file:build.sh]

[bumpversion:file:release.sh]

[bumpversion:file:src/nuget-inspector/OutputFormatJson.cs]

[bumpversion:file:src/nuget-inspector/nuget-inspector.csproj]

[metadata]
name = nuget-inspector-test-suite
license = Apache-2.0 AND MIT

description = A test suite for nuget-inspector
long_description = file:README.rst
long_description_content_type = text/x-rst
url = https://github.com/nexB/nuget-inspector

author = nexB. Inc. and others
author_email = info@aboutcode.org

classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Topic :: Software Development
Topic :: Utilities

keywords =
utilities

license_files =
apache-2.0.LICENSE
NOTICE
AUTHORS.rst
CHANGELOG.rst
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Topic :: Software Development
Topic :: Utilities
keywords =
utilities
license_files =
apache-2.0.LICENSE
NOTICE
AUTHORS.rst
CHANGELOG.rst

[options]
package_dir =
=tests
package_dir =
=tests
packages = find:
include_package_data = true
zip_safe = false

setup_requires = setuptools_scm[toml] >= 4

python_requires = >=3.8.*

install_requires =
pytest >= 6, != 7.0.0
pytest-xdist >= 2
commoncode
aboutcode-toolkit >= 6.0.0
black

install_requires =
pytest >= 6, != 7.0.0
pytest-xdist >= 2
commoncode
aboutcode-toolkit >= 6.0.0
black

[options.packages.find]
where = tests


[options.extras_require]
testing =
pytest >= 6, != 7.0.0
pytest-xdist >= 2
commoncode
aboutcode-toolkit >= 6.0.0
black

docs =
Sphinx >= 3.3.1
sphinx-rtd-theme >= 0.5.0
doc8 >= 0.8.1
testing =
pytest >= 6, != 7.0.0
pytest-xdist >= 2
commoncode
aboutcode-toolkit >= 6.0.0
black
bump2version
docs =
Sphinx >= 3.3.1
sphinx-rtd-theme >= 0.5.0
doc8 >= 0.8.1
7 changes: 7 additions & 0 deletions src/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"version": "6.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
4 changes: 4 additions & 0 deletions src/nuget-inspector.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;
&lt;Assembly Path="/home/pombreda/.nuget/packages/microsoft.build/17.3.2/ref/net6.0/Microsoft.Build.dll" /&gt;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>
4 changes: 2 additions & 2 deletions src/nuget-inspector/AssemblyInfoParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class AssemblyInfoParser
{
public class AssemblyVersion
{
public string? Version { get; }
public string Path { get; }
public string? Version { get; set; }
public string Path { get; set; }

public AssemblyVersion(string? version, string path)
{
Expand Down
5 changes: 3 additions & 2 deletions src/nuget-inspector/DependencyResolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ internal interface IDependencyResolver
/// Resolve dependencies and return a DependencyResolution
/// </summary>
/// <returns>DependencyResolution</returns>
DependencyResolution Process();
DependencyResolution Resolve();
}

public class DependencyResolution
{
public bool Success { get; set; } = true;
public string? ProjectVersion { get; set; }
public List<PackageSet> Packages { get; set; } = new();
public string? ErrorMessage { get; set; } = "";
public List<BasePackage> Packages { get; set; } = new();
public List<BasePackage> Dependencies { get; set; } = new();
}
15 changes: 8 additions & 7 deletions src/nuget-inspector/LegacyPackagesConfigNoDupeResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,28 @@ public LegacyPackagesConfigNoDupeResolver(NugetApi service)
return result;
}

public List<PackageSet> ProcessAll(List<Dependency> packages)
public List<BasePackage> ProcessAll(List<Dependency> packages)
{
foreach (var package in packages)
{
Add(id: package.Name!, name: package.Name, range: package.VersionRange, framework: package.Framework);
Add(id: package.name!, name: package.name, range: package.version_range, framework: package.framework);
}

var builder = new PackageSetBuilder();
var builder = new PackageBuilder();
foreach (var data in ResolutionDatas.Values)
{
var deps = new HashSet<BasePackage?>();
var deps = new List<BasePackage>();
foreach (var dep in data.Dependencies.Keys)
if (!ResolutionDatas.ContainsKey(key: dep))
throw new Exception(
message: $"Encountered a dependency but was unable to resolve a package for it: {dep}");
else
deps.Add(item: new BasePackage(name: ResolutionDatas[key: dep].Name,
deps.Add(item: new BasePackage(
name: ResolutionDatas[key: dep].Name!,
version: ResolutionDatas[key: dep].CurrentVersion?.ToNormalizedString()));
builder.AddOrUpdatePackage(
id: new BasePackage(name: data.Name, version: data.CurrentVersion?.ToNormalizedString()),
dependencies: deps);
id: new BasePackage(name: data.Name!, version: data.CurrentVersion?.ToNormalizedString()),
dependencies: deps!);
}

return builder.GetPackageList();
Expand Down
14 changes: 7 additions & 7 deletions src/nuget-inspector/LegacyProjectJsonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ public LegacyProjectJsonHandler(string? projectName, string projectJsonPath)
ProjectJsonPath = projectJsonPath;
}

public DependencyResolution Process()
public DependencyResolution Resolve()
{
var result = new DependencyResolution();
var model = JsonPackageSpecReader.GetPackageSpec(name: ProjectName, packageSpecPath: ProjectJsonPath);
IList<LibraryDependency> packages = model.Dependencies;
foreach (var package in packages)
{
var set = new PackageSet
{
PackageId = new BasePackage(name: package.Name, version: package.LibraryRange.VersionRange.OriginalString)
};
result.Packages.Add(item: set);
result.Dependencies.Add(item: set.PackageId);
var bpwd = new BasePackage(
name: package.Name,
version: package.LibraryRange.VersionRange.OriginalString
);
result.Packages.Add(item: bpwd);
result.Dependencies.Add(item: bpwd);
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion src/nuget-inspector/LegacyProjectLockJsonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public LegacyProjectLockJsonHandler(string projectLockJsonPath)
ProjectLockJsonPath = projectLockJsonPath;
}

public DependencyResolution Process()
public DependencyResolution Resolve()
{
var lockFile = LockFileUtilities.GetLockFile(lockFilePath: ProjectLockJsonPath, logger: new NugetLogger());
if (lockFile == null)
Expand Down
19 changes: 10 additions & 9 deletions src/nuget-inspector/LockFileHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private NuGetVersion BestLibraryVersion(string? name, VersionRange range, IList<

public DependencyResolution Process()
{
var builder = new PackageSetBuilder();
var builder = new PackageBuilder();
var result = new DependencyResolution();

foreach (var target in LockFile.Targets)
Expand All @@ -83,7 +83,7 @@ public DependencyResolution Process()
var version = library.Version.ToNormalizedString();
var packageId = new BasePackage(name: name, version: version);

var dependencies = new HashSet<BasePackage?>();
var dependencies = new List<BasePackage?>();
foreach (var dependency in library.Dependencies)
{
var dep_id = dependency.Id;
Expand Down Expand Up @@ -161,8 +161,9 @@ public DependencyResolution Process()
{
version = library_version.ToNormalizedString();
}

result.Dependencies.Add(
item: new BasePackage(name: project_dependency.GetName(), version: version));
item: new BasePackage(name: project_dependency.GetName()!, version: version));
}
}

Expand Down Expand Up @@ -190,19 +191,18 @@ public DependencyResolution Process()
/// ".NETFramework,Version=v4.7.2": ["FSharp.Core >= 4.3.4 < 5.0.0",]
/// },
/// This a case that is NOT handled yet

public ProjectFileDependency ParseProjectFileDependencyGroup(string project_file_dependency)
{
if (ParseProjectFileDependencyGroupTokens(
input: project_file_dependency,
input: project_file_dependency,
tokens: " >= ",
project_name: out var project_name,
project_version: out var version_raw))
{
return new ProjectFileDependency(
name: project_name,
version_range: MinVersionOrFloat(
version_value_raw: version_raw,
version_value_raw: version_raw,
include_min: true));
}

Expand All @@ -218,8 +218,9 @@ public ProjectFileDependency ParseProjectFileDependencyGroup(string project_file
version_value_raw: version_raw2,
include_min: false));
}

if (ParseProjectFileDependencyGroupTokens(
input: project_file_dependency,
input: project_file_dependency,
tokens: " <= ",
project_name: out var project_name3,
project_version: out var version_raw3))
Expand All @@ -235,7 +236,7 @@ public ProjectFileDependency ParseProjectFileDependencyGroup(string project_file
}

if (ParseProjectFileDependencyGroupTokens(
input: project_file_dependency,
input: project_file_dependency,
tokens: " < ",
project_name: out var project_name4,
project_version: out var version_raw4))
Expand All @@ -244,7 +245,7 @@ public ProjectFileDependency ParseProjectFileDependencyGroup(string project_file
return new ProjectFileDependency(
name: project_name4,
version_range: new VersionRange(
minVersion: null,
minVersion: null,
includeMinVersion: false,
maxVersion: maxVersion));
}
Expand Down
Loading