Skip to content

Commit

Permalink
Merge pull request #1 from hydrator/update-4.3
Browse files Browse the repository at this point in the history
Updated to 4.3
  • Loading branch information
bdmogal authored Nov 17, 2017
2 parents ab26b26 + 458d009 commit 247c394
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 89 deletions.
Binary file added icons/AmazonS3Client-action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 13 additions & 88 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<name>Amazon S3 Client Action Plugin</name>
<groupId>co.cask.hydrator</groupId>
<artifactId>amazon-s3client-action</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<licenses>
Expand Down Expand Up @@ -64,12 +64,8 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cdap.version>4.3.0-SNAPSHOT</cdap.version>
<cdap.version>4.3.2</cdap.version>
<hadoop.version>2.3.0</hadoop.version>
<!-- properties for script build step that creates the config files for the artifacts -->
<widgets.dir>widgets</widgets.dir>
<docs.dir>docs</docs.dir>
<app.parents>system:cdap-data-pipeline[4.1.0,4.3.0-SNAPSHOT),system:cdap-data-streams[4.1.0,4.3.0-SNAPSHOT)</app.parents>
<!-- this is here because project.basedir evaluates to null in the script build step -->
<main.basedir>${project.basedir}</main.basedir>
</properties>
Expand Down Expand Up @@ -188,96 +184,25 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<groupId>co.cask</groupId>
<artifactId>cdap-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<configuration>
<cdapArtifacts>
<parent>system:cdap-data-pipeline[4.0.0,5.0.0-SNAPSHOT)</parent>
<parent>system:cdap-data-streams[4.0.0,5.0.0-SNAPSHOT)</parent>
</cdapArtifacts>
</configuration>
<executions>
<!-- Create the config file for artifact which can be used to deploy the artifact.
Sets the parents field to system:cdap-etl-batch and system:cdap-etl-realtime with whatever
version range is set in the etl.versionRange property.
also sets a widget and doc property for each file contained in the widgets and docs directories. -->
<execution>
<id>create-artifact-config</id>
<phase>prepare-package</phase>
<configuration>
<target>
<script language="javascript"> <![CDATA[
// for some reason, project.basedir evaluates to null if we just get the property here.
// so we set main.basedir to project.basedir in the pom properties, then main.basedir is used here
// where it evaluates correctly for whatever reason
var baseDir = project.getProperty("main.basedir");
var targetDir = project.getProperty("project.build.directory");
var artifactId = project.getProperty("project.artifactId");
var version = project.getProperty("project.version");
var cfgFile = new java.io.File(targetDir, artifactId + "-" + version + ".json");
if (!cfgFile.exists()) {
cfgFile.createNewFile();
}
var parents = project.getProperty("app.parents").split(",");
var config = {
"parents": [ ],
"properties": {}
}
for (i = 0; i < parents.length; i+=2) {
// because name1[lo,hi],name2[lo,hi] gets split into "name1[lo", "hi]", "name2[lo", "hi]"
// so we have to combine them again
config.parents.push(parents[i] + "," + parents[i+1]);
}
// look in widgets directory for widget config for each plugin
var widgetsDir = new java.io.File(baseDir, project.getProperty("widgets.dir"));
if (widgetsDir.isDirectory()) {
var widgetsFiles = widgetsDir.listFiles();
for (i = 0; i < widgetsFiles.length; i++) {
var widgetsFile = widgetsFiles[i];
if (widgetsFile.isFile()) {
var propertyName = "widgets." + widgetsFile.getName();
// if the filename ends with .json
if (propertyName.indexOf(".json", propertyName.length - 5) !== -1) {
// strip the .json
propertyName = propertyName.slice(0, -5);
var contents = new java.lang.String(java.nio.file.Files.readAllBytes(widgetsFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
var contentsAsJson = JSON.parse(contents);
config.properties[propertyName] = JSON.stringify(contentsAsJson);
}
}
}
}
// look in the docs directory for docs for each plugin
var docsDir = new java.io.File(baseDir, project.getProperty("docs.dir"));
if (docsDir.isDirectory()) {
var docFiles = docsDir.listFiles();
for (i = 0; i < docFiles.length; i++) {
var docFile = docFiles[i];
if (docFile.isFile()) {
var propertyName = "doc." + docFile.getName();
// if the filename ends with .md
if (propertyName.indexOf(".md", propertyName.length - 3) !== -1) {
// strip the extension
propertyName = propertyName.slice(0, -3);
var contents = new java.lang.String(java.nio.file.Files.readAllBytes(docFile.toPath()), java.nio.charset.StandardCharsets.UTF_8);
config.properties[propertyName] = contents + "";
}
}
}
}
var fw = new java.io.BufferedWriter(new java.io.FileWriter(cfgFile.getAbsoluteFile()));
fw.write(JSON.stringify(config, null, 2));
fw.close();
]]></script>
</target>
</configuration>
<goals>
<goal>run</goal>
<goal>create-plugin-json</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
</project>
3 changes: 2 additions & 1 deletion widgets/AmazonS3Client-action.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"metadata": {
"spec-version": "1.4"
"spec-version": "1.5"
},
"display-name": "Amazon S3 Client",
"configuration-groups": [
{
"label": "Required Options",
Expand Down

0 comments on commit 247c394

Please sign in to comment.