-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(type-safe-api): platform agnostic copies for gradle wrapper and …
…smithy transformer (#862) Rewrite the copy scripts in TypeScript instead of bash, and move as subcommands of the type-safe-api script. This is now more consistent with the other scripts, and has the advantage of being platform agnostic via node.
- Loading branch information
Showing
14 changed files
with
106 additions
and
115 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
packages/type-safe-api/scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
packages/type-safe-api/scripts/type-safe-api/custom/gradle-wrapper/copy-gradle-wrapper.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
|
||
const GRADLE_WRAPPER_DIR = "gradle/wrapper"; | ||
|
||
const copyFromScriptDir = (rootScriptDir: string, file: string) => { | ||
if (!fs.existsSync(file)) { | ||
fs.copyFileSync(path.join(rootScriptDir, "custom", "gradle-wrapper", file), file); | ||
} | ||
} | ||
|
||
export default async (_argv: string[], rootScriptDir: string) => { | ||
// Create the gradle wrapper directory if it doesn't already exist | ||
fs.mkdirSync(GRADLE_WRAPPER_DIR, { recursive: true }); | ||
|
||
// Copy the gradle wrapper files into the working directory | ||
[ | ||
path.join(GRADLE_WRAPPER_DIR, "gradle-wrapper.jar"), | ||
path.join(GRADLE_WRAPPER_DIR, "gradle-wrapper.properties"), | ||
"gradlew", | ||
"gradlew.bat", | ||
].forEach((file) => copyFromScriptDir(rootScriptDir, file)); | ||
}; |
15 changes: 0 additions & 15 deletions
15
...ages/type-safe-api/scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...s/type-safe-api/scripts/type-safe-api/custom/smithy-async-transformer/copy-transformer.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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 */ | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
|
||
const SMITHY_ASYNC_DIR = ".smithy-async"; | ||
const JAR_NAME = "aws-pdk-smithy-async-transformer.jar"; | ||
|
||
export default async (_argv: string[], rootScriptDir: string) => { | ||
// Create the smithy transformer dir | ||
fs.mkdirSync(SMITHY_ASYNC_DIR, { recursive: true }); | ||
|
||
// Copy the jar if it doesn't already exist | ||
const sourceJarPath = path.join(rootScriptDir, "custom", "smithy-async-transformer", JAR_NAME); | ||
const destinationJarPath = path.join(SMITHY_ASYNC_DIR, JAR_NAME); | ||
|
||
if (!fs.existsSync(destinationJarPath)) { | ||
fs.copyFileSync(sourceJarPath, destinationJarPath); | ||
} | ||
}; |
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: 16 additions & 16 deletions
32
packages/type-safe-api/test/project/__snapshots__/type-safe-api-project.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.