Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust connector icons #20547

Merged
merged 9 commits into from
Jan 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions airbyte-config/init/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,52 @@ tasks.named("buildDockerImage") {
}

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)

/**
* Simple task that checks if all icons in the seed definition files exist as well as
* that no icon in the icons folder is unused.
*/
class IconValidationTask extends DefaultTask {

private slurper = new groovy.yaml.YamlSlurper()

@InputFile
File sourceDefinitions = project.file("src/main/resources/seed/source_definitions.yaml")

@InputFile
File destinationDefinitions = project.file("src/main/resources/seed/destination_definitions.yaml")

@InputDirectory
File iconDirectory = project.file("src/main/resources/icons")

private String[] getIconsFromYaml(File file) {
def yaml = this.slurper.parse(file.newReader())
return yaml.collect { it.icon }.findAll { it != null }
}

@TaskAction
void validateIcons() {
def sourceIcons = this.getIconsFromYaml(this.sourceDefinitions)
def destinationIcons = this.getIconsFromYaml(this.destinationDefinitions)
def icons = sourceIcons.plus(destinationIcons) as Collection<String>

def iconFiles = project.fileTree(this.iconDirectory).collect { it.name }
def nonExistingIconFiles = icons - iconFiles
def orphanedFiles = iconFiles - icons.intersect(iconFiles)

def errors = []
if (!nonExistingIconFiles.isEmpty()) {
errors.push("The following icon files have been referenced inside the seed files, but don't exist:\n\n${nonExistingIconFiles.join('\n')}")
}
if (!orphanedFiles.isEmpty()) {
errors.push("The following icons are not used in the seed files and should be removed:\n\n${orphanedFiles.join('\n')}")
}

if (!errors.isEmpty()) {
throw new Error(errors.join('\n\n'))
}
}
}

task validateIcons(type: IconValidationTask)
check.dependsOn validateIcons
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions airbyte-config/init/src/main/resources/icons/adjust.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions airbyte-config/init/src/main/resources/icons/aha.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion airbyte-config/init/src/main/resources/icons/airbyte.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion airbyte-config/init/src/main/resources/icons/airtable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion airbyte-config/init/src/main/resources/icons/alloydb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion airbyte-config/init/src/main/resources/icons/amazonads.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading