-
Notifications
You must be signed in to change notification settings - Fork 599
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(scripts): build smithy-typescript from specific commit during c…
…odegen (#5139) Co-authored-by: Steven Yuan <[email protected]>
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @ts-check | ||
const { access, rm } = require("fs/promises"); | ||
const { spawnProcess } = require("../utils/spawn-process"); | ||
|
||
const buildSmithyTypeScript = async (repo, commit) => { | ||
let deleteSmithyTsRepo = false; | ||
|
||
// Check out smithy-typescript at repo, if it does not exist. | ||
try { | ||
await access(repo); | ||
} catch (error) { | ||
deleteSmithyTsRepo = true; | ||
await spawnProcess("git", ["clone", "https://github.com/awslabs/smithy-typescript.git", repo]); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
// Checkout commit | ||
const tempBranchName = `temp-${commit}`; | ||
await spawnProcess("git", ["checkout", "-b", tempBranchName, commit], { cwd: repo }); | ||
|
||
// Build smithy-typescript and publish to maven local | ||
await spawnProcess("./gradlew", ["clean", "publishToMavenLocal"], { cwd: repo }); | ||
|
||
if (deleteSmithyTsRepo) { | ||
await rm(repo, { recursive: true, force: true }); | ||
} else { | ||
// Delete temp branch | ||
await spawnProcess("git", ["checkout", "main"], { cwd: repo }); | ||
await spawnProcess("git", ["branch", "-D", tempBranchName], { cwd: repo }); | ||
} | ||
}; | ||
|
||
module.exports = { buildSmithyTypeScript }; |
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
ToDo: The smithy-typescript repo can be shallow cloned from
commit
here