use of org.wso2.ballerinalang.compiler.packaging.repo.HomeRepo in project ballerina by ballerina-lang.
the class PackageLoader method genRepoHierarchy.
private RepoHierarchy genRepoHierarchy(Path sourceRoot) {
Path balHomeDir = HomeRepoUtils.createAndGetHomeReposPath();
Path projectHiddenDir = sourceRoot.resolve(".ballerina");
RepoHierarchyBuilder.RepoNode[] systemArr = loadSystemRepos();
Converter<Path> converter = sourceDirectory.getConverter();
Repo remote = new RemoteRepo(URI.create("https://staging.central.ballerina.io:9090/"));
Repo homeCacheRepo = new CacheRepo(balHomeDir);
Repo homeRepo = new ZipRepo(balHomeDir);
Repo projectCacheRepo = new CacheRepo(projectHiddenDir);
Repo projectRepo = new ZipRepo(projectHiddenDir);
RepoHierarchyBuilder.RepoNode homeCacheNode;
if (offline) {
homeCacheNode = node(homeCacheRepo, systemArr);
} else {
homeCacheNode = node(homeCacheRepo, node(remote, systemArr));
}
RepoHierarchyBuilder.RepoNode nonLocalRepos = node(projectRepo, node(projectCacheRepo, homeCacheNode), node(homeRepo, homeCacheNode));
RepoHierarchyBuilder.RepoNode fullRepoGraph;
if (converter != null) {
Repo programingSource = new ProgramingSourceRepo(converter);
Repo projectSource = new ProjectSourceRepo(converter);
fullRepoGraph = node(programingSource, node(projectSource, nonLocalRepos));
} else {
fullRepoGraph = nonLocalRepos;
}
return RepoHierarchyBuilder.build(fullRepoGraph);
}
use of org.wso2.ballerinalang.compiler.packaging.repo.HomeRepo in project ballerina by ballerina-lang.
the class RepoHierarchyTest method createSubject.
/**
* <pre>
*
* easy/too:0 good/i.am:1 ugly/ok.pkg:4
* | | ,--- projectCacheRepo ---. |
* v v / 2 \ v
* projectSource --- projectRepo ---< >--- homeCacheRepo
* 0 1 \ / 4
* `------- homeRepo -------'
* 3
* </pre>
* Expected lookup order
* <p>
* <p>
* 0. projectSource
* 1. projectRepo
* 2. homeRepo
* 3. projectCacheRepo
* 4. homeCacheRepo
*
* @param order list to remember order of invocation into
*/
private RepoHierarchy createSubject(List<Integer> order) {
Repo projectSource = mockRepo(0, order);
Repo projectRepo = mockRepo(1, order);
Repo projectCacheRepo = mockRepo(2, order);
Repo homeRepo = mockRepo(3, order);
Repo homeCacheRepo = mockRepo(4, order);
RepoHierarchyBuilder.RepoNode homeCacheNode = node(homeCacheRepo);
return RepoHierarchyBuilder.build(node(projectSource, node(projectRepo, null, /* null nodes should be ignored */
node(projectCacheRepo, homeCacheNode), node(homeRepo, homeCacheNode))));
}
use of org.wso2.ballerinalang.compiler.packaging.repo.HomeRepo in project ballerina by ballerina-lang.
the class RepoTest method testHomeRepo.
@Test
public void testHomeRepo() {
PackageID pkg = newPackageID("my_org", "my.pkg", "10.2.3");
HomeRepo subject = new HomeRepo((PathConverter) null);
Patten patten = subject.calculate(pkg);
Assert.assertEquals(patten.toString(), "$/repo/my_org/my.pkg/10.2.3/src/**~test~resources/*.bal");
}
Aggregations