Giter Club home page Giter Club logo

Comments (3)

Tatskaari avatar Tatskaari commented on June 18, 2024

The plugin settings are either inherited from the host repo, or overridden by the subrepo. This is defined by the plugin e.g. DefaultOptFlags is inherited:
https://github.com/please-build/cc-rules/blob/master/.plzconfig#L47

This means that we will use the flags as defined in the host repo. I think this is probably what you want most of the time, because these flags can be dependant on the toolchain you're using. Maybe we need another config option called AdditionalOptFlags that is not inherited that allows B to provide any other flags that should be applied on top of the flags from the host repo? Would that help?

from please.

izissise avatar izissise commented on June 18, 2024

As a workaround for this issue, I've been doing something similar to this :

buildfile = text_file(
    name="BUILD.plz",
    visibility=["PUBLIC"],
    strip=True,
    content=f"""
        CONFIG["OS"] = '{goos}'
        CONFIG["ARCH"] = '{goarch}'
        CONFIG["GO"] = {{
            'PLEASE_GO_TOOL': '{please_go_tool_tl}',
            'GO_TOOL': '{go_tool}',
            'AR_TOOL': '{ar_tool}',
            'CC_TOOL': '{cc_tool}',
            'STRIP_TOOL': '{strip_tool}',
            'C_FLAGS': [],
            'LD_FLAGS': [],
            'BUILDMODE': '{buildmode}',
            'CGO_ENABLED': '{cgo_enabled}',
            'COVERAGEREDESIGN': False,
            'CPP_COVERAGE': False,
            'DEFAULT_STATIC': {default_static},
            'DELVE_TOOL': 'dlv',
            'PKG_INFO': True,
            'RACE': False,
            'TEST_ROOT_COMPAT': False,
            'VALIDATE_MODULE_VERSION': False,
            'IMPORT_PATH': None,
            'LEGACY_IMPORTS': None,
            'SPLIT_DEBUG_INFO': None,
            'REQUIRE_LICENCES': None,
            'STDLIB': None,
        }}
        # build file
    """,
)

repo = filegroup(
    name="srepo",
    srcs = [buildfile, tree]
)

subrepo(
    name=subrepo_name,
    dep=repo,
    package_root=f"pkg/{CONFIG.OS}_{CONFIG.ARCH}/{module}",
)

This create a BUILD file for the subrepo that will override every config keys first and then do the actual work, you can even completely remove PluginDefinition from .plzconfig

I still get this bug #2943 though

from please.

cemeceme avatar cemeceme commented on June 18, 2024

Sorry for the late response.

The issue I'm facing is that I have transient plugins that need different settings for other plugins.

In my case, I have a c++20 project, which depends on 2 other c++ projects using please. Namely, a library I wrote & mysql-connector-cpp (I wrote a diff file to add please support for it).
The issue is that the latter sub-repo only compiles with c++17 but I cant seem to define a .please file that overrides DefaultOptCppflags/DefaultDbgCppflags just for it.
Instead I had to define something like what izissise suggested and assign a variable to all compiler_flags arguments of cc_library within the sub-repo.

Further issues arise as mysql-connector-cpp also provides a modified version of the protobuf compiler, so even though any projects that depend on it should not care, they still have to define the please proto rules and their arguments in the root .plzconfig file.

While something like AdditionalOptFlags would help, a more plugin agnostic approach would be better. Ideally, the root repo would not have to define what tools/other plugins are needed for the sub-repos it uses. Especially for things like internal compilers that wouldnt be used outside of the sub-repo in the first place.

If it helps, I can also look into creating a public repo for the patch file I made for mysql-connector-cpp, though right now it only adds the minimum required please support to it (I have not tried to dynamically generate version strings etc. that their current cmake setup does).

from please.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.