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 +4 -4
- data/.gitignore +16 -16
- data/LICENSE.txt +21 -21
- data/README.md +168 -144
- data/build.gradle +104 -102
- data/config.yml +31 -31
- data/config/checkstyle/checkstyle.xml +128 -128
- data/config/checkstyle/default.xml +108 -108
- data/gradle/wrapper/gradle-wrapper.properties +5 -5
- data/gradlew +172 -172
- data/lib/embulk/input/bigquery_extract_files.rb +3 -3
- data/src/main/java/org/embulk/input/bigquery_export_gcs/BigqueryExportGcsFileInputPlugin.java +378 -383
- data/src/main/java/org/embulk/input/bigquery_export_gcs/BigqueryExportUtils.java +519 -495
- data/src/main/java/org/embulk/input/bigquery_export_gcs/PHASE.java +7 -7
- data/src/test/java/org/embulk/input/bigquery_export_gcs/TestGoogleCloudAccessData.java +33 -33
- data/src/test/java/org/embulk/input/bigquery_export_gcs/TestPluginFunctions.java +56 -56
- data/src/test/java/org/embulk/input/bigquery_export_gcs/UnitTestInitializer.java +96 -96
- metadata +18 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55f1e7dc3d4dcd5ebe905f42c289c4034702718d
|
4
|
+
data.tar.gz: eda2e0485a70f8fa63e6f4c292a792bd2af7633a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
- **
|
44
|
-
- **
|
45
|
-
|
46
|
-
- **
|
47
|
-
|
48
|
-
- **
|
49
|
-
- **
|
50
|
-
- **
|
51
|
-
|
52
|
-
|
53
|
-
- **
|
54
|
-
- **
|
55
|
-
|
56
|
-
- **
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
- **
|
61
|
-
|
62
|
-
- **
|
63
|
-
|
64
|
-
- **
|
65
|
-
|
66
|
-
- **
|
67
|
-
|
68
|
-
- **
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
in
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
type:
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
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.
|
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 (
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
testCompile "
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
}
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
spec.
|
85
|
-
spec.
|
86
|
-
spec.
|
87
|
-
spec.
|
88
|
-
spec.
|
89
|
-
spec.
|
90
|
-
|
91
|
-
spec.
|
92
|
-
|
93
|
-
spec.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
spec.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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" }
|