Skip to content

Commit 866144b

Browse files
Hibernate-CImbellade
authored andcommitted
Fail documentation builds on missing includes
1 parent 8e051ac commit 866144b

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

documentation/documentation.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ asciidoctorj {
264264
'html-meta-version-family': ormBuildDetails.hibernateVersion.family
265265

266266
options logDocuments: true
267+
268+
fatalWarnings(missingIncludes())
267269
}
268270

269271

documentation/src/main/asciidoc/userguide/chapters/domain/entity.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ The https://docs.hibernate.org/orm/{majorMinorVersion}/javadocs/org/hibernate/an
470470
====
471471
[source,java]
472472
----
473-
include::{example-dir-proxy}/concrete/AbstractConcreteProxyTest.java[tag=entity-concrete-proxy-mapping,indent=0]
473+
include::{example-dir-proxy}/concrete/ConcreteProxyTest.java[tag=entity-concrete-proxy-mapping,indent=0]
474474
----
475475
====
476476

@@ -481,7 +481,7 @@ In the following example we load the parent's lazy association and resolve to th
481481
====
482482
[source,java]
483483
----
484-
include::{example-dir-proxy}/concrete/AbstractConcreteProxyTest.java[tag=entity-concrete-proxy-find,indent=0]
484+
include::{example-dir-proxy}/concrete/ConcreteProxyTest.java[tag=entity-concrete-proxy-find,indent=0]
485485
----
486486
487487
[source,sql]
@@ -505,7 +505,7 @@ In the following example, you can see how Hibernate issues a query to resolve th
505505
====
506506
[source,java]
507507
----
508-
include::{example-dir-proxy}/concrete/AbstractConcreteProxyTest.java[tag=entity-concrete-proxy-reference,indent=0]
508+
include::{example-dir-proxy}/concrete/ConcreteProxyTest.java[tag=entity-concrete-proxy-reference,indent=0]
509509
----
510510
511511
[source,sql]

documentation/src/main/asciidoc/userguide/chapters/pc/PersistenceContext.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ if the `@Filter` defines a condition that uses predicates across multiple tables
584584
====
585585
[source, java, indent=0]
586586
----
587-
include::{example-dir-pc}/FilterSqlFragementAliasTest.java[tags=pc-filter-sql-fragment-alias-example]
587+
include::{example-dir-pc}/FilterSqlFragmentAliasTest.java[tags=pc-filter-sql-fragment-alias-example]
588588
----
589589
====
590590

@@ -596,7 +596,7 @@ Hibernate is going to apply the right table aliases to the filter predicates:
596596
====
597597
[source, java, indent=0]
598598
----
599-
include::{example-dir-pc}/FilterSqlFragementAliasTest.java[tags=pc-filter-sql-fragment-alias-query-example]
599+
include::{example-dir-pc}/FilterSqlFragmentAliasTest.java[tags=pc-filter-sql-fragment-alias-query-example]
600600
----
601601
602602
[source, sql, indent=0]

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/basic/bitset/BitSetTypeTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
import org.hibernate.annotations.Parameter;
1212
import org.hibernate.annotations.Type;
13+
import org.hibernate.boot.MetadataBuilder;
14+
import org.hibernate.boot.MetadataSources;
15+
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
1316
import org.hibernate.testing.orm.junit.DomainModel;
1417
import org.hibernate.testing.orm.junit.ServiceRegistry;
1518
import org.hibernate.testing.orm.junit.SessionFactory;
@@ -37,6 +40,22 @@ public void cleanup(SessionFactoryScope scope) {
3740
scope.getSessionFactory().getSchemaManager().truncateMappedObjects();
3841
}
3942

43+
/*
44+
* We don't need this code for the test itself but we need to include it in the ref doc.
45+
*/
46+
public void ignoredJustForIncludeInSources() {
47+
try (org.hibernate.service.ServiceRegistry standardRegistry = new StandardServiceRegistryBuilder().build()) {
48+
//tag::basic-custom-type-register-BasicType-example[]
49+
MetadataSources sources = new MetadataSources( standardRegistry );
50+
MetadataBuilder metadataBuilder = sources.getMetadataBuilder();
51+
metadataBuilder.applyBasicType( BitSetType.INSTANCE );
52+
//end::basic-custom-type-register-BasicType-example[]
53+
}
54+
catch (Exception ignore) {
55+
56+
}
57+
}
58+
4059
@Test
4160
public void test(SessionFactoryScope scope) {
4261

0 commit comments

Comments
 (0)