-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathRakefile
33 lines (29 loc) · 923 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require "bundler/gem_tasks"
task test: :generate do |t|
Dir.chdir('codegen') do
system('rake', 'test') || abort
end
Dir.chdir('support') do
system('swift', 'test') || abort
end
end
task :generate do
require 'graphql_schema'
require 'graphql_swift_gen'
require_relative 'codegen/test/support/schema'
FileUtils.rm_rf(Dir.glob("support/Tests/GraphQLSupportTests/Generated*"))
schema = GraphQLSchema.new(Support::Schema.introspection_result)
GraphQLSwiftGen.new(schema,
nest_under: 'Generated',
import_graphql_support: true,
custom_scalars: [
GraphQLSwiftGen::Scalar.new(
type_name: 'Time',
swift_type: 'Date',
deserialize_expr: ->(expr) { "iso8601DateParser.date(from: #{expr})!" },
serialize_expr: ->(expr) { "iso8601DateParser.string(from: #{expr})" },
),
]
).save("support/Tests/GraphQLSupportTests")
end
task :default => :test