Skip to content

feat: .NET Support#73

Merged
mergify[bot] merged 5 commits intocdklabs:masterfrom
jsteinich:dotnet
Sep 22, 2020
Merged

feat: .NET Support#73
mergify[bot] merged 5 commits intocdklabs:masterfrom
jsteinich:dotnet

Conversation

@jsteinich
Copy link
Copy Markdown
Contributor

Adds support for generating a .NET (C#) project.

I choose namespace rather than package since it seemed more appropriate when generating source code.

I went with dotnet since it matches the jsii naming, but csharp may make more sense for configuration options / cli parameters. I don't believe there are any plans to generate F# code in jsii, but if there were, I'd lean towards using csharp naming.

@eladb
Copy link
Copy Markdown
Contributor

eladb commented Sep 21, 2020

@campionfellin can you take a quick look?

Copy link
Copy Markdown
Contributor

@eladb eladb left a comment

Choose a reason for hiding this comment

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

Great job. Looks great.

Comment thread README.md Outdated

```ts
await srcmak('srcdir', {
dotnet: {
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.

I'd go with csharp here since this is producing source code and not a library (like Pacmak)

Comment thread test/__snapshots__/srcmak.test.ts.snap Outdated
}
}
",
"Hello.World/dotnetpackage-0.0.0.tgz": "��X�o�H�g�
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.

This shouldn't be included in the snapshot

Comment thread src/srcmak.ts
const reldir = options.csharp.namespace;
const source = path.resolve(path.join(workdir, 'dist/dotnet/', reldir));
const target = path.join(options.csharp.outdir, reldir);
await fs.move(source, target, { overwrite: true });
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.

How does dotnet package dependencies work? Just wondering if we should do it similarly to java with:

await ncp(source, target, { clobber: false });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense as is since each module generates a standalone project. Applications would then have project dependencies on the generated projects.

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.

Great!

@campionfellin
Copy link
Copy Markdown
Contributor

LGTM!

@mergify mergify Bot merged commit a0dc5ea into cdklabs:master Sep 22, 2020
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.

3 participants