This repository was archived by the owner on Nov 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
114 lines (96 loc) · 3.36 KB
/
build.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
/*
* Copyright 2020 Kato Shinya.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
plugins {
id 'java'
id 'application'
id 'maven-publish'
id 'com.palantir.git-version' version '0.12.2'
}
publishing {
publications {
group 'org.thinkit.formatter'
version = gitVersion()
gpr(MavenPublication) {
from(components.java)
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/myConsciousness/sql-formatter")
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_PUBLISH_TOKEN")
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/myConsciousness/sql-formatter")
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_DOWNLOAD_PACKAGE_TOKEN")
}
}
jcenter()
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
dependencies {
implementation 'com.google.guava:guava:29.0-jre'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
implementation 'org.thinkit.common:dev-utils:v1.0.1'
implementation 'org.thinkit.formatter.common:formatter-commons:v1.0.1'
implementation 'org.thinkit.framework.content:content-framework:v1.0.2'
implementation 'org.thinkit.api.catalog:catalog-api:v1.0.1'
}
application {
mainClassName = 'org.thinkit.formatter.EntrySqlFormatter'
}
run {
if (project.hasProperty('sql')) {
args project.sql
} else {
// demo for select
args " select distinct salary from employee a where 3 >= (select count(distinct salary) from employee b where a.salary <= b.salary) order by a.salary desc;"
// // demo for create table
// args "create table staff (id int not null, name varchar(10) default 'NoData');"
// // demo for comment on
// args "COMMENT ON COLUMN emp.empno IS 'this is description for column';";
// // demo for alter table
// args "ALTER TABLE t2 ADD c INT UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (c);";
// args "ALTER TABLE t2 DROP COLUMN c, b, a;";
// args "ALTER TABLE t2 ADD INDEX (d), ADD UNIQUE (a);";
// args "ALTER TABLE t2 MODIFY a TINYINT NOT NULL, CHANGE b c CHAR(20);";
// args "ALTER TABLE 'aaa' RENAME TO a;";
}
if (project.hasProperty('indent')) {
args project.indent
} else {
args "-1"
}
}
test {
// Use junit platform for unit tests
useJUnitPlatform()
}