-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
publish-common.gradle
154 lines (138 loc) · 5.98 KB
/
publish-common.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.flywaydb.flyway'
apply plugin: 'nu.studer.jooq'
if (!name.equalsIgnoreCase("stores") && !name.equalsIgnoreCase("components")) {
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact(sourceJar) {
classifier = 'sources'
}
artifact(javadocJar) {
classifier = 'javadoc'
}
artifactId 'yaci-store-' + project.name
pom {
url = 'https://github.com/bloxbean/yaci-store'
licenses {
license {
name = 'The MIT License'
url = 'https://opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
id = 'satran004'
name = 'Satya'
}
}
scm {
connection = 'scm:git:git://github.com/bloxbean/yaci-store.git'
developerConnection = 'scm:git:ssh://git@github.com/bloxbean/yaci-store.git'
url = 'https://github.com/bloxbean/yaci-store'
}
}
}
}
repositories {
String ossrhUsername = System.getenv('MAVEN_USERNAME')
String ossrhPassword = System.getenv('MAVEN_PASSWORD')
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
}
//JOOQ generator
//Add store modules to this array
def jooq_modules = ['utxo', 'transaction', 'block', 'script', 'account', 'governance-aggr', 'staking', 'adapot']
if (jooq_modules.contains(name)) {
configurations {
flywayMigration
}
dependencies {
flywayMigration 'com.h2database:h2'
jooqGenerator 'com.h2database:h2'
}
flyway {
configurations = ['flywayMigration']
url = 'jdbc:h2:' + project.buildDir.absolutePath + File.separator + 'testdb;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;INIT=CREATE SCHEMA IF NOT EXISTS \"PUBLIC\"\\;'
user = 'sa'
password = ''
locations = ['filesystem:src/main/resources/db/store/h2']
createSchemas = true
schemas = ['PUBLIC']
// cleanOnValidationError = true
// cleanDisabled = false
}
jooq {
version = '3.18.9'
configurations {
main {
generationTool {
// logging = org.jooq.meta.jaxb.Logging.WARN
jdbc {
driver = 'org.h2.Driver'
url = flyway.url
user = flyway.user
password = flyway.password
}
generator {
name = 'org.jooq.codegen.DefaultGenerator'
database {
name = 'org.jooq.meta.h2.H2Database'
includes = 'PUBLIC.*'
excludes = 'FLYWAY_SCHEMA_HISTORY | UNUSED_TABLE | PREFIX_.* | SECRET_SCHEMA.SECRET_TABLE | SECRET_ROUTINE'
schemata {
schema {
inputSchema = 'PUBLIC'
outputSchemaToDefault = true
}
}
}
target {
packageName = 'com.bloxbean.cardano.yaci.store.' + project.name + ".jooq";
}
generate {
// Generate the DAO classes
daos = true
// Annotate DAOs (and other types) with spring annotations, such as @Repository and @Autowired
// for auto-wiring the Configuration instance, e.g. from Spring Boot's jOOQ starter
springAnnotations = true
// Generate Spring-specific DAOs containing @Transactional annotations
springDao = true
}
}
}
}
}
}
// configure jOOQ task such that it only executes when something has changed that potentially affects the generated JOOQ sources
// - the jOOQ configuration has changed (Jdbc, Generator, Strategy, etc.)
// - the classpath used to execute the jOOQ generation tool has changed (jOOQ library, database driver, strategy classes, etc.)
// - the schema files from which the schema is generated and which is used by jOOQ to generate the sources have changed (scripts added, modified, etc.)
tasks.named('generateJooq').configure {
// ensure database schema has been prepared by Flyway before generating the jOOQ sources
dependsOn tasks.named('flywayMigrate')
// declare Flyway migration scripts as inputs on the jOOQ task
inputs.files(fileTree('src/main/resources/db/store/h2'))
.withPropertyName('migrations')
.withPathSensitivity(PathSensitivity.RELATIVE)
// make jOOQ task participate in incremental builds (and build caching)
allInputsDeclared = true
}
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
if (isReleaseVersion && !project.hasProperty("skipSigning")) {
signing {
sign publishing.publications
}
}