-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gradle] Don't fail import if compose compiler plugin misconfigured.
- Loading branch information
Showing
7 changed files
with
47 additions
and
31 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
32 changes: 32 additions & 0 deletions
32
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/internal/IdeaImportTask.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,32 @@ | ||
package org.jetbrains.compose.internal | ||
|
||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.Project | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
internal fun Project.ideaIsInSyncProvider(): Provider<Boolean> = provider { | ||
System.getProperty("idea.sync.active", "false").toBoolean() | ||
} | ||
|
||
/** | ||
* This task should be FAST and SAFE! Because it is being run during IDE import. | ||
*/ | ||
internal abstract class IdeaImportTask : DefaultTask() { | ||
@get:Input | ||
val ideaIsInSync: Provider<Boolean> = project.ideaIsInSyncProvider() | ||
|
||
@TaskAction | ||
fun run() { | ||
try { | ||
safeAction() | ||
} catch (e: Exception) { | ||
//message must contain two ':' symbols to be parsed by IDE UI! | ||
logger.error("e: $name task was failed:", e) | ||
if (!ideaIsInSync.get()) throw e | ||
} | ||
} | ||
|
||
abstract fun safeAction() | ||
} |
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
27 changes: 1 addition & 26 deletions
27
...e-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/GenerateResClassTask.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