Skip to content

Commit

Permalink
Merge pull request #4 from xenit-eu/contentgrid-namespace
Browse files Browse the repository at this point in the history
Contentgrid namespace
  • Loading branch information
rschev authored Dec 7, 2023
2 parents 6351ce1 + aa33817 commit 354840a
Show file tree
Hide file tree
Showing 43 changed files with 119 additions and 117 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Bard 1.0.0 *(UNRELEASED)*
* Converted build system to Gradle
* New: Inline annotation members for fields
* New: Supports JDK 11 (baseline) & JDK 17
* Override whitespace for nested annotations
* Changed package namespace to `com.contentgrid.bard`

JavaPoet 1.13.0 *(2020-06-18)*
-----------------------------
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

`Bard` is a Java API for generating `.java` source files, forked from [square/javapoet][javapoet].

Its primary purpose is to serve as the java sourcecode generator for [xenit-eu/contentcloud-scribe][scribe].
Its primary purpose is to serve as the java sourcecode generator for [xenit-eu/contentgrid-scribe][scribe].

## Installation

With Maven:
```xml
<dependency>
<groupId>eu.xenit.contentcloud.bard</groupId>
<groupId>com.contentgrid.bard</groupId>
<artifactId>bard</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
```

or Gradle:
```groovy
compile 'eu.xenit.contentcloud.bard:0.1.0-SNAPSHOT'
compile 'com.contentgrid.bard:0.1.0-SNAPSHOT'
```

Snapshots of the development version are available in [Sonatype's `snapshots` repository][snapshot].
Expand Down Expand Up @@ -911,7 +911,7 @@ Use `$T` when referencing types in Javadoc to get automatic imports.

# JavaPoet & JavaWriter

Bard is a fork of [JavaPoet][javapoet]. It's the java sourcecode generator library used in [xenit-eu/contentcloud-scribe][scribe]
Bard is a fork of [JavaPoet][javapoet]. It's the java sourcecode generator library used in [xenit-eu/contentgrid-scribe][scribe]

The main reason for forking JavaPoet is to have more control over the layout of the generated code. See [#658] for example.
There are some straight forward progress possible, when you can break the original JavaPoet API.
Expand All @@ -923,7 +923,7 @@ also better suited to composition: rather than streaming the contents of a `.jav
top-to-bottom in a single pass, a file can be assembled as a tree of declarations.

[javapoet]: https://github.com/square/javapoet
[scribe]: https://github.com/xenit-eu/contentcloud-scribe
[scribe]: https://github.com/xenit-eu/contentgrid-scribe
[#658]: https://github.com/square/javapoet/issues/658
[snapshot]: https://oss.sonatype.org/content/repositories/snapshots/com/squareup/javapoet/
[javadoc]: https://square.github.io/javapoet/1.x/javapoet/
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
group=eu.xenit.contentcloud.bard
group=com.contentgrid.bard
description=Bard is a Java API to generate .java source code
2 changes: 2 additions & 0 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ publishing {
repositories {
if (version.version.isSignificant()) {
sonatypeMavenCentral {
url = "https://s01.oss.sonatype.org/service/local/"
credentials {
username = project.findProperty('sonatype_username')
password = project.findProperty('sonatype_password')
}
}
} else {
sonatypeSnapshots {
url = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
credentials {
username = project.findProperty('sonatype_username')
password = project.findProperty('sonatype_password')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.annotation.Annotation;
Expand All @@ -36,9 +36,9 @@
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.SimpleAnnotationValueVisitor8;

import static eu.xenit.contentcloud.bard.Util.characterLiteralWithoutSingleQuotes;
import static eu.xenit.contentcloud.bard.Util.checkArgument;
import static eu.xenit.contentcloud.bard.Util.checkNotNull;
import static com.contentgrid.bard.Util.characterLiteralWithoutSingleQuotes;
import static com.contentgrid.bard.Util.checkArgument;
import static com.contentgrid.bard.Util.checkNotNull;

/** A generated annotation on a declaration. */
public final class AnnotationSpec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.GenericArrayType;
Expand All @@ -25,7 +25,7 @@
import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.type.ArrayType;

import static eu.xenit.contentcloud.bard.Util.checkNotNull;
import static com.contentgrid.bard.Util.checkNotNull;

public final class ArrayTypeName extends TypeName {
public final TypeName componentType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -31,10 +31,10 @@
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Modifier;

import static eu.xenit.contentcloud.bard.Util.checkArgument;
import static eu.xenit.contentcloud.bard.Util.checkNotNull;
import static eu.xenit.contentcloud.bard.Util.checkState;
import static eu.xenit.contentcloud.bard.Util.stringLiteralWithDoubleQuotes;
import static com.contentgrid.bard.Util.checkArgument;
import static com.contentgrid.bard.Util.checkNotNull;
import static com.contentgrid.bard.Util.checkState;
import static com.contentgrid.bard.Util.stringLiteralWithDoubleQuotes;
import static java.lang.String.join;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Type;
Expand All @@ -24,9 +24,9 @@
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Modifier;

import static eu.xenit.contentcloud.bard.Util.checkArgument;
import static eu.xenit.contentcloud.bard.Util.checkNotNull;
import static eu.xenit.contentcloud.bard.Util.checkState;
import static com.contentgrid.bard.Util.checkArgument;
import static com.contentgrid.bard.Util.checkNotNull;
import static com.contentgrid.bard.Util.checkState;

/** A generated field declaration. */
public final class FieldSpec {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.ByteArrayInputStream;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;

import static eu.xenit.contentcloud.bard.Util.checkNotNull;
import static com.contentgrid.bard.Util.checkNotNull;

/**
* Implements soft line wrapping on an appendable. To use, append characters using {@link #append}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Modifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.GenericArrayType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.ParameterizedType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Type;
Expand All @@ -28,8 +28,8 @@
import javax.lang.model.type.TypeMirror;
import javax.lang.model.type.TypeVariable;

import static eu.xenit.contentcloud.bard.Util.checkArgument;
import static eu.xenit.contentcloud.bard.Util.checkNotNull;
import static com.contentgrid.bard.Util.checkArgument;
import static com.contentgrid.bard.Util.checkNotNull;

public final class TypeVariableName extends TypeName {
public final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.io.IOException;
import java.lang.reflect.Type;
Expand All @@ -26,7 +26,7 @@
import javax.lang.model.element.TypeParameterElement;
import javax.lang.model.type.TypeMirror;

import static eu.xenit.contentcloud.bard.Util.checkArgument;
import static com.contentgrid.bard.Util.checkArgument;

public final class WildcardTypeName extends TypeName {
public final List<TypeName> upperBounds;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/ClassNameNoPackageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static com.google.common.truth.Truth.assertThat;

import eu.xenit.contentcloud.bard.ClassName;
import com.contentgrid.bard.ClassName;
import org.junit.Test;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import static com.google.common.truth.Truth.assertThat;
import static com.google.testing.compile.CompilationSubject.assertThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.xenit.contentcloud.bard;
package com.contentgrid.bard;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
Expand Down Expand Up @@ -196,8 +196,7 @@ private void annotatedEquivalence(TypeName type) {
.varargs()
.build();
assertThat(varargsMethod.toString()).isEqualTo(""
+ "void m(\n"
+ " java.lang.Object @" + TUA + " []... p) {\n"
+ "void m(java.lang.Object @" + TUA + " []... p) {\n"
+ "}\n");
}

Expand All @@ -213,8 +212,7 @@ private void annotatedEquivalence(TypeName type) {
.build();

assertThat(varargsMethod.toString()).isEqualTo(""
+ "void m(\n"
+ " java.lang.Object[] @" + TUA + " ... p) {\n"
+ "void m(java.lang.Object[] @" + TUA + " ... p) {\n"
+ "}\n");
}
}
Loading

0 comments on commit 354840a

Please sign in to comment.