Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pmlopes committed Nov 29, 2018
2 parents a257665 + 383fbf3 commit 42bc556
Show file tree
Hide file tree
Showing 946 changed files with 160,800 additions and 51,016 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.


## [Unreleased]

## [0.5.6] - 2018-10-07
- Added a package command to package either fat jar or a JVMCI fat jar.
- Fix issue preventing GraalJS running on OpenJ9
- Allow specifying absolute path as start module
Expand All @@ -18,6 +20,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Decoupled Codec from the engine (avoids calls on the wrong context)
- Several clean ups

## [0.5.5] - Demo release
- Small fixes in order to get demos running

## [0.5.4] - 2018-09-17
- Bump `pg-reactive-client` to 0.10.3
- Fix `parsePaths` to properly convert slashes on windows.
Expand Down
47 changes: 47 additions & 0 deletions codegen/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>io.reactiverse</groupId>
<artifactId>es4x-parent</artifactId>
<version>0.6.0</version>
<relativePath>..</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>

<artifactId>es4x-codegen</artifactId>
<version>0.6.0</version>

<properties>
</properties>

<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-codegen</artifactId>
<version>${vertx.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2018 Paulo Lopes.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.reactiverse.es4x.codegen;

import io.reactiverse.es4x.codegen.generator.*;
import io.vertx.codegen.Generator;
import io.vertx.codegen.GeneratorLoader;

import javax.annotation.processing.ProcessingEnvironment;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Stream;

public class ES4XGeneratorLoader implements GeneratorLoader {
@Override
public Stream<Generator<?>> loadGenerators(ProcessingEnvironment processingEnv) {

final List<Generator<?>> generators = new LinkedList<>();

generators.add(new IndexJS());
generators.add(new IndexDTS());
generators.add(new OptionsJS());
generators.add(new OptionsDTS());
generators.add(new EnumJS());
generators.add(new EnumDTS());
generators.add(new ReadmeMD());
generators.add(new PackageJSON());

return generators.stream();

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2018 Paulo Lopes.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.reactiverse.es4x.codegen.generator;

import io.vertx.codegen.EnumModel;
import io.vertx.codegen.EnumValueInfo;
import io.vertx.codegen.Generator;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashSet;
import java.util.Map;

public class EnumDTS extends Generator<EnumModel> {

public EnumDTS() {
incremental = true;

kinds = new HashSet<>();
kinds.add("enum");

name = "es4x-generator (enum.d.ts)";
}

@Override
public String filename(EnumModel model) {
return "npm/enums.d.ts";
}

@Override
public String render(EnumModel model, int index, int size, Map<String, Object> session) {

StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);

if (index == 0) {
Util.generateLicense(writer);
} else {
writer.print("\n");
}

writer.printf("export enum %s {\n", model.getType().getRaw().getSimpleName());
for (int i = 0; i < model.getValues().size(); i++) {
EnumValueInfo value = model.getValues().get(i);
writer.printf(" %s", value.getIdentifier());
if (i != model.getValues().size() - 1) {
writer.print(",");
}
writer.print("\n");
}
writer.print("}\n");

return sw.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2018 Paulo Lopes.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.reactiverse.es4x.codegen.generator;

import io.vertx.codegen.Generator;
import io.vertx.codegen.EnumModel;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.HashSet;
import java.util.Map;

import static io.reactiverse.es4x.codegen.generator.Util.*;

public class EnumJS extends Generator<EnumModel> {

public EnumJS() {
incremental = true;

kinds = new HashSet<>();
kinds.add("enum");

name = "es4x-generator (enum.js)";
}

@Override
public String filename(EnumModel model) {
return "npm/enums.js";
}

@Override
public String render(EnumModel model, int index, int size, Map<String, Object> session) {

StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);

if (index == 0) {
Util.generateLicense(writer);
writer.printf("/// <reference types=\"%s/enums\" />\n", getNPMScope(model.getType().getRaw().getModule()));
writer.print("module.exports = {\n");
}

writer.printf(" %s: Java.type('%s')", model.getType().getRaw().getSimpleName(), model.getType().getName());

if (index != size - 1) {
writer.print(',');
}

writer.print('\n');

if (index == size - 1) {
writer.print("};\n");
}

return sw.toString();
}
}
Loading

0 comments on commit 42bc556

Please sign in to comment.