Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbabbce3

Browse files
committed
New macOS & Ubuntu toolchain
1 parentf61cffe commitbabbce3

25 files changed

+542
-71
lines changed

‎.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild

‎.idea/compiler.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/copyright/profiles_settings.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/gradle.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/misc.xml

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/modules.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
##Kotlin example for theSwiftAndroid toolchain.
1+
#Kotlin example for theAndroid Swift toolchain.
22

3-
Requires a build of the latest Android toolchain downloadable[here](http://johnholdsworth.com/android_toolchain.tgz). Once you've extracted the toolchain, run`swift-install/setup.sh` to get started. Once you've extracted this example you may need to edit local.properties to point to your Android SDK and then you should be able to run`./gradlew installDebug` or build the project in Android Studio. Make sure the that the`ANDROID_HOME` environment variable is set to the path to the SDK.
3+
![](http://johnholdsworth.com/kotlin.png)
4+
5+
Requires a build of the latest Android toolchain downloadable[here](http://johnholdsworth.com/android_toolchain.tgz). Once you've extracted the toolchain, run`swift-install/setup.sh` to get started. You then run`./gradlew installDebug` or build the project in Android Studio. Make sure the that the`ANDROID_HOME` environment variable is set to the path to an[Android SDK](https://developer.android.com/studio/index.html).
46
The phone must be api 21 aka Android v5+ aka Lollipop or better (I used an LG K4.)
7+
58
To create a new application, decide on a pair of interfaces to connect to and from your Swift
69
code and place them in a[Java Source](https://github.com/SwiftJava/swift-android-samples/blob/master/swifthello/src/main/java/com/jh/SwiftHello.java).
710
Use the command`./genswift.sh` in the[SwiftJava Project](https://github.com/SwiftJava/SwiftJava)
@@ -18,15 +21,14 @@ Context.getCacheDir().getPath() from the java side. In addition, to be able to u
1821
need to add a[CARoot info file](http://curl.haxx.se/docs/caextract.html) to the application's
1922
raw resources and copy it to this cache directory to be picked up by Foundation as follows:
2023

21-
URLSession.sslCertificateAuthorityFile = URL(fileURLWithPath: cacheDir! + "/cacert.pem")
24+
setenv("URLSessionCAInfo", cacheDir! + "/cacert.pem", 1)
25+
setenv("TMPDIR", cacheDir!, 1)
2226

2327
If you don't want peer validation you have the following option (not recommended at all)
2428

25-
URLSession.verifyPeerSSLCertificate = false
26-
27-
##
28-
29-
Simple demo of Swift code accessed over JNI.
29+
setenv("URLSessionCAInfo", “INSECURE_SSL_NO_VERIFY”, 1)
30+
31+
##Simple demo of Swift code accessed over JNI.
3032

3133
To build, setup the Gradle plugin, then run`./gradlew installDebug`
3234

‎app/app.iml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@
2121
<optionname="ASSETS_FOLDER_RELATIVE_PATH"value="/src/main/assets" />
2222
</configuration>
2323
</facet>
24-
<facettype="kotlin-language"name="Kotlin">
25-
<configurationversion="3"platform="JVM 1.8"useProjectSettings="false">
26-
<compilerSettings />
27-
<compilerArguments>
28-
<optionname="jvmTarget"value="1.8" />
29-
<optionname="languageVersion"value="1.1" />
30-
<optionname="apiVersion"value="1.1" />
31-
<optionname="pluginOptions">
32-
<array />
33-
</option>
34-
<optionname="pluginClasspaths">
35-
<array />
36-
</option>
37-
</compilerArguments>
38-
</configuration>
39-
</facet>
4024
</component>
4125
<componentname="NewModuleRootManager"LANGUAGE_LEVEL="JDK_1_7">
4226
<outputurl="file://$MODULE_DIR$/build/intermediates/classes/debug" />
@@ -78,40 +62,45 @@
7862
<sourceFolderurl="file://$MODULE_DIR$/src/main/java"isTestSource="false" />
7963
<sourceFolderurl="file://$MODULE_DIR$/src/main/rs"isTestSource="false" />
8064
<sourceFolderurl="file://$MODULE_DIR$/src/main/shaders"isTestSource="false" />
81-
<sourceFolderurl="file://$MODULE_DIR$/src/test/res"type="java-test-resource" />
82-
<sourceFolderurl="file://$MODULE_DIR$/src/test/resources"type="java-test-resource" />
83-
<sourceFolderurl="file://$MODULE_DIR$/src/test/assets"type="java-test-resource" />
84-
<sourceFolderurl="file://$MODULE_DIR$/src/test/aidl"isTestSource="true" />
85-
<sourceFolderurl="file://$MODULE_DIR$/src/test/java"isTestSource="true" />
86-
<sourceFolderurl="file://$MODULE_DIR$/src/test/rs"isTestSource="true" />
87-
<sourceFolderurl="file://$MODULE_DIR$/src/test/shaders"isTestSource="true" />
8865
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/res"type="java-test-resource" />
8966
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/resources"type="java-test-resource" />
9067
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/assets"type="java-test-resource" />
9168
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/aidl"isTestSource="true" />
9269
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/java"isTestSource="true" />
9370
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/rs"isTestSource="true" />
9471
<sourceFolderurl="file://$MODULE_DIR$/src/androidTest/shaders"isTestSource="true" />
72+
<sourceFolderurl="file://$MODULE_DIR$/src/test/res"type="java-test-resource" />
73+
<sourceFolderurl="file://$MODULE_DIR$/src/test/resources"type="java-test-resource" />
74+
<sourceFolderurl="file://$MODULE_DIR$/src/test/assets"type="java-test-resource" />
75+
<sourceFolderurl="file://$MODULE_DIR$/src/test/aidl"isTestSource="true" />
76+
<sourceFolderurl="file://$MODULE_DIR$/src/test/java"isTestSource="true" />
77+
<sourceFolderurl="file://$MODULE_DIR$/src/test/rs"isTestSource="true" />
78+
<sourceFolderurl="file://$MODULE_DIR$/src/test/shaders"isTestSource="true" />
9579
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/assets" />
9680
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/blame" />
81+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/build-info" />
9782
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/builds" />
83+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/check-manifest" />
9884
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/classes" />
85+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/classes-jar" />
9986
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/incremental" />
10087
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
10188
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
102-
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
10389
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
10490
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
10591
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
92+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
10693
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/jniLibs" />
10794
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/manifests" />
95+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/prebuild" />
10896
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/reload-dex" />
10997
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/res" />
110-
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/restart-dex" />
11198
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/rs" />
11299
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/shaders" />
113100
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/split-apk" />
101+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/splits-support" />
114102
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/symbols" />
103+
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/tmp" />
115104
<excludeFolderurl="file://$MODULE_DIR$/build/intermediates/transforms" />
116105
<excludeFolderurl="file://$MODULE_DIR$/build/kotlin" />
117106
<excludeFolderurl="file://$MODULE_DIR$/build/outputs" />
@@ -133,8 +122,8 @@
133122
<orderEntrytype="library"exported=""name="support-fragment-25.3.1"level="project" />
134123
<orderEntrytype="library"exported=""scope="TEST"name="espresso-core-2.2.2"level="project" />
135124
<orderEntrytype="library"exported=""scope="TEST"name="exposed-instrumentation-api-publish-0.5"level="project" />
136-
<orderEntrytype="library"exported=""scope="TEST"name="rules-0.5"level="project" />
137125
<orderEntrytype="library"exported=""name="constraint-layout-solver-1.0.2"level="project" />
126+
<orderEntrytype="library"exported=""scope="TEST"name="rules-0.5"level="project" />
138127
<orderEntrytype="library"exported=""scope="TEST"name="javax.annotation-api-1.2"level="project" />
139128
<orderEntrytype="library"exported=""name="annotations-13.0"level="project" />
140129
<orderEntrytype="library"exported=""scope="TEST"name="javax.inject-1"level="project" />
@@ -146,9 +135,9 @@
146135
<orderEntrytype="library"exported=""name="recyclerview-v7-25.3.1"level="project" />
147136
<orderEntrytype="library"exported=""name="kotlin-stdlib-1.1.3-2"level="project" />
148137
<orderEntrytype="library"exported=""name="support-annotations-25.3.1"level="project" />
149-
<orderEntrytype="library"exported=""name="support-vector-drawable-25.3.1"level="project" />
150138
<orderEntrytype="library"exported=""name="appcompat-v7-25.3.1"level="project" />
151-
<orderEntrytype="library"exported=""name="support-compat-25.3.1"level="project" />
139+
<orderEntrytype="library"exported=""name="support-vector-drawable-25.3.1"level="project" />
152140
<orderEntrytype="library"exported=""name="animated-vector-drawable-25.3.1"level="project" />
141+
<orderEntrytype="library"exported=""name="support-compat-25.3.1"level="project" />
153142
</component>
154143
</module>

‎app/src/main/java/com/example/user/myapplication/MainActivity.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import android.view.Menu
99
importandroid.view.MenuItem
1010
importandroid.widget.TextView
1111

12-
importcom.jh.SwiftHello.Listener
13-
importcom.jh.SwiftHello.Responder
12+
importcom.jh.SwiftHelloBinding.Listener
13+
importcom.jh.SwiftHelloBinding.Responder
1414
importcom.jh.SwiftHelloTest.TestListener
1515
importcom.jh.SwiftHelloTest.TestResponderImpl
1616

@@ -35,10 +35,10 @@ class MainActivity : AppCompatActivity(), Responder {
3535
}
3636
loadNativeDependencies()
3737
listener= bind(this)
38-
val context=SwiftApp.sharedApplication?.getApplicationContext()
38+
val context=SwiftApp.sharedApplication.getApplicationContext()
3939
val cacheDir= context?.getCacheDir()?.getPath()
4040
val pemfile= cacheDir+"/cacert.pem"
41-
val pemStream=SwiftApp.sharedApplication?.getResources()?.openRawResource(R.raw.cacert)
41+
val pemStream=SwiftApp.sharedApplication.getResources()?.openRawResource(R.raw.cacert)
4242
copyResource(pemStream, pemfile)
4343
listener.setCacheDir(cacheDir)
4444
listener.processText("World")
@@ -49,7 +49,7 @@ class MainActivity : AppCompatActivity(), Responder {
4949
valout=FileOutputStream(to)
5050
`in`?.copyTo(out)
5151
`in`?.close()
52-
out?.close()
52+
out.close()
5353
}catch (e:IOException) {
5454
e.printStackTrace()
5555
System.out.println(""+ e)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp