Skip to content

Commit b76221b

Browse files
authored
feat!: repackaging project (#51)
1 parent 3f47f47 commit b76221b

30 files changed

+914
-720
lines changed

.github/workflows/build.yml

+20-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: build
33
on:
44
push:
55
branches:
6-
- "**"
6+
- '**'
77

88
env:
99
DOTNET_NOLOGO: true
@@ -28,9 +28,17 @@ jobs:
2828
run: ./tools/build-java.ps1
2929

3030
test-dotnet:
31-
runs-on: windows-latest
31+
runs-on: ${{ matrix.os }}
3232
timeout-minutes: 15
3333

34+
strategy:
35+
# fail-fast: false
36+
matrix:
37+
os:
38+
- ubuntu-latest
39+
# - macos-latest Doesn't work yet
40+
- windows-latest
41+
3442
steps:
3543
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
3644

@@ -43,15 +51,21 @@ jobs:
4351
- name: prepare
4452
run: dotnet restore
4553

46-
- name: jars
47-
shell: pwsh
48-
run: ./tools/get-jars.ps1
54+
- name: tfm
55+
# building net461 doesn't work on non windows
56+
if: matrix.os != 'windows-latest'
57+
run: echo "NoNet4=true" >> $GITHUB_ENV
4958

5059
- name: build
5160
run: dotnet build --no-restore
5261

5362
- name: test
54-
run: dotnet test -l trx -v m --no-build
63+
run: dotnet test --no-build
64+
65+
- name: Codecov
66+
uses: codecov/codecov-action@v3.1.1
67+
with:
68+
files: '**/TestResults/*/*.cobertura.xml'
5569

5670
build:
5771
runs-on: windows-latest
@@ -70,10 +84,6 @@ jobs:
7084
- name: prepare
7185
run: dotnet restore
7286

73-
- name: jars
74-
shell: pwsh
75-
run: ./tools/get-jars.ps1
76-
7787
- name: build
7888
run: dotnet build --no-restore
7989

.github/workflows/release.yml

-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ jobs:
3737
- name: prepare
3838
run: dotnet restore
3939

40-
- name: jars
41-
shell: pwsh
42-
run: ./tools/get-jars.ps1
43-
4440
- name: build
4541
run: dotnet build --no-restore
4642

.prettierrc .prettierrc.json

File renamed without changes.

Directory.Build.props

+30-25
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
<?xml version="1.0" encoding="utf-8" ?>
22
<Project>
3-
<PropertyGroup>
4-
<MinVerMinimumMajorMinor>2.0</MinVerMinimumMajorMinor>
5-
<MinVerTagPrefix>v</MinVerTagPrefix>
6-
<SolutionDir>$(MSBuildThisFileDirectory)/</SolutionDir>
7-
<NoWarn>CA1014;CA1031;CA1065;CA1812;CA2225;SA0001;SA1404;SA1636;NU1701;$(NoWarn)</NoWarn>
8-
<!-- Caused somehow by minver https://github.com/adamralph/minver/issues/754 -->
9-
<NoWarn>CS7035;$(NoWarn)</NoWarn>
10-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
11-
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
12-
<LangVersion>latest</LangVersion>
3+
<PropertyGroup>
4+
<MinVerMinimumMajorMinor>4.0</MinVerMinimumMajorMinor>
5+
<MinVerTagPrefix>v</MinVerTagPrefix>
6+
<SolutionDir>$(MSBuildThisFileDirectory)/</SolutionDir>
7+
<NoWarn>CA1014;CA1031;CA1065;CA1812;CA2225;SA0001;SA1404;SA1636;NU1701;$(NoWarn)</NoWarn>
8+
<!-- Caused somehow by minver https://github.com/adamralph/minver/issues/754 -->
9+
<NoWarn>CS7035;$(NoWarn)</NoWarn>
10+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
11+
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
12+
<LangVersion>latest</LangVersion>
1313

14-
<RunSettingsFilePath>$(MSBuildThisFileDirectory)\featureide.runsettings</RunSettingsFilePath>
15-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
16-
</PropertyGroup>
14+
<RunSettingsFilePath>$(MSBuildThisFileDirectory)\featureide.runsettings</RunSettingsFilePath>
15+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1716

18-
<ItemGroup>
19-
<!-- <AdditionalFiles Include="$(MSBuildThisFileDirectory)/.stylecop.json" link="stylecop.json" /> -->
20-
<!-- <PackageReference Include="MinVer" PrivateAssets="All" /> -->
21-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="All" />
22-
<!--<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />-->
23-
</ItemGroup>
2417

25-
<Target Name="_AfterMinVer" AfterTargets="MinVer">
26-
<PropertyGroup>
27-
<BUILD_NUMBER Condition="'$(BUILD_NUMBER)' == ''">0</BUILD_NUMBER>
28-
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BUILD_NUMBER)</FileVersion>
29-
</PropertyGroup>
30-
</Target>
18+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
19+
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
20+
21+
22+
<Sat4JVersion>2.3.5</Sat4JVersion>
23+
<!-- renovate: datasource=github-releases depName=featureide packageName=FeatureIDE/FeatureIDE -->
24+
<FeatureIDEVersion>v3.9.1</FeatureIDEVersion>
25+
</PropertyGroup>
26+
27+
<ItemGroup>
28+
<PackageReference Include="MinVer" PrivateAssets="All" />
29+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
30+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" PrivateAssets="All" />
31+
</ItemGroup>
32+
33+
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) ">
34+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" />
35+
</ItemGroup>
3136
</Project>

Directory.Build.targets

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project>
3+
4+
<Target Name="_AfterMinVer" AfterTargets="MinVer">
5+
<PropertyGroup>
6+
<BUILD_NUMBER Condition="'$(BUILD_NUMBER)' == ''">0</BUILD_NUMBER>
7+
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BUILD_NUMBER)</FileVersion>
8+
</PropertyGroup>
9+
</Target>
10+
</Project>

Directory.Packages.props

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
<PropertyGroup>
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
6-
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
7-
<RestoreLockedMode Condition="'$(CI)' == 'true'">true</RestoreLockedMode>
8-
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
96
<AutomaticallyUseReferenceAssemblyPackages>false</AutomaticallyUseReferenceAssemblyPackages>
107
<!-- TODO: fix me-->
118
<NoWarn>$(NoWarn);NU1507</NoWarn>
129
</PropertyGroup>
1310

1411
<ItemGroup>
1512
<PackageVersion Include="IKVM" Version="8.4.5" />
13+
<PackageVersion Include="Validation" Version="2.5.51" />
1614
</ItemGroup>
1715

1816
<ItemGroup>

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
# FeatureIDE.net
2+
13
[![build](https://github.com/visualon/featureide.net/actions/workflows/build.yml/badge.svg)](https://github.com/visualon/featureide.net/actions/workflows/build.yml)
24
![github-release](https://badgen.net/github/release/visualon/featureide.net?icon=github)
3-
![nuget](https://badgen.net/nuget/v/de.ovgu.featureide.fm/latest?icon=nuget)
4-
5-
# FeatureIDE.net
5+
![nuget](https://badgen.net/nuget/v/VisualOn.FeatureIDE/latest?icon=nuget)
66

77
IKVM compiled dotnet version of the [FeatureIDE](https://featureide.github.io) library.
88

99
This is the IKVM version; which is to say that this is compiled from Java to .NET
1010

11-
Currently `net461` and `netcoreapp3.1` are the minimum supported runtimes.
11+
Currently `net461` and `net6.0` are the minimum supported runtimes.
1212

1313
## Changes
1414

codecov.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
comment: false
2+
codecov:
3+
require_ci_to_pass: false
4+
notify:
5+
after_n_builds: 2
6+
wait_for_ci: true

featureide.runsettings

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<CodeCoverage>
1313
<ModulePaths>
1414
<Include>
15-
<ModulePath>de\.ovgu\.featureide\.fm\.dll$</ModulePath>
15+
<ModulePath>VisualOn\.FeatureIDE\.dll$</ModulePath>
1616
</Include>
1717
</ModulePaths>
1818
</CodeCoverage>

featureide.sln

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ VisualStudioVersion = 17.2.32602.215
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{23D1173E-D636-41E5-9B9D-2123BDD7A2FB}"
77
EndProject
8-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "de.ovgu.featureide.fm", "src\de.ovgu.featureide.fm\de.ovgu.featureide.fm.csproj", "{8FBEE9FC-42B7-48CE-B5CF-35D0C1D21EE0}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualOn.FeatureIDE", "src\VisualOn.FeatureIDE\VisualOn.FeatureIDE.csproj", "{8FBEE9FC-42B7-48CE-B5CF-35D0C1D21EE0}"
99
EndProject
1010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B95567D4-AA88-41AF-AA84-EC452AFE83AA}"
1111
ProjectSection(SolutionItems) = preProject
1212
Directory.Build.props = Directory.Build.props
13+
Directory.Build.targets = Directory.Build.targets
1314
Directory.Packages.props = Directory.Packages.props
1415
EndProjectSection
1516
EndProject
1617
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8F344BA8-EF69-42E0-84C6-9CA1128DAFE6}"
1718
EndProject
18-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "de.ovgu.featureide.fm.test", "test\de.ovgu.featureide.fm.test\de.ovgu.featureide.fm.test.csproj", "{87431B37-B6C3-432D-800C-28D71357E020}"
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualOn.FeatureIDE.Test", "test\VisualOn.FeatureIDE.Test\VisualOn.FeatureIDE.Test.csproj", "{87431B37-B6C3-432D-800C-28D71357E020}"
1920
EndProject
2021
Global
2122
GlobalSection(SolutionConfigurationPlatforms) = preSolution

global.json

-5
This file was deleted.

renovate.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"regexManagers": [
4747
{
4848
"description": "Update jar versions",
49-
"fileMatch": ["\\.csproj$"],
49+
"fileMatch": ["^Directory\\.Build\\.props$"],
5050
"matchStringsStrategy": "any",
5151
"matchStrings": [
5252
"<!-- renovate: datasource=(?<datasource>.+?) depName=(?<depName>.+?)(?: (?:packageName|lookupName)=(?<packageName>.+?))?(?: versioning=(?<versioning>.+?))? -->\\s+<[^>]+>(?<currentValue>.+?)<\\/[^>]+>"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using de.ovgu.featureide.fm.core.@base;
2+
using de.ovgu.featureide.fm.core.@base.impl;
3+
using de.ovgu.featureide.fm.core.configuration;
4+
using System.Collections.Generic;
5+
using org.prop4j;
6+
7+
namespace VisualOn.FeatureIDE
8+
{
9+
public static class FeatureModelFactory
10+
{
11+
private static readonly DefaultFeatureModelFactory FACTORY = DefaultFeatureModelFactory.getInstance();
12+
13+
static FeatureModelFactory()
14+
{
15+
// suppress errors
16+
FMFactoryManager.getInstance().addExtension(DefaultFeatureModelFactory.getInstance());
17+
ConfigurationFactoryManager.getInstance().addExtension(DefaultConfigurationFactory.getInstance());
18+
}
19+
20+
public static IFeatureStructure AddFeature(this IFeatureModel @this, string feature, bool @abstract = false)
21+
{
22+
Requires.NotNull(@this, nameof(@this));
23+
Requires.NotNull(feature, nameof(feature));
24+
25+
var f = FACTORY.createFeature(@this, feature);
26+
27+
@this.addFeature(f);
28+
29+
var res = f.getStructure();
30+
31+
if (@abstract)
32+
{
33+
res.setAbstract(true);
34+
}
35+
36+
return res;
37+
}
38+
39+
40+
public static IConstraint AddConstraint(this IFeatureModel @this, Node rule)
41+
{
42+
Requires.NotNull(@this, nameof(@this));
43+
Requires.NotNull(rule, nameof(rule));
44+
45+
var res = FACTORY.createConstraint(@this, rule);
46+
47+
@this.addConstraint(res);
48+
49+
return res;
50+
}
51+
52+
public static IFeatureModel CreateModel() => FACTORY.create();
53+
54+
public static IEnumerable<SelectableFeature> GetFeatures(this Configuration @this) => Requires.NotNull(@this, nameof(@this)).getFeatures().Cast<SelectableFeature>();
55+
56+
public static IEnumerable<IFeature> GetSelectedFeatures(this Configuration @this) => Requires.NotNull(@this, nameof(@this)).getSelectedFeatures().Cast<IFeature>();
57+
58+
public static bool? ToBool(this Selection @this)
59+
{
60+
if (@this == Selection.SELECTED)
61+
{
62+
return true;
63+
}
64+
65+
if (@this == Selection.UNSELECTED)
66+
{
67+
return false;
68+
}
69+
70+
return null;
71+
}
72+
73+
public static Selection ToSel(this bool? @this)
74+
{
75+
if (@this.HasValue)
76+
{
77+
return @this.Value ? Selection.SELECTED : Selection.UNSELECTED;
78+
}
79+
80+
return Selection.UNDEFINED;
81+
}
82+
}
83+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using java.lang;
2+
using System.Collections.Generic;
3+
4+
namespace VisualOn.FeatureIDE;
5+
6+
public static class JavaExtensions
7+
{
8+
public static IEnumerable<T> Cast<T>(this Iterable @this)
9+
{
10+
Requires.NotNull(@this, nameof(@this));
11+
for (var it = @this.iterator(); it.hasNext();)
12+
{
13+
yield return (T)it.next();
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)