File tree 3 files changed +9
-3
lines changed
gapic-generator-java/src/main/java/com/google/api/generator/gapic
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ public class ClientLibraryPackageInfoComposer {
44
44
private static final String SERVICE_DESCRIPTION_HEADER_PATTERN = "Service Description: %s" ;
45
45
46
46
public static GapicPackageInfo generatePackageInfo (GapicContext context ) {
47
- Preconditions .checkState (!context .services ().isEmpty (), "No services found to generate" );
47
+ if (context .services ().isEmpty ()) {
48
+ return GapicPackageInfo .empty ();
49
+ }
48
50
49
51
// Pick some service's package, as we assume they are all the same.
50
52
String libraryPakkage = context .services ().get (0 ).pakkage ();
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ public static GapicPackageInfo with(PackageInfoDefinition packageInfo) {
26
26
return builder ().setPackageInfo (packageInfo ).build ();
27
27
}
28
28
29
+ public static GapicPackageInfo empty () {
30
+ return builder ().setPackageInfo (PackageInfoDefinition .builder ().build ()).build ();
31
+ }
32
+
29
33
static Builder builder () {
30
34
return new AutoValue_GapicPackageInfo .Builder ();
31
35
}
Original file line number Diff line number Diff line change @@ -176,13 +176,13 @@ public static GapicContext parse(CodeGeneratorRequest request) {
176
176
transport );
177
177
178
178
if (services .isEmpty ()) {
179
- //throw new NoServicesFoundException( );
179
+ System . err . println ( "No services found. Will not generate Gapic clients" );
180
180
}
181
181
182
182
// TODO(vam-google): Figure out whether we should keep this allowlist or bring
183
183
// back the unused resource names for all APIs.
184
184
// Temporary workaround for Ads, who still need these resource names.
185
- if (services .get (0 ).protoPakkage ().startsWith ("google.ads.googleads.v" )) {
185
+ if (! services . isEmpty () && services .get (0 ).protoPakkage ().startsWith ("google.ads.googleads.v" )) {
186
186
Function <ResourceName , String > typeNameFn =
187
187
r -> r .resourceTypeString ().substring (r .resourceTypeString ().indexOf ("/" ) + 1 );
188
188
Function <Set <ResourceName >, Set <String >> typeStringSetFn =
You can’t perform that action at this time.
0 commit comments