embulk-input-bigquery_extract_files 0.0.7 → 0.0.13

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: bdb3cb2064c1b19c0748adb981d2593fd30950af
4
+ data.tar.gz: 4c54a7075d3b4877e0ad66d2e91125fbd2b1af61
5
5
  SHA512:
6
- metadata.gz: 123ff54b8d18e9ecefaa1525a74792a98ec56537d5123f3e3a5180b62e92b84454fefe42813420fd4c16b5eddb1c300460918dae787b32291271edc2b28afb4c
7
- data.tar.gz: 6c3872f92860a27bf42eb8ffc9ad71612c9defbd25f41a82234bb09fad62c5fb87492e6bd8bbf10d8b01ec4c928df4824fd8ffed941a7672b9f3e6b4cdcabd08
6
+ metadata.gz: 8e4c7646e18867ef61a6488151eed43bda4001b1935bcffc1d5cb5ef545eaf731f3aa94f3f663a07d8d9e363f60b407072dcfea4c41722c5cd8c4dcb807e48cf
7
+ data.tar.gz: c5f6d6843afb3848714be3bb0ae9dc249ea68f40cf92db75911222c7d72adf0bd55f4b65c8cb1971a8eb357e8678425d0a06befc6d9fb7e0a6668c93da0c04a3
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
@@ -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,171 @@
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
+ - **location**: location of bigquery dataset and temp_dataset. see : https://cloud.google.com/bigquery/docs/locations (Optional) (string, default: `US`)
46
+ - **gcs_uri**: bigquery result saved uri. bucket and path names parsed from this uri. (string, required)
47
+ - **temp_local_path**: extract files download directory in local machine (string, required)
48
+
49
+ - **dataset**: target datasource dataset (string, default: `null`)
50
+ - **table**: target datasource table. either query or table are required. (string, default: `null`)
51
+ - **query**: target datasource query. either query or table are required. (string, default: `null`)
52
+
53
+ - **temp_dataset**: if you use **query** param, query result saved here (string, default: `null`)
54
+ - **temp_table**: if you use **query** param, query result saved here. if not set, plugin generate temp name (string, default: `null`)
55
+ - **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`)
56
+ - **cache**: if you use **query** param, see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.query.useQueryCache (string, default: `true`)
57
+ - **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`)
58
+ - **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`)
59
+
60
+ - **file_format**: Table extract file format. see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract.destinationFormat (string, default: `CSV`)
61
+ - **compression**: Table extract file compression setting. see : https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#configuration.extract.compression (string, default: `GZIP`)
62
+
63
+ - **temp_schema_file_path**: bigquery result schema file for parser. (Optional) (string, default: `null`)
64
+
65
+ - **bigquery_job_wait_second**: bigquery job waiting second. (Optional) (string, default: `600`)
66
+
67
+ - **cleanup_gcs_before_executing**: delete all file in gcs temp path before process start (Optional) (string, default: `true`)
68
+
69
+ - **cleanup_gcs_files**: delete all file in gcs temp path after process end (Optional) (string, default: `false`)
70
+
71
+ - **cleanup_temp_table**: delete query result table after process end (Optional) (string, default: `true`)
72
+
73
+ - **cleanup_local_temp_files**: delete all file in local temp dir (Optional) (string, default: `true`)
74
+
75
+ - **direct_download_enabled**: gcs download option. see : https://developers.google.com/api-client-library/java/google-api-java-client/reference/1.19.1/com/google/api/client/googleapis/media/MediaHttpDownloader#setDirectDownloadEnabled(boolean) (Optional) (string, default: `false`)
76
+
77
+ - **decoders**: embulk java-file-input plugin's default attribute. see : http://www.embulk.org/docs/built-in.html#gzip-decoder-plugin
78
+ - **parser**: embulk java-file-input plugin's default .attribute see : http://www.embulk.org/docs/built-in.html#csv-parser-plugin
79
+
80
+ ## Example
81
+
82
+ ```yaml
83
+ in:
84
+ type: bigquery_extract_files
85
+ project: googlecloudplatformproject
86
+ json_keyfile: gcp-service-account-private-key.json
87
+ dataset: target_dataset
88
+ #table: target_table
89
+ query: 'select a,b,c from target_table'
90
+ gcs_uri: gs://bucket/subdir
91
+ temp_dataset: temp_dataset
92
+ temp_local_path: C:\Temp
93
+ file_format: 'NEWLINE_DELIMITED_JSON'
94
+ compression: 'GZIP'
95
+ decoders:
96
+ - {type: gzip}
97
+ parser:
98
+ type: json
99
+ out:
100
+ type: stdout
101
+ ```
102
+
103
+ ### Advenced Example
104
+
105
+ #### bigquery to mysql with auto-schema
106
+
107
+ I have to batch bigquery table to mysql every day for my job.
108
+ then, I wan'to get auto-schema for this file input plugin.
109
+
110
+ - see also
111
+ - https://github.com/jo8937/embulk-parser-csv_with_schema_file
112
+ - https://github.com/embulk/embulk-output-jdbc/tree/master/embulk-output-mysql
113
+
114
+ this is my best practive for bigquery to mysql batch config.
115
+
116
+ ```yaml
117
+ in:
118
+ type: bigquery_extract_files
119
+ project: my-google-project
120
+ json_keyfile: /tmp/embulk/google_service_account.json
121
+ query: 'select * from dataset.t_nitocris'
122
+ temp_dataset: temp_dataset
123
+ gcs_uri: gs://bucket/embulktemp/t_nitocris_*
124
+ temp_local_path: /tmp/embulk/data
125
+ file_format: 'CSV'
126
+ compression: 'GZIP'
127
+ temp_schema_file_path: /tmp/embulk/schema/csv_schema_nitocris.json
128
+ decoders:
129
+ - {type: gzip}
130
+ parser:
131
+ type: csv_with_schema_file
132
+ default_timestamp_format: '%Y-%m-%d %H:%M:%S %z'
133
+ schema_path: /tmp/embulk/schema/csv_schema_nitocris.json
134
+ out:
135
+ type: mysql
136
+ host: host
137
+ user: user
138
+ password: password
139
+ port: 3306
140
+ database: MY_DATABASE
141
+ table:
142
+ options: {connectTimeout: 0, waitTimeout: 0, enableQueryTimeouts: false, autoReconnect: true}
143
+ mode: insert_direct
144
+ retry_limit: 60
145
+ retry_wait: 3000
146
+ batch_size: 4096000
147
+ ```
148
+
149
+ * 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.
150
+
151
+ ```yml
152
+ ...
153
+ parser:
154
+ type: csv_with_schema_file
155
+ default_timestamp_format: '%Y-%m-%d %H:%M:%S %z'
156
+ schema_path: /tmp/embulk/schema/csv_schema_nitocris.json
157
+ columns:
158
+ - {name: Date2, type: timestamp, format: '%Y-%m-%d %H:%M:%S.%N %z'}
159
+ ```
160
+
161
+ ## Build
162
+
163
+ ```
164
+ $ ./gradlew gem # -t to watch change of files and rebuild continuously
165
+ ```
166
+
167
+ # Another choice
168
+
169
+ This plugin useful for file-input type. but maybe so complicated to use.
170
+
171
+ For portable use, see embulk-input-bigquery : https://github.com/medjed/embulk-input-bigquery
@@ -1,102 +1,105 @@
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.13"
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.guava:guava:16+"
26
+ compile "com.google.http-client:google-http-client-jackson2:1.28.0"
27
+ //compile ('com.google.apis:google-api-services-bigquery:v2-rev363-1.23.0') {exclude module: "guava-jdk5"}
28
+ compile ('com.google.apis:google-api-services-bigquery:v2-rev429-1.25.0') {exclude module: "guava-jdk5"}
29
+ //compile ("com.google.apis:google-api-services-storage:v1-rev59-1.21.0") {exclude module: "guava-jdk5"}
30
+ compile ("com.google.apis:google-api-services-storage:v1-rev150-1.25.0") {exclude module: "guava-jdk5"}
31
+
32
+ testCompile "junit:junit:4.+"
33
+ testCompile "org.embulk:embulk-core:0.8.36:tests"
34
+ testCompile "org.embulk:embulk-standards:0.8.36"
35
+ }
36
+
37
+ task classpath(type: Copy, dependsOn: ["jar"]) {
38
+ doFirst { file("classpath").deleteDir() }
39
+ from (configurations.runtime - configurations.provided + files(jar.archivePath))
40
+ into "classpath"
41
+ }
42
+ clean { delete "classpath" }
43
+
44
+ checkstyle {
45
+ configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
46
+ toolVersion = '6.14.1'
47
+ }
48
+ checkstyleMain {
49
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
50
+ ignoreFailures = true
51
+ }
52
+ checkstyleTest {
53
+ configFile = file("${project.rootDir}/config/checkstyle/default.xml")
54
+ ignoreFailures = true
55
+ }
56
+ task checkstyle(type: Checkstyle) {
57
+ classpath = sourceSets.main.output + sourceSets.test.output
58
+ source = sourceSets.main.allJava + sourceSets.test.allJava
59
+ }
60
+
61
+ task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
62
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build"
63
+ script "${project.name}.gemspec"
64
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
65
+ }
66
+
67
+ task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
68
+ jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "push"
69
+ script "pkg/${project.name}-${project.version}.gem"
70
+ }
71
+
72
+ task "package"(dependsOn: ["gemspec", "classpath"]) {
73
+ doLast {
74
+ println "> Build succeeded."
75
+ println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
76
+ }
77
+ }
78
+
79
+ task gemspec {
80
+ ext.gemspecFile = file("${project.name}.gemspec")
81
+ inputs.file "build.gradle"
82
+ outputs.file gemspecFile
83
+ doLast { gemspecFile.write($/
84
+ Gem::Specification.new do |spec|
85
+ spec.name = "${project.name}"
86
+ spec.version = "${project.version}"
87
+ spec.authors = ["jo8937"]
88
+ spec.summary = %[Bigquery Exports GCS file input plugin for Embulk]
89
+ spec.description = %[Reads files stored on Google Cloud Storage that extracted from bigquery table or query result]
90
+ spec.email = ["jo8937@gmail.com"]
91
+ spec.licenses = ["MIT"]
92
+ spec.homepage = "https://github.com/jo8937/embulk-input-bigquery_extract_files"
93
+
94
+ spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
95
+ spec.test_files = spec.files.grep(%r"^(test|spec)/")
96
+ spec.require_paths = ["lib"]
97
+
98
+ #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION']
99
+ spec.add_development_dependency 'bundler', ['~> 1.0']
100
+ spec.add_development_dependency 'rake', ['>= 10.0']
101
+ end
102
+ /$)
103
+ }
104
+ }
105
+ clean { delete "${project.name}.gemspec" }