-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from InsertKoinIO/check_kmp_fix
KMP Code Generation Fix + Revamp Code Generation
- Loading branch information
Showing
33 changed files
with
1,012 additions
and
741 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
examples/android-coffee-maker/src/test/java/AndroidModuleTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...cts/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/generator/ClassModuleWriter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2017-present the original author or authors. | ||
* | ||
* 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. | ||
*/ | ||
package org.koin.compiler.generator | ||
|
||
import com.google.devtools.ksp.processing.CodeGenerator | ||
import com.google.devtools.ksp.processing.Resolver | ||
import org.koin.compiler.metadata.KoinMetaData | ||
|
||
class ClassModuleWriter( | ||
codeGenerator: CodeGenerator, | ||
resolver: Resolver, | ||
module: KoinMetaData.Module | ||
) : ModuleWriter(codeGenerator, resolver, module) { | ||
|
||
override val fileName : String = generateModuleFileName(module) | ||
private fun generateModuleFileName(m: KoinMetaData.Module): String { | ||
val extensionName = m.packageName("$") | ||
return "${m.name}Gen${extensionName}" | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...s/koin-ksp-compiler/src/jvmMain/kotlin/org/koin/compiler/generator/DefaultModuleWriter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2017-present the original author or authors. | ||
* | ||
* 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. | ||
*/ | ||
package org.koin.compiler.generator | ||
|
||
import com.google.devtools.ksp.processing.CodeGenerator | ||
import com.google.devtools.ksp.processing.Resolver | ||
import org.koin.compiler.metadata.KoinMetaData | ||
|
||
class DefaultModuleWriter( | ||
codeGenerator: CodeGenerator, | ||
resolver: Resolver, | ||
defaultModule: KoinMetaData.Module, | ||
generateDefaultModule: Boolean | ||
) : ModuleWriter(codeGenerator, resolver, defaultModule) { | ||
|
||
override val fileName : String = "KoinDefault-${defaultModule.hashCode()}" | ||
override val hasExternalDefinitions: Boolean = true | ||
override val generateModuleBody: Boolean = generateDefaultModule | ||
|
||
override fun writeModuleFooter() { | ||
writeln(DEFAULT_MODULE_FOOTER) | ||
} | ||
} |
Oops, something went wrong.