use of io.quarkus.bootstrap.model.PlatformImportsImpl in project quarkus by quarkusio.
the class GradleApplicationModelBuilder method resolvePlatformImports.
private PlatformImports resolvePlatformImports(Project project, List<org.gradle.api.artifacts.Dependency> deploymentDeps) {
final Configuration boms = project.getConfigurations().detachedConfiguration(deploymentDeps.toArray(new org.gradle.api.artifacts.Dependency[0]));
final PlatformImportsImpl platformImports = new PlatformImportsImpl();
boms.getResolutionStrategy().eachDependency(d -> {
final String group = d.getTarget().getGroup();
final String name = d.getTarget().getName();
if (name.endsWith(BootstrapConstants.PLATFORM_DESCRIPTOR_ARTIFACT_ID_SUFFIX)) {
platformImports.addPlatformDescriptor(group, name, d.getTarget().getVersion(), "json", d.getTarget().getVersion());
} else if (name.endsWith(BootstrapConstants.PLATFORM_PROPERTIES_ARTIFACT_ID_SUFFIX)) {
final DefaultDependencyArtifact dep = new DefaultDependencyArtifact();
dep.setExtension("properties");
dep.setType("properties");
dep.setName(name);
final DefaultExternalModuleDependency gradleDep = new DefaultExternalModuleDependency(group, name, d.getTarget().getVersion(), null);
gradleDep.addArtifact(dep);
for (ResolvedArtifact a : project.getConfigurations().detachedConfiguration(gradleDep).getResolvedConfiguration().getResolvedArtifacts()) {
if (a.getName().equals(name)) {
try {
platformImports.addPlatformProperties(group, name, null, "properties", d.getTarget().getVersion(), a.getFile().toPath());
} catch (AppModelResolverException e) {
throw new GradleException("Failed to import platform properties " + a.getFile(), e);
}
break;
}
}
}
});
boms.getResolvedConfiguration();
return platformImports;
}
use of io.quarkus.bootstrap.model.PlatformImportsImpl in project quarkus by quarkusio.
the class BootstrapAppModelResolver method collectPlatformProperties.
private void collectPlatformProperties(ApplicationModelBuilder appBuilder, List<Dependency> managedDeps) throws AppModelResolverException {
final PlatformImportsImpl platformReleases = new PlatformImportsImpl();
for (Dependency d : managedDeps) {
final Artifact artifact = d.getArtifact();
final String extension = artifact.getExtension();
final String artifactId = artifact.getArtifactId();
if ("json".equals(extension) && artifactId.endsWith(BootstrapConstants.PLATFORM_DESCRIPTOR_ARTIFACT_ID_SUFFIX)) {
platformReleases.addPlatformDescriptor(artifact.getGroupId(), artifactId, artifact.getClassifier(), extension, artifact.getVersion());
} else if ("properties".equals(artifact.getExtension()) && artifactId.endsWith(BootstrapConstants.PLATFORM_PROPERTIES_ARTIFACT_ID_SUFFIX)) {
platformReleases.addPlatformProperties(artifact.getGroupId(), artifactId, artifact.getClassifier(), extension, artifact.getVersion(), mvn.resolve(artifact).getArtifact().getFile().toPath());
}
}
appBuilder.setPlatformImports(platformReleases);
}
Aggregations