Skip to content

fix(internal/librarian/php): remove --side_loaded_root_dir option in install - #7141

Merged
sofisl merged 96 commits into
googleapis:mainfrom
sofisl:removeSideLoad
Aug 10, 2026
Merged

sofisl merged 96 commits into
googleapis:mainfrom
sofisl:removeSideLoad

Conversation

@sofisl

@sofisl sofisl commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

This PR completes the refactoring effort to make the PHP Composer tool installation logic fully generic.
Now that wrapper script generation is decoupled from the gapic-generator-php package name (completed in PR #7156), we can safely remove the hardcoded --side_loaded_root_dir "$GOOGLEAPIS_DIR" flag from the bash wrapper script template. Because the wrapper simply forwards all arguments ("$@"), this change makes the PHP wrapper logic completely generic and cleanly reusable for any future Composer tool that specifies an entrypoint.

In order to remove the option, we've plumbed the absolute path of the necessary arguments for the generator.

Fixes #7000

sofisl added 20 commits July 30, 2026 18:20
This change modifies Librarian to automatically run composer install
during the php tool installation phase if a composer.json is found in
the current working directory. This ensures that PHP-specific tools
like dev/google-cloud component:new have their dependencies installed
before being executed.

Fixes googleapis#6978
This change modifies Librarian to use the internal command.RunStreaming helper instead of os/exec.CommandContext to reduce boilerplate. It also adds comments to clarify the different composer install commands.
This change modifies Librarian to encapsulate the composer installation logic into composer.InstallProject, making it consistent with other package installations.
The composer tool installation step now strictly requires a composer.json
file to exist in the target path. This change updates the php tools tests
and the github action to create a dummy composer.json file where necessary.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the PHP generator to resolve absolute paths for configuration files using googleapisDir instead of relying on the --side_loaded_root_dir flag. It also generalizes the Composer tool installation by dynamically checking for executable entry points in vendor/bin/ or falling back to src/Main.php. Feedback on the changes suggests handling potential errors from os.Stat and returning an explicit error if no executable entry point is found, rather than silently proceeding.

Comment thread internal/tool/composer/composer.go Resolved
@sofisl sofisl changed the title fix:internal/librarian/php): remove --side_loaded_root_dir option in install fix(internal/librarian/php): remove --side_loaded_root_dir option in install Jul 30, 2026
When creating a dummy composer.json in the github action for PHP tests,
composer install defaults to using the vendor/ directory for php packages.
This causes issues since subsequent Go commands detect the vendor/ directory
and fail because their vendor/modules.txt and vendor directory were overwritten
or confused by composer.
Setting vendor-dir in the composer.json configuration prevents this collision.

Fixes googleapis#7122
@sofisl
sofisl marked this pull request as ready for review July 30, 2026 22:31
@sofisl
sofisl requested a review from a team as a code owner July 30, 2026 22:31
Comment thread internal/librarian/php/generate.go Resolved
Comment thread internal/tool/composer/composer.go Resolved
JoeWang1127 and others added 22 commits August 8, 2026 00:41
…oogleapis#7210)

The Ruby GAPIC generator options builder now checks if a gem namespace
is configured in the Ruby Cloud options and appends the
`ruby-cloud-gem-namespace` argument when present.

Fixes googleapis#7209
For googleapis#6633
Signed-off-by: Brian Quinlan <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
)

A new `internal/proto` package is added to provide shared helper
functions for discovering and gathering protobuf files across language
generators.

The Gather function supports recursive search while skipping
subdirectories for non-recursive paths such as `google/api`,
`google/cloud`, and `google/rpc`.

The Java generator is updated to use proto.Gather, replacing redundant
gathering logic and unit tests in internal/librarian/java.

For googleapis#7217
…n convert-prost (googleapis#7211)

Repeated enum fields in convert-prost templates were using v.into(),
which caused rustc type inference error because GAPIC builder setters
for repeated fields are generic over any collection T and item V where
V: Into<TargetEnum>. Replacing v.into() with PrimitiveFieldType::from
explicitly specifies the target enum type and resolves the ambiguity.

This has no effect on the current code that is generated since none end
up using this branch. This was discovered while trying to generate
google-cloud-dialogflow-v2.
…oogleapis#7203)

Update Rust client generation templates so bidirectional streaming RPCs
return a request builder rather than directly executing the call on the
client. This aligns bidirectional streaming methods with the builder
pattern used across all other client methods in the Google Cloud Rust
SDK.

The client method now returns a method-specific builder struct. The
generated builder wraps the request builder, exposes a build method to
construct the stream, and omits unary request setters.

For googleapis#6835
Extend the Swift sidekick generator to support converting Protobuf
`oneof` fields between clean Swift struct models and `SwiftProtobuf`
message types.

generates googleapis/google-cloud-swift#167
…gleapis#7212)

External message and enum types referenced by bidirectional streaming
RPCs in hybrid crates were not being generated in convert.rs because
filterModelToStreaming only included messages in the target package.

Populate ExternalMessages and ExternalEnums in hybridModel for external
top-level messages and enums. Override RelativeName for ExternalMessages
and ExternalEnums so ToProto and FromProto implementations generate
cleanly.

Fixes googleapis#7144
…on (googleapis#7214)

If a library's folder name matches the derived component name,
component_name is omitted from librarian.yaml. Only libraries with
custom component name overrides retain component_name in configuration.

Exported `php.ComponentNameForLibrary` to reuse in migrate, added a TODO
to remove it after migration is done.

Test run shows 46 overrides remaining. See more details in
https://paste.googleplex.com/6321381083054080.

Fixes googleapis#7025
…ion (googleapis#7225)

When generating a new PHP library (component directory does not yet
exist in google-cloud-php), Librarian invokes the repository development
tool (dev/google-cloud component:new) with required component options to
scaffold the component skeleton prior to GAPIC generation.

  
For googleapis#7153
…neration (googleapis#7223)

A new `delete_generation_output_paths` configuration option is added to
the Ruby API configuration, allowing specific files and directories
relative to the output directory to be deleted following code
generation.

The generator validates that each configured path exists before deleting
it, helping ensure that obsolete paths are not retained in configuration
files.

For googleapis#6633
…s#7186)

Batch format all generated Java client libraries in a single
`google-java-format` invocation using an argument file (@<filename>).

This avoids per-library JVM startup overhead when formatting multiple
libraries and prevents exceeding OS command-line length limits
(ARG_MAX).

For googleapis#6218

---------

Signed-off-by: yangyzs <[email protected]>
googleapis#7227)

The PHP component initialization parameters previously re-appended the
version suffix to the base namespace. The dev tool expects the root
component namespace without the API version suffix.

This updates newInitParams to use the unversioned namespace directly.

Fixes googleapis#7226
…oogleapis#7221)

Initialize bidirectional streaming RPCs eagerly on send instead of
deferring transport dialing until the first message is written to the
channel in a background task.

Stream builders now support field setters and with_request to configure
the initial request message, and send initiates the stream immediately,
surfacing connection errors to the caller.

This change is intended to be the minimal change needed to move the
initialization logic and does not address other TODOs remaining in the
transport implementation. This includes configuration for the channel
values, which may mean we will not use RequestBuilder directly in the
final implementation.

For googleapis#6835
`librarian bump` works differently for Dart compared to other languages:
1. `bump` for Dart does not work on single libraries
2. `bump` for Dart uses analysis of the package interface as a heuristic
to determine how much to bump the version
3. `bump` also updates CHANGELOG.md and dependency constraints

### Expected publishing workflow:

```bash
$ librarian update # update all SDK descriptions
$ librarian generate --all # regenerate all packages
$ git commit …
$ librarian bump --all # inc the version number of changed packages
$ git commit …
$ librarian publish # publish packages that were updated
$ librarian tag # create a git tag for each published package
```

### Refactors:
1. Moved `FormatTagName` and `HasChangesIn` to
internal/librarian/bump.go from internal/git/git.go

### Repository Package Release Algorithm (excluding edge cases)

1. **Find the dependencies** of all packages in the repository.
2. **Order the packages topologically** so that no package appears
before any of its dependencies.
3. **For each package in order:**
   * **a.** Check if any files have changed since the last release.
* **b.** Use `dart-apitool` to determine the recommended next version.
   * **c.** If the version should be updated:
     * Update the version in `pubspec.yaml`.
     * Update `CHANGELOG.md`.
     * Update the `dependencies:` section of each dependent package.
* Update the version for the package in `cfg.Default.Dart.Packages` if
the package has an entry there.

---------

Signed-off-by: Brian Quinlan <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…oogleapis#7229)

Update bidirectional streaming transport generation to use type-erased
RequestSender and ResponseReceiver handles:

Construct RequestSender via from_fn, performing request serialization
synchronously within the sender closure and returning serialization
errors directly on send(). Construct ResponseReceiver via from_stream,
lazily converting received proto messages on recv().

For googleapis#6835
@sofisl sofisl removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 10, 2026
Comment thread internal/librarian/php/generate.go Resolved
@sofisl
sofisl merged commit bf82078 into googleapis:main Aug 10, 2026
40 checks passed
JoeWang1127 pushed a commit that referenced this pull request Aug 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.36.0](v0.35.0...v0.36.0)
(2026-08-11)


### Features

* **internal/librarian/php:** add google-cloud-php/dev as a tool to
install ([#7122](#7122))
([97ed7e2](97ed7e2))
* **sidekick/impl:** use `GoogleCloudGax._HTTPClient`
([#7237](#7237))
([7e0dc84](7e0dc84))
* **swift:** qualify external package types in module conversions
([#7240](#7240))
([23f3754](23f3754))


### Bug Fixes

* **internal/librarian/php:** remove --side_loaded_root_dir option in
install ([#7141](#7141))
([bf82078](bf82078))
* **sidekick/rust:** BQ query creation metadata not checking skip field
id ([#7232](#7232))
([bda2a49](bda2a49))
* **sidekick/swift:** correct doc links for services
([#7236](#7236))
([f421d6c](f421d6c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php(install/generate): remove --side_loaded_root_dir option in install