Skip to content

Commit

Permalink
Adjust connector icons (#20547)
Browse files Browse the repository at this point in the history
* Adjust connector icons

* Update icons

* Add missing icons

* Remove missing icon from spec

* Add trailing newline

* Fix test
  • Loading branch information
timroes authored and jbfbell committed Jan 13, 2023
1 parent 81947aa commit a93ac03
Show file tree
Hide file tree
Showing 285 changed files with 434 additions and 192 deletions.
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

0 comments on commit a93ac03

Please sign in to comment.