Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use relative path in gradle codegen task #980

Merged
merged 1 commit into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/sdk-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks.register("generate-smithy-build") {
doLast {
val projectionsBuilder = Node.objectNodeBuilder()
val modelsDirProp: String by project
val models = File(modelsDirProp)
val models = project.file(modelsDirProp);

fileTree(models).filter { it.isFile }.files.forEach { file ->
val (sdkId, version, remaining) = file.name.split(".")
Expand Down
3 changes: 3 additions & 0 deletions scripts/generate-clients/code-gen-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const { join, normalize } = require("path");

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

const CODE_GEN_TASK_ROOT = join(CODE_GEN_ROOT, "sdk-codegen");

const TEMP_CODE_GEN_INPUT_DIR = normalize(join(__dirname, ".aws-models"));

const CODE_GEN_OUTPUT_DIR = normalize(
Expand All @@ -19,6 +21,7 @@ const CODE_GEN_OUTPUT_DIR = normalize(

module.exports = {
CODE_GEN_ROOT,
CODE_GEN_TASK_ROOT,
CODE_GEN_OUTPUT_DIR,
TEMP_CODE_GEN_INPUT_DIR
};
13 changes: 11 additions & 2 deletions scripts/generate-clients/code-gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ const path = require("path");
const { copyFileSync, emptyDirSync } = require("fs-extra");
const { readdirSync, lstatSync } = require("fs");
const { spawnProcess } = require("./spawn-process");
const { CODE_GEN_ROOT, TEMP_CODE_GEN_INPUT_DIR } = require("./code-gen-dir");
const {
CODE_GEN_ROOT,
CODE_GEN_TASK_ROOT,
TEMP_CODE_GEN_INPUT_DIR
} = require("./code-gen-dir");
const Glob = require("glob");

async function generateClients(models) {
Expand Down Expand Up @@ -47,7 +51,12 @@ async function generateClients(models) {
}
const options = [":sdk-codegen:clean", ":sdk-codegen:build"];
if (designatedModels) {
options.push(`-PmodelsDirProp=${TEMP_CODE_GEN_INPUT_DIR}`);
options.push(
`-PmodelsDirProp=${path.relative(
CODE_GEN_TASK_ROOT,
TEMP_CODE_GEN_INPUT_DIR
)}`
);
}
await spawnProcess("./gradlew", options, {
cwd: CODE_GEN_ROOT
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-clients/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "clients"));
const { models, globs, output: clientsDir } = yargs
.alias("m", "models")
.string("m")
.describe("m", "The directory of models.")
.describe("m", "The path to directory with models.")
.alias("g", "globs")
.array("g")
.describe("g", "A list of smithy model globs")
Expand Down