Skip to content

Commit

Permalink
refactor: share code between kotlin and android
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarendorff committed Oct 22, 2023
1 parent 7b6cd0a commit 54cf128
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 192 deletions.
36 changes: 28 additions & 8 deletions src/SDK/Language/Android.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,42 @@ public function getFiles(): array
[
'scope' => 'default',
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Permission.kt',
'template' => '/android/library/src/main/java/io/appwrite/Permission.kt.twig',
'template' => '/kotlin/src/main/kotlin/io/appwrite/Permission.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/test/java/{{ sdk.namespace | caseSlash }}/PermissionTest.kt',
'template' => '/kotlin/src/test/kotlin/io/appwrite/PermissionTest.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Role.kt',
'template' => '/android/library/src/main/java/io/appwrite/Role.kt.twig',
'template' => '/kotlin/src/main/kotlin/io/appwrite/Role.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/test/java/{{ sdk.namespace | caseSlash }}/RoleTest.kt',
'template' => '/kotlin/src/test/kotlin/io/appwrite/RoleTest.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/ID.kt',
'template' => '/android/library/src/main/java/io/appwrite/ID.kt.twig',
'template' => '/kotlin/src/main/kotlin/io/appwrite/ID.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/test/java/{{ sdk.namespace | caseSlash }}/IDTest.kt',
'template' => '/kotlin/src/test/kotlin/io/appwrite/IDTest.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Query.kt',
'template' => '/android/library/src/main/java/io/appwrite/Query.kt.twig',
'template' => '/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig',
],
[
'scope' => 'default',
'destination' => '/library/src/test/java/{{ sdk.namespace | caseSlash }}/QueryTest.kt',
'template' => '/kotlin/src/test/kotlin/io/appwrite/QueryTest.kt.twig',
],
[
'scope' => 'default',
Expand Down Expand Up @@ -178,7 +198,7 @@ public function getFiles(): array
[
'scope' => 'default',
'destination' => '/library/src/main/java/{{ sdk.namespace | caseSlash }}/Response.kt',
'template' => '/android/library/src/main/java/io/appwrite/Response.kt.twig',
'template' => '/kotlin/src/main/kotlin/io/appwrite/Response.kt.twig',
],
[
'scope' => 'default',
Expand Down Expand Up @@ -238,7 +258,7 @@ public function getFiles(): array
[
'scope' => 'default',
'destination' => '/library/src/test/java/{{ sdk.namespace | caseSlash }}/cookies/CookiesTest.kt',
'template' => '/android/library/src/test/java/io/appwrite/cookies/CookiesTest.kt.twig',
'template' => '/kotlin/src/test/kotlin/io/appwrite/cookies/CookiesTest.kt.twig',
],
[
'scope' => 'default',
Expand Down Expand Up @@ -400,12 +420,12 @@ public function getFiles(): array
[
'scope' => 'definition',
'destination' => 'library/src/main/java/io/appwrite/models/{{ definition.name | caseUcfirst }}.kt',
'template' => '/android/library/src/main/java/io/appwrite/models/Model.kt.twig',
'template' => '/kotlin/src/main/kotlin/io/appwrite/models/Model.kt.twig',
],
[
'scope' => 'definition',
'destination' => 'library/src/test/java/io/appwrite/models/{{ definition.name | caseUcfirst }}Test.kt',
'template' => '/android/library/src/test/java/io/appwrite/models/ModelTest.kt.twig',
'template' => '/kotlin/src/test/kotlin/io/appwrite/models/ModelTest.kt.twig',
],
];
}
Expand Down
10 changes: 0 additions & 10 deletions templates/android/library/src/main/java/io/appwrite/ID.kt.twig

This file was deleted.

This file was deleted.

60 changes: 0 additions & 60 deletions templates/android/library/src/main/java/io/appwrite/Query.kt.twig

This file was deleted.

72 changes: 0 additions & 72 deletions templates/android/library/src/main/java/io/appwrite/Role.kt.twig

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import kotlin.test.assertIs

{%~ if method.type == 'webAuth' ~%}
@RunWith(AndroidJUnit4::class)
{%~ endif ~%}
class {{service.name | caseUcfirst}}ServiceTest {
private lateinit var client: Client
private lateinit var {{service.name | caseCamel}}: {{service.name | caseUcfirst}}
Expand Down
Loading

0 comments on commit 54cf128

Please sign in to comment.