-
Notifications
You must be signed in to change notification settings - Fork 51
/
Platform.kt
59 lines (49 loc) · 1.75 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
49
50
51
52
53
54
55
56
57
58
59
package gdx.liftoff.data.platforms
import com.badlogic.gdx.graphics.Pixmap
import gdx.liftoff.data.files.CopiedFile
import gdx.liftoff.data.files.GeneratedImageFile
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
/**
* Description of the platform as it appears in the generated project README files.
*/
val description: 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 addGeneratedImageFile(project: Project, content: Pixmap, vararg file: String) {
project.files.add(GeneratedImageFile(projectName = id, content = content, path = path(*file)))
}
fun addGradleTaskDescription(project: Project, task: String, description: String) {
project.addGradleTaskDescription("$id:$task", description)
}
}