private void generateKotlinThrifts()

in thrifty-gradle-plugin/src/main/java/com/microsoft/thrifty/gradle/GenerateThriftSourcesWorkAction.java [144:196]


    private void generateKotlinThrifts(Schema schema, SerializableThriftOptions opts) throws IOException {
        KotlinCodeGenerator gen = new KotlinCodeGenerator()
                .emitJvmName()
                .filePerType()
                .failOnUnknownEnumValues(!opts.isAllowUnknownEnumValues());

        if (opts.isParcelable()) {
            gen.parcelize();
        }

        SerializableThriftOptions.Kotlin kopt = opts.getKotlinOpts();

        if (opts.isGenerateServiceClients()) {
            ClientStyle serviceClientStyle = kopt.getServiceClientStyle();
            if (serviceClientStyle == null) {
                serviceClientStyle = ClientStyle.DEFAULT;
            }

            switch (serviceClientStyle) {
                case DEFAULT:
                    // no-op
                    break;
                case NONE:
                    gen.omitServiceClients();
                    break;
                case COROUTINE:
                    gen.coroutineServiceClients();
                    break;
            }
        } else {
            gen.omitServiceClients();
        }

        if (kopt.isGenerateServer()) {
            gen.generateServer();
        }

        if (opts.getListType() != null) {
            gen.listClassName(opts.getListType());
        }

        if (opts.getSetType() != null) {
            gen.setClassName(opts.getSetType());
        }

        if (opts.getMapType() != null) {
            gen.mapClassName(opts.getMapType());
        }

        for (com.squareup.kotlinpoet.FileSpec fs : gen.generate(schema)) {
            fs.writeTo(getParameters().getOutputDirectory().getAsFile().get());
        }
    }