• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2 
<lambda>null3 plugins {
4     kotlin("jvm") version "1.3.72"
5     application
6 }
7 
8 group = "com.android"
9 version = "1.0.0-SNAPSHOT"
10 
<lambda>null11 repositories {
12     mavenCentral()
13     jcenter()
14     google()
15     maven(url = "https://dl.bintray.com/s1m0nw1/KtsRunner")
16 }
17 
<lambda>null18 dependencies {
19     implementation(kotlin("stdlib", "1.3.72"))
20     implementation(kotlin("reflect", "1.3.72"))
21 
22     implementation("com.google.prefab:api:1.0.0")
23 
24     implementation("com.github.ajalt:clikt:2.2.0")
25     implementation("de.swirtz:ktsRunner:0.0.7")
26     implementation("org.apache.maven:maven-core:3.6.2")
27     implementation("org.redundent:kotlin-xml-builder:1.5.3")
28 
29     testImplementation("org.jetbrains.kotlin:kotlin-test")
30     testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
31     testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0-M1")
32     testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0-M1")
33 }
34 
<lambda>null35 application {
36     // Define the main class for the application.
37     mainClassName = "com.android.ndkports.CliKt"
38 }
39 
<lambda>null40 tasks.withType<KotlinCompile> {
41     kotlinOptions.jvmTarget = "1.8"
42     kotlinOptions.freeCompilerArgs += listOf(
43         "-progressive",
44         "-Xuse-experimental=kotlinx.serialization.ImplicitReflectionSerializer"
45     )
46 }
47 
48 val portsBuildDir = buildDir.resolve("ports")
49 
50 val allPorts = listOf("openssl", "curl", "jsoncpp")
51 
52 // Can be specified in ~/.gradle/gradle.properties:
53 //
54 //     ndkPath=/path/to/ndk
55 //
56 // Or on the command line:
57 //
58 //     ./gradlew -PndkPath=/path/to/ndk run
59 val ndkPath: String by project
<lambda>null60 tasks.named<JavaExec>("run") {
61     // Order matters since we don't do any dependency sorting, so we can't just
62     // use the directory list.
63     args = listOf("--ndk", ndkPath, "-o", portsBuildDir.toString()) + allPorts
64 }
65 
portnull66 for (port in allPorts) {
67     distributions {
68         create(port) {
69             contents {
70                 includeEmptyDirs = false
71                 from(portsBuildDir.resolve(port)) {
72                     include("**/*.aar")
73                     include("**/*.pom")
74                 }
75             }
76         }
77     }
78 
79     tasks.named("${port}DistTar") {
80         dependsOn(":run")
81     }
82 
83     tasks.named("${port}DistZip") {
84         dependsOn(":run")
85     }
86 }
87 
<lambda>null88 distributions {
89     create("all") {
90         contents {
91             includeEmptyDirs = false
92             from(portsBuildDir) {
93                 include("**/*.aar")
94                 include("**/*.pom")
95             }
96         }
97     }
98 }
99 
<lambda>null100 tasks.named("allDistTar") {
101     dependsOn(":run")
102 }
103 
<lambda>null104 tasks.named("allDistZip") {
105     dependsOn(":run")
106 }
107 
<lambda>null108 tasks.register("release") {
109     dependsOn(":allDistZip")
110     for (port in allPorts) {
111         dependsOn(":${port}DistZip")
112     }
113 }
114