Skip to content

Commit ee9fdde

Browse files
committed
chore(scripts): override smithy partitions
1 parent e4af3e3 commit ee9fdde

File tree

3 files changed

+94
-3
lines changed

3 files changed

+94
-3
lines changed

scripts/generate-clients/code-gen.js

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,23 @@ const generateClient = async (clientName) => {
3131
const filename = `${clientName}.json`;
3232
copyFileSync(join(DEFAULT_CODE_GEN_INPUT_DIR, filename), join(TEMP_CODE_GEN_INPUT_DIR_SERVICE, filename));
3333

34-
await spawnProcess("./gradlew", options, { cwd: CODE_GEN_ROOT });
34+
await spawnProcess("./gradlew", options, {
35+
cwd: CODE_GEN_ROOT,
36+
env: {
37+
...process.env,
38+
AWS_PARTITIONS_FILE_OVERRIDE: join(
39+
__dirname,
40+
"..",
41+
"..",
42+
"packages",
43+
"util-endpoints",
44+
"src",
45+
"lib",
46+
"aws",
47+
"partitions.json"
48+
),
49+
},
50+
});
3551
rmSync(join(__dirname, "..", "..", "codegen", "sdk-codegen", `smithy-build-${clientName}.json`));
3652
};
3753

@@ -51,7 +67,23 @@ const generateClients = async (models, batchSize) => {
5167
const filename = basename(filepath);
5268
copyFileSync(filepath, join(TEMP_CODE_GEN_INPUT_DIR, filename));
5369
}
54-
await spawnProcess("./gradlew", options, { cwd: CODE_GEN_ROOT });
70+
await spawnProcess("./gradlew", options, {
71+
cwd: CODE_GEN_ROOT,
72+
env: {
73+
...process.env,
74+
AWS_PARTITIONS_FILE_OVERRIDE: join(
75+
__dirname,
76+
"..",
77+
"..",
78+
"packages",
79+
"util-endpoints",
80+
"src",
81+
"lib",
82+
"aws",
83+
"partitions.json"
84+
),
85+
},
86+
});
5587
// We're copying generated code to temporary directory as it's cleans
5688
// codegen directory in every run.
5789
// Refs: https://github.com/aws/aws-sdk-js-v3/issues/3321
@@ -64,12 +96,40 @@ const generateClients = async (models, batchSize) => {
6496
const generateProtocolTests = async () => {
6597
await spawnProcess("./gradlew", [":protocol-test-codegen:clean", ":protocol-test-codegen:build"], {
6698
cwd: CODE_GEN_ROOT,
99+
env: {
100+
...process.env,
101+
AWS_PARTITIONS_FILE_OVERRIDE: join(
102+
__dirname,
103+
"..",
104+
"..",
105+
"packages",
106+
"util-endpoints",
107+
"src",
108+
"lib",
109+
"aws",
110+
"partitions.json"
111+
),
112+
},
67113
});
68114
};
69115

70116
const generateGenericClient = async () => {
71117
await spawnProcess("./gradlew", [":smithy-aws-typescript-codegen:clean", ":generic-client-test-codegen:build"], {
72118
cwd: CODE_GEN_ROOT,
119+
env: {
120+
...process.env,
121+
AWS_PARTITIONS_FILE_OVERRIDE: join(
122+
__dirname,
123+
"..",
124+
"..",
125+
"packages",
126+
"util-endpoints",
127+
"src",
128+
"lib",
129+
"aws",
130+
"partitions.json"
131+
),
132+
},
73133
});
74134
};
75135

scripts/generate-clients/nested-clients/generate-nested-clients.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,24 @@ async function generateNestedClient(clientName, operations) {
9999
});
100100
writeFileSync(targetModelPath, JSON.stringify(model, null, 2) + "\n");
101101

102-
await spawnProcess("./gradlew", options, { cwd: CODE_GEN_ROOT });
102+
await spawnProcess("./gradlew", options, {
103+
cwd: CODE_GEN_ROOT,
104+
env: {
105+
...process.env,
106+
AWS_PARTITIONS_FILE_OVERRIDE: join(
107+
__dirname,
108+
"..",
109+
"..",
110+
"..",
111+
"packages",
112+
"util-endpoints",
113+
"src",
114+
"lib",
115+
"aws",
116+
"partitions.json"
117+
),
118+
},
119+
});
103120
rmSync(join(__dirname, "..", "..", "..", "codegen", "sdk-codegen", `smithy-build-${clientName}.json`));
104121
}
105122

scripts/generate-defaults-mode-provider/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ const { CODE_GEN_ROOT } = require("../generate-clients/code-gen-dir");
77
const run = async () => {
88
await spawnProcess("./gradlew", [":sdk-codegen:generate-default-configs-provider"], {
99
cwd: CODE_GEN_ROOT,
10+
env: {
11+
...process.env,
12+
AWS_PARTITIONS_FILE_OVERRIDE: join(
13+
__dirname,
14+
"..",
15+
"..",
16+
"packages",
17+
"util-endpoints",
18+
"src",
19+
"lib",
20+
"aws",
21+
"partitions.json"
22+
),
23+
},
1024
});
1125

1226
const DEFAULTS_MODE_CONFIG_DIR = normalize(join(__dirname, "..", "..", "packages", "smithy-client", "src"));

0 commit comments

Comments
 (0)