Skip to content

Commit

Permalink
update icons and version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhooshan Mogal authored and anew committed Apr 16, 2019
1 parent b4b9016 commit 9d645aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 91 deletions.
Binary file added icons/CobolRecordConverter-transform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 15 additions & 89 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,17 @@
<groupId>co.cask</groupId>
<artifactId>cobol-to-avro-transform</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<version>1.0.0</version>
<name>Cobol to Avro Transform</name>

<properties>
<avro.version>1.7.7</avro.version>
<cdap.version>4.1.0</cdap.version>
<cdap.version>4.3.1</cdap.version>
<guava.version>18.0</guava.version>
<janino.version>3.0.7</janino.version>
<legstar.avro.version>0.4.2</legstar.avro.version>
<logback.version>1.2.3</logback.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- properties for script build step that creates the config files for the artifacts -->
<widgets.dir>widgets</widgets.dir>
<docs.dir>docs</docs.dir>

<!-- This is the version range for the app.parents that this plugin is valid for. Usually this will correspond with
the CDAP version, but not always. -->
<etl.versionRange>[3.3.0,10.0.0-SNAPSHOT)</etl.versionRange>

<!-- These are the application template artifacts that this plugin will be available for. -->
<app.parents>
system:cdap-etl-batch,
system:cdap-data-pipeline,
system:cdap-data-streams
</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 @@ -98,81 +84,21 @@
<build>
<plugins>
<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>
<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 parentVersions = project.getProperty("etl.versionRange");
var config = {
"parents": [ ],
"properties": {}
}
for (i = 0; i < parents.length; i++) {
config.parents.push(parents[i].trim() + parentVersions);
}
// 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>
Expand Down Expand Up @@ -214,4 +140,4 @@
</plugin>
</plugins>
</build>
</project>
</project>
5 changes: 3 additions & 2 deletions widgets/CobolRecordConverter-transform.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"metadata": {
"spec-version": "1.0"
"spec-version": "1.5"
},
"display-name": "COBOL to Avro Converter",
"configuration-groups": [
{
"label": "COBOL to Avro Record Converter Configuration",
Expand Down Expand Up @@ -80,4 +81,4 @@
}
}
]
}
}

0 comments on commit 9d645aa

Please sign in to comment.