use of org.wso2.ballerinalang.compiler.packaging.repo.ZipRepo 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.ZipRepo in project ballerina by ballerina-lang.
the class URIConverter method finalize.
public Stream<PackageSourceEntry> finalize(URI u, PackageID packageID) {
String orgName = packageID.getOrgName().getValue();
String pkgName = packageID.getName().getValue();
Path destDirPath = HomeRepoUtils.createAndGetHomeReposPath().resolve(Paths.get("repo", orgName, pkgName));
createDirectory(destDirPath);
try {
String fullPkgPath = orgName + "/" + pkgName;
executor.execute(pullBalxLocation, u.toString(), destDirPath.toString(), fullPkgPath, File.separator);
// TODO Simplify using ZipRepo
Patten pattern = new Patten(Patten.WILDCARD_DIR, Patten.path(pkgName + ".zip"), Patten.path("src"), Patten.WILDCARD_SOURCE);
return pattern.convertToSources(new ZipConverter(destDirPath), packageID);
} catch (Exception ignore) {
}
return Stream.of();
}
Aggregations