Skip to content

feat(internal/librarian/php): add google-cloud-php/dev as a tool to install - #7122

Merged
sofisl merged 80 commits into
googleapis:mainfrom
sofisl:runComposerInstall
Aug 10, 2026
Merged

sofisl merged 80 commits into
googleapis:mainfrom
sofisl:runComposerInstall

Conversation

@sofisl

@sofisl sofisl commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

This change adds google-cloud-php/dev as a local_path to install its dependencies that are necessary for library generation. This ensures that PHP-specific tools have their dependencies installed before being executed.

Fixes #6978

@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 adds logic to run composer install during installation if a composer.json file is present, and includes tests to verify this behavior. The review feedback recommends using t.Chdir() to simplify directory changes in tests and preferring errors.Is over os.IsNotExist for checking file existence.

Comment thread internal/librarian/php/install_test.go Resolved
Comment thread internal/librarian/php/install_test.go Resolved
Comment thread internal/librarian/php/install_test.go Resolved
@sofisl
sofisl marked this pull request as ready for review July 29, 2026 20:07
@sofisl
sofisl requested a review from a team as a code owner July 29, 2026 20:07
Comment thread internal/librarian/php/install.go Resolved
Comment thread internal/librarian/php/install.go Resolved
@sofisl
sofisl requested a review from JoeWang1127 July 29, 2026 22:13
@sofisl
sofisl force-pushed the runComposerInstall branch 4 times, most recently from a2080ed to 3488b1f Compare July 29, 2026 22:45
@sofisl
sofisl marked this pull request as draft July 29, 2026 23:34
sofisl added a commit that referenced this pull request Jul 30, 2026
…iguration (#7131)

This change adds `local_path` support to the Composer tool configuration
(analogous to the pip tool) so that we can support more installation
cases (specifically, installing dependencies in the monorepo). This is
split out from
#7122 (comment).

Fixes #7132
sofisl added 7 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.
@sofisl
sofisl force-pushed the runComposerInstall branch from 3488b1f to b999840 Compare July 30, 2026 18:21
sofisl added 9 commits July 30, 2026 18:25
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.
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
nolanleastin and others added 25 commits August 8, 2026 00:41
This unblocks storage v2 generation by providing the ability to skip
duplicated object types.

Example librarian.yaml usage:
```yaml
libraries:
  - name: google-cloud-storage
    swift:
      modules:
        - output: packages/storage/Sources/GoogleCloudStorage/generated/Storage
          api_path: google/storage/v2
          skipped_ids:
            - .google.storage.v2.Storage
```

helps generate googleapis/google-cloud-swift#150
…ide in generate (googleapis#7197)

Add ComponentNameForLibrary to resolve the PHP component name for
staging and output paths. Use component_name as override if explicitly
set. Otherwise, the component name is derived on the fly from the
php_namespace option of the primary API proto file.
    
Update Generate and postProcessLibrary to use the resolved component
name when creating and cleaning up owl-bot-staging directories.


For googleapis#7025
…or (googleapis#7208)

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

Fixes googleapis#7207 
For googleapis#6633
… names from api path (googleapis#7215)

Update php.DefaultLibraryName to derive lowercase hyphenated library
names from API paths (e.g. google/cloud/security/privateca/v1 ->
security-privateca).
    
Update migrate tool to use php.DefaultLibraryName(apis[0].Path) for
library.Name instead of the repository folder name.
    
Fixes googleapis#7024
…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 merged commit 97ed7e2 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): install step for dev/google-cloud tool