Skip to content

Commit c3da5ee

Browse files
authored
Merge branch 'origin-dev' into kris/swift-template
2 parents e2ee8a6 + 60ce291 commit c3da5ee

71 files changed

Lines changed: 1267 additions & 119 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-javascript.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ jobs:
115115
with:
116116
go-version: '^1.13.1'
117117

118+
- name: Setup Java
119+
uses: actions/setup-java@v3
120+
with:
121+
distribution: 'corretto'
122+
java-version: '17'
123+
cache: 'gradle'
124+
118125
- name: Install cue lang
119126
run: go install cuelang.org/go/cmd/cue@latest
120127

packages/cli/src/__tests__/e2e/p1/create.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Commands:
1919
wasm [options] <language> <name> Create a Polywrap wasm wrapper. langs:
2020
assemblyscript, rust, golang, interface
2121
app [options] <language> <name> Create a Polywrap application. langs:
22-
typescript, python, ios
22+
typescript, python, rust, android, ios
2323
plugin [options] <language> <name> Create a Polywrap plugin. langs:
2424
typescript, rust, python
2525
template [options] <url> <name> Download template from a URL. formats:

packages/cli/src/commands/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const urlStr = intlMsg.commands_create_options_t_url();
2828

2929
export const supportedLangs = {
3030
wasm: ["assemblyscript", "rust", "golang", "interface"] as const,
31-
app: ["typescript", "python", "ios"] as const,
31+
app: ["typescript", "python", "rust", "android", "ios"] as const,
3232
plugin: ["typescript", "rust", "python"] as const,
3333
};
3434

packages/cli/src/lib/project/manifests/app/languages.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import { BindLanguage } from "@polywrap/schema-bind";
55
export const appManifestLanguages = {
66
"app/typescript": "app/typescript",
77
"app/python": "app/python",
8+
"app/rust": "app/rust",
9+
"app/kotlin": "app/kotlin",
10+
"app/swift": "app/swift",
811
};
912

1013
export type AppManifestLanguages = typeof appManifestLanguages;
@@ -25,6 +28,12 @@ export function appManifestLanguageToBindLanguage(
2528
return "app-ts";
2629
case "app/python":
2730
return "app-py";
31+
case "app/rust":
32+
return "app-rs";
33+
case "app/kotlin":
34+
return "app-kt";
35+
case "app/swift":
36+
return "app-swift";
2837
default:
2938
throw Error(
3039
intlMsg.lib_language_unsupportedManifestLanguage({

packages/schema/bind/src/bindings/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ export function getGenerateBindingFn(
4949
return WrapBindgen.getGenerateBindingFn(
5050
"wrapscan.io/polywrap/app-python-abi-bindgen@1"
5151
);
52+
case "app-rs":
53+
return WrapBindgen.getGenerateBindingFn(
54+
"wrapscan.io/polywrap/app-rust-abi-bindgen@1"
55+
);
5256
case "app-swift":
5357
return WrapBindgen.getGenerateBindingFn(
5458
"wrapscan.io/polywrap/app-swift-abi-bindgen@1"

packages/schema/bind/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const bindLanguage = {
1212
"plugin-swift": "plugin-swift",
1313
"app-ts": "app-ts",
1414
"app-py": "app-py",
15+
"app-rs": "app-rs",
1516
"app-swift": "app-swift",
1617
"app-kt": "app-kt",
1718
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
id("com.android.application")
5+
id("org.jetbrains.kotlin.android")
6+
id("org.jetbrains.kotlin.plugin.serialization")
7+
id("com.github.node-gradle.node")
8+
}
9+
10+
android {
11+
namespace = "io.template.polywrap"
12+
compileSdk = 33
13+
14+
defaultConfig {
15+
applicationId = "io.template.polywrap"
16+
minSdk = 24
17+
targetSdk = 33
18+
versionCode = 1
19+
versionName = "1.0"
20+
21+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
22+
vectorDrawables {
23+
useSupportLibrary = true
24+
}
25+
}
26+
27+
buildTypes {
28+
release {
29+
isMinifyEnabled = false
30+
proguardFiles(
31+
getDefaultProguardFile("proguard-android-optimize.txt"),
32+
"proguard-rules.pro"
33+
)
34+
}
35+
}
36+
compileOptions {
37+
sourceCompatibility = JavaVersion.VERSION_17
38+
targetCompatibility = JavaVersion.VERSION_17
39+
}
40+
kotlinOptions {
41+
jvmTarget = "17"
42+
}
43+
buildFeatures {
44+
compose = true
45+
}
46+
composeOptions {
47+
kotlinCompilerExtensionVersion = "1.4.8"
48+
}
49+
packaging {
50+
resources {
51+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
52+
}
53+
}
54+
}
55+
56+
dependencies {
57+
// polywrap client
58+
implementation("io.polywrap:polywrap-client:0.10.4")
59+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
60+
// polywrap logger plugin
61+
implementation("io.polywrap.plugins:logger:0.10.4")
62+
implementation("com.github.tony19:logback-android:3.0.0")
63+
64+
// ui
65+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
66+
67+
// defaults
68+
implementation("androidx.core:core-ktx:1.10.1")
69+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
70+
implementation("androidx.activity:activity-compose:1.7.2")
71+
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
72+
implementation("androidx.compose.ui:ui")
73+
implementation("androidx.compose.ui:ui-graphics")
74+
implementation("androidx.compose.ui:ui-tooling-preview")
75+
implementation("androidx.compose.material3:material3")
76+
testImplementation("junit:junit:4.13.2")
77+
androidTestImplementation("androidx.test.ext:junit:1.1.5")
78+
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
79+
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
80+
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
81+
debugImplementation("androidx.compose.ui:ui-tooling")
82+
debugImplementation("androidx.compose.ui:ui-test-manifest")
83+
}
84+
85+
// set up NodeJS to run the Polywrap CLI
86+
// NodeJS installation will be stored in gradle cache
87+
node {
88+
val nullString: String? = null
89+
distBaseUrl.set(nullString)
90+
// Whether to download and install a specific Node.js version or not
91+
// If false, it will use the globally installed Node.js
92+
// If true, it will download node using above parameters
93+
// Note that npm is bundled with Node.js
94+
download.set(true)
95+
}
96+
97+
// run polwyrap codegen
98+
tasks.register<com.github.gradle.node.npm.task.NpxTask>("codegen") {
99+
group = "polywrap"
100+
dependsOn(tasks.npmInstall)
101+
command.set("polywrap")
102+
args.set(listOf("codegen",
103+
"-m", "$rootDir/polywrap.yaml",
104+
"-g", "$projectDir/src/main/java/wrap"
105+
))
106+
}
107+
108+
// set polywrap codegen to run before each build
109+
tasks.withType<KotlinCompile> { dependsOn("codegen") }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)