-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add props reference support (-t props)
- Loading branch information
Showing
9 changed files
with
154 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace ConvA; | ||
|
||
public class PropsConverter(RepoInfo repoInfo) : ProjectConverterBase(repoInfo) { | ||
protected override void ConvertCore(Project project, HashSet<PackageInfo> packages, List<string> externPackages, List<string> assets, List<Reference> references, | ||
List<ProjectReference> projectReferences) { | ||
// | ||
// * remove old props (move code for detecting props in RepoInfo.GetPropsImports) | ||
// * read from props all imported packages add dlls and maybe project references | ||
// | ||
|
||
foreach(string externPackage in externPackages) { | ||
project.RemovePackage(externPackage); | ||
} | ||
foreach(PackageInfo package in packages) { | ||
project.RemovePackage(package.Id!); | ||
} | ||
project.RemoveProjectReferences(projectReferences); | ||
project.RemoveDllReferences(references); | ||
foreach (var asset in assets) { | ||
project.RemoveAsset(asset); | ||
} | ||
|
||
HashSet<string> props = new(); | ||
foreach (PackageInfo package in packages) { | ||
foreach (var prop in RepoInfo.GetPropsImports(package.Id!)) { | ||
props.Add(prop); | ||
} | ||
} | ||
project.AddImports(props); | ||
HashSet<string> packagesFromProps = new(); | ||
foreach (string propsFile in props) { | ||
var propsProject = new Project(propsFile); | ||
foreach (var package in propsProject.GetPackageReferences()) { | ||
if (package.Name != null) { | ||
packagesFromProps.Add(package.Name); | ||
} | ||
} | ||
} | ||
|
||
project.RemovePackages(packagesFromProps, reportMissed: false); | ||
project.AddJsonProjectReference("m");//TODO: after detect dependencies | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ public enum ConversionType: int { | |
Proj2, | ||
Package, | ||
Dll, | ||
Props | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters