mirror of
https://github.com/corda/corda.git
synced 2025-04-07 19:34:41 +00:00
Merge pull request #359 from corda/clint-explicitkapt
Kapt is no longer run automatically when build is run.
This commit is contained in:
commit
66e4f8d74b
@ -16,12 +16,24 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
// Kapt plugin is hardcoded in output directory and sourcesets. Use a separate sourceset to keep the generated
|
||||
// files in git and outside of the build directory (to avoid cleaning issues)
|
||||
sourceSets {
|
||||
main {
|
||||
kotlin {
|
||||
srcDir "${buildDir}/generated/source/kapt/main/"
|
||||
}
|
||||
}
|
||||
generated {
|
||||
java {
|
||||
srcDir "${projectDir}/generated/source/kapt/main/"
|
||||
compileClasspath += sourceSets.main.compileClasspath + sourceSets.main.output
|
||||
}
|
||||
}
|
||||
test {
|
||||
compileClasspath += sourceSets.generated.output + sourceSets.main.compileClasspath
|
||||
runtimeClasspath += compileClasspath
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -33,3 +45,34 @@ dependencies {
|
||||
// For H2 database support in persistence
|
||||
testCompile "com.h2database:h2:$h2_version"
|
||||
}
|
||||
|
||||
// Generated files will be removed by gradle clean. Since we aren't running kapt every time we must preserve these files
|
||||
// Note: The lines that actually invoke kapt are those in the project.afterEvaluate block.
|
||||
task buildKapt(type: Copy) {
|
||||
from "${buildDir}/generated"
|
||||
into "${projectDir}/generated"
|
||||
}
|
||||
|
||||
// Kapt hijacks anything named "compile"
|
||||
task buildGenerated(type: JavaCompile) {
|
||||
source = sourceSets.generated.allJava
|
||||
classpath = sourceSets.generated.compileClasspath + sourceSets.main.compileClasspath + sourceSets.main.output
|
||||
destinationDir = file("$buildDir/classes/generated")
|
||||
}
|
||||
|
||||
// Remove the dependency on compile in kapt to avoid automatic kapt running - run :node-schemas:kaptKotlin explicitly.
|
||||
project.afterEvaluate {
|
||||
jar.dependsOn.each { jar.dependsOn.remove it }
|
||||
buildGenerated.dependsOn.each { buildGenerated.dependsOn.remove it }
|
||||
jar.dependsOn buildGenerated
|
||||
compileTestKotlin.dependsOn buildGenerated
|
||||
buildGenerated.dependsOn classes
|
||||
compileKotlin.dependsOn.remove kaptKotlin
|
||||
compileTestKotlin.dependsOn.remove kaptTestKotlin
|
||||
buildKapt.dependsOn kaptKotlin
|
||||
buildKapt.mustRunAfter kaptKotlin
|
||||
}
|
||||
|
||||
jar {
|
||||
from sourceSets.generated.output
|
||||
}
|
||||
|
@ -0,0 +1,153 @@
|
||||
// Generated file do not edit, generated by io.requery.processor.EntityProcessor
|
||||
package net.corda.node.services.persistence.schemas;
|
||||
|
||||
import io.requery.Persistable;
|
||||
import io.requery.meta.AttributeBuilder;
|
||||
import io.requery.meta.AttributeDelegate;
|
||||
import io.requery.meta.Type;
|
||||
import io.requery.meta.TypeBuilder;
|
||||
import io.requery.proxy.EntityProxy;
|
||||
import io.requery.proxy.Property;
|
||||
import io.requery.proxy.PropertyState;
|
||||
import io.requery.util.function.Function;
|
||||
import io.requery.util.function.Supplier;
|
||||
import java.lang.Object;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import javax.annotation.Generated;
|
||||
import net.corda.core.crypto.SecureHash;
|
||||
|
||||
@Generated("io.requery.processor.EntityProcessor")
|
||||
public class AttachmentEntity implements Attachment, Persistable {
|
||||
public static final AttributeDelegate<AttachmentEntity, SecureHash> ATT_ID = new AttributeDelegate(
|
||||
new AttributeBuilder<AttachmentEntity, SecureHash>("att_id", SecureHash.class)
|
||||
.setProperty(new Property<AttachmentEntity, SecureHash>() {
|
||||
@Override
|
||||
public SecureHash get(AttachmentEntity entity) {
|
||||
return entity.attId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(AttachmentEntity entity, SecureHash value) {
|
||||
entity.attId = value;
|
||||
}
|
||||
})
|
||||
.setPropertyName("getAttId")
|
||||
.setPropertyState(new Property<AttachmentEntity, PropertyState>() {
|
||||
@Override
|
||||
public PropertyState get(AttachmentEntity entity) {
|
||||
return entity.$attId_state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(AttachmentEntity entity, PropertyState value) {
|
||||
entity.$attId_state = value;
|
||||
}
|
||||
})
|
||||
.setKey(true)
|
||||
.setGenerated(false)
|
||||
.setLazy(false)
|
||||
.setNullable(true)
|
||||
.setUnique(false)
|
||||
.build());
|
||||
|
||||
public static final AttributeDelegate<AttachmentEntity, byte[]> CONTENT = new AttributeDelegate(
|
||||
new AttributeBuilder<AttachmentEntity, byte[]>("content", byte[].class)
|
||||
.setProperty(new Property<AttachmentEntity, byte[]>() {
|
||||
@Override
|
||||
public byte[] get(AttachmentEntity entity) {
|
||||
return entity.content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(AttachmentEntity entity, byte[] value) {
|
||||
entity.content = value;
|
||||
}
|
||||
})
|
||||
.setPropertyName("getContent")
|
||||
.setPropertyState(new Property<AttachmentEntity, PropertyState>() {
|
||||
@Override
|
||||
public PropertyState get(AttachmentEntity entity) {
|
||||
return entity.$content_state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(AttachmentEntity entity, PropertyState value) {
|
||||
entity.$content_state = value;
|
||||
}
|
||||
})
|
||||
.setGenerated(false)
|
||||
.setLazy(false)
|
||||
.setNullable(true)
|
||||
.setUnique(false)
|
||||
.setConverter(new net.corda.core.schemas.requery.converters.BlobConverter())
|
||||
.build());
|
||||
|
||||
public static final Type<AttachmentEntity> $TYPE = new TypeBuilder<AttachmentEntity>(AttachmentEntity.class, "attachments")
|
||||
.setBaseType(Attachment.class)
|
||||
.setCacheable(true)
|
||||
.setImmutable(false)
|
||||
.setReadOnly(false)
|
||||
.setStateless(false)
|
||||
.setFactory(new Supplier<AttachmentEntity>() {
|
||||
@Override
|
||||
public AttachmentEntity get() {
|
||||
return new AttachmentEntity();
|
||||
}
|
||||
})
|
||||
.setProxyProvider(new Function<AttachmentEntity, EntityProxy<AttachmentEntity>>() {
|
||||
@Override
|
||||
public EntityProxy<AttachmentEntity> apply(AttachmentEntity entity) {
|
||||
return entity.$proxy;
|
||||
}
|
||||
})
|
||||
.addAttribute(ATT_ID)
|
||||
.addAttribute(CONTENT)
|
||||
.build();
|
||||
|
||||
private PropertyState $attId_state;
|
||||
|
||||
private PropertyState $content_state;
|
||||
|
||||
private SecureHash attId;
|
||||
|
||||
private byte[] content;
|
||||
|
||||
private final transient EntityProxy<AttachmentEntity> $proxy = new EntityProxy<AttachmentEntity>(this, $TYPE);
|
||||
|
||||
public AttachmentEntity() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SecureHash getAttId() {
|
||||
return $proxy.get(ATT_ID);
|
||||
}
|
||||
|
||||
public void setAttId(SecureHash attId) {
|
||||
$proxy.set(ATT_ID, attId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getContent() {
|
||||
return $proxy.get(CONTENT);
|
||||
}
|
||||
|
||||
public void setContent(byte[] content) {
|
||||
$proxy.set(CONTENT, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof AttachmentEntity && ((AttachmentEntity)obj).$proxy.equals(this.$proxy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return $proxy.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return $proxy.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
// Generated file do not edit, generated by io.requery.processor.EntityProcessor
|
||||
package net.corda.node.services.persistence.schemas;
|
||||
|
||||
import io.requery.meta.EntityModel;
|
||||
import io.requery.meta.EntityModelBuilder;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated("io.requery.processor.EntityProcessor")
|
||||
public class Models {
|
||||
public static final EntityModel PERSISTENCE = new EntityModelBuilder("persistence")
|
||||
.addType(AttachmentEntity.$TYPE)
|
||||
.build();
|
||||
|
||||
private Models() {
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user