Skip to content

Output config structure #738

Closed
dart-archive/jnigen
#93

Description

@dcharkes
  • Added root_package option, which allows simpler hierarchy if all classes are from same package. For example, instead of org/apache/pdfbox/pdmodel.dart we can create pdmodel.dart, by telling that root_package is org.apache.pdfbox.

I presume we add this because it is annoying for people. 😄
Though, Java explicitly doesn't support this.
The question is should we make our bindings look mostly like Java or mostly like Dart? (With ffigen in C, we say that when you write code against generated bindings, you're writing C in Dart syntax. So we're okay with violating dart naming for identifiers etc. With that reasoning, maybe we should stick with the nested folders, because it is more Java-esque.)

I would like to unify everything that influences only output structure in the config:

output:
  dart:
    path: 'lib/src/third_party/pdfbox/'
    output_structure: single_file || package_structure
  c:
    ## Root for generated C bindings.
    path: 'src/'

Also, maybe we could clean up the C output

output:
  dart:
    path: 'lib/src/third_party/pdfbox/'
    output_structure: single_file || package_structure
  c:
    path: 'src/third_party/' # both generated C file and makefile?
    cmake_path: 'src/' # To make Flutter happy?

Originally posted by @dcharkes in dart-archive/jnigen#87 (comment)

Activity

  1. mahesh-hegde commented on Oct 5, 2022

    @mahesh-hegde
    Contributor

    The question is should we make our bindings look mostly like Java or mostly like Dart?

    That's a great question. I am trying to make jnigen-generated packages look like dart packages, which may not really be needed 😃. It seemed pretty easy to implement. Overall it may have required 20 lines max.

    Also output config unification sounds good.

  2. dcharkes commented on Oct 5, 2022

    @dcharkes
    CollaboratorAuthor

    Let's leave out un_nest for now then. If we have many users asking for this later, we can always add it later.

  3. mahesh-hegde commented on Oct 7, 2022

    @mahesh-hegde
    Contributor

    @dcharkes do you want this config format change in the current PR or a later PR? Which one is easier for reviewing?

  4. dcharkes commented on Oct 7, 2022

    @dcharkes
    CollaboratorAuthor

    @dcharkes do you want this config format change in the current PR or a later PR? Which one is easier for reviewing?

    More, smaller PRs is easier for reviewing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions