embulk 0.8.31-java → 0.8.32-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ Release Notes
4
4
  .. toctree::
5
5
  :maxdepth: 1
6
6
 
7
+ release/release-0.8.32
7
8
  release/release-0.8.31
8
9
  release/release-0.8.30
9
10
  release/release-0.8.29
@@ -0,0 +1,14 @@
1
+ Release 0.8.32
2
+ ==================================
3
+
4
+ General Changes
5
+ ------------------
6
+
7
+ * Ensure plugin's "gradlew" to have executable permissions by "migrate" subcommand [#710] [#782]
8
+ * Upgrade Gradle wrapper of plugin templates to 4.1.0. [#781]
9
+ * Initialize the global JRuby instance in JRubyScriptingModule except for Embulk::Runner [#765]
10
+
11
+
12
+ Release Date
13
+ ------------------
14
+ 2017-09-07
Binary file
@@ -1,6 +1,5 @@
1
- #Sun Jan 08 00:35:58 PST 2017
2
1
  distributionBase=GRADLE_USER_HOME
3
2
  distributionPath=wrapper/dists
4
3
  zipStoreBase=GRADLE_USER_HOME
5
4
  zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip
5
+ distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
data/gradlew CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env sh
2
2
 
3
3
  ##############################################################################
4
4
  ##
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
33
33
  # Use the maximum available, or set MAX_FD != -1 to use that value.
34
34
  MAX_FD="maximum"
35
35
 
36
- warn ( ) {
36
+ warn () {
37
37
  echo "$*"
38
38
  }
39
39
 
40
- die ( ) {
40
+ die () {
41
41
  echo
42
42
  echo "$*"
43
43
  echo
@@ -154,16 +154,19 @@ if $cygwin ; then
154
154
  esac
155
155
  fi
156
156
 
157
- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158
- function splitJvmOpts() {
159
- JVM_OPTS=("$@")
157
+ # Escape application args
158
+ save () {
159
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
+ echo " "
160
161
  }
161
- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162
- JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
162
+ APP_ARGS=$(save "$@")
163
+
164
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
165
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
163
166
 
164
167
  # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165
- if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
168
+ if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
166
169
  cd "$(dirname "$0")"
167
170
  fi
168
171
 
169
- exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172
+ exec "$JAVACMD" "$@"
data/lib/embulk.rb CHANGED
@@ -63,13 +63,10 @@ module Embulk
63
63
 
64
64
  require_classpath(true)
65
65
 
66
- Java::org.embulk.EmbulkSetup::setup(
67
- Java::java.util.ArrayList.new(),
68
- Java::java.util.HashMap.new(system_config),
69
- Java::java.util.ArrayList.new(),
70
- Java::java.util.ArrayList.new(),
71
- Java::java.util.ArrayList.new(),
72
- nil
73
- )
66
+ require 'embulk/runner'
67
+
68
+ # see also embulk/java/bootstrap.rb loaded by JRubyScriptingModule
69
+ runner_java = EmbulkRunner.new(Java::org.embulk.EmbulkSetup::setup(Java::java.util.HashMap.new(system_config)))
70
+ Embulk.const_set :Runner, runner_java
74
71
  end
75
72
  end
@@ -1,6 +1,5 @@
1
- #Sun Jan 08 00:35:58 PST 2017
2
1
  distributionBase=GRADLE_USER_HOME
3
2
  distributionPath=wrapper/dists
4
3
  zipStoreBase=GRADLE_USER_HOME
5
4
  zipStorePath=wrapper/dists
6
- distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-bin.zip
5
+ distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env sh
2
2
 
3
3
  ##############################################################################
4
4
  ##
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
33
33
  # Use the maximum available, or set MAX_FD != -1 to use that value.
34
34
  MAX_FD="maximum"
35
35
 
36
- warn ( ) {
36
+ warn () {
37
37
  echo "$*"
38
38
  }
39
39
 
40
- die ( ) {
40
+ die () {
41
41
  echo
42
42
  echo "$*"
43
43
  echo
@@ -154,16 +154,19 @@ if $cygwin ; then
154
154
  esac
155
155
  fi
156
156
 
157
- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158
- function splitJvmOpts() {
159
- JVM_OPTS=("$@")
157
+ # Escape application args
158
+ save () {
159
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160
+ echo " "
160
161
  }
161
- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162
- JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
162
+ APP_ARGS=$(save "$@")
163
+
164
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
165
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
163
166
 
164
167
  # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165
- if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
168
+ if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
166
169
  cd "$(dirname "$0")"
167
170
  fi
168
171
 
169
- exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172
+ exec "$JAVACMD" "$@"
@@ -3,7 +3,7 @@
3
3
  module Embulk
4
4
  @@warned = false
5
5
 
6
- VERSION_INTERNAL = '0.8.31'
6
+ VERSION_INTERNAL = '0.8.32'
7
7
 
8
8
  DEPRECATED_MESSAGE = 'Embulk::VERSION in (J)Ruby is deprecated. Use org.embulk.EmbulkVersion::VERSION instead. If this message is from a plugin, please tell this to the author of the plugin!'
9
9
  def self.const_missing(name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.31
4
+ version: 0.8.32
5
5
  platform: java
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -155,10 +155,10 @@ files:
155
155
  - classpath/commons-compress-1.10.jar
156
156
  - classpath/commons-lang-2.4.jar
157
157
  - classpath/commons-lang3-3.4.jar
158
- - classpath/embulk-cli-0.8.31.jar
159
- - classpath/embulk-core-0.8.31.jar
160
- - classpath/embulk-jruby-strptime-0.8.31.jar
161
- - classpath/embulk-standards-0.8.31.jar
158
+ - classpath/embulk-cli-0.8.32.jar
159
+ - classpath/embulk-core-0.8.32.jar
160
+ - classpath/embulk-jruby-strptime-0.8.32.jar
161
+ - classpath/embulk-standards-0.8.32.jar
162
162
  - classpath/guava-18.0.jar
163
163
  - classpath/guice-4.0.jar
164
164
  - classpath/guice-bootstrap-0.1.1.jar
@@ -218,7 +218,6 @@ files:
218
218
  - embulk-cli/src/test/java/org/embulk/cli/SelfrunTest.java
219
219
  - embulk-core/build.gradle
220
220
  - embulk-core/src/main/java/org/embulk/EmbulkEmbed.java
221
- - embulk-core/src/main/java/org/embulk/EmbulkGlobalJRubyScriptingContainer.java
222
221
  - embulk-core/src/main/java/org/embulk/EmbulkRunner.java
223
222
  - embulk-core/src/main/java/org/embulk/EmbulkService.java
224
223
  - embulk-core/src/main/java/org/embulk/EmbulkSetup.java
@@ -434,6 +433,7 @@ files:
434
433
  - embulk-core/src/test/java/org/embulk/spi/TestFileOutputRunner.java
435
434
  - embulk-core/src/test/java/org/embulk/spi/TestInputStreamFileInput.java
436
435
  - embulk-core/src/test/java/org/embulk/spi/TestPageBuilderReader.java
436
+ - embulk-core/src/test/java/org/embulk/spi/json/TestJsonParser.java
437
437
  - embulk-core/src/test/java/org/embulk/spi/time/TestTimestamp.java
438
438
  - embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParser.java
439
439
  - embulk-core/src/test/java/org/embulk/spi/time/TestTimestampFormatterParserDeprecated.java
@@ -561,6 +561,7 @@ files:
561
561
  - embulk-docs/src/release/release-0.8.3.rst
562
562
  - embulk-docs/src/release/release-0.8.30.rst
563
563
  - embulk-docs/src/release/release-0.8.31.rst
564
+ - embulk-docs/src/release/release-0.8.32.rst
564
565
  - embulk-docs/src/release/release-0.8.4.rst
565
566
  - embulk-docs/src/release/release-0.8.5.rst
566
567
  - embulk-docs/src/release/release-0.8.6.rst
@@ -1,215 +0,0 @@
1
- package org.embulk;
2
-
3
- import java.io.PrintStream;
4
- import java.net.URISyntaxException;
5
- import java.net.URL;
6
- import java.nio.file.Files;
7
- import java.nio.file.Path;
8
- import java.nio.file.Paths;
9
- import java.security.CodeSource;
10
- import java.security.ProtectionDomain;
11
- import java.util.Collections;
12
- import java.util.List;
13
- import org.jruby.RubyInstanceConfig;
14
- import org.jruby.embed.LocalContextScope;
15
- import org.jruby.embed.LocalVariableBehavior;
16
- import org.jruby.embed.PathType;
17
- import org.jruby.embed.ScriptingContainer;
18
- import org.jruby.util.cli.Options;
19
-
20
- /**
21
- * EmbulkGlobalJRubyScriptingContainer creates a ScriptingContainer instance for global use in Embulk.
22
- *
23
- * The creator method is static because the target instance is singleton by definition.
24
- */
25
- public class EmbulkGlobalJRubyScriptingContainer
26
- {
27
- private EmbulkGlobalJRubyScriptingContainer()
28
- {
29
- // Do not instantiate.
30
- }
31
-
32
- /**
33
- * Sets up a ScriptingContainer instance for global use in Embulk.
34
- */
35
- public static ScriptingContainer setup(
36
- final List<String> jrubyOptions,
37
- final String bundlePath,
38
- final PrintStream warning)
39
- {
40
- // The JRuby instance is a global singleton so that the settings here affects later execution.
41
- // The local variable should be persistent so that local variables are set through ScriptingContainer.put.
42
- final ScriptingContainer jrubyGlobalContainer =
43
- new ScriptingContainer(LocalContextScope.SINGLETON, LocalVariableBehavior.PERSISTENT);
44
- final RubyInstanceConfig jrubyGlobalConfig = jrubyGlobalContainer.getProvider().getRubyInstanceConfig();
45
-
46
- for (final String jrubyOption : jrubyOptions) {
47
- try {
48
- processJRubyOption(jrubyOption, jrubyGlobalConfig);
49
- }
50
- catch (UnrecognizedJRubyOptionException ex) {
51
- warning.println("[WARN] The \"-R\" option(s) are not recognized in Embulk: -R" + jrubyOption);
52
- warning.println("[WARN] Please add your requests at: https://github.com/embulk/embulk/issues/707");
53
- warning.println("");
54
- }
55
- catch (NotWorkingJRubyOptionException ex) {
56
- warning.println("[WARN] The \"-R\" option(s) do not work in Embulk: -R" + jrubyOption);
57
- warning.println("");
58
- }
59
- }
60
-
61
- if (bundlePath != null) {
62
- /* Environment variables are set in the selfrun script or bin/embulk:
63
- * ENV['EMBULK_BUNDLE_PATH']: set through '-b' | '--bundle', or inherit from the runtime environment
64
- * ENV['BUNDLE_GEMFILE']: set for "ENV['EMBULK_BUNDLE_PATH']/Gemfile"
65
- * ENV['GEM_HOME']: unset
66
- * ENV['GEM_PATH']: unset
67
- */
68
-
69
- // bundler is included in embulk-core.jar
70
- jrubyGlobalContainer.runScriptlet("Gem.clear_paths");
71
- jrubyGlobalContainer.runScriptlet("require 'bundler'");
72
-
73
- jrubyGlobalContainer.runScriptlet("Bundler.load.setup_environment");
74
- jrubyGlobalContainer.runScriptlet("require 'bundler/setup'");
75
- // since here, `require` may load files of different (newer) embulk versions
76
- // especially following 'embulk/command/embulk_main'.
77
-
78
- // NOTE: It is intentionally not done by building a Ruby statement string from |bundlePath|.
79
- // It can cause insecure injections.
80
- //
81
- // add bundle directory path to load local plugins at ./embulk
82
- jrubyGlobalContainer.put("__internal_bundle_path__", bundlePath);
83
- jrubyGlobalContainer.runScriptlet("$LOAD_PATH << File.expand_path(__internal_bundle_path__)");
84
- jrubyGlobalContainer.remove("__internal_bundle_path__");
85
-
86
- return jrubyGlobalContainer;
87
- }
88
- else {
89
- /* Environment variables are set in the selfrun script or bin/embulk:
90
- * ENV['EMBULK_BUNDLE_PATH']: unset
91
- * ENV['BUNDLE_GEMFILE']: unset
92
- * ENV['GEM_HOME']: set for "~/.embulk/jruby/${ruby-version}"
93
- * ENV['GEM_PATH']: set for ""
94
- */
95
-
96
- jrubyGlobalContainer.runScriptlet("Gem.clear_paths"); // force rubygems to reload GEM_HOME
97
-
98
- // NOTE: The path from |getEmbulkJRubyLoadPath()| is added in $LOAD_PATH just in case.
99
- // Though it is not mandatory just to run "embulk_main.rb", it may be required in later steps.
100
- //
101
- // NOTE: It is intentionally not done by building a Ruby statement string from |getEmbulkJRubyLoadPath()|.
102
- // It can cause insecure injections.
103
- //
104
- // NOTE: It was written in Ruby as follows:
105
- // $LOAD_PATH << File.expand_path('../../', File.dirname(__FILE__))
106
- final String jrubyLoadPath;
107
- try {
108
- jrubyLoadPath = getEmbulkJRubyLoadPath();
109
- }
110
- catch (UnrecognizedJRubyLoadPathException ex) {
111
- warning.println("[ERROR] Failed to retrieve Embulk's path.");
112
- ex.printStackTrace(warning);
113
- throw new RuntimeException(ex);
114
- }
115
- jrubyGlobalContainer.put("__internal_load_path__", jrubyLoadPath);
116
- jrubyGlobalContainer.runScriptlet("$LOAD_PATH << File.expand_path(__internal_load_path__)");
117
- jrubyGlobalContainer.remove("__internal_load_path__");
118
-
119
- return jrubyGlobalContainer;
120
- }
121
- }
122
-
123
- private static final class UnrecognizedJRubyOptionException extends Exception {}
124
- private static final class NotWorkingJRubyOptionException extends Exception {}
125
- private static final class UnrecognizedJRubyLoadPathException extends Exception {
126
- public UnrecognizedJRubyLoadPathException(final String message)
127
- {
128
- super(message);
129
- }
130
-
131
- public UnrecognizedJRubyLoadPathException(final String message, final Throwable cause)
132
- {
133
- super(message, cause);
134
- }
135
- }
136
-
137
- private static void processJRubyOption(final String jrubyOption, final RubyInstanceConfig jrubyGlobalConfig)
138
- throws UnrecognizedJRubyOptionException, NotWorkingJRubyOptionException
139
- {
140
- if (jrubyOption.charAt(0) != '-') {
141
- throw new UnrecognizedJRubyOptionException();
142
- }
143
-
144
- for (int index = 1; index < jrubyOption.length(); ++index) {
145
- switch (jrubyOption.charAt(index)) {
146
- case '-':
147
- if (jrubyOption.equals("--dev")) {
148
- // They are not all of "--dev", but they are most possible configurations after JVM boot.
149
- Options.COMPILE_INVOKEDYNAMIC.force("false"); // NOTE: Options is global.
150
- jrubyGlobalConfig.setCompileMode(RubyInstanceConfig.CompileMode.OFF);
151
- return;
152
- }
153
- else if (jrubyOption.equals("--client")) {
154
- throw new NotWorkingJRubyOptionException();
155
- }
156
- else if (jrubyOption.equals("--server")) {
157
- throw new NotWorkingJRubyOptionException();
158
- }
159
- throw new UnrecognizedJRubyOptionException();
160
- default:
161
- throw new UnrecognizedJRubyOptionException();
162
- }
163
- }
164
- }
165
-
166
- /**
167
- * Returns a path to be added in JRuby's $LOAD_PATH.
168
- *
169
- * In case Embulk runs from the Embulk JAR file (normal case):
170
- * "file:/some/directory/embulk.jar!"
171
- *
172
- * In case Embulk runs out of a JAR file (irregular case):
173
- * "/some/directory"
174
- */
175
- private static String getEmbulkJRubyLoadPath()
176
- throws UnrecognizedJRubyLoadPathException
177
- {
178
- final ProtectionDomain protectionDomain;
179
- try {
180
- protectionDomain = EmbulkGlobalJRubyScriptingContainer.class.getProtectionDomain();
181
- }
182
- catch (SecurityException ex) {
183
- throw new UnrecognizedJRubyLoadPathException("Failed to achieve ProtectionDomain", ex);
184
- }
185
-
186
- final CodeSource codeSource = protectionDomain.getCodeSource();
187
- if (codeSource == null) {
188
- throw new UnrecognizedJRubyLoadPathException("Failed to achieve CodeSource");
189
- }
190
-
191
- final URL locationUrl = codeSource.getLocation();
192
- if (locationUrl == null) {
193
- throw new UnrecognizedJRubyLoadPathException("Failed to achieve location");
194
- }
195
- else if (!locationUrl.getProtocol().equals("file")) {
196
- throw new UnrecognizedJRubyLoadPathException("Invalid location: " + locationUrl.toString());
197
- }
198
-
199
- final Path locationPath;
200
- try {
201
- locationPath = Paths.get(locationUrl.toURI());
202
- }
203
- catch (URISyntaxException ex) {
204
- throw new UnrecognizedJRubyLoadPathException("Invalid location: " + locationUrl.toString(), ex);
205
- }
206
-
207
- if (Files.isDirectory(locationPath)) { // Out of a JAR file
208
- System.err.println("Warning: Embulk looks running out of the Embulk jar file. It is unsupported.");
209
- return locationPath.toString();
210
- }
211
-
212
- // TODO: Consider checking the file is really a JAR file.
213
- return locationUrl.toString() + "!"; // Inside the Embulk JAR file
214
- }
215
- }