[Gradle] Rename -Xdepends-on to -Xfragment-refines and use ':' for -Xfragment-sources instead of ';'
^KT-56210 Verification Pending
This commit is contained in:
committed by
Space Team
parent
a692de871b
commit
b90207edb9
+4
-4
@@ -725,7 +725,7 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
|
|
||||||
@Argument(
|
@Argument(
|
||||||
value = "-Xfragment-sources",
|
value = "-Xfragment-sources",
|
||||||
valueDescription = "<fragment name>;<path>",
|
valueDescription = "<fragment name>:<path>",
|
||||||
description = "Adds sources to a specific fragment of a multiplatform compilation",
|
description = "Adds sources to a specific fragment of a multiplatform compilation",
|
||||||
)
|
)
|
||||||
var fragmentSources: Array<String>? = null
|
var fragmentSources: Array<String>? = null
|
||||||
@@ -735,11 +735,11 @@ abstract class CommonCompilerArguments : CommonToolArguments() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Argument(
|
@Argument(
|
||||||
value = "-Xdepends-on",
|
value = "-Xfragment-refines",
|
||||||
valueDescription = "<fromModuleName>:<onModuleName>",
|
valueDescription = "<fromModuleName>:<onModuleName>",
|
||||||
description = "Declares that <fromModuleName> depends on <onModuleName> with dependsOn relation",
|
description = "Declares that <fromModuleName> refines <onModuleName> with dependsOn/refines relation",
|
||||||
)
|
)
|
||||||
var dependsOnDependencies: Array<String>? = null
|
var fragmentRefines: Array<String>? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
checkFrozen()
|
checkFrozen()
|
||||||
field = value
|
field = value
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ private fun <A : CommonToolArguments> MessageCollector.reportUnsafeInternalArgum
|
|||||||
private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonCompilerArguments): HmppCliModuleStructure? {
|
private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonCompilerArguments): HmppCliModuleStructure? {
|
||||||
val rawFragments = arguments.fragments
|
val rawFragments = arguments.fragments
|
||||||
val rawFragmentSources = arguments.fragmentSources
|
val rawFragmentSources = arguments.fragmentSources
|
||||||
val rawDependencies = arguments.dependsOnDependencies
|
val rawFragmentRefines = arguments.fragmentRefines
|
||||||
|
|
||||||
val messageCollector = getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
val messageCollector = getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||||
|
|
||||||
@@ -145,8 +145,8 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rawFragments == null) {
|
if (rawFragments == null) {
|
||||||
if (rawDependencies != null) {
|
if (rawFragmentRefines != null) {
|
||||||
reportError("-Xdepends-on flag can not be used without -Xfragments")
|
reportError("-Xfragment-refines flag can not be used without -Xfragments")
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -159,11 +159,11 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp
|
|||||||
|
|
||||||
val sourcesByFragmentName: Map<String, Set<String>> = rawFragments.associateWith { mutableSetOf<String>() }.apply {
|
val sourcesByFragmentName: Map<String, Set<String>> = rawFragments.associateWith { mutableSetOf<String>() }.apply {
|
||||||
rawFragmentSources.orEmpty().forEach { rawFragmentSourceArg ->
|
rawFragmentSources.orEmpty().forEach { rawFragmentSourceArg ->
|
||||||
val split = rawFragmentSourceArg.split(";")
|
val split = rawFragmentSourceArg.split(":", limit = 2)
|
||||||
if (split.size != 2) {
|
if (split.size < 2) {
|
||||||
reportError(
|
reportError(
|
||||||
"Incorrect syntax for -Xfragment-sources argument. " +
|
"Incorrect syntax for -Xfragment-sources argument. " +
|
||||||
"`<module name>;<source file>` expected but got `$rawFragmentSourceArg`"
|
"`<module name>:<source file>` expected but got `$rawFragmentSourceArg`"
|
||||||
)
|
)
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,10 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp
|
|||||||
val fragmentSource = split[1]
|
val fragmentSource = split[1]
|
||||||
|
|
||||||
getOrElse(fragmentName) {
|
getOrElse(fragmentName) {
|
||||||
reportError("fragment `$fragmentName` of source file $fragmentSource is not specified in -Xfragments")
|
reportError(
|
||||||
|
"Passed $rawFragmentSourceArg, " +
|
||||||
|
"but fragment `$fragmentName` of source file $fragmentSource is not specified in -Xfragments"
|
||||||
|
)
|
||||||
return@forEach
|
return@forEach
|
||||||
}.add(fragmentSource)
|
}.add(fragmentSource)
|
||||||
}
|
}
|
||||||
@@ -218,8 +221,8 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (modules.size == 1) {
|
if (modules.size == 1) {
|
||||||
if (rawDependencies?.isNotEmpty() == true) {
|
if (rawFragmentRefines?.isNotEmpty() == true) {
|
||||||
reportError("-Xdepends-on flag is specified but there is only one module declared")
|
reportError("-Xfragment-refines flag is specified but there is only one module declared")
|
||||||
}
|
}
|
||||||
return HmppCliModuleStructure(modules, emptyMap())
|
return HmppCliModuleStructure(modules, emptyMap())
|
||||||
}
|
}
|
||||||
@@ -233,10 +236,13 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp
|
|||||||
|
|
||||||
val moduleByName = modules.associateBy { it.name }
|
val moduleByName = modules.associateBy { it.name }
|
||||||
|
|
||||||
val dependenciesMap = rawDependencies.orEmpty().mapNotNull {
|
val dependenciesMap = rawFragmentRefines.orEmpty().mapNotNull { rawFragmentRefinesEdge ->
|
||||||
val split = it.split(":")
|
val split = rawFragmentRefinesEdge.split(":")
|
||||||
if (split.size != 2) {
|
if (split.size != 2) {
|
||||||
reportError("Incorrect syntax for -Xdepends-on argument. Expected <fromModuleName>:<onModuleName> but got `$it`")
|
reportError(
|
||||||
|
"Incorrect syntax for -Xfragment-refines argument. " +
|
||||||
|
"Expected <fromModuleName>:<onModuleName> but got `$rawFragmentRefines`"
|
||||||
|
)
|
||||||
return@mapNotNull null
|
return@mapNotNull null
|
||||||
}
|
}
|
||||||
val moduleName1 = split[0]
|
val moduleName1 = split[0]
|
||||||
@@ -245,7 +251,7 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp
|
|||||||
fun findModule(name: String): HmppCliModule? {
|
fun findModule(name: String): HmppCliModule? {
|
||||||
return moduleByName[name].also { module ->
|
return moduleByName[name].also { module ->
|
||||||
if (module == null) {
|
if (module == null) {
|
||||||
reportError("Module `$name` not found in -Xfragments arguments")
|
reportError("`-Xfragment-refines=$rawFragmentRefinesEdge` Fragment `$name` not found in -Xfragments arguments")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -63,8 +63,6 @@ where advanced options include:
|
|||||||
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
||||||
Should be a subset of sources passed as free arguments
|
Should be a subset of sources passed as free arguments
|
||||||
-Xcontext-receivers Enable experimental context receivers
|
-Xcontext-receivers Enable experimental context receivers
|
||||||
-Xdepends-on=<fromModuleName>:<onModuleName>
|
|
||||||
Declares that <fromModuleName> depends on <onModuleName> with dependsOn relation
|
|
||||||
-Xdisable-default-scripting-plugin
|
-Xdisable-default-scripting-plugin
|
||||||
Do not enable scripting plugin by default
|
Do not enable scripting plugin by default
|
||||||
-Xdisable-phases Disable backend phases
|
-Xdisable-phases Disable backend phases
|
||||||
@@ -83,7 +81,9 @@ where advanced options include:
|
|||||||
Use 'warning' level to issue warnings instead of errors.
|
Use 'warning' level to issue warnings instead of errors.
|
||||||
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
|
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
|
||||||
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
|
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
|
||||||
-Xfragment-sources=<fragment name>;<path>
|
-Xfragment-refines=<fromModuleName>:<onModuleName>
|
||||||
|
Declares that <fromModuleName> refines <onModuleName> with dependsOn/refines relation
|
||||||
|
-Xfragment-sources=<fragment name>:<path>
|
||||||
Adds sources to a specific fragment of a multiplatform compilation
|
Adds sources to a specific fragment of a multiplatform compilation
|
||||||
-Xfragments=<fragment name> Declares all known fragments of a multiplatform compilation
|
-Xfragments=<fragment name> Declares all known fragments of a multiplatform compilation
|
||||||
-Xenable-incremental-compilation
|
-Xenable-incremental-compilation
|
||||||
|
|||||||
+5
-5
@@ -9,8 +9,8 @@ fir-hmpp
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b,c
|
-Xfragments=a,b,c
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/../jvm/hmpp/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/../jvm/hmpp/src/a.kt
|
||||||
-Xfragment-sources=b;$TESTDATA_DIR$/../jvm/hmpp/src/b.kt
|
-Xfragment-sources=b\:$TESTDATA_DIR$/../jvm/hmpp/src/b.kt
|
||||||
-Xfragment-sources=c;$TESTDATA_DIR$/../jvm/hmpp/src/c.kt
|
-Xfragment-sources=c\:$TESTDATA_DIR$/../jvm/hmpp/src/c.kt
|
||||||
-Xdepends-on=b\:a
|
-Xfragment-refines=b\:a
|
||||||
-Xdepends-on=c\:b
|
-Xfragment-refines=c\:b
|
||||||
|
|||||||
+3
-3
@@ -169,8 +169,6 @@ where advanced options include:
|
|||||||
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
-Xcommon-sources=<path> Sources of the common module that need to be compiled together with this module in the multi-platform mode.
|
||||||
Should be a subset of sources passed as free arguments
|
Should be a subset of sources passed as free arguments
|
||||||
-Xcontext-receivers Enable experimental context receivers
|
-Xcontext-receivers Enable experimental context receivers
|
||||||
-Xdepends-on=<fromModuleName>:<onModuleName>
|
|
||||||
Declares that <fromModuleName> depends on <onModuleName> with dependsOn relation
|
|
||||||
-Xdisable-default-scripting-plugin
|
-Xdisable-default-scripting-plugin
|
||||||
Do not enable scripting plugin by default
|
Do not enable scripting plugin by default
|
||||||
-Xdisable-phases Disable backend phases
|
-Xdisable-phases Disable backend phases
|
||||||
@@ -189,7 +187,9 @@ where advanced options include:
|
|||||||
Use 'warning' level to issue warnings instead of errors.
|
Use 'warning' level to issue warnings instead of errors.
|
||||||
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
|
-Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors.
|
||||||
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
|
Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code.
|
||||||
-Xfragment-sources=<fragment name>;<path>
|
-Xfragment-refines=<fromModuleName>:<onModuleName>
|
||||||
|
Declares that <fromModuleName> refines <onModuleName> with dependsOn/refines relation
|
||||||
|
-Xfragment-sources=<fragment name>:<path>
|
||||||
Adds sources to a specific fragment of a multiplatform compilation
|
Adds sources to a specific fragment of a multiplatform compilation
|
||||||
-Xfragments=<fragment name> Declares all known fragments of a multiplatform compilation
|
-Xfragments=<fragment name> Declares all known fragments of a multiplatform compilation
|
||||||
-Xenable-incremental-compilation
|
-Xenable-incremental-compilation
|
||||||
|
|||||||
+6
-6
@@ -7,9 +7,9 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b,c
|
-Xfragments=a,b,c
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt
|
||||||
-Xfragment-sources=b;$TESTDATA_DIR$/src/b.kt
|
-Xfragment-sources=b\:$TESTDATA_DIR$/src/b.kt
|
||||||
-Xfragment-sources=c;$TESTDATA_DIR$/src/c.kt
|
-Xfragment-sources=c\:$TESTDATA_DIR$/src/c.kt
|
||||||
-Xdepends-on=b\:a
|
-Xfragment-refines=b\:a
|
||||||
-Xdepends-on=c\:b
|
-Xfragment-refines=c\:b
|
||||||
-Xdepends-on=a\:c
|
-Xfragment-refines=a\:c
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ as no stability/compatibility guarantees are given on
|
|||||||
compiler or generated code. Use it at your own risk!
|
compiler or generated code. Use it at your own risk!
|
||||||
|
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
error: incorrect syntax for -Xfragment-sources argument. `<module name>;<source file>` expected but got `a;a.kt;`
|
error: incorrect syntax for -Xfragment-sources argument. `<module name>:<source file>` expected but got `a;a.kt;`
|
||||||
error: source '$TESTDATA_DIR$/src/a.kt' does not belong to any module
|
error: source '$TESTDATA_DIR$/src/a.kt' does not belong to any module
|
||||||
error: source '$TESTDATA_DIR$/src/b.kt' does not belong to any module
|
error: source '$TESTDATA_DIR$/src/b.kt' does not belong to any module
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
+2
-2
@@ -6,5 +6,5 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b
|
-Xfragments=a,b
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt,b;$TESTDATA_DIR$/src/b.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt,b\:$TESTDATA_DIR$/src/b.kt
|
||||||
-Xdepends-on=c\:a
|
-Xfragment-refines=c\:a
|
||||||
|
|||||||
+1
-1
@@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on
|
|||||||
compiler or generated code. Use it at your own risk!
|
compiler or generated code. Use it at your own risk!
|
||||||
|
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
error: module `c` not found in -Xfragments arguments
|
error: `-Xfragment-refines=c:a` Fragment `c` not found in -Xfragments arguments
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
+2
-2
@@ -5,5 +5,5 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a
|
-Xfragments=a
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt
|
||||||
-Xdepends-on=b\:a
|
-Xfragment-refines=b\:a
|
||||||
+1
-1
@@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on
|
|||||||
compiler or generated code. Use it at your own risk!
|
compiler or generated code. Use it at your own risk!
|
||||||
|
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
error: -Xdepends-on flag is specified but there is only one module declared
|
error: -Xfragment-refines flag is specified but there is only one module declared
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
+1
-1
@@ -4,4 +4,4 @@ $TEMP_DIR$
|
|||||||
-language-version
|
-language-version
|
||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xdepends-on=a\:b
|
-Xfragment-refines=a\:b
|
||||||
+1
-1
@@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on
|
|||||||
compiler or generated code. Use it at your own risk!
|
compiler or generated code. Use it at your own risk!
|
||||||
|
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
error: -Xdepends-on flag can not be used without -Xfragments
|
error: -Xfragment-refines flag can not be used without -Xfragments
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
+1
-1
@@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on
|
|||||||
compiler or generated code. Use it at your own risk!
|
compiler or generated code. Use it at your own risk!
|
||||||
|
|
||||||
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features
|
||||||
error: -Xdepends-on flag can not be used without -Xfragments
|
error: -Xfragment-refines flag can not be used without -Xfragments
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
@@ -6,6 +6,6 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b
|
-Xfragments=a,b
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt
|
||||||
-Xfragment-sources=b;$TESTDATA_DIR$/src/a.kt
|
-Xfragment-sources=b\:$TESTDATA_DIR$/src/a.kt
|
||||||
-Xfragment-sources=b;$TESTDATA_DIR$/src/b.kt
|
-Xfragment-sources=b\:$TESTDATA_DIR$/src/b.kt
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b
|
-Xfragments=a,b
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ $TEMP_DIR$
|
|||||||
-Xfragments=a
|
-Xfragments=a
|
||||||
-Xfragments=b
|
-Xfragments=b
|
||||||
-Xfragments=c
|
-Xfragments=c
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt
|
||||||
-Xfragment-sources=b;$TESTDATA_DIR$/src/b.kt
|
-Xfragment-sources=b\:$TESTDATA_DIR$/src/b.kt
|
||||||
-Xfragment-sources=c;$TESTDATA_DIR$/src/c.kt
|
-Xfragment-sources=c\:$TESTDATA_DIR$/src/c.kt
|
||||||
-Xdepends-on=b\:a
|
-Xfragment-refines=b\:a
|
||||||
-Xdepends-on=c\:b
|
-Xfragment-refines=c\:b
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b,c
|
-Xfragments=a,b,c
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt,b;$TESTDATA_DIR$/src/b.kt,c;$TESTDATA_DIR$/src/c.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/src/a.kt,b\:$TESTDATA_DIR$/src/b.kt,c\:$TESTDATA_DIR$/src/c.kt
|
||||||
-Xdepends-on=b\:a,c\:b
|
-Xfragment-refines=b\:a,c\:b
|
||||||
|
|||||||
+5
-5
@@ -7,8 +7,8 @@ $TEMP_DIR$
|
|||||||
2.0
|
2.0
|
||||||
-XXLanguage\:+MultiPlatformProjects
|
-XXLanguage\:+MultiPlatformProjects
|
||||||
-Xfragments=a,b,c
|
-Xfragments=a,b,c
|
||||||
-Xfragment-sources=a;$TESTDATA_DIR$/../jvm/hmpp/src/a.kt
|
-Xfragment-sources=a\:$TESTDATA_DIR$/../jvm/hmpp/src/a.kt
|
||||||
-Xfragment-sources=b;$TESTDATA_DIR$/../jvm/hmpp/src/b.kt
|
-Xfragment-sources=b\:$TESTDATA_DIR$/../jvm/hmpp/src/b.kt
|
||||||
-Xfragment-sources=c;$TESTDATA_DIR$/../jvm/hmpp/src/c.kt
|
-Xfragment-sources=c\:$TESTDATA_DIR$/../jvm/hmpp/src/c.kt
|
||||||
-Xdepends-on=b\:a
|
-Xfragment-refines=b\:a
|
||||||
-Xdepends-on=c\:b
|
-Xfragment-refines=c\:b
|
||||||
|
|||||||
+10
-10
@@ -122,16 +122,6 @@ public class CliTestGenerated extends AbstractCliTest {
|
|||||||
runTest("compiler/testData/cli/jvm/hmpp/cycleInDependencies.args");
|
runTest("compiler/testData/cli/jvm/hmpp/cycleInDependencies.args");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("dependsOnSingleModule.args")
|
|
||||||
public void testDependsOnSingleModule() throws Exception {
|
|
||||||
runTest("compiler/testData/cli/jvm/hmpp/dependsOnSingleModule.args");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("dependsOnWithoutFragments.args")
|
|
||||||
public void testDependsOnWithoutFragments() throws Exception {
|
|
||||||
runTest("compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.args");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("duplicatedFragments.args")
|
@TestMetadata("duplicatedFragments.args")
|
||||||
public void testDuplicatedFragments() throws Exception {
|
public void testDuplicatedFragments() throws Exception {
|
||||||
runTest("compiler/testData/cli/jvm/hmpp/duplicatedFragments.args");
|
runTest("compiler/testData/cli/jvm/hmpp/duplicatedFragments.args");
|
||||||
@@ -157,6 +147,16 @@ public class CliTestGenerated extends AbstractCliTest {
|
|||||||
runTest("compiler/testData/cli/jvm/hmpp/missingFragment.args");
|
runTest("compiler/testData/cli/jvm/hmpp/missingFragment.args");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("refinesSingleModule.args")
|
||||||
|
public void testRefinesSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/cli/jvm/hmpp/refinesSingleModule.args");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("refinesWithoutFragments.args")
|
||||||
|
public void testRefinesWithoutFragments() throws Exception {
|
||||||
|
runTest("compiler/testData/cli/jvm/hmpp/refinesWithoutFragments.args");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("sameSourceInDifferentFragments.args")
|
@TestMetadata("sameSourceInDifferentFragments.args")
|
||||||
public void testSameSourceInDifferentFragments() throws Exception {
|
public void testSameSourceInDifferentFragments() throws Exception {
|
||||||
runTest("compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args");
|
runTest("compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args");
|
||||||
|
|||||||
+2
-2
@@ -15,10 +15,10 @@ internal object KotlinCompilationK2MultiplatformConfigurator : KotlinCompilation
|
|||||||
if (compileTask.name != compilation.compileKotlinTaskName) return@configureEach
|
if (compileTask.name != compilation.compileKotlinTaskName) return@configureEach
|
||||||
if (compileTask !is K2CompileTask) return@configureEach
|
if (compileTask !is K2CompileTask) return@configureEach
|
||||||
|
|
||||||
compileTask.multiplatformStructure.dependsOnEdges.set(compilation.project.provider {
|
compileTask.multiplatformStructure.refinesEdges.set(compilation.project.provider {
|
||||||
compilation.allKotlinSourceSets.flatMap { sourceSet ->
|
compilation.allKotlinSourceSets.flatMap { sourceSet ->
|
||||||
sourceSet.dependsOn.map { dependsOn ->
|
sourceSet.dependsOn.map { dependsOn ->
|
||||||
K2MultiplatformStructure.DependsOnEdge(sourceSet.name, dependsOn.name)
|
K2MultiplatformStructure.RefinesEdge(sourceSet.name, dependsOn.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ internal fun buildKotlinNativeKlibCompilerArgs(
|
|||||||
if (sharedCompilationData == null) {
|
if (sharedCompilationData == null) {
|
||||||
add("-Xfragments=${k2MultiplatformCompilationData.fragmentsCompilerArgs.joinToString(",")}")
|
add("-Xfragments=${k2MultiplatformCompilationData.fragmentsCompilerArgs.joinToString(",")}")
|
||||||
add("-Xfragment-sources=${k2MultiplatformCompilationData.fragmentSourcesCompilerArgs.joinToString(",")}")
|
add("-Xfragment-sources=${k2MultiplatformCompilationData.fragmentSourcesCompilerArgs.joinToString(",")}")
|
||||||
add("-Xdepends-on=${k2MultiplatformCompilationData.dependsOnCompilerArgs.joinToString(",")}")
|
add("-Xfragment-refines=${k2MultiplatformCompilationData.fragmentRefinesCompilerArgs.joinToString(",")}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.gradle.dsl.usesK2
|
|||||||
abstract class K2MultiplatformStructure {
|
abstract class K2MultiplatformStructure {
|
||||||
|
|
||||||
@InternalKotlinGradlePluginApi
|
@InternalKotlinGradlePluginApi
|
||||||
data class DependsOnEdge(
|
data class RefinesEdge(
|
||||||
@Input
|
@Input
|
||||||
val fromFragmentName: String,
|
val fromFragmentName: String,
|
||||||
@Input
|
@Input
|
||||||
@@ -41,7 +41,7 @@ abstract class K2MultiplatformStructure {
|
|||||||
)
|
)
|
||||||
|
|
||||||
@get:Nested
|
@get:Nested
|
||||||
abstract val dependsOnEdges: SetProperty<DependsOnEdge>
|
abstract val refinesEdges: SetProperty<RefinesEdge>
|
||||||
|
|
||||||
@get:Nested
|
@get:Nested
|
||||||
abstract val fragments: ListProperty<Fragment>
|
abstract val fragments: ListProperty<Fragment>
|
||||||
@@ -52,18 +52,18 @@ internal val K2MultiplatformStructure.fragmentsCompilerArgs: Array<String>
|
|||||||
|
|
||||||
internal val K2MultiplatformStructure.fragmentSourcesCompilerArgs: Array<String>
|
internal val K2MultiplatformStructure.fragmentSourcesCompilerArgs: Array<String>
|
||||||
get() = fragments.get().flatMap { sourceSet ->
|
get() = fragments.get().flatMap { sourceSet ->
|
||||||
sourceSet.sources.files.map { sourceFile -> "${sourceSet.fragmentName};${sourceFile.absolutePath}" }
|
sourceSet.sources.files.map { sourceFile -> "${sourceSet.fragmentName}:${sourceFile.absolutePath}" }
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
|
|
||||||
internal val K2MultiplatformStructure.dependsOnCompilerArgs: Array<String>
|
internal val K2MultiplatformStructure.fragmentRefinesCompilerArgs: Array<String>
|
||||||
get() = dependsOnEdges.get().map { edge ->
|
get() = refinesEdges.get().map { edge ->
|
||||||
"${edge.fromFragmentName}:${edge.toFragmentName}"
|
"${edge.fromFragmentName}:${edge.toFragmentName}"
|
||||||
}.toTypedArray()
|
}.toTypedArray()
|
||||||
|
|
||||||
internal fun CommonCompilerArguments.configureK2Multiplatform(multiplatformStructure: K2MultiplatformStructure) {
|
internal fun CommonCompilerArguments.configureK2Multiplatform(multiplatformStructure: K2MultiplatformStructure) {
|
||||||
fragments = multiplatformStructure.fragmentsCompilerArgs
|
fragments = multiplatformStructure.fragmentsCompilerArgs
|
||||||
fragmentSources = multiplatformStructure.fragmentSourcesCompilerArgs
|
fragmentSources = multiplatformStructure.fragmentSourcesCompilerArgs
|
||||||
dependsOnDependencies = multiplatformStructure.dependsOnCompilerArgs
|
fragmentRefines = multiplatformStructure.fragmentRefinesCompilerArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun CommonCompilerArguments.configureMultiplatform(
|
internal fun CommonCompilerArguments.configureMultiplatform(
|
||||||
|
|||||||
+11
-11
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.IR
|
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType.IR
|
||||||
import org.jetbrains.kotlin.gradle.tasks.K2CompileTask
|
import org.jetbrains.kotlin.gradle.tasks.K2CompileTask
|
||||||
import org.jetbrains.kotlin.gradle.tasks.K2MultiplatformStructure
|
import org.jetbrains.kotlin.gradle.tasks.K2MultiplatformStructure
|
||||||
import org.jetbrains.kotlin.gradle.tasks.K2MultiplatformStructure.DependsOnEdge
|
import org.jetbrains.kotlin.gradle.tasks.K2MultiplatformStructure.RefinesEdge
|
||||||
import org.jetbrains.kotlin.gradle.tasks.K2MultiplatformStructure.Fragment
|
import org.jetbrains.kotlin.gradle.tasks.K2MultiplatformStructure.Fragment
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
|
||||||
import org.jetbrains.kotlin.gradle.tasks.configureK2Multiplatform
|
import org.jetbrains.kotlin.gradle.tasks.configureK2Multiplatform
|
||||||
@@ -43,7 +43,7 @@ class K2MultiplatformStructureTest {
|
|||||||
@Test
|
@Test
|
||||||
fun `test - configureK2Multiplatform - then parse arguments`() {
|
fun `test - configureK2Multiplatform - then parse arguments`() {
|
||||||
val structure = project.objects.newInstance<K2MultiplatformStructure>()
|
val structure = project.objects.newInstance<K2MultiplatformStructure>()
|
||||||
structure.dependsOnEdges.set(listOf(DependsOnEdge("a", "b"), DependsOnEdge("b", "c")))
|
structure.refinesEdges.set(listOf(RefinesEdge("a", "b"), RefinesEdge("b", "c")))
|
||||||
structure.fragments.set(
|
structure.fragments.set(
|
||||||
listOf(
|
listOf(
|
||||||
Fragment("a", project.files("a.kt")),
|
Fragment("a", project.files("a.kt")),
|
||||||
@@ -65,13 +65,13 @@ class K2MultiplatformStructureTest {
|
|||||||
val fragmentSources = parsedArguments.fragmentSources ?: fail("Missing ${CommonCompilerArguments::fragmentSources.name}")
|
val fragmentSources = parsedArguments.fragmentSources ?: fail("Missing ${CommonCompilerArguments::fragmentSources.name}")
|
||||||
assertEquals(
|
assertEquals(
|
||||||
listOf(
|
listOf(
|
||||||
"a;${project.file("a.kt").absolutePath}",
|
"a:${project.file("a.kt").absolutePath}",
|
||||||
"b;${project.file("b.kt").absolutePath}"
|
"b:${project.file("b.kt").absolutePath}"
|
||||||
),
|
),
|
||||||
fragmentSources.toList()
|
fragmentSources.toList()
|
||||||
)
|
)
|
||||||
|
|
||||||
val dependsOn = parsedArguments.dependsOnDependencies ?: fail("Missing ${CommonCompilerArguments::dependsOnDependencies.name}")
|
val dependsOn = parsedArguments.fragmentRefines ?: fail("Missing ${CommonCompilerArguments::fragmentRefines.name}")
|
||||||
assertEquals(listOf("a:b", "b:c"), dependsOn.toList())
|
assertEquals(listOf("a:b", "b:c"), dependsOn.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,11 +116,11 @@ class K2MultiplatformStructureTest {
|
|||||||
/* check dependsOnEdges */
|
/* check dependsOnEdges */
|
||||||
assertEquals(
|
assertEquals(
|
||||||
setOf(
|
setOf(
|
||||||
DependsOnEdge(defaultSourceSet.name, "commonMain"),
|
RefinesEdge(defaultSourceSet.name, "commonMain"),
|
||||||
DependsOnEdge(defaultSourceSet.name, "intermediateMain"),
|
RefinesEdge(defaultSourceSet.name, "intermediateMain"),
|
||||||
DependsOnEdge("intermediateMain", "commonMain")
|
RefinesEdge("intermediateMain", "commonMain")
|
||||||
),
|
),
|
||||||
compileTask.multiplatformStructure.dependsOnEdges.get().toSet()
|
compileTask.multiplatformStructure.refinesEdges.get().toSet()
|
||||||
)
|
)
|
||||||
|
|
||||||
/* check source files */
|
/* check source files */
|
||||||
@@ -149,8 +149,8 @@ class K2MultiplatformStructureTest {
|
|||||||
fail("Missing ${CommonCompilerArguments::fragmentSources.name} in K2 compilation")
|
fail("Missing ${CommonCompilerArguments::fragmentSources.name} in K2 compilation")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.dependsOnDependencies == null) {
|
if (args.fragmentRefines == null) {
|
||||||
fail("Missing ${CommonCompilerArguments::dependsOnDependencies.name} in K2 compilation")
|
fail("Missing ${CommonCompilerArguments::fragmentRefines.name} in K2 compilation")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user