File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/kotlin/com/replaymod/gradle/preprocess Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ class PreprocessPlugin : Plugin<Project> {
1818
1919 val parent = project.parent!!
2020 val coreVersion = coreVersionFile.readText().toInt()
21- val mcVersion = project.extra[" mcVersion" ] as Int
21+ val mcVersion = project.getMcVersion()
22+ project.extra[" mcVersion" ] = mcVersion
2223 if (coreVersion == mcVersion) {
2324 project.the<SourceSetContainer >().configureEach {
2425 java.setSrcDirs(listOf (parent.file(" src/$name /java" )))
@@ -118,6 +119,10 @@ class PreprocessPlugin : Plugin<Project> {
118119 }
119120}
120121
122+ private fun Project.getMcVersion (): Int = (name.split(" ." ) + listOf (" " )).let { (major, minor, patch) ->
123+ " $major${minor.padStart(2 , ' 0' )}${patch.padStart(2 , ' 0' )} " .toInt()
124+ }
125+
121126private fun Project.byVersion (version : Int ): Project {
122127 val name = " ${version/ 10000 } .${version/ 100 % 100 }${if (version% 100 == 0 ) " " else " .${version% 100 } " } "
123128 return project.parent!! .evaluationDependsOn(name)
You can’t perform that action at this time.
0 commit comments