embulk 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +5 -13
  2. data/.travis.yml +16 -0
  3. data/Gemfile +0 -1
  4. data/README.md +37 -19
  5. data/Rakefile +5 -37
  6. data/bin/embulk +1 -1
  7. data/build.gradle +178 -95
  8. data/embulk-core/build.gradle +1 -1
  9. data/embulk-core/src/main/java/org/embulk/command/Runner.java +11 -10
  10. data/embulk-core/src/main/java/org/embulk/config/ConfigDiff.java +26 -0
  11. data/embulk-core/src/main/java/org/embulk/config/ConfigInject.java +14 -0
  12. data/embulk-core/src/main/java/org/embulk/config/DataSourceImpl.java +2 -2
  13. data/embulk-core/src/main/java/org/embulk/config/DataSourceSerDe.java +4 -3
  14. data/embulk-core/src/main/java/org/embulk/config/TaskSerDe.java +5 -3
  15. data/embulk-core/src/main/java/org/embulk/config/TaskValidationException.java +1 -0
  16. data/embulk-core/src/main/java/org/embulk/exec/ExecutionResult.java +6 -6
  17. data/embulk-core/src/main/java/org/embulk/exec/GuessExecutor.java +19 -19
  18. data/embulk-core/src/main/java/org/embulk/exec/LocalExecutor.java +61 -36
  19. data/embulk-core/src/main/java/org/embulk/plugin/InjectedPluginSource.java +4 -0
  20. data/embulk-core/src/main/java/org/embulk/plugin/PluginManager.java +16 -1
  21. data/embulk-core/src/main/java/org/embulk/spi/Column.java +1 -1
  22. data/embulk-core/src/main/java/org/embulk/spi/{SchemaVisitor.java → ColumnVisitor.java} +1 -1
  23. data/embulk-core/src/main/java/org/embulk/spi/Exec.java +3 -3
  24. data/embulk-core/src/main/java/org/embulk/spi/ExecSession.java +2 -2
  25. data/embulk-core/src/main/java/org/embulk/spi/FileInputPlugin.java +3 -3
  26. data/embulk-core/src/main/java/org/embulk/spi/FileInputRunner.java +3 -3
  27. data/embulk-core/src/main/java/org/embulk/spi/FileOutputPlugin.java +3 -3
  28. data/embulk-core/src/main/java/org/embulk/spi/FileOutputRunner.java +3 -3
  29. data/embulk-core/src/main/java/org/embulk/spi/FilterPlugin.java +1 -1
  30. data/embulk-core/src/main/java/org/embulk/spi/GuessPlugin.java +2 -2
  31. data/embulk-core/src/main/java/org/embulk/spi/InputPlugin.java +3 -3
  32. data/embulk-core/src/main/java/org/embulk/spi/OutputPlugin.java +3 -3
  33. data/embulk-core/src/main/java/org/embulk/spi/PluginClassLoader.java +80 -0
  34. data/embulk-core/src/main/java/org/embulk/spi/Schema.java +1 -1
  35. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampFormatter.java +2 -2
  36. data/embulk-core/src/main/java/org/embulk/spi/time/TimestampParser.java +2 -2
  37. data/embulk-core/src/main/java/org/embulk/spi/util/Filters.java +1 -1
  38. data/embulk-core/src/main/java/org/embulk/spi/util/LineEncoder.java +2 -2
  39. data/embulk-core/src/main/java/org/embulk/spi/util/PagePrinter.java +6 -6
  40. data/embulk-core/src/main/java/org/embulk/spi/util/Pages.java +6 -6
  41. data/embulk-core/src/test/java/org/embulk/GuiceBinder.java +1 -1
  42. data/embulk-core/src/test/java/org/embulk/plugin/MockPluginSource.java +1 -0
  43. data/embulk-core/src/test/java/org/embulk/spi/MockFormatterPlugin.java +2 -2
  44. data/embulk-core/src/test/java/org/embulk/spi/PageTestUtils.java +1 -1
  45. data/embulk-core/src/test/java/org/embulk/spi/TestFileInputRunner.java +3 -3
  46. data/embulk-core/src/test/java/org/embulk/spi/TestFileOutputRunner.java +4 -4
  47. data/embulk-docs/Makefile +178 -0
  48. data/embulk-docs/build.gradle +20 -0
  49. data/embulk-docs/make.bat +243 -0
  50. data/embulk-docs/push-gh-pages.sh +29 -0
  51. data/embulk-docs/src/conf.py +260 -0
  52. data/embulk-docs/src/index.rst +19 -0
  53. data/embulk-docs/src/release.rst +14 -0
  54. data/embulk-docs/src/release/release-0.1.0.rst +8 -0
  55. data/embulk-docs/src/release/release-0.2.0.rst +16 -0
  56. data/embulk-docs/src/release/release-0.2.1.rst +19 -0
  57. data/embulk-docs/src/release/release-0.3.0.rst +34 -0
  58. data/embulk-docs/src/release/release-0.3.1.rst +11 -0
  59. data/embulk-docs/src/release/release-0.3.2.rst +15 -0
  60. data/embulk-docs/src/release/release-0.4.0.rst +74 -0
  61. data/embulk-standards/build.gradle +0 -1
  62. data/embulk-standards/src/main/java/org/embulk/standards/CsvFormatterPlugin.java +2 -2
  63. data/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java +12 -3
  64. data/embulk-standards/src/main/java/org/embulk/standards/GzipFileDecoderPlugin.java +2 -2
  65. data/embulk-standards/src/main/java/org/embulk/standards/LocalFileInputPlugin.java +49 -26
  66. data/embulk-standards/src/main/java/org/embulk/standards/LocalFileOutputPlugin.java +16 -17
  67. data/embulk-standards/src/main/java/org/embulk/standards/NullOutputPlugin.java +4 -4
  68. data/embulk-standards/src/main/java/org/embulk/standards/StandardPluginModule.java +0 -1
  69. data/embulk-standards/src/main/java/org/embulk/standards/StdoutOutputPlugin.java +5 -5
  70. data/gradle/wrapper/gradle-wrapper.jar +0 -0
  71. data/gradle/wrapper/gradle-wrapper.properties +2 -2
  72. data/lib/embulk/buffer.rb +2 -2
  73. data/lib/embulk/column.rb +6 -6
  74. data/lib/embulk/command/embulk_example.rb +1 -1
  75. data/lib/embulk/command/embulk_new_plugin.rb +87 -0
  76. data/lib/embulk/command/embulk_run.rb +84 -26
  77. data/lib/embulk/data/bundle/Gemfile +12 -20
  78. data/lib/embulk/data/bundle/embulk/{filter_example.rb → filter/example.rb} +3 -3
  79. data/lib/embulk/data/bundle/embulk/{input_example.rb → input/example.rb} +3 -3
  80. data/lib/embulk/data/bundle/embulk/{output_example.rb → output/example.rb} +3 -3
  81. data/lib/embulk/data/new/LICENSE.txt +21 -0
  82. data/lib/embulk/data/new/README.md.erb +75 -0
  83. data/lib/embulk/data/new/gitignore.erb +12 -0
  84. data/lib/embulk/data/new/java/build.gradle.erb +57 -0
  85. data/lib/embulk/data/new/java/decoder.java.erb +40 -0
  86. data/lib/embulk/data/new/java/encoder.java.erb +40 -0
  87. data/lib/embulk/data/new/java/file_input.java.erb +64 -0
  88. data/lib/embulk/data/new/java/file_output.java.erb +66 -0
  89. data/lib/embulk/data/new/java/filter.java.erb +47 -0
  90. data/lib/embulk/data/new/java/formatter.java.erb +45 -0
  91. data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.jar +0 -0
  92. data/lib/embulk/data/new/java/gradle/wrapper/gradle-wrapper.properties +6 -0
  93. data/lib/embulk/data/new/java/gradlew +164 -0
  94. data/lib/embulk/data/new/java/gradlew.bat +90 -0
  95. data/lib/embulk/data/new/java/input.java.erb +69 -0
  96. data/lib/embulk/data/new/java/output.java.erb +65 -0
  97. data/lib/embulk/data/new/java/parser.java.erb +51 -0
  98. data/lib/embulk/data/new/java/plugin_loader.rb.erb +3 -0
  99. data/lib/embulk/data/new/java/test.java.erb +5 -0
  100. data/lib/embulk/data/new/ruby/Gemfile +2 -0
  101. data/lib/embulk/data/new/ruby/Rakefile +1 -0
  102. data/lib/embulk/data/new/ruby/filter.rb.erb +39 -0
  103. data/lib/embulk/data/new/ruby/gemspec.erb +19 -0
  104. data/lib/embulk/data/new/ruby/input.rb.erb +47 -0
  105. data/lib/embulk/data/new/ruby/output.rb.erb +59 -0
  106. data/lib/embulk/data/package_data.rb +64 -0
  107. data/lib/embulk/data_source.rb +2 -2
  108. data/lib/embulk/decoder_plugin.rb +27 -0
  109. data/lib/embulk/encoder_plugin.rb +27 -0
  110. data/lib/embulk/error.rb +3 -0
  111. data/lib/embulk/file_input_plugin.rb +27 -0
  112. data/lib/embulk/file_output_plugin.rb +27 -0
  113. data/lib/embulk/filter_plugin.rb +28 -9
  114. data/lib/embulk/formatter_plugin.rb +105 -0
  115. data/lib/embulk/guess_csv.rb +10 -1
  116. data/lib/embulk/guess_plugin.rb +22 -27
  117. data/lib/embulk/input_plugin.rb +34 -20
  118. data/lib/embulk/java/bootstrap.rb +5 -0
  119. data/lib/embulk/java/imports.rb +7 -0
  120. data/lib/embulk/java_plugin.rb +84 -0
  121. data/lib/embulk/output_plugin.rb +35 -19
  122. data/lib/embulk/page.rb +1 -1
  123. data/lib/embulk/page_builder.rb +1 -1
  124. data/lib/embulk/parser_plugin.rb +76 -0
  125. data/lib/embulk/plugin.rb +130 -65
  126. data/lib/embulk/plugin_registry.rb +19 -8
  127. data/lib/embulk/schema.rb +4 -4
  128. data/lib/embulk/version.rb +1 -1
  129. data/settings.gradle +1 -0
  130. metadata +123 -90
  131. data/ChangeLog +0 -46
  132. data/embulk-cli/pom.xml +0 -94
  133. data/embulk-core/pom.xml +0 -148
  134. data/embulk-core/src/main/java/org/embulk/config/NextConfig.java +0 -26
  135. data/embulk-standards/pom.xml +0 -68
  136. data/embulk-standards/src/main/java/org/embulk/standards/S3FileInputPlugin.java +0 -250
  137. data/embulk-standards/src/test/java/org/embulk/standards/TestS3FileInputPlugin.java +0 -43
  138. data/pom.xml +0 -541
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzUyMzU0ODY2OWE5N2U4NTM3NjIwYjUzNTlmNjUwMGRkNWE4N2UxZg==
5
- data.tar.gz: !binary |-
6
- NzkyM2I3NzI2YmY4M2EyNGI3MzA1ODYyYmIwMzgxZjdkMzYxODg3Yg==
2
+ SHA1:
3
+ metadata.gz: bf78740441995394000d1ada6d8ca939cda77754
4
+ data.tar.gz: 9da2b0b76a8b702dffa2063fcc626e1ea25698af
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MWE0YjBiYzY4ZDc2MDc0ODFmY2QxZDY2ODljZTBhOTBmYjMwZjhhMWY5M2Q5
10
- N2JjODJhOTE1M2EwYmQxMjBiNWEzNmNjNjJkZDRiOTUyMjMzMTBlMGNiMTYx
11
- YzIxNGRjMTk2OTI5YzQwYjQ5NTcyODQ0ZGQzOTJhYzA2YTU3NmM=
12
- data.tar.gz: !binary |-
13
- ZGUxMzk0ZjcyNWRmMTNhY2IwYzFlODg3NGMzOGMyMzlhNzM5YjllZjkyMWMy
14
- ZTc5Yjk2YzY0MWE2MTBmODZhNmVjMWMzZjdjMDg0YWRkNDBmZGIwZWVjN2Rl
15
- NzFiN2EwNmU2Y2M3MzdiMWVhMDUxZDRmZDE1YzBlYWVjYzk0YTU=
6
+ metadata.gz: 12cec9ae89bab146559eaa68e2cc57a6ac71a48e18b81b3c393077842dc7f30b7fb8ea41502538c23d1ae0ca2e64f428cacd534e04f06d59d39d6e096b9b2d79
7
+ data.tar.gz: 513f463830ac564a873bf11a0a58905f57c4de91f4415718b428721cc836ca54d25c3293869b1974652189c9c29f4969c120d8ce1ada72e5d55e7025e7108234
data/.travis.yml ADDED
@@ -0,0 +1,16 @@
1
+ language: java
2
+ jdk:
3
+ - oraclejdk8
4
+ sudo: false
5
+ addons:
6
+ apt_packages:
7
+ - sphinx
8
+ - yardoc
9
+ script:
10
+ - ./gradlew check
11
+ - ./embulk-docs/push-gh-pages.sh
12
+ env:
13
+ global:
14
+ GIT_USER_NAME: travis
15
+ GIT_USER_NAME: travis@embulk.org
16
+ secure: ZiDtC073/oAXtPkXZYP9MoVBidLrrjeAV8PeXICtTzVMxR4Td5QDifiTy2NNStVLT+1g6NgzjSK9XFpDyVFb2cNy+9EOP+FoSC6Q0gRD/9nIrvB/LAtiDDfLqRtUrvPjN6U8BF3Zm2IvwTP77ml8bZZy3SH9ob4NQhxxEXVtynI=
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
1
  source 'https://rubygems.org/'
2
-
3
2
  gemspec
data/README.md CHANGED
@@ -97,28 +97,50 @@ java -jar embulk.jar cleanup config.yml -r resume-state.yml
97
97
  ### Build
98
98
 
99
99
  ```
100
- rake # creates embulk-VERSION.jar
100
+ ./gradlew cli # creates pkg/embulk-VERSION.jar
101
+ ./gradlew gem # creates pkg/embulk-VERSION.gem
101
102
  ```
102
103
 
103
- You can see JaCoCo's test coverage report at ${project}/target/site/jacoco/index.html
104
+ You can see JaCoCo's test coverage report at `${project}/build/reports/tests/index.html`
105
+ You can see Findbug's report at `${project}/build/reports/findbug/main.html` # FIXME coverage information is not included somehow
106
+
107
+ You can use `classpath` task to use `./bin/embulk` for development:
104
108
 
105
- To build by Gradle, run:
106
109
  ```
107
- ./gradlew build
110
+ ./gradlew classpath # -x test: skip test
111
+ ./bin/embulk
108
112
  ```
109
- If you want to deploy artifacts on local maven repository like ~/.m2/repository/, run:
113
+
114
+ To deploy artifacts to your local maven repository at ~/.m2/repository/:
115
+
110
116
  ```
111
117
  ./gradlew install
112
118
  ```
113
- If you want to compile the source code of embulk-core project only, run:
119
+
120
+ To compile the source code of embulk-core project only:
121
+
114
122
  ```
115
123
  ./gradlew :embulk-core:compileJava
116
124
  ```
117
- The following command allows use to see the dependency tree of embulk-core project
125
+
126
+ Task `dependencies` shows dependency tree of embulk-core project:
127
+
118
128
  ```
119
129
  ./gradlew :embulk-core:dependencies
120
130
  ```
121
131
 
132
+ ### Documents
133
+
134
+ Embulk uses Sphinx, YARD (Ruby API) and JavaDoc (Java API) for document generation.
135
+
136
+ ```
137
+ brew install python
138
+ pip install sphinx
139
+ gem install yard
140
+ ./gradlew site
141
+ # documents are: embulk-docs/build/html
142
+ ```
143
+
122
144
  ### Release
123
145
 
124
146
  You need to add your bintray account information to ~/.gradle/gradle.properties
@@ -128,24 +150,20 @@ bintray_user=(bintray user name)
128
150
  bintray_api_key=(bintray api key)
129
151
  ```
130
152
 
131
- Increment version number written at following 3 files (TODO improve this):
153
+ Update following files:
132
154
 
133
- * build.gradle
134
- * pom.xml
135
- * lib/embulk/version.rb
155
+ * embulk-docs/src/release/release-VERSION.rst (release note)
156
+ * build.gradle (version number)
157
+ * lib/embulk/version.rb (version number)
136
158
 
137
159
  Then, build and upload using gradle:
138
160
 
139
161
  ```
162
+ ./gradlew releaseCheck
163
+ ./gradlew cli gem
140
164
  ./gradlew bintrayUpload
141
- ```
142
-
143
- Finally, you need to manually upload the single-file jar package to bintray.
144
- Run `rake` and upload embulk-VERSION.jar from "Upload Files" link at https://bintray.com/embulk/maven/embulk/VERSION/upload.
145
-
146
- ```
147
- rake
148
- # embulk-VERSION.jar is built
165
+ gem push pkg/embulk-....gem
166
+ open "https://bintray.com/embulk/maven/embulk" # and upload pkg/embulk-....jar
149
167
  ```
150
168
 
151
169
  See also:
data/Rakefile CHANGED
@@ -15,44 +15,12 @@ end
15
15
 
16
16
  desc "Clean java code and copy files"
17
17
  task :clean do
18
- sh "mvn clean"
19
- rm_rf "classpath"
18
+ sh "./gradlew clean"
20
19
  end
21
20
 
22
- desc "Compile java code and copy jar files to classpath/"
23
- task :compile do
24
- sh "mvn package dependency:copy-dependencies"
25
- rm_rf "classpath"
26
- mkdir_p "classpath"
27
- cp Dir["embulk-cli/target/dependency/*.jar"], "classpath"
28
- targets = Dir["embulk-cli/target/embulk-cli-*.jar"]
29
- targets.reject! {|target| target =~ /-sources.jar$/ || target =~ /-executable.jar$/ }
30
- cp targets, "classpath"
21
+ desc "Build and copy jar files to ./classpath"
22
+ task :classpath do
23
+ sh "./gradlew classpath"
31
24
  end
32
25
 
33
- desc "Create embulk-{version}.jar"
34
- task :jar do
35
- require_relative 'lib/embulk/version'
36
- executable = Dir["embulk-cli/target/embulk-cli-*-executable.jar"].sort.last
37
- executable_data = File.read(executable).force_encoding('ASCII-8BIT')
38
- header = <<EOF
39
- #!/bin/sh
40
- exec java -jar "$0" "$@"
41
- exit 127
42
- EOF
43
- data = header.force_encoding('ASCII-8BIT') + executable_data
44
- path = "embulk-#{Embulk::VERSION}.jar"
45
- rm_f path
46
- File.open(path, 'wb', 0755) {|f| f.write data }
47
- puts "Created #{path}"
48
- end
49
-
50
- desc "Run clean, compile, build and jar"
51
- task :all do
52
- Rake::Task["clean"].invoke
53
- Rake::Task["compile"].invoke
54
- Rake::Task["build"].invoke
55
- Rake::Task["jar"].invoke
56
- end
57
-
58
- task :default => :all
26
+ task :default => :classpath
data/bin/embulk CHANGED
@@ -45,7 +45,7 @@ jruby_complete = Dir.entries(classpath_dir).find {|jar| jar =~ /jruby-complete-[
45
45
  unless jruby_complete
46
46
  STDERR.puts "Could not find jruby-complete at #{embulk_home}/classpath directory."
47
47
  if embulk_home == '.'
48
- STDERR.puts "Did you run \`rake\`? You need to build java code and create ./classpath directory first."
48
+ STDERR.puts "Did you run ./gradlew classpath? You need to build java code and create ./classpath directory first."
49
49
  end
50
50
  raise SystemExit.new(1)
51
51
  end
data/build.gradle CHANGED
@@ -1,37 +1,104 @@
1
- // TODO this build.gradle file just works but not well-written yet...
2
1
 
3
- //plugins {
4
- // id "com.jfrog.bintray" version "1.0"
5
- //}
6
- buildscript {
7
- repositories {
8
- jcenter()
9
- }
10
- dependencies {
11
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
12
- classpath 'com.github.ben-manes:gradle-versions-plugin:0.7'
13
- }
2
+ plugins {
3
+ id 'com.jfrog.bintray' version '1.1'
4
+ id 'com.github.ben-manes.versions' version '0.7'
5
+ id 'com.github.jruby-gradle.base' version '0.1.5'
6
+ id 'com.github.johnrengelman.shadow' version '1.2.0'
7
+ id 'java'
14
8
  }
15
9
 
16
10
  allprojects {
11
+ group = 'org.embulk'
12
+ version = '0.4.0'
13
+ }
14
+
15
+ subprojects {
16
+ apply plugin: 'maven' // install jar files to the local repo: $ gradle install
17
+ apply plugin: 'java'
18
+ apply plugin: 'findbugs'
19
+ apply plugin: 'jacoco'
20
+
17
21
  repositories {
18
22
  mavenCentral()
19
23
  jcenter()
20
24
  }
21
25
 
22
- apply plugin: 'idea'
23
- apply plugin: 'maven-publish'
24
- apply plugin: 'com.jfrog.bintray'
26
+ compileJava.options.encoding = 'UTF-8' // source encoding
27
+ sourceCompatibility = 1.7
28
+ targetCompatibility = 1.7
25
29
 
26
- // determine which dependencies have updates
27
- // $ gradle dependencyUpdates
28
- apply plugin: 'com.github.ben-manes.versions'
30
+ configurations {
31
+ // guice depends on asm and cglib but version of the libraries conflict
32
+ // with ones bundled in jruby-complete and cause bytecode compatibility error
33
+ compile.exclude group: 'asm', module: 'asm'
34
+ compile.exclude group: 'org.sonatype.sisu.inject', module: 'cglib'
35
+ }
29
36
 
30
- group = 'org.embulk'
31
- version = '0.3.2'
37
+ // determine which dependencies have updates: $ gradle dependencyUpdates
38
+ dependencies {
39
+ compile 'com.google.guava:guava:18.0'
40
+ compile 'com.google.inject:guice:3.0'
41
+ compile 'com.google.inject.extensions:guice-multibindings:3.0'
42
+ compile 'javax.inject:javax.inject:1'
43
+ compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0'
44
+ compile 'com.fasterxml.jackson.core:jackson-core:2.5.0'
45
+ compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0'
46
+ compile 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.0'
47
+ compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0'
48
+ compile 'com.fasterxml.jackson.module:jackson-module-guice:2.5.0'
49
+ compile 'log4j:log4j:1.2.17'
50
+ compile 'org.slf4j:slf4j-api:1.7.10'
51
+ compile 'org.slf4j:slf4j-log4j12:1.7.10'
52
+ compile 'org.jruby:jruby-complete:1.7.19'
53
+ compile 'com.google.code.findbugs:annotations:3.0.0'
54
+ compile 'org.yaml:snakeyaml:1.14'
55
+ compile 'javax.validation:validation-api:1.1.0.Final'
56
+ compile 'org.apache.bval:bval-jsr303:0.5'
57
+ compile 'io.airlift:slice:0.9'
58
+ compile 'joda-time:joda-time:2.7'
59
+ compile 'io.netty:netty-buffer:5.0.0.Alpha1'
60
+ compile 'com.ibm.icu:icu4j:54.1.1'
61
+
62
+ testCompile 'junit:junit:4.12'
63
+ }
64
+
65
+ gradle.projectsEvaluated {
66
+ tasks.withType(JavaCompile) {
67
+ options.compilerArgs << "-Xlint:unchecked" //<< "-Xlint:deprecation"
68
+ }
69
+ tasks.withType(FindBugs) {
70
+ reports {
71
+ xml.enabled = false
72
+ html.enabled = true
73
+ }
74
+ }
75
+ }
76
+
77
+ findbugs {
78
+ ignoreFailures = true
79
+ }
80
+
81
+ // add javadoc/source jar tasks as artifacts to be released
82
+ task sourcesJar(type: Jar, dependsOn: classes) {
83
+ classifier = 'sources'
84
+ from sourceSets.main.allSource
85
+ }
86
+ task javadocJar(type: Jar, dependsOn: javadoc) {
87
+ classifier = 'javadoc'
88
+ from javadoc.destinationDir
89
+ }
90
+ artifacts {
91
+ archives sourcesJar, javadocJar
92
+ }
32
93
 
33
- // to upload artifacts to Bintray by gradle-bintray-plugin
34
- // $ gradle bintrayUpload
94
+ javadoc {
95
+ options {
96
+ locale = 'en_US'
97
+ encoding = 'UTF-8'
98
+ }
99
+ }
100
+
101
+ // upload artifacts to Bintray: $ gradle bintrayUpload
35
102
  bintray {
36
103
  // write at your bintray user name and api key to ~/.gradle/gradle.properties file:
37
104
  // bintray_user=frsyuki
@@ -42,7 +109,7 @@ allprojects {
42
109
  publications = ['mavenJava']
43
110
 
44
111
  dryRun = false
45
- publish = false // TODO publish = project.publish
112
+ publish = false // TODO automate uploading embulk.jar and make this true
46
113
 
47
114
  pkg {
48
115
  userOrg = 'embulk'
@@ -70,86 +137,102 @@ allprojects {
70
137
  }
71
138
  }
72
139
 
73
- subprojects {
74
- apply plugin: 'java'
75
-
76
- // to install jar files to the local repo
77
- // $ gradle install
78
- apply plugin: 'maven'
79
-
80
- compileJava.options.encoding = 'UTF-8' // source encoding
81
- sourceCompatibility = 1.7
82
- targetCompatibility = 1.7
83
-
84
- dependencies {
85
- compile 'commons-logging:commons-logging:1.2',
86
- 'com.google.guava:guava:17.0',
87
- 'com.google.inject:guice:3.0',
88
- 'com.google.inject.extensions:guice-multibindings:3.0',
89
- 'javax.inject:javax.inject:1',
90
- 'com.fasterxml.jackson.core:jackson-annotations:2.4.3',
91
- 'com.fasterxml.jackson.core:jackson-core:2.4.3',
92
- 'com.fasterxml.jackson.core:jackson-databind:2.4.3',
93
- 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.4.3',
94
- 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.3',
95
- 'com.fasterxml.jackson.module:jackson-module-guice:2.4.3',
96
- 'log4j:log4j:1.2.17',
97
- 'org.slf4j:slf4j-api:1.7.9',
98
- 'org.slf4j:slf4j-log4j12:1.7.9',
99
- 'org.jruby:jruby-complete:1.7.16.1',
100
- 'com.google.code.findbugs:annotations:3.0.0',
101
- 'org.yaml:snakeyaml:1.14',
102
- 'javax.validation:validation-api:1.1.0.Final',
103
- 'org.apache.bval:bval-jsr303:0.5',
104
- 'io.airlift:slice:0.7',
105
- 'joda-time:joda-time:2.3',
106
- 'io.netty:netty-buffer:4.0.24.Final',
107
- 'com.ibm.icu:icu4j:53.1'
108
-
109
- testCompile 'junit:junit:4.10',
110
- 'org.mockito:mockito-core:1.9.5'
111
- }
112
-
113
- // custom tasks for creating source/javadoc jars
114
- task sourcesJar(type: Jar, dependsOn: classes) {
115
- classifier = 'sources'
116
- from sourceSets.main.allSource
140
+ project(':embulk-cli') {
141
+ apply plugin: 'com.github.johnrengelman.shadow'
142
+
143
+ shadowJar {
144
+ manifest {
145
+ attributes 'Implementation-Title': project.name,
146
+ 'Implementation-Version': project.version,
147
+ 'Implementation-Vendor-Id': project.group,
148
+ 'Specification-Title': project.name,
149
+ 'Specification-Version': project.version,
150
+ 'Main-Class': 'org.embulk.cli.Main'
151
+ }
152
+ append("${parent.projectDir}/COPYING")
117
153
  }
118
154
 
119
- task javadocJar(type: Jar, dependsOn: javadoc) {
120
- classifier = 'javadoc'
121
- from javadoc.destinationDir
155
+ task classpath(type: Copy) {
156
+ doFirst { file("${parent.projectDir}/classpath").mkdirs() }
157
+ from configurations.runtime
158
+ into "${parent.projectDir}/classpath"
122
159
  }
160
+ }
123
161
 
124
- // add javadoc/source jar tasks as artifacts
125
- artifacts {
126
- archives sourcesJar, javadocJar
127
- }
162
+ task classpath(dependsOn: ['build', ':embulk-cli:classpath']) << { }
163
+ clean { delete 'classpath' }
164
+
165
+ task cli(dependsOn: ':embulk-cli:shadowJar') << {
166
+ file('pkg').mkdirs()
167
+ File f = file("pkg/embulk-${project.version}.jar")
168
+ f.write('''\
169
+ #!/bin/sh
170
+ exec java -jar "$0" "$@"
171
+ exit 127
172
+ ''')
173
+ f.append(file("embulk-cli/build/libs/embulk-cli-${project.version}-all.jar").readBytes())
174
+ f.setExecutable(true)
175
+ }
128
176
 
129
- // $ gradle copyDependencies
130
- task copyDependencies(type: Copy) {
131
- println ":copy depend to $buildDir/libs/dependencies"
132
- new File("$buildDir/libs/dependencies").mkdirs()
177
+ import com.github.jrubygradle.JRubyExec
178
+ task gem(type: JRubyExec) {
179
+ jrubyArgs '-rrubygems/gem_runner', '-eGem::GemRunner.new.run(ARGV)', 'build'
180
+ script 'build/gemspec'
181
+ doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
182
+ }
183
+ gem.dependsOn('gemspec')
184
+ gem.dependsOn('classpath')
133
185
 
134
- into "$buildDir/libs/dependencies"
135
- from configurations.runtime.filter {
136
- // TODO avoid bytecode compatibility error
137
- it.name != 'asm-3.1.jar' && it.name != 'cglib-2.2.1-v20090111.jar'
138
- }
186
+ task releaseCheck << {
187
+ if (!file("lib/embulk/version.rb").getText().contains("${project.version}")) {
188
+ throw new GradleException("lib/embulk/version.rb doesn't include ${project.version}")
189
+ }
190
+ String date = new Date().format("yyyy-MM-dd")
191
+ if (!file("embulk-docs/src/release/release-${project.version}.rst").getText().contains(date)) {
192
+ throw new GradleException("ChangeLog doesn't include entry for ${project.version}")
139
193
  }
194
+ println "Ready. Run ./gradlew release"
195
+ }
140
196
 
141
- publishing {
142
- publications {
143
- mavenJava(MavenPublication) {
144
- groupId project.group
145
- artifactId project.name
146
- version project.version
197
+ task release(dependsOn: ["cli", "gem"]) << {
198
+ println """
199
+ manual operations:
147
200
 
148
- from components.java
201
+ git commit -a -m v${project.version}
202
+ git tag v${project.version}
203
+ gem push pkg/embulk-${project.version}.gem"
204
+ ./gradlew bintrayUpload
205
+ open "https://bintray.com/embulk/maven/embulk/${project.version}/view" # and upload pkg/embulk-${project.version}.jar
149
206
 
150
- artifact sourcesJar
151
- artifact javadocJar
152
- }
153
- }
154
- }
207
+ """
208
+ }
209
+
210
+ task gemspec << {
211
+ file('build').mkdirs()
212
+ file('build/gemspec').write($/
213
+ Gem::Specification.new do |gem|
214
+ gem.name = "embulk"
215
+ gem.version = "${project.version}"
216
+
217
+ gem.summary = "Embulk, a plugin-based parallel bulk data loader"
218
+ gem.description = "Embulk is an open-source, plugin-based bulk data loader to scale and simplify data management across heterogeneous data stores. It can collect and ship any kinds of data in high throughput with transaction control."
219
+ gem.authors = ["Sadayuki Furuhashi"]
220
+ gem.email = ["frsyuki@gmail.com"]
221
+ gem.license = "Apache 2.0"
222
+ gem.homepage = "https://github.com/embulk/embulk"
223
+
224
+ gem.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
225
+ gem.test_files = gem.files.grep(%r"^(test|spec)/")
226
+ gem.executables = gem.files.grep(%r"^bin/").map{ |f| File.basename(f) }
227
+ gem.require_paths = ["lib"]
228
+ gem.has_rdoc = false
229
+
230
+ gem.add_development_dependency "bundler", [">= 1.0"]
231
+ gem.add_development_dependency "rake", [">= 0.10.0"]
232
+ gem.add_development_dependency "rspec", ["~> 2.11"]
233
+ gem.add_development_dependency "json", ["~> 1.7"]
234
+ gem.add_development_dependency "yard", ["~> 0.8.7"]
235
+ gem.add_development_dependency "kramdown", ["~> 1.5.0"]
236
+ end
237
+ /$)
155
238
  }