Alexey Tsvetkov
3 years ago
committed by
GitHub
10 changed files with 43 additions and 90 deletions
@ -1,19 +0,0 @@
|
||||
/* |
||||
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. |
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. |
||||
*/ |
||||
|
||||
package org.jetbrains.compose.experimental.dsl |
||||
|
||||
import org.gradle.api.Action |
||||
import org.gradle.api.model.ObjectFactory |
||||
import javax.inject.Inject |
||||
|
||||
abstract class ExperimentalExtension @Inject constructor( |
||||
objects: ObjectFactory |
||||
) { |
||||
val web: ExperimentalWebExtension = objects.newInstance(ExperimentalWebExtension::class.java) |
||||
fun web(action: Action<ExperimentalWebExtension>) { |
||||
action.execute(web) |
||||
} |
||||
} |
@ -1,25 +0,0 @@
|
||||
/* |
||||
* Copyright 2020-2022 JetBrains s.r.o. and respective authors and developers. |
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. |
||||
*/ |
||||
|
||||
package org.jetbrains.compose.experimental.dsl |
||||
|
||||
import org.gradle.api.Action |
||||
import org.gradle.api.model.ObjectFactory |
||||
import org.gradle.api.plugins.ExtensionAware |
||||
import javax.inject.Inject |
||||
|
||||
abstract class ExperimentalWebExtension @Inject constructor(private val objectFactory: ObjectFactory) : ExtensionAware { |
||||
internal var _isApplicationInitialized = false |
||||
private set |
||||
|
||||
val application: ExperimentalWebApplication by lazy { |
||||
_isApplicationInitialized = true |
||||
objectFactory.newInstance(ExperimentalWebApplication::class.java, "main") |
||||
} |
||||
|
||||
fun application(fn: Action<ExperimentalWebApplication>) { |
||||
fn.execute(application) |
||||
} |
||||
} |
@ -1,24 +0,0 @@
|
||||
/* |
||||
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. |
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. |
||||
*/ |
||||
|
||||
package org.jetbrains.compose.experimental.internal |
||||
|
||||
import org.gradle.api.Project |
||||
import org.jetbrains.compose.ComposeExtension |
||||
import org.jetbrains.compose.experimental.dsl.ExperimentalExtension |
||||
import org.jetbrains.compose.experimental.web.internal.configureExperimentalWebApplication |
||||
import org.jetbrains.compose.web.WebExtension |
||||
|
||||
internal fun Project.configureExperimental( |
||||
composeExt: ComposeExtension, |
||||
experimentalExt: ExperimentalExtension |
||||
) { |
||||
if (experimentalExt.web._isApplicationInitialized) { |
||||
val webExt = composeExt.extensions.getByType(WebExtension::class.java) |
||||
for (target in webExt.targetsToConfigure(project)) { |
||||
target.configureExperimentalWebApplication(experimentalExt.web.application) |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue