objectbox / objectbox/objectbox-dart

Generate files in submodules, not only in root package

Open
#466 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Dart
Stars
1.2k
Forks
162
Avg merge
15m
Merged PRs (30d)
1

Description

In our team we have a multi-package application using Objectbox. For a while we had Objectbox and all classes using it in a root package. Now we want to decouple all of that for root package and move to one of our dependencies.

As you know, Objectbox uses generated files to work. In our case we run build_runner in root_package with the following build.yaml file content:

targets:
  $default:
    sources:
      - modules/**
      - lib/**
      - test/**
      # Note that it is important to include these in the default target.
      - pubspec.*
      - $package$

This allows us to run build_runner only once and have files generated in all our modules (sub-packages). objectbox_generator:resolver handles this nicely as *.objectbox.info files are being generated for our files. objectbox_generator:generator doesn't generate outputs though.

As I see in the generator's source code, It handles files only present in lib of current package, though files of submodules are accessible from buildStep.

Is this behaviour intentional or this can be changed in the future to use files from packages too?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the objectbox_generator:generator source and compare its handling of files under lib with the resolver's *.objectbox.info outputs. Use the supplied build.yaml and buildStep context to investigate submodule inputs. Done means generated ObjectBox files are produced for eligible files in dependency packages while existing root-package generation remains functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
build-system, databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.