Skip to content

can a diamond dependency be used #2256

@shivlaks

Description

@shivlaks

❓ Guidance

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: 1.14.1
  • Platform: macOS Catalina (10.15.7)

The Question

Is it possible to use a diamond dependency if there are no conflicting (potentially duplicated) properties?
A recent CDK PR motivated this question where a construct was updated to declare interfaces in the following manner:
image

a simplified view of the interface declarations here looks like the following:

interface CommonStartBuildOptions {
  readonly buildSpec?: BuildSpec;
  readonly encryptionKey?: kms.IKey;
  readonly cache?: Cache;
  readonly environment?: BuildEnvironment;
  readonly role?: iam.IRole;
  /**
   * The number of minutes after which AWS CodeBuild stops the build if it's
   * not complete. For valid values, see the timeoutInMinutes field in the AWS
   * CodeBuild User Guide.
   *
   * @default Duration.hours(1)
   */
  readonly timeout?: Duration;
  readonly environmentVariables?: { [name: string]: BuildEnvironmentVariable };
}

export interface StartBuildOptions extends CommonStartBuildOptions {
  readonly source?: ISource;
  readonly artifacts?: IArtifacts;
  readonly secondarySources?: ISource[];
  readonly secondaryArtifacts?: IArtifacts[];
}

export interface CommonProjectProps extends CommonStartBuildOptions {
  readonly description?: string;
  readonly badge?: boolean;
  readonly projectName?: string;
  readonly vpc?: ec2.IVpc;
  readonly subnetSelection?: ec2.SubnetSelection;
  readonly securityGroups?: ec2.ISecurityGroup[];
  readonly allowAllOutbound?: boolean;
  readonly fileSystemLocations?: IFileSystemLocation[];
  readonly grantReportGroupPermissions?: boolean;
}

export interface ProjectProps extends StartBuildOptions, CommonProjectProps {
}

However there was a failure with the java code generation:

[ERROR] /tmp/npm-packf10vHL/monocdk/src/main/java/software/amazon/awscdk/services/codebuild/ProjectProps.java:[10,8] interface software.amazon.awscdk.services.codebuild.ProjectProps inherits unrelated defaults for getTimeout() from types software.amazon.awscdk.services.codebuild.StartBuildOptions and software.amazon.awscdk.services.codebuild.CommonProjectProps

Is this something that we could support? If not, perhaps it's an opportunity to validate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions