forked from libgdx/gdx-liftoff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlatform.kt
48 lines (40 loc) · 1.42 KB
/
Platform.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package gdx.liftoff.data.platforms
import gdx.liftoff.data.files.CopiedFile
import gdx.liftoff.data.files.gradle.GradleFile
import gdx.liftoff.data.files.path
import gdx.liftoff.data.project.Project
/**
* Common interface for all supported platforms. Implementation should be annotated with GdxPlatform.
*/
interface Platform {
/**
* Unique ID of the platform.
*/
val id: String
/**
* Display order of the platform within the application.
*/
val order: Int
/**
* This value is set to true if the platform is a standard graphical libGDX backend. False otherwise.
*/
val isStandard: Boolean
get() = true
/**
* Creates a new gradle file used to manage this project's dependencies.
* @param project requests the creation of file.
*/
fun createGradleFile(project: Project): GradleFile
/**
* This method is used to resolve additional dependencies in other projects.
* @param project contains the platform.
*/
fun initiate(project: Project)
fun addCopiedFile(project: Project, vararg file: String) {
val originalFile = arrayOf("generator", id) + file
project.files.add(CopiedFile(projectName = id, original = path(*originalFile), path = path(*file)))
}
fun addGradleTaskDescription(project: Project, task: String, description: String) {
project.addGradleTaskDescription("$id:$task", description)
}
}