-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for gradle submodules (#219)
- Loading branch information
1 parent
2d5b897
commit d1dbbcd
Showing
12 changed files
with
185 additions
and
117 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
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
23 changes: 23 additions & 0 deletions
23
...dle-plugin/src/main/kotlin/org/sourcegrade/jagr/gradle/extension/ProjectSourceSetTuple.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,23 @@ | ||
package org.sourcegrade.jagr.gradle.extension | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.tasks.SourceSet | ||
import org.gradle.api.tasks.SourceSetContainer | ||
import org.gradle.kotlin.dsl.getByType | ||
import java.io.Serializable | ||
|
||
data class ProjectSourceSetTuple( | ||
val projectPath: String, | ||
val sourceSetName: String, | ||
) : Serializable { | ||
companion object { | ||
fun fromSourceSetNames(projectPath: String, sourceSetNames: Sequence<String>) = | ||
sourceSetNames.map { ProjectSourceSetTuple(projectPath, it) }.toSet() | ||
|
||
fun fromSourceSetNames(projectPath: String, sourceSetNames: Iterable<String>) = | ||
fromSourceSetNames(projectPath, sourceSetNames.asSequence()) | ||
} | ||
} | ||
|
||
fun ProjectSourceSetTuple.getSourceSet(rootProject: Project): SourceSet = | ||
rootProject.relative(projectPath).extensions.getByType<SourceSetContainer>().getByName(sourceSetName) |
8 changes: 8 additions & 0 deletions
8
...dle-plugin/src/main/kotlin/org/sourcegrade/jagr/gradle/extension/RelativeProjectSearch.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,8 @@ | ||
package org.sourcegrade.jagr.gradle.extension | ||
|
||
import org.gradle.api.Project | ||
|
||
fun Project.relative(path: String): Project { | ||
if (path.isEmpty()) return this | ||
return project.project(path) | ||
} |
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
Oops, something went wrong.