Skip to content

Commit

Permalink
GH-2589: As a developer I want to also use pnpm as a package manager (#…
Browse files Browse the repository at this point in the history
…2590)

* remove obsolete code

* semver support for workspace protocol

* support symlinks for package dependencies

* fix unrelated bug

* add parser for yaml files, check workspaces in pnpm-workspaces.yaml

* add tests

* add warning

* improve xt test setup parser

* respect pnpm-workspaces.yaml

* fix unrelated NPE

* treat pnpm and yarn workspace equally

* check for symlinks

* move XtextResourceLocator

* file scanner ignores nested projects

* deal with failures during resource loading

* fix tests due to resolving symlinks
  • Loading branch information
mmews-n4 authored Jan 8, 2024
1 parent 8999137 commit 45de588
Show file tree
Hide file tree
Showing 70 changed files with 16,343 additions and 8,007 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.eclipse.xtext.util.IFileSystemScanner;
import org.eclipse.xtext.validation.Issue;

import com.google.common.base.Strings;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
Expand Down Expand Up @@ -296,7 +297,7 @@ private String getAdjustedModuleSpecifierOrNull(String moduleSpecifier, N4JSProj
Multimap<String, URI> moduleName2Uri) {

ProjectDescription pd = projectConfig.getProjectDescription();
String prjName = projectConfig.getPackageName();
String prjName = Strings.nullToEmpty(projectConfig.getPackageName());
if (moduleName2Uri.containsKey(moduleSpecifier)) {
return moduleSpecifier;
} else if (moduleSpecifier.startsWith("./")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import org.eclipse.emf.common.util.URI;
import org.eclipse.n4js.packagejson.projectDescription.ProjectDependency;
import org.eclipse.n4js.workspace.IN4JSSourceFolder;
import org.eclipse.n4js.workspace.N4JSProjectConfig;
import org.eclipse.n4js.workspace.N4JSProjectConfigSnapshot;
import org.eclipse.n4js.workspace.N4JSSourceFolder;
import org.eclipse.n4js.workspace.N4JSSourceFolderForPackageJson;
import org.eclipse.n4js.workspace.N4JSSourceFolderSnapshot;
import org.eclipse.n4js.workspace.N4JSSourceFolderSnapshotForPackageJson;
Expand Down Expand Up @@ -65,8 +65,8 @@ public N4JSSourceFolderSnapshot createSourceFolderSnapshot(ISourceFolder sourceF
if (sourceFolder instanceof N4JSSourceFolderForPackageJson) {
return new N4JSSourceFolderSnapshotForPackageJson((N4JSSourceFolderForPackageJson) sourceFolder);
}
IN4JSSourceFolder sourceFolderCasted = (IN4JSSourceFolder) sourceFolder;
N4JSSourceFolder sourceFolderCasted = (N4JSSourceFolder) sourceFolder;
return new N4JSSourceFolderSnapshot(sourceFolder.getName(), sourceFolder.getPath(),
sourceFolderCasted.getType(), sourceFolderCasted.getRelativePath());
sourceFolderCasted.getType(), sourceFolderCasted.getRelativePath(), sourceFolderCasted.getWorkspaces());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getNPMVersionRequirementAccess().getAlternatives(), "rule__NPMVersionRequirement__Alternatives");
builder.put(grammarAccess.getNPMVersionRequirementAccess().getAlternatives_1_0(), "rule__NPMVersionRequirement__Alternatives_1_0");
builder.put(grammarAccess.getNPMVersionRequirementAccess().getAlternatives_1_0_1(), "rule__NPMVersionRequirement__Alternatives_1_0_1");
builder.put(grammarAccess.getNPMVersionRequirementAccess().getAlternatives_1_0_1_1(), "rule__NPMVersionRequirement__Alternatives_1_0_1_1");
builder.put(grammarAccess.getURLVersionSpecifierAccess().getAlternatives(), "rule__URLVersionSpecifier__Alternatives");
builder.put(grammarAccess.getWorkspaceVersionRequirementAccess().getAlternatives_1(), "rule__WorkspaceVersionRequirement__Alternatives_1");
builder.put(grammarAccess.getVersionRangeAccess().getAlternatives(), "rule__VersionRange__Alternatives");
builder.put(grammarAccess.getVersionPartAccess().getAlternatives(), "rule__VersionPart__Alternatives");
builder.put(grammarAccess.getQualifierAccess().getAlternatives(), "rule__Qualifier__Alternatives");
Expand All @@ -54,9 +56,8 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getURL_NO_VXAccess().getAlternatives_1(), "rule__URL_NO_VX__Alternatives_1");
builder.put(grammarAccess.getURL_NO_VXAccess().getAlternatives_2(), "rule__URL_NO_VX__Alternatives_2");
builder.put(grammarAccess.getURL_NO_VXAccess().getAlternatives_3(), "rule__URL_NO_VX__Alternatives_3");
builder.put(grammarAccess.getTAGAccess().getAlternatives_1(), "rule__TAG__Alternatives_1");
builder.put(grammarAccess.getALPHA_NUMERIC_CHARSAccess().getAlternatives(), "rule__ALPHA_NUMERIC_CHARS__Alternatives");
builder.put(grammarAccess.getALPHA_NUMERIC_CHARS_START_WITH_DIGITSAccess().getAlternatives_1(), "rule__ALPHA_NUMERIC_CHARS_START_WITH_DIGITS__Alternatives_1");
builder.put(grammarAccess.getWORKSPACE_VERSIONAccess().getAlternatives(), "rule__WORKSPACE_VERSION__Alternatives");
builder.put(grammarAccess.getALPHA_NUMERIC_CHARAccess().getAlternatives(), "rule__ALPHA_NUMERIC_CHAR__Alternatives");
builder.put(grammarAccess.getWILDCARDAccess().getAlternatives(), "rule__WILDCARD__Alternatives");
builder.put(grammarAccess.getLETTERAccess().getAlternatives(), "rule__LETTER__Alternatives");
builder.put(grammarAccess.getLETTER_NO_VXAccess().getAlternatives(), "rule__LETTER_NO_VX__Alternatives");
Expand All @@ -71,6 +72,7 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getURLVersionSpecifierAccess().getGroup_1(), "rule__URLVersionSpecifier__Group_1__0");
builder.put(grammarAccess.getURLVersionSpecifierAccess().getGroup_2(), "rule__URLVersionSpecifier__Group_2__0");
builder.put(grammarAccess.getURLSemverAccess().getGroup(), "rule__URLSemver__Group__0");
builder.put(grammarAccess.getWorkspaceVersionRequirementAccess().getGroup(), "rule__WorkspaceVersionRequirement__Group__0");
builder.put(grammarAccess.getGitHubVersionRequirementAccess().getGroup(), "rule__GitHubVersionRequirement__Group__0");
builder.put(grammarAccess.getGitHubVersionRequirementAccess().getGroup_1(), "rule__GitHubVersionRequirement__Group_1__0");
builder.put(grammarAccess.getVersionRangeSetRequirementAccess().getGroup(), "rule__VersionRangeSetRequirement__Group__0");
Expand All @@ -92,6 +94,7 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getQualifierTagAccess().getGroup_1(), "rule__QualifierTag__Group_1__0");
builder.put(grammarAccess.getFILE_TAGAccess().getGroup(), "rule__FILE_TAG__Group__0");
builder.put(grammarAccess.getSEMVER_TAGAccess().getGroup(), "rule__SEMVER_TAG__Group__0");
builder.put(grammarAccess.getWORKSPACE_TAGAccess().getGroup(), "rule__WORKSPACE_TAG__Group__0");
builder.put(grammarAccess.getURL_PROTOCOLAccess().getGroup(), "rule__URL_PROTOCOL__Group__0");
builder.put(grammarAccess.getURLAccess().getGroup(), "rule__URL__Group__0");
builder.put(grammarAccess.getURL_NO_VXAccess().getGroup(), "rule__URL_NO_VX__Group__0");
Expand All @@ -105,9 +108,11 @@ private static void init(ImmutableMap.Builder<AbstractElement, String> builder,
builder.put(grammarAccess.getURLVersionSpecifierAccess().getCommitISHAssignment_2_1(), "rule__URLVersionSpecifier__CommitISHAssignment_2_1");
builder.put(grammarAccess.getURLSemverAccess().getWithSemverTagAssignment_1(), "rule__URLSemver__WithSemverTagAssignment_1");
builder.put(grammarAccess.getURLSemverAccess().getSimpleVersionAssignment_2(), "rule__URLSemver__SimpleVersionAssignment_2");
builder.put(grammarAccess.getTagVersionRequirementAccess().getTagNameAssignment(), "rule__TagVersionRequirement__TagNameAssignment");
builder.put(grammarAccess.getWorkspaceVersionRequirementAccess().getVersionAssignment_1_0(), "rule__WorkspaceVersionRequirement__VersionAssignment_1_0");
builder.put(grammarAccess.getWorkspaceVersionRequirementAccess().getOtherVersionAssignment_1_1(), "rule__WorkspaceVersionRequirement__OtherVersionAssignment_1_1");
builder.put(grammarAccess.getGitHubVersionRequirementAccess().getGithubUrlAssignment_0(), "rule__GitHubVersionRequirement__GithubUrlAssignment_0");
builder.put(grammarAccess.getGitHubVersionRequirementAccess().getCommitISHAssignment_1_1(), "rule__GitHubVersionRequirement__CommitISHAssignment_1_1");
builder.put(grammarAccess.getTagVersionRequirementAccess().getTagNameAssignment(), "rule__TagVersionRequirement__TagNameAssignment");
builder.put(grammarAccess.getVersionRangeSetRequirementAccess().getRangesAssignment_1_0(), "rule__VersionRangeSetRequirement__RangesAssignment_1_0");
builder.put(grammarAccess.getVersionRangeSetRequirementAccess().getRangesAssignment_1_1_3(), "rule__VersionRangeSetRequirement__RangesAssignment_1_1_3");
builder.put(grammarAccess.getHyphenVersionRangeAccess().getFromAssignment_1(), "rule__HyphenVersionRange__FromAssignment_1");
Expand Down
Loading

0 comments on commit 45de588

Please sign in to comment.