Skip to content

Commit ef017ef

Browse files
authored
fix: use relative path in gradle codegen task (#980)
1 parent 15a66c7 commit ef017ef

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

Diff for: codegen/sdk-codegen/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tasks.register("generate-smithy-build") {
4242
doLast {
4343
val projectionsBuilder = Node.objectNodeBuilder()
4444
val modelsDirProp: String by project
45-
val models = File(modelsDirProp)
45+
val models = project.file(modelsDirProp);
4646

4747
fileTree(models).filter { it.isFile }.files.forEach { file ->
4848
val (sdkId, version, remaining) = file.name.split(".")

Diff for: scripts/generate-clients/code-gen-dir.js

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const { join, normalize } = require("path");
22

33
const CODE_GEN_ROOT = normalize(join(__dirname, "..", "..", "codegen"));
44

5+
const CODE_GEN_TASK_ROOT = join(CODE_GEN_ROOT, "sdk-codegen");
6+
57
const TEMP_CODE_GEN_INPUT_DIR = normalize(join(__dirname, ".aws-models"));
68

79
const CODE_GEN_OUTPUT_DIR = normalize(
@@ -19,6 +21,7 @@ const CODE_GEN_OUTPUT_DIR = normalize(
1921

2022
module.exports = {
2123
CODE_GEN_ROOT,
24+
CODE_GEN_TASK_ROOT,
2225
CODE_GEN_OUTPUT_DIR,
2326
TEMP_CODE_GEN_INPUT_DIR
2427
};

Diff for: scripts/generate-clients/code-gen.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ const path = require("path");
22
const { copyFileSync, emptyDirSync } = require("fs-extra");
33
const { readdirSync, lstatSync } = require("fs");
44
const { spawnProcess } = require("./spawn-process");
5-
const { CODE_GEN_ROOT, TEMP_CODE_GEN_INPUT_DIR } = require("./code-gen-dir");
5+
const {
6+
CODE_GEN_ROOT,
7+
CODE_GEN_TASK_ROOT,
8+
TEMP_CODE_GEN_INPUT_DIR
9+
} = require("./code-gen-dir");
610
const Glob = require("glob");
711

812
async function generateClients(models) {
@@ -47,7 +51,12 @@ async function generateClients(models) {
4751
}
4852
const options = [":sdk-codegen:clean", ":sdk-codegen:build"];
4953
if (designatedModels) {
50-
options.push(`-PmodelsDirProp=${TEMP_CODE_GEN_INPUT_DIR}`);
54+
options.push(
55+
`-PmodelsDirProp=${path.relative(
56+
CODE_GEN_TASK_ROOT,
57+
TEMP_CODE_GEN_INPUT_DIR
58+
)}`
59+
);
5160
}
5261
await spawnProcess("./gradlew", options, {
5362
cwd: CODE_GEN_ROOT

Diff for: scripts/generate-clients/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "clients"));
1414
const { models, globs, output: clientsDir } = yargs
1515
.alias("m", "models")
1616
.string("m")
17-
.describe("m", "The directory of models.")
17+
.describe("m", "The path to directory with models.")
1818
.alias("g", "globs")
1919
.array("g")
2020
.describe("g", "A list of smithy model globs")

0 commit comments

Comments
 (0)