-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See CHANGELOG ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
10 changed files
with
148 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 26 additions & 6 deletions
32
packages/aws-cdk/lib/init-templates/app/csharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const csprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.csproj'); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', csprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', csprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
}; |
32 changes: 26 additions & 6 deletions
32
packages/aws-cdk/lib/init-templates/app/fsharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const fsprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.fsproj'); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', fsprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', fsprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
}; |
32 changes: 26 additions & 6 deletions
32
packages/aws-cdk/lib/init-templates/sample-app/csharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const csprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.csproj'); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', csprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', csprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.csproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
}; |
32 changes: 26 additions & 6 deletions
32
packages/aws-cdk/lib/init-templates/sample-app/fsharp/add-project.hook.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
import * as child_process from 'child_process'; | ||
import * as path from 'path'; | ||
import { InvokeHook } from '../../../init'; | ||
import { shell } from '../../../os'; | ||
|
||
export const invoke: InvokeHook = async (targetDirectory: string) => { | ||
const slnPath = path.join(targetDirectory, 'src', '%name.PascalCased%.sln'); | ||
const fsprojPath = path.join(targetDirectory, 'src', '%name.PascalCased%', '%name.PascalCased%.fsproj'); | ||
try { | ||
await shell(['dotnet', 'sln', slnPath, 'add', fsprojPath]); | ||
} catch (e) { | ||
throw new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. ${e.message}`); | ||
} | ||
|
||
const child = child_process.spawn('dotnet', ['sln', slnPath, 'add', fsprojPath], { | ||
// Need this for Windows where we want .cmd and .bat to be found as well. | ||
shell: true, | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}); | ||
|
||
await new Promise<string>((resolve, reject) => { | ||
const stdout = new Array<any>(); | ||
|
||
child.stdout.on('data', chunk => { | ||
process.stdout.write(chunk); | ||
stdout.push(chunk); | ||
}); | ||
|
||
child.once('error', reject); | ||
|
||
child.once('exit', code => { | ||
if (code === 0) { | ||
resolve(Buffer.concat(stdout).toString('utf-8')); | ||
} else { | ||
reject(new Error(`Could not add project %name.PascalCased%.fsproj to solution %name.PascalCased%.sln. Error code: ${code}`)); | ||
} | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.