use of org.ballerinalang.toml.model.Dependency in project ballerina by ballerina-lang.
the class ManifestBuildListener method createDependencyObject.
/**
* Create dependency object and set the name.
*
* @param packageName pkg name of the dependency
*/
private void createDependencyObject(String packageName) {
dependency = new Dependency();
DependencyField dependencyField = DependencyField.NAME;
if (dependencyField != null) {
dependencyField.setValueTo(dependency, packageName);
}
}
use of org.ballerinalang.toml.model.Dependency in project ballerina by ballerina-lang.
the class PackageLoader method updateVersionFromToml.
private void updateVersionFromToml(PackageID pkgId) {
String orgName = pkgId.orgName.value;
String pkgName = pkgId.name.value;
String pkgAlias = orgName + "/" + pkgName;
// TODO: make getDependencies return a map
Optional<Dependency> dependency = manifest.getDependencies().stream().filter(d -> d.getPackageName().equals(pkgAlias)).findFirst();
if (dependency.isPresent()) {
if (pkgId.version.value.isEmpty()) {
pkgId.version = new Name(dependency.get().getVersion());
} else {
throw new BLangCompilerException("dependency version in Ballerina.toml mismatches" + " with the version in the source for package " + pkgAlias);
}
}
}
Aggregations