Skip to content

Commit

Permalink
Merge pull request #27 from lulichn/upgrade-embulk
Browse files Browse the repository at this point in the history
breaking change: Upgrade embulk 0.9.23 -> 0.10.41 with removing deprecated features
  • Loading branch information
civitaspo authored Feb 14, 2023
2 parents 6c7b877 + 084c579 commit 577beba
Show file tree
Hide file tree
Showing 38 changed files with 448 additions and 1,607 deletions.
4 changes: 2 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# https://scalameta.org/scalafmt/#Configuration

version = "2.3.2"
version = "3.7.1"
runner.dialect = "scala3"
newlines.alwaysBeforeElseAfterCurlyIf = true
newlines.alwaysBeforeTopLevelStatements = true
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
The MIT License (MIT)

Copyright (c) 2015 Daisuke Higashi
Copyright (c) 2020 Takahiro Nakayama (civitaspo)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

29 changes: 5 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,27 +123,6 @@ This type of `DynamodbAttributeValue` is one that can express Dynamodb `Attribut
- **NULL**: null or not. (boolean, optional)
- **BOOL**: `true` or `false`. (boolean, optional)
### Deprecated Configuration
You can use the below options yet for the backward compatibility before `v0.3.0`. However, these are already deprecated, so please use new options instead.
- **access_key**: *[Deprecated: Use **access_key** instead]* aws access key id. this is required when **auth_method** is `"basic"` or `"session"`. (string, optional)
- **secret_key**: *[Deprecated: Use **secret_access_key** instead]* aws secret access key. this is required when **auth_method** is `"basic"` or `"session"`. (string, optional)
- **end_point**: *[Deprecated: Use **endpoint** instead]* The AWS Service endpoint (string, optional)
- **operation**: *[Deprecated: Use **scan** or **query** option instead]* Operation Type (`"scan"` or `"query"`, required)
- **filters**: *[Deprecated: Use **query.filter_expression** option or **query.filter_expression** instead]* Query Filters. (Required if **operation** is `"query"`, optional if **operation** is `"scan"`)
- **name**: Column name.
- **type**: Column type.
- **condition**: Comparison Operator.
- **value(s)**: Attribute Value(s).
- **limit**: *[Deprecated: Use **query.batch_size** option or **query.batch_size** instead]* DynamoDB 1-time Scan/Query Operation size limit (int, optional)
- **scan_limit**: *[Deprecated: Use **query.batch_size** option or **query.batch_size** instead]* DynamoDB 1-time Scan Query size limit (int, optional)
- **record_limit**: *[Deprecated: Use **query.limit** option or **query.limit** instead]* Max Record Search limit (long, optional)
- **columns**: *[Deprecated: This **columns** option for the deprecated operation. See the above **columns** option when using a new operation.]* a key-value pairs where key is a column name and value is options for the column (required)
- **name**: Column name. (string, required)
- **type**: Column values are converted to this embulk type. (`"boolean"`, `"long"`, `"double"`, `"string"`, `"json"`, required)
- NOTE: Be careful that storing values is skipped when you specify `"timestamp"`.
## Example
- Scan Operation
Expand Down Expand Up @@ -195,9 +174,11 @@ You can see more examples [here](./example).
```shell
$ ./run_dynamodb_local.sh
# Set dummy credentials (access_key_id=dummy and secret_access_key=dummy)
$ aws configure
$ ./example/prepare_dynamodb_table.sh
$ ./gradlew classpath
$ embulk run example/config-query.yml -Ilib
$ ./gradlew gem
$ embulk run example/config-query.yml -Ibuild/gemContents/lib
```

### Run tests
Expand Down Expand Up @@ -251,4 +232,4 @@ $ ./gradlew gemPush

## License

[MIT LICENSE](./LICENSE)
[MIT LICENSE](./LICENSE.txt)
146 changes: 60 additions & 86 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,110 +1,84 @@
plugins {
id "com.jfrog.bintray" version "1.1"
id "com.github.jruby-gradle.base" version "1.5.0"
id "scala"
id "com.diffplug.gradle.spotless" version "3.27.1"
id "maven-publish"
id "org.embulk.embulk-plugins" version "0.5.5"
// note: Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
// id "com.diffplug.spotless" version "6.15.0"
// https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md#6130---2023-01-14
id "com.diffplug.spotless" version "6.13.0"
// note: We cannot use the latest version because of the following error.
// > org/eclipse/jgit/lib/Repository has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
// id "com.palantir.git-version" version "0.15.0"
id "com.palantir.git-version" version "0.12.3"
}

import com.github.jrubygradle.JRubyExec
repositories {
mavenCentral()
jcenter()
}
configurations {
provided
}

version = "0.3.1"
group = "pro.civitaspo"
description = "Loads records from Dynamodb."
version = {
def vd = versionDetails()
if (vd.commitDistance == 0 && vd.lastTag ==~ /^[0-9]+\.[0-9]+\.[0-9]+(\.[a-zA-Z0-9]+)?/) {
vd.lastTag
} else {
"0.0.0.${vd.gitHash}"
}
}()

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile "org.scala-lang:scala-library:2.13.1"

compile "org.embulk:embulk-core:0.9.23"
provided "org.embulk:embulk-core:0.9.23"

compile "com.amazonaws:aws-java-sdk-dynamodb:1.11.711"
compile "com.amazonaws:aws-java-sdk-sts:1.11.711"
// For @delegate macro.
compile "dev.zio:zio-macros-core_2.13:0.6.2"

testCompile "junit:junit:4.+"
testCompile "org.embulk:embulk-core:0.9.23:tests"
testCompile "org.embulk:embulk-standards:0.9.23"
testCompile "org.embulk:embulk-deps-buffer:0.9.23"
testCompile "org.embulk:embulk-deps-config:0.9.23"
}

compileScala {
scalaCompileOptions.additionalParameters = [
"-Ymacro-annotations"
]
// note: The upper versions of embulk includes Guava Dependency removal,
// so we need to specify the version of embulk to avoid some errors.
// We may need to update the version of embulk in the future.
def embulkVersion = "0.10.41"
compileOnly "org.embulk:embulk-api:${embulkVersion}"
compileOnly "org.embulk:embulk-spi:${embulkVersion}"
implementation "org.scala-lang:scala-library:2.13.1"

implementation "org.embulk:embulk-util-config:0.3.2"
implementation "org.embulk:embulk-util-json:0.1.1"
implementation "org.embulk:embulk-util-timestamp:0.2.1"
implementation "com.amazonaws:aws-java-sdk-dynamodb:1.11.711"
implementation "com.amazonaws:aws-java-sdk-sts:1.11.711"

testImplementation "junit:junit:4.+"
testImplementation "org.embulk:embulk-junit4:${embulkVersion}"
testImplementation "org.embulk:embulk-deps:${embulkVersion}"
testImplementation "org.embulk:embulk-input-config:0.10.36"
}

test {
jvmArgs '-Xms4g', '-Xmx4g', '-XX:MaxMetaspaceSize=1g'
maxHeapSize = "4g"
}

spotless {
scala {
scalafmt('2.3.2').configFile('.scalafmt.conf')
scalafmt('3.7.1').configFile('.scalafmt.conf')
}
}

task classpath(type: Copy, dependsOn: ["jar"]) {
doFirst { file("classpath").deleteDir() }
from (configurations.runtime - configurations.provided + files(jar.archivePath))
into "classpath"
embulkPlugin {
mainClass = "org.embulk.input.dynamodb.DynamodbInputPlugin"
category = "input"
type = "dynamodb"
}
clean { delete "classpath" }

task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
jrubyArgs "-S"
script "gem"
scriptArgs "build", "${project.name}.gemspec"
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
}

task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
jrubyArgs "-S"
script "gem"
scriptArgs "push", "pkg/${project.name}-${project.version}.gem"
}

task "package"(dependsOn: ["gemspec", "classpath"]) {
doLast {
println "> Build succeeded."
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
publishing {
publications {
embulkPluginMaven(MavenPublication) {
from components.java
}
}
}

task gemspec {
ext.gemspecFile = file("${project.name}.gemspec")
inputs.file "build.gradle"
outputs.file gemspecFile
doLast { gemspecFile.write($/
Gem::Specification.new do |spec|
spec.name = "${project.name}"
spec.version = "${project.version}"
spec.authors = ["Daisuke Higashi", "Civitaspo"]
spec.summary = %[Dynamodb input plugin for Embulk]
spec.description = %["Loads records from Dynamodb."]
spec.email = ["[email protected]", "[email protected]"]
spec.licenses = ["MIT"]
spec.homepage = "https://github.com/lulichn/embulk-input-dynamodb"

spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
spec.test_files = spec.files.grep(%r"^(test|spec)/")
spec.require_paths = ["lib"]

spec.add_development_dependency 'bundler', ['~> 1.0']
spec.add_development_dependency 'rake', ['~> 12.0']
end
/$)
repositories {
maven {
url = "${project.buildDir}/mavenPublishLocal"
}
}
}
clean { delete "${project.name}.gemspec" }

gem {
from("LICENSE.txt")
authors = ["Daisuke Higashi", "Civitaspo"]
email = ["[email protected]", "[email protected]"]
summary = "An Embulk plugin to ingest data from Dynamodb."
homepage = "https://github.com/lulichn/embulk-input-dynamodb"
licenses = [ "MIT" ]
}
20 changes: 0 additions & 20 deletions example/config-deprecated.yml

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 577beba

Please sign in to comment.