embulk-input-bigquery_extract_files 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0728b31117097ca0eef206be33646b0e210a85aa
4
- data.tar.gz: 1ce4c3bd0eab4385250bfd7a9876866cd7f4f136
3
+ metadata.gz: 55f1e7dc3d4dcd5ebe905f42c289c4034702718d
4
+ data.tar.gz: eda2e0485a70f8fa63e6f4c292a792bd2af7633a
5
5
  SHA512:
6
- metadata.gz: 123ff54b8d18e9ecefaa1525a74792a98ec56537d5123f3e3a5180b62e92b84454fefe42813420fd4c16b5eddb1c300460918dae787b32291271edc2b28afb4c
7
- data.tar.gz: 6c3872f92860a27bf42eb8ffc9ad71612c9defbd25f41a82234bb09fad62c5fb87492e6bd8bbf10d8b01ec4c928df4824fd8ffed941a7672b9f3e6b4cdcabd08
6
+ metadata.gz: 30debdbcaed3653c29a66a327d5799c4af50fb1783e20244b8aa8ca539dfbcef3a093d159d5678ae684bee2900af44aa7d884a3dc950cd79ecf3eab92eec652e
7
+ data.tar.gz: c7f538f8dcb10b1799e6c38d4e0e9c5477da032a13ce3bede7ba03830b98c7f7961b1c87e5d141c7313e2f1781a141b19466a942ab826cfe67bd2c481586c913
data/.gitignore CHANGED
@@ -1,16 +1,16 @@
1
- *~
2
- /bin/
3
- /pkg/
4
- /tmp/
5
- *.gemspec
6
- .gradle/
7
- /classpath/
8
- build/
9
- .idea
10
- /.settings/
11
- /.metadata/
12
- .classpath
13
- .project
14
- /setenv.bat
15
- /local_config.yml
16
- /local_setenv.bat
1
+ *~
2
+ /bin/
3
+ /pkg/
4
+ /tmp/
5
+ *.gemspec
6
+ .gradle/
7
+ /classpath/
8
+ build/
9
+ .idea
10
+ /.settings/
11
+ /.metadata/
12
+ .classpath
13
+ .project
14
+ /setenv.bat
15
+ /local_config.yml
16
+ /local_setenv.bat
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
-
2
- MIT License
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining
5
- a copy of this software and associated documentation files (the
6
- "Software"), to deal in the Software without restriction, including
7
- without limitation the rights to use, copy, modify, merge, publish,
8
- distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so, subject to
10
- the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be
13
- included in all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+
2
+ MIT License
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,144 +1,168 @@
1
- # Google Cloud Bigquery extract file input plugin for Embulk
2
-
3
- development version.
4
-
5
- ## Overview
6
-
7
- * **Plugin type**: file input
8
- * **Resume supported**: no
9
- * **Cleanup supported**: yes
10
-
11
- ### Detail
12
-
13
- Read files stored in Google Cloud Storage, that exported from Google Cloud Bigquery's table or query result.
14
-
15
- Maybe solution for very big data in bigquery.
16
-
17
- If you set **table** config without **query** config,
18
- then just extract table to Google Cloud Storage.
19
-
20
- If you set **query** config,
21
- then query result save to temp table and then extracted that temp table to Google Cloud Storage uri.
22
- see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract
23
-
24
- ## Usage
25
-
26
- ### Install plugin
27
-
28
- ```bash
29
- embulk gem install embulk-input-bigquery_extract_files
30
- ```
31
-
32
- * rubygem url : https://rubygems.org/profiles/jo8937
33
-
34
-
35
- ## Configuration
36
-
37
- - **project**: Google Cloud Platform (gcp) project id (string, required)
38
- - **json_keyfile**: gcp service account's private key with json (string, required)
39
- - **gcs_uri**: bigquery result saved uri. bucket and path names parsed from this uri. (string, required)
40
- - **temp_local_path**: extract files download directory in local machine (string, required)
41
-
42
- - **dataset**: target datasource dataset (string, default: `null`)
43
- - **table**: target datasource table. either query or table are required. (string, default: `null`)
44
- - **query**: target datasource query. either query or table are required. (string, default: `null`)
45
-
46
- - **temp_dataset**: if you use **query** param, query result saved here (string, default: `null`)
47
- - **temp_table**: if you use **query** param, query result saved here. if not set, plugin generate temp name (string, default: `null`)
48
- - **use_legacy_sql**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.useLegacySql (string, default: `false`)
49
- - **cache**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.useQueryCache (string, default: `true`)
50
- - **create_disposition**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.createDisposition (string, default: `CREATE_IF_NEEDED`)
51
- - **write_disposition**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.writeDisposition (string, default: `WRITE_APPEND`)
52
-
53
- - **file_format**: Table extract file format. see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract.destinationFormat (string, default: `CSV`)
54
- - **compression**: Table extract file compression setting. see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract.compression (string, default: `GZIP`)
55
-
56
- - **temp_schema_file_path**: bigquery result schema file for parser. (Optional) (string, default: `null`)
57
-
58
- - **bigquery_job_wait_second**: bigquery job waiting second. (Optional) (string, default: `600`)
59
-
60
- - **cleanup_gcs_before_executing**: delete all file in gcs temp path before process start (Optional) (string, default: `true`)
61
-
62
- - **cleanup_gcs_files**: delete all file in gcs temp path after process end (Optional) (string, default: `false`)
63
-
64
- - **cleanup_temp_table**: delete query result table after process end (Optional) (string, default: `true`)
65
-
66
- - **cleanup_local_temp_files**: delete all file in local temp dir (Optional) (string, default: `true`)
67
-
68
- - **decoders**: embulk java-file-input plugin's default attribute. see : http://www.embulk.org/docs/built-in.html#gzip-decoder-plugin
69
- - **parser**: embulk java-file-input plugin's default .attribute see : http://www.embulk.org/docs/built-in.html#csv-parser-plugin
70
-
71
- ## Example
72
-
73
- ```yaml
74
- in:
75
- type: bigquery_extract_files
76
- project: googlecloudplatformproject
77
- json_keyfile: gcp-service-account-private-key.json
78
- dataset: target_dataset
79
- #table: target_table
80
- query: 'select a,b,c from target_table'
81
- gcs_uri: gs://bucket/subdir
82
- temp_dataset: temp_dataset
83
- temp_local_path: C:\Temp
84
- file_format: 'NEWLINE_DELIMITED_JSON'
85
- compression: 'GZIP'
86
- decoders:
87
- - {type: gzip}
88
- parser:
89
- type: json
90
- out:
91
- type: stdout
92
- ```
93
-
94
- ### Advenced Example
95
-
96
- #### bigquery to mysql with auto-schema
97
-
98
- I have to batch bigquery table to mysql every day for my job.
99
- then, I wan'to get auto-schema for this file input plugin.
100
-
101
- - see also
102
- - https://github.com/jo8937/embulk-parser-csv_with_schema_file
103
- - https://github.com/embulk/embulk-output-jdbc/tree/master/embulk-output-mysql
104
-
105
- this is my best practive for bigquery to mysql batch config.
106
-
107
- ```yaml
108
- in:
109
- type: bigquery_extract_files
110
- project: my-google-project
111
- json_keyfile: /tmp/embulk/google_service_account.json
112
- query: 'select * from dataset.t_nitocris'
113
- temp_dataset: temp_dataset
114
- gcs_uri: gs://bucket/embulktemp/t_nitocris_*
115
- temp_local_path: /tmp/embulk/data
116
- file_format: 'CSV'
117
- compression: 'GZIP'
118
- temp_schema_file_path: /tmp/embulk/schema/csv_schema_nitocris.json
119
- decoders:
120
- - {type: gzip}
121
- parser:
122
- type: csv_with_schema_file
123
- default_timestamp_format: '%Y-%m-%d %H:%M:%S %z'
124
- schema_path: /tmp/embulk/schema/csv_schema_nitocris.json
125
- out:
126
- type: mysql
127
- host: host
128
- user: user
129
- password: password
130
- port: 3306
131
- database: MY_DATABASE
132
- table:
133
- options: {connectTimeout: 0, waitTimeout: 0, enableQueryTimeouts: false, autoReconnect: true}
134
- mode: insert_direct
135
- retry_limit: 60
136
- retry_wait: 3000
137
- batch_size: 4096000
138
- ```
139
-
140
- ## Build
141
-
142
- ```
143
- $ ./gradlew gem # -t to watch change of files and rebuild continuously
144
- ```
1
+ # Google Cloud Bigquery extract file input plugin for Embulk
2
+
3
+ embulk file input plugin.
4
+
5
+ - embulk : http://www.embulk.org/docs/
6
+
7
+ - embulk plugins : http://www.embulk.org/plugins/
8
+
9
+ Read files stored in Google Cloud Storage that extracted from Google Cloud Bigquery's table or query result.
10
+
11
+ ## Overview
12
+
13
+ * **Plugin type**: file input
14
+ * **Resume supported**: no
15
+ * **Cleanup supported**: yes
16
+
17
+ ### Detail
18
+
19
+ Read files stored in Google Cloud Storage, that exported from Google Cloud Bigquery's table or query result.
20
+
21
+ Maybe solution for very big data in bigquery.
22
+
23
+ If you set **table** config without **query** config,
24
+ then just extract table to Google Cloud Storage.
25
+
26
+ If you set **query** config,
27
+ then query result save to temp table and then extracted that temp table to Google Cloud Storage uri.
28
+ see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract
29
+
30
+ ## Usage
31
+
32
+ ### Install plugin
33
+
34
+ ```bash
35
+ embulk gem install embulk-input-bigquery_extract_files
36
+ ```
37
+
38
+ * rubygem url : https://rubygems.org/profiles/jo8937
39
+
40
+
41
+ ## Configuration
42
+
43
+ - **project**: Google Cloud Platform (gcp) project id (string, required)
44
+ - **json_keyfile**: gcp service account's private key with json (string, required)
45
+ - **gcs_uri**: bigquery result saved uri. bucket and path names parsed from this uri. (string, required)
46
+ - **temp_local_path**: extract files download directory in local machine (string, required)
47
+
48
+ - **dataset**: target datasource dataset (string, default: `null`)
49
+ - **table**: target datasource table. either query or table are required. (string, default: `null`)
50
+ - **query**: target datasource query. either query or table are required. (string, default: `null`)
51
+
52
+ - **temp_dataset**: if you use **query** param, query result saved here (string, default: `null`)
53
+ - **temp_table**: if you use **query** param, query result saved here. if not set, plugin generate temp name (string, default: `null`)
54
+ - **use_legacy_sql**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.useLegacySql (string, default: `false`)
55
+ - **cache**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.useQueryCache (string, default: `true`)
56
+ - **create_disposition**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.createDisposition (string, default: `CREATE_IF_NEEDED`)
57
+ - **write_disposition**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.writeDisposition (string, default: `WRITE_APPEND`)
58
+
59
+ - **file_format**: Table extract file format. see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract.destinationFormat (string, default: `CSV`)
60
+ - **compression**: Table extract file compression setting. see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract.compression (string, default: `GZIP`)
61
+
62
+ - **temp_schema_file_path**: bigquery result schema file for parser. (Optional) (string, default: `null`)
63
+
64
+ - **bigquery_job_wait_second**: bigquery job waiting second. (Optional) (string, default: `600`)
65
+
66
+ - **cleanup_gcs_before_executing**: delete all file in gcs temp path before process start (Optional) (string, default: `true`)
67
+
68
+ - **cleanup_gcs_files**: delete all file in gcs temp path after process end (Optional) (string, default: `false`)
69
+
70
+ - **cleanup_temp_table**: delete query result table after process end (Optional) (string, default: `true`)
71
+
72
+ - **cleanup_local_temp_files**: delete all file in local temp dir (Optional) (string, default: `true`)
73
+
74
+ - **decoders**: embulk java-file-input plugin's default attribute. see : http://www.embulk.org/docs/built-in.html#gzip-decoder-plugin
75
+ - **parser**: embulk java-file-input plugin's default .attribute see : http://www.embulk.org/docs/built-in.html#csv-parser-plugin
76
+
77
+ ## Example
78
+
79
+ ```yaml
80
+ in:
81
+ type: bigquery_extract_files
82
+ project: googlecloudplatformproject
83
+ json_keyfile: gcp-service-account-private-key.json
84
+ dataset: target_dataset
85
+ #table: target_table
86
+ query: 'select a,b,c from target_table'
87
+ gcs_uri: gs://bucket/subdir
88
+ temp_dataset: temp_dataset
89
+ temp_local_path: C:\Temp
90
+ file_format: 'NEWLINE_DELIMITED_JSON'
91
+ compression: 'GZIP'
92
+ decoders:
93
+ - {type: gzip}
94
+ parser:
95
+ type: json
96
+ out:
97
+ type: stdout
98
+ ```
99
+
100
+ ### Advenced Example
101
+
102
+ #### bigquery to mysql with auto-schema
103
+
104
+ I have to batch bigquery table to mysql every day for my job.
105
+ then, I wan'to get auto-schema for this file input plugin.
106
+
107
+ - see also
108
+ - https://github.com/jo8937/embulk-parser-csv_with_schema_file
109
+ - https://github.com/embulk/embulk-output-jdbc/tree/master/embulk-output-mysql
110
+
111
+ this is my best practive for bigquery to mysql batch config.
112
+
113
+ ```yaml
114
+ in:
115
+ type: bigquery_extract_files
116
+ project: my-google-project
117
+ json_keyfile: /tmp/embulk/google_service_account.json
118
+ query: 'select * from dataset.t_nitocris'
119
+ temp_dataset: temp_dataset
120
+ gcs_uri: gs://bucket/embulktemp/t_nitocris_*
121
+ temp_local_path: /tmp/embulk/data
122
+ file_format: 'CSV'
123
+ compression: 'GZIP'
124
+ temp_schema_file_path: /tmp/embulk/schema/csv_schema_nitocris.json
125
+ decoders:
126
+ - {type: gzip}
127
+ parser:
128
+ type: csv_with_schema_file
129
+ default_timestamp_format: '%Y-%m-%d %H:%M:%S %z'
130
+ schema_path: /tmp/embulk/schema/csv_schema_nitocris.json
131
+ out:
132
+ type: mysql
133
+ host: host
134
+ user: user
135
+ password: password
136
+ port: 3306
137
+ database: MY_DATABASE
138
+ table:
139
+ options: {connectTimeout: 0, waitTimeout: 0, enableQueryTimeouts: false, autoReconnect: true}
140
+ mode: insert_direct
141
+ retry_limit: 60
142
+ retry_wait: 3000
143
+ batch_size: 4096000
144
+ ```
145
+
146
+ * bigquery's TIMESTAMP value format is not exactly one format in one CSV export. you can define optional 'columns' param in 'csv_with_schema_file' parser for another format like below.
147
+
148
+ ```yml
149
+ ...
150
+ parser:
151
+ type: csv_with_schema_file
152
+ default_timestamp_format: '%Y-%m-%d %H:%M:%S %z'
153
+ schema_path: /tmp/embulk/schema/csv_schema_nitocris.json
154
+ columns:
155
+ - {name: Date2, type: timestamp, format: '%Y-%m-%d %H:%M:%S.%N %z'}
156
+ ```
157
+
158
+ ## Build
159
+
160
+ ```
161
+ $ ./gradlew gem # -t to watch change of files and rebuild continuously
162
+ ```
163
+
164
+ # Another choice
165
+
166
+ This plugin useful for file-input type. but maybe so complicated to use.
167
+
168
+ For portable use, see embulk-input-bigquery : https://github.com/medjed/embulk-input-bigquery
data/build.gradle CHANGED
@@ -1,102 +1,104 @@
1
- plugins {
2
- id "com.jfrog.bintray" version "1.1"
3
- id "com.github.jruby-gradle.base" version "0.1.5"
4
- id "java"
5
- id "checkstyle"
6
- }
7
- import com.github.jrubygradle.JRubyExec
8
- repositories {
9
- mavenCentral()
10
- jcenter()
11
- }
12
- configurations {
13
- provided
14
- }
15
-
16
- version = "0.0.7"
17
-
18
- sourceCompatibility = 1.7
19
- targetCompatibility = 1.7
20
-
21
- dependencies {
22
- compile ("org.embulk:embulk-core:0.8.36")
23
- provided("org.embulk:embulk-core:0.8.36")
24
-
25
- compile "com.google.http-client:google-http-client-jackson2:1.21.0"
26
- compile ('com.google.apis:google-api-services-bigquery:v2-rev363-1.23.0') {exclude module: "guava-jdk5"}
27
- compile ("com.google.apis:google-api-services-storage:v1-rev59-1.21.0") {exclude module: "guava-jdk5"}
28
-
29
- testCompile "junit:junit:4.+"
30
- testCompile "org.embulk:embulk-core:0.8.36:tests"
31
- testCompile "org.embulk:embulk-standards:0.8.36"
32
- }
33
-
34
- task classpath(type: Copy, dependsOn: ["jar"]) {
35
- doFirst { file("classpath").deleteDir() }
36
- from (configurations.runtime - configurations.provided + files(jar.archivePath))
37
- into "classpath"
38
- }
39
- clean { delete "classpath" }
40
-
41
- checkstyle {
42
- configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
43
- toolVersion = '6.14.1'
44
- }
45
- checkstyleMain {
46
- configFile = file("${project.rootDir}/config/checkstyle/default.xml")
47
- ignoreFailures = true
48
- }
49
- checkstyleTest {
50
- configFile = file("${project.rootDir}/config/checkstyle/default.xml")
51
- ignoreFailures = true
52
- }
53
- task checkstyle(type: Checkstyle) {
54
- classpath = sourceSets.main.output + sourceSets.test.output
55
- source = sourceSets.main.allJava + sourceSets.test.allJava
56
- }
57
-
58
- task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
59
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
60
- script "${project.name}.gemspec"
61
- doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
62
- }
63
-
64
- task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
65
- jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
66
- script "pkg/${project.name}-${project.version}.gem"
67
- }
68
-
69
- task "package"(dependsOn: ["gemspec", "classpath"]) {
70
- doLast {
71
- println "> Build succeeded."
72
- println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
73
- }
74
- }
75
-
76
- task gemspec {
77
- ext.gemspecFile = file("${project.name}.gemspec")
78
- inputs.file "build.gradle"
79
- outputs.file gemspecFile
80
- doLast { gemspecFile.write($/
81
- Gem::Specification.new do |spec|
82
- spec.name = "${project.name}"
83
- spec.version = "${project.version}"
84
- spec.authors = ["jo8937"]
85
- spec.summary = %[Bigquery Exports GCS file input plugin for Embulk]
86
- spec.description = %[Reads files stored on Google Cloud Storage, that exportes from Bigquery query result or table]
87
- spec.email = ["jo8937@gmail.com"]
88
- spec.licenses = ["MIT"]
89
- spec.homepage = "https://github.com/jo8937/embulk-input-bigquery_extract_files"
90
-
91
- spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
92
- spec.test_files = spec.files.grep(%r"^(test|spec)/")
93
- spec.require_paths = ["lib"]
94
-
95
- #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
96
- spec.add_development_dependency 'bundler', ['~> 1.0']
97
- spec.add_development_dependency 'rake', ['>= 10.0']
98
- end
99
- /$)
100
- }
101
- }
102
- clean { delete "${project.name}.gemspec" }
1
+ plugins {
2
+ id "com.jfrog.bintray" version "1.1"
3
+ id "com.github.jruby-gradle.base" version "0.1.5"
4
+ id "java"
5
+ id "checkstyle"
6
+ }
7
+ import com.github.jrubygradle.JRubyExec
8
+ repositories {
9
+ mavenCentral()
10
+ jcenter()
11
+ }
12
+ configurations {
13
+ provided
14
+ }
15
+
16
+ version = "0.0.9"
17
+
18
+ sourceCompatibility = 1.7
19
+ targetCompatibility = 1.7
20
+
21
+ dependencies {
22
+ compile ("org.embulk:embulk-core:0.8.36")
23
+ provided("org.embulk:embulk-core:0.8.36")
24
+
25
+ compile "com.google.http-client:google-http-client-jackson2:1.21.0"
26
+ //compile ('com.google.apis:google-api-services-bigquery:v2-rev363-1.23.0') {exclude module: "guava-jdk5"}
27
+ compile ('com.google.apis:google-api-services-bigquery:v2-rev402-1.25.0') {exclude module: "guava-jdk5"}
28
+ //compile ("com.google.apis:google-api-services-storage:v1-rev59-1.21.0") {exclude module: "guava-jdk5"}
29
+ compile ("com.google.apis:google-api-services-storage:v1-rev136-1.25.0") {exclude module: "guava-jdk5"}
30
+
31
+ testCompile "junit:junit:4.+"
32
+ testCompile "org.embulk:embulk-core:0.8.36:tests"
33
+ testCompile "org.embulk:embulk-standards:0.8.36"
34
+ }
35
+
36
+ task classpath(type: Copy, dependsOn: ["jar"]) {
37
+ doFirst { file("classpath").deleteDir() }
38
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
39
+ into "classpath"
40
+ }
41
+ clean { delete "classpath" }
42
+
43
+ checkstyle {
44
+ configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
45
+ toolVersion = '6.14.1'
46
+ }
47
+ checkstyleMain {
48
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
49
+ ignoreFailures = true
50
+ }
51
+ checkstyleTest {
52
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
53
+ ignoreFailures = true
54
+ }
55
+ task checkstyle(type: Checkstyle) {
56
+ classpath = sourceSets.main.output + sourceSets.test.output
57
+ source = sourceSets.main.allJava + sourceSets.test.allJava
58
+ }
59
+
60
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
61
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
62
+ script "${project.name}.gemspec"
63
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
64
+ }
65
+
66
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
67
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
68
+ script "pkg/${project.name}-${project.version}.gem"
69
+ }
70
+
71
+ task "package"(dependsOn: ["gemspec", "classpath"]) {
72
+ doLast {
73
+ println "> Build succeeded."
74
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
75
+ }
76
+ }
77
+
78
+ task gemspec {
79
+ ext.gemspecFile = file("${project.name}.gemspec")
80
+ inputs.file "build.gradle"
81
+ outputs.file gemspecFile
82
+ doLast { gemspecFile.write($/
83
+ Gem::Specification.new do |spec|
84
+ spec.name = "${project.name}"
85
+ spec.version = "${project.version}"
86
+ spec.authors = ["jo8937"]
87
+ spec.summary = %[Bigquery Exports GCS file input plugin for Embulk]
88
+ spec.description = %[Reads files stored on Google Cloud Storage that extracted from bigquery table or query result]
89
+ spec.email = ["jo8937@gmail.com"]
90
+ spec.licenses = ["MIT"]
91
+ spec.homepage = "https://github.com/jo8937/embulk-input-bigquery_extract_files"
92
+
93
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
94
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
95
+ spec.require_paths = ["lib"]
96
+
97
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
98
+ spec.add_development_dependency 'bundler', ['~> 1.0']
99
+ spec.add_development_dependency 'rake', ['>= 10.0']
100
+ end
101
+ /$)
102
+ }
103
+ }
104
+ clean { delete "${project.name}.gemspec" }