private boolean checkContentTypes( @NonNull Set<ContentType> contentTypes, @NonNull Transform transform) { for (ContentType contentType : contentTypes) { if (!(contentType instanceof QualifiedContent.DefaultContentType || contentType instanceof ExtendedContentType)) { errorReporter.handleSyncError(null, SyncIssue.TYPE_GENERIC, String.format("Custom content types (%1$s) are not supported in transforms (%2$s)", contentType.getClass().getName(), transform.getName())); return false; } } return true; }
@VisibleForTesting @NonNull static String getTaskNamePrefix(@NonNull Transform transform) { StringBuilder sb = new StringBuilder(100); sb.append("transform"); sb.append( transform.getInputTypes() .stream() .map(inputType -> CaseFormat.UPPER_UNDERSCORE.to( CaseFormat.UPPER_CAMEL, inputType.name())) .sorted() // Keep the order stable. .collect(Collectors.joining("And"))) .append("With") .append(capitalize(transform.getName())) .append("For"); return sb.toString(); }
private boolean validateTransform(@NonNull Transform transform) { // check the content type are of the right Type. if (!checkContentTypes(transform.getInputTypes(), transform) || !checkContentTypes(transform.getOutputTypes(), transform)) { return false; } // check some scopes are not consumed. Set<? super Scope> scopes = transform.getScopes(); // Allow Jack transform to consume provided classes as the .jack files are needed. if (scopes.contains(Scope.PROVIDED_ONLY) && !isJackRuntimeLib(transform)) { errorReporter.handleSyncError(null, SyncIssue.TYPE_GENERIC, String.format("PROVIDED_ONLY scope cannot be consumed by Transform '%1$s'", transform.getName())); return false; } if (scopes.contains(Scope.TESTED_CODE)) { errorReporter.handleSyncError(null, SyncIssue.TYPE_GENERIC, String.format("TESTED_CODE scope cannot be consumed by Transform '%1$s'", transform.getName())); return false; } return true; }
AndroidProject.FD_INTERMEDIATES, FD_TRANSFORMS, transform.getName(), scope.getDirectorySegments()));
String.format( "Unable to add Transform '%s' on variant '%s': requested streams not available: %s+%s / %s", transform.getName(), scope.getFullVariantName(), transform.getScopes(), transform.getReferencedScopes(), transform.getInputTypes())); logger.debug("\tName: " + transform.getName()); logger.debug("\tTask: " + taskName); for (TransformStream sd : inputStreams) {
if (t.getTransform().getName().equals(NAME)) { t.dependsOn(getByVariant(t.getVariantName()));