Skip to content

Commit d7d437a

Browse files
authored
Merge pull request #747 from aws-amplify/main
Release Codegen Utility
2 parents 648a2a5 + 211bb0d commit d7d437a

File tree

28 files changed

+365
-86
lines changed

28 files changed

+365
-86
lines changed

.codebuild/build_windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ env:
44
phases:
55
build:
66
commands:
7-
- yarn run production-build
8-
7+
# commands need to be run in stand-alone bash scripts so that bash can be used on windows
8+
- bash ./.codebuild/scripts/build_windows.sh
99
artifacts:
1010
files:
1111
- 'shared-scripts.sh'

.codebuild/e2e_workflow.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ batch:
1616
type: WINDOWS_SERVER_2019_CONTAINER
1717
compute-type: BUILD_GENERAL1_LARGE
1818
image: $WINDOWS_IMAGE_2019
19+
- identifier: test_windows
20+
buildspec: .codebuild/test_windows.yml
21+
env:
22+
type: WINDOWS_SERVER_2019_CONTAINER
23+
compute-type: BUILD_GENERAL1_LARGE
24+
image: $WINDOWS_IMAGE_2019
25+
depend-on:
26+
- build_windows
1927
- identifier: test
2028
buildspec: .codebuild/test.yml
2129
env:

.codebuild/e2e_workflow_base.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ batch:
1616
type: WINDOWS_SERVER_2019_CONTAINER
1717
compute-type: BUILD_GENERAL1_LARGE
1818
image: $WINDOWS_IMAGE_2019
19+
- identifier: test_windows
20+
buildspec: .codebuild/test_windows.yml
21+
env:
22+
type: WINDOWS_SERVER_2019_CONTAINER
23+
compute-type: BUILD_GENERAL1_LARGE
24+
image: $WINDOWS_IMAGE_2019
25+
depend-on:
26+
- build_windows
1927
- identifier: test
2028
buildspec: .codebuild/test.yml
2129
env:

.codebuild/pr_workflow.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ batch:
1414
type: WINDOWS_SERVER_2019_CONTAINER
1515
compute-type: BUILD_GENERAL1_LARGE
1616
image: $WINDOWS_IMAGE_2019
17+
- identifier: test_windows
18+
buildspec: .codebuild/test_windows.yml
19+
env:
20+
type: WINDOWS_SERVER_2019_CONTAINER
21+
compute-type: BUILD_GENERAL1_LARGE
22+
image: $WINDOWS_IMAGE_2019
23+
depend-on:
24+
- build_windows
1725
- identifier: test
1826
buildspec: .codebuild/test.yml
1927
depend-on:

.codebuild/release_workflow.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ batch:
1414
type: WINDOWS_SERVER_2019_CONTAINER
1515
compute-type: BUILD_GENERAL1_LARGE
1616
image: $WINDOWS_IMAGE_2019
17+
- identifier: test_windows
18+
buildspec: .codebuild/test_windows.yml
19+
env:
20+
type: WINDOWS_SERVER_2019_CONTAINER
21+
compute-type: BUILD_GENERAL1_LARGE
22+
image: $WINDOWS_IMAGE_2019
23+
depend-on:
24+
- build_windows
1725
- identifier: test
1826
buildspec: .codebuild/test.yml
1927
depend-on:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# set exit on error to true
4+
set -e
5+
6+
source ./shared-scripts.sh && _buildWindows

.codebuild/scripts/test_windows.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# set exit on error to true
4+
set -e
5+
6+
source ./shared-scripts.sh && _testWindows

.codebuild/test_windows.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 0.2
2+
env:
3+
shell: powershell.exe
4+
phases:
5+
build:
6+
commands:
7+
# commands need to be run in stand-alone bash scripts so that bash can be used on windows
8+
- bash ./.codebuild/scripts/test_windows.sh
9+
artifacts:
10+
files:
11+
- 'shared-scripts.sh'

packages/amplify-codegen-e2e-core/src/utils/graphql-config-helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function constructGraphQLConfig(
3535
extensions.amplify.codeGenTarget = 'swift';
3636
extensions.amplify.docsFilePath = 'graphql';
3737
extensions.amplify.generatedFileName = 'API.swift';
38+
excludes.push('API.swift');
3839
break;
3940
default:
4041
schemaPath = `amplify/backend/api/${projectName}/build/schema.graphql`;

packages/amplify-codegen/src/codegen-config/AmplifyCodeGenConfig.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const graphQLConfig = require('graphql-config');
22
const { isAbsolute, relative, join } = require('path');
33
const slash = require('slash');
44
const { graphQlToAmplifyConfig } = require('./utils');
5-
const fs = require('fs-extra');
5+
const fs = require('fs-extra');
6+
const path = require('path');
67

78
class AmplifyCodeGenConfig {
89
static configFileName = '.graphqlconfig.yml';
@@ -15,10 +16,9 @@ class AmplifyCodeGenConfig {
1516
if (e instanceof graphQLConfig.ConfigNotFoundError) {
1617
const projectRoot = projectPath || process.cwd();
1718
const configPath = join(projectRoot, '.graphqlconfig.yml');
18-
if(fs.existsSync(configPath)) {
19+
if (fs.existsSync(configPath)) {
1920
this.gqlConfig = graphQLConfig.getGraphQLConfig(projectRoot);
20-
}
21-
else {
21+
} else {
2222
this.gqlConfig = new graphQLConfig.GraphQLConfig(null, configPath);
2323
this.gqlConfig.config = {};
2424
}
@@ -45,7 +45,11 @@ class AmplifyCodeGenConfig {
4545
if (!this.constructor.isValidAmplifyProject(project)) {
4646
return false;
4747
}
48-
const schemaPath = isAbsolute(project.schema) ? relative(this.gqlConfig.configDir, project.schema) : project.schema;
48+
// Set schemaPath to use posix separators. Node can handle windows and posix separators regradless of platform
49+
// Ensures all paths in .graphlqconfig.yml use posix style
50+
const schemaPath = (isAbsolute(project.schema) ? relative(this.gqlConfig.configDir, project.schema) : project.schema)
51+
.split(path.win32.sep)
52+
.join(path.posix.sep);
4953
const newProject = {
5054
schemaPath,
5155
includes: project.includes,

0 commit comments

Comments
 (0)