private Set<String> getCompileArtifactsForAgp2x() { Set<String> compileLibs = new HashSet<>(); Configuration configuration = project.getConfigurations().getByName("compile"); if (configuration.isCanBeResolved()) { ResolvableDependencies incoming = configuration.getIncoming(); ResolutionResult resolutionResult = incoming.getResolutionResult(); Set<ResolvedComponentResult> components = resolutionResult.getAllComponents(); for (ResolvedComponentResult result : components) { ModuleVersionIdentifier identifier = result.getModuleVersion(); if (identifier != null && !"unspecified".equals(identifier.getVersion())) { compileLibs.add( String.join(":", identifier.getGroup(), identifier.getName(), identifier.getVersion())); } } } return compileLibs; }
public String getGroup() { return mArtifact.getModuleVersion().getId().getGroup(); }
public DefaultGradleModuleVersion(ModuleVersionIdentifier identifier) { this.group = identifier.getGroup(); this.name = identifier.getName(); this.version = identifier.getVersion(); }
/** * Creates a {@code DependencyIdentifier} from a given {@link ModuleVersionIdentifier}. * * @param moduleVersionIdentifier The {@code ModuleVersionIdentifier} to create this object from. */ public DependencyIdentifier(ModuleVersionIdentifier moduleVersionIdentifier) { group = moduleVersionIdentifier.getGroup(); name = moduleVersionIdentifier.getName(); version = moduleVersionIdentifier.getVersion(); }
@Override public void execute( ComponentMetadataContext ctx ) { ComponentMetadataDetails details = ctx.getDetails(); ModuleVersionIdentifier module = details.getId(); details.allVariants( vm -> { String group = "org.jetbrains.kotlin"; log.trace( "checking for {}: {}", group, module ); if ( Objects.equals( module.getGroup(), group ) ) { details.belongsTo( group + ":kotlin-bom:" + module.getVersion() ); log.info( "alligning {}: {}", group, module ); } } ); } }
public boolean isSatisfiedBy(ModuleVersionIdentifier candidate) { return candidate.getName().equals(selector.getName()) && candidate.getGroup().equals(selector.getGroup()) && candidate.getVersion().equals(selector.getVersion()); } }
private String coordinates(ResolvedArtifact artifact, boolean withVersion) { // group:artifact:extension:classifier:version String classifier = artifact.getClassifier(); String extension = artifact.getType(); ModuleVersionIdentifier artifactId = artifact.getModuleVersion().getId(); return artifactId.getGroup() + ":" + artifactId.getName() + (StringUtils.hasText(extension) && (!"jar".equals(extension) || StringUtils.hasText(classifier)) ? ":" + extension : "") + (StringUtils.hasText(classifier) ? ":" + classifier : "") + (withVersion ? ":" + artifactId.getVersion() : ""); }
ResolvedArtifactLibrary(ResolvedArtifact artifact, LibraryScope scope) { super(artifact.getModuleVersion().getId().getGroup(), artifact.getFile(), scope); this.artifact = artifact; }
@Override public void execute( ComponentMetadataContext ctx ) { ComponentMetadataDetails details = ctx.getDetails(); ModuleVersionIdentifier module = details.getId(); details.allVariants( vm -> { String group = "org.jetbrains.kotlin"; log.trace( "checking for {}: {}", group, module ); if ( Objects.equals( module.getGroup(), group ) ) { details.belongsTo( group + ":kotlin-bom:" + module.getVersion() ); log.info( "alligning {}: {}", group, module ); } } ); } }
@Override public void execute( ComponentMetadataContext ctx ) { ComponentMetadataDetails details = ctx.getDetails(); ModuleVersionIdentifier module = details.getId(); details.allVariants( vm -> { String group = "org.immutables"; log.trace( "checking for immutables: {}", module ); if ( Objects.equals( module.getGroup(), group ) ) { details.belongsTo( group + ":platform:" + module.getVersion(), true ); log.info( "alligning immutables: {}", module ); } } ); } }
@Override public void execute( ComponentMetadataContext ctx ) { ComponentMetadataDetails details = ctx.getDetails(); ModuleVersionIdentifier module = details.getId(); details.allVariants( vm -> { String group = "org.immutables"; log.trace( "checking for immutables: {}", module ); if ( Objects.equals( module.getGroup(), group ) ) { details.belongsTo( group + ":platform:" + module.getVersion(), true ); log.info( "alligning immutables: {}", module ); } } ); } }
private String getId(ResolvedComponentResult component) { return component.getModuleVersion().getGroup() + ":" + component.getModuleVersion() .getName(); }
public String recommend(String dependencyNotation, String recommenderName) throws Exception { ModuleVersionIdentifier mvid = ModuleNotationParser.parse(dependencyNotation); String version = mvid.getVersion() != null ? mvid.getVersion() : project.getExtensions().getByType(RecommendationProviderContainer.class).getByName(recommenderName) .getVersion(mvid.getGroup(), mvid.getName()); return mvid.getGroup() + ":" + mvid.getName() + ":" + version; } }
public File getExploadedRootDir() { File explodedRootDir = mProject.file( mProject.getBuildDir() + "/intermediates" + "/exploded-aar/"); ModuleVersionIdentifier id = mArtifact.getModuleVersion().getId(); return mProject.file(explodedRootDir + "/" + id.getGroup() + "/" + id.getName()); }
@Override public boolean isUnpackRequired() { if (ProjectLibraries.this.extension.getRequiresUnpack() != null) { ModuleVersionIdentifier id = this.artifact.getModuleVersion().getId(); return ProjectLibraries.this.extension.getRequiresUnpack() .contains(id.getGroup() + ":" + id.getName()); } return false; }
private ArtifactId getResolvedArtifactId(ResolvedArtifact artifact) { ModuleVersionIdentifier artifactIdentifier = artifact.getModuleVersion().getId(); return new ArtifactId(artifactIdentifier.getGroup(), artifactIdentifier.getName()); }
public File getRootFolder() { File explodedRootDir = mProject.file( mProject.getBuildDir() + "/intermediates" + "/exploded-aar/"); ModuleVersionIdentifier id = mArtifact.getModuleVersion().getId(); return mProject.file( explodedRootDir + "/" + id.getGroup() + "/" + id.getName() + "/" + id.getVersion()); }
private ArtifactVersionId getResolvedArtifactVersionId(ResolvedArtifact artifact) { ModuleVersionIdentifier artifactIdentifier = artifact.getModuleVersion().getId(); return new ArtifactVersionId(artifactIdentifier.getGroup(), artifactIdentifier.getName(), artifactIdentifier.getVersion()); }
public MavenCoordinatesImpl(@NonNull ResolvedArtifact resolvedArtifact) { this( resolvedArtifact.getModuleVersion().getId().getGroup(), resolvedArtifact.getModuleVersion().getId().getName(), resolvedArtifact.getModuleVersion().getId().getVersion(), resolvedArtifact.getExtension(), resolvedArtifact.getClassifier()); }
@NonNull private static MavenCoordinatesImpl createMavenCoordinates( @NonNull ResolvedArtifact resolvedArtifact) { return new MavenCoordinatesImpl( resolvedArtifact.getModuleVersion().getId().getGroup(), resolvedArtifact.getModuleVersion().getId().getName(), resolvedArtifact.getModuleVersion().getId().getVersion(), resolvedArtifact.getExtension(), resolvedArtifact.getClassifier()); }