Search in sources :

Example 1 with PersistentModuleSource

use of org.gradle.internal.component.model.PersistentModuleSource in project gradle by gradle.

the class ModuleSourcesSerializer method write.

@Override
public void write(Encoder encoder, ModuleSources value) throws IOException {
    value.withSources(source -> {
        try {
            if (source instanceof PersistentModuleSource) {
                PersistentModuleSource persistentModuleSource = (PersistentModuleSource) source;
                int codecId = assertValidId(persistentModuleSource.getCodecId());
                encoder.writeSmallInt(codecId);
                PersistentModuleSource.Codec<PersistentModuleSource> codec = Cast.uncheckedCast(moduleSourceCodecs.get(codecId));
                codec.encode(persistentModuleSource, encoder);
            }
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    });
    // end of sources
    encoder.writeSmallInt(0);
}
Also used : UncheckedIOException(java.io.UncheckedIOException) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) PersistentModuleSource(org.gradle.internal.component.model.PersistentModuleSource)

Aggregations

IOException (java.io.IOException)1 UncheckedIOException (java.io.UncheckedIOException)1 PersistentModuleSource (org.gradle.internal.component.model.PersistentModuleSource)1