Skip to content

Commit 5e59dbe

Browse files
author
matrixdev
committed
formatting fixes
1 parent a57cc7d commit 5e59dbe

File tree

20 files changed

+422
-423
lines changed

20 files changed

+422
-423
lines changed

RoomigrantCompiler/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626

2727
// Auto META-INF processor info generator
2828
//noinspection AnnotationProcessorOnCompilePath
29-
compileOnly 'com.google.auto.service:auto-service:1.0-rc6'
29+
compileOnly 'com.google.auto.service:auto-service:1.0-rc7'
3030

3131
// Incremental processor support
3232
compileOnly 'net.ltgt.gradle.incap:incap:0.3'

RoomigrantCompiler/src/main/java/dev/matrix/roomigrant/compiler/Database.kt

+39-39
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@ class Database(val environment: ProcessingEnvironment, element: TypeElement) {
4040

4141
fun generate() {
4242
val typeSpec = TypeSpec.objectBuilder(migrationListClassName)
43-
.addProperties(generate_rules())
44-
.addFunction(generate_build())
45-
.addFunction(generate_buildScheme())
46-
.also {
47-
schemes.forEach { scheme -> it.addFunction(generate_buildSchemeInfo(scheme)) }
48-
}
43+
.addProperties(generate_rules())
44+
.addFunction(generate_build())
45+
.addFunction(generate_buildScheme())
46+
.also {
47+
schemes.forEach { scheme -> it.addFunction(generate_buildSchemeInfo(scheme)) }
48+
}
4949

5050
val fileSpec = FileSpec.builder(packageName, migrationListClassName.simpleName)
51-
.addType(typeSpec.build())
52-
.build()
51+
.addType(typeSpec.build())
52+
.build()
5353

5454
val fileName = "${migrationListClassName.simpleName}.kt"
5555
environment.filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, fileName)
56-
.openWriter()
57-
.use { fileSpec.writeTo(it) }
56+
.openWriter()
57+
.use { fileSpec.writeTo(it) }
5858
}
5959

6060
private fun generate_rules() = rules.getProvidersFields().map {
6161
PropertySpec.builder(it.name, it.type)
62-
.initializer("%T()", it.type)
63-
.build()
62+
.initializer("%T()", it.type)
63+
.build()
6464
}
6565

6666
private fun generate_build(): FunSpec {
@@ -74,7 +74,7 @@ class Database(val environment: ProcessingEnvironment, element: TypeElement) {
7474

7575
private fun generate_buildScheme(): FunSpec {
7676
val code = FunSpec.builder("buildScheme")
77-
.returns(Map::class.parameterizedBy(Int::class, SchemeInfo::class))
77+
.returns(Map::class.parameterizedBy(Int::class, SchemeInfo::class))
7878

7979
val schemesMap = "schemesMap"
8080
val schemesType = HashMap::class.parameterizedBy(Int::class, SchemeInfo::class)
@@ -90,39 +90,39 @@ class Database(val environment: ProcessingEnvironment, element: TypeElement) {
9090
return code.build()
9191
}
9292

93-
private fun generate_buildSchemeInfo(scheme: Scheme): FunSpec {
94-
val code = FunSpec.builder("buildSchemeInfo_${scheme.version}")
95-
.addModifiers(KModifier.PRIVATE)
96-
.returns(SchemeInfo::class)
93+
private fun generate_buildSchemeInfo(scheme: Scheme): FunSpec {
94+
val code = FunSpec.builder("buildSchemeInfo_${scheme.version}")
95+
.addModifiers(KModifier.PRIVATE)
96+
.returns(SchemeInfo::class)
9797

98-
val tablesMap = "tables"
99-
val tablesType = HashMap::class.parameterizedBy(String::class, TableInfo::class)
100-
code.addStatement("val %L = %T()", tablesMap, tablesType)
98+
val tablesMap = "tables"
99+
val tablesType = HashMap::class.parameterizedBy(String::class, TableInfo::class)
100+
code.addStatement("val %L = %T()", tablesMap, tablesType)
101101

102-
val schemeInfo = "schemeInfo"
103-
code.addStatement("val %L = %T(%L, %L)", schemeInfo, SchemeInfo::class, scheme.version, tablesMap)
102+
val schemeInfo = "schemeInfo"
103+
code.addStatement("val %L = %T(%L, %L)", schemeInfo, SchemeInfo::class, scheme.version, tablesMap)
104104

105-
code.addStatement("")
105+
code.addStatement("")
106106

107-
for (table in scheme.tables) {
108-
val tableInfo = "tableInfo_${table.name}"
109-
val indices = "indices_${table.name}"
107+
for (table in scheme.tables) {
108+
val tableInfo = "tableInfo_${table.name}"
109+
val indices = "indices_${table.name}"
110110

111-
val indicesType = HashMap::class.parameterizedBy(String::class, IndexInfo::class)
112-
code.addStatement("val %L = %T()", indices, indicesType)
113-
code.addStatement("")
111+
val indicesType = HashMap::class.parameterizedBy(String::class, IndexInfo::class)
112+
code.addStatement("val %L = %T()", indices, indicesType)
113+
code.addStatement("")
114114

115-
code.addStatement("val %L = %T(%L, %S, %S, %L)", tableInfo, TableInfo::class, schemeInfo, table.name, table.createSql(), indices)
116-
code.addStatement("%L.put(%S, %L)", tablesMap, table.name, tableInfo)
117-
code.addStatement("")
115+
code.addStatement("val %L = %T(%L, %S, %S, %L)", tableInfo, TableInfo::class, schemeInfo, table.name, table.createSql(), indices)
116+
code.addStatement("%L.put(%S, %L)", tablesMap, table.name, tableInfo)
117+
code.addStatement("")
118118

119-
for (index in table.indices) {
120-
code.addStatement("%L.put(%S, %T(%L, %S, %S))", indices, index.name, IndexInfo::class, tableInfo, index.name, index.createSql(table.name))
121-
}
122-
}
119+
for (index in table.indices) {
120+
code.addStatement("%L.put(%S, %T(%L, %S, %S))", indices, index.name, IndexInfo::class, tableInfo, index.name, index.createSql(table.name))
121+
}
122+
}
123123

124-
code.addStatement("return %L", schemeInfo)
124+
code.addStatement("return %L", schemeInfo)
125125

126-
return code.build()
127-
}
126+
return code.build()
127+
}
128128
}

0 commit comments

Comments
 (0)