-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor config entities and arguments (#831)
* Refactor config entities and arguments
- Loading branch information
Showing
57 changed files
with
1,798 additions
and
1,529 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
43 changes: 43 additions & 0 deletions
43
test_runner/src/main/kotlin/ftl/args/AndroidArgsCompanion.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,43 @@ | ||
package ftl.args | ||
|
||
import com.google.common.annotations.VisibleForTesting | ||
import ftl.args.yml.mergeYmlKeys | ||
import ftl.cli.firebase.test.android.AndroidRunCommand | ||
import ftl.config.android.AndroidFlankConfig | ||
import ftl.config.android.AndroidGcloudConfig | ||
import ftl.config.common.CommonFlankConfig | ||
import ftl.config.common.CommonGcloudConfig | ||
import ftl.config.defaultAndroidConfig | ||
import ftl.config.loadAndroidConfig | ||
import ftl.config.plus | ||
import ftl.util.loadFile | ||
import java.io.Reader | ||
import java.nio.file.Path | ||
|
||
open class AndroidArgsCompanion : IArgs.ICompanion { | ||
override val validArgs by lazy { | ||
mergeYmlKeys( | ||
CommonGcloudConfig, | ||
AndroidGcloudConfig, | ||
CommonFlankConfig, | ||
AndroidFlankConfig | ||
) | ||
} | ||
|
||
fun default() = | ||
createAndroidArgs(defaultAndroidConfig()) | ||
|
||
fun load(yamlPath: Path, cli: AndroidRunCommand? = null) = | ||
load(loadFile(yamlPath), cli) | ||
|
||
@VisibleForTesting | ||
internal fun load(yamlReader: Reader, cli: AndroidRunCommand? = null) = | ||
createAndroidArgs( | ||
config = defaultAndroidConfig() + | ||
loadAndroidConfig(reader = yamlReader) + | ||
cli?.config | ||
).apply { | ||
commonArgs.validate() | ||
this.validate() | ||
} | ||
} |
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.