diff --git a/.github/workflows/test-ios.yml b/.github/workflows/test-ios.yml index 82a9ca6..0162026 100644 --- a/.github/workflows/test-ios.yml +++ b/.github/workflows/test-ios.yml @@ -1,6 +1,6 @@ name: iOS e2e -# toolchain#22, iOS: sample's app on an arm64 iOS simulator runs Python with the stdlib and +# toolchain#22, iOS: usage-example's app on an arm64 iOS simulator runs Python with the stdlib and # Python.framework python-multiplatform puts into the .app, plus this plugin's python/ payload. # macOS minutes cost ~10x, so this runs only for iOS wiring changes, on develop and by hand, and is # informational (not a required check). Lead decision, 2026-10-03. @@ -9,9 +9,9 @@ on: branches: [develop] pull_request: paths: - - "sample/src/iosMain/**" - - "sample/build.gradle.kts" - - "sample/gradle/**" + - "usage-example/src/iosMain/**" + - "usage-example/build.gradle.kts" + - "usage-example/gradle/**" - "toolchain/src/main/kotlin/org/thisisthepy/python/multiplatform/toolchain/bundle/**" - ".github/workflows/test-ios.yml" workflow_dispatch: @@ -48,7 +48,7 @@ jobs: - uses: actions/cache@v4 with: path: ~/.konan - key: konan-${{ runner.os }}-${{ hashFiles('sample/gradle/libs.versions.toml') }} + key: konan-${{ runner.os }}-${{ hashFiles('usage-example/gradle/libs.versions.toml') }} - name: Publish packpack, the toolchain plugin and python-multiplatform (iOS simulator) run: | @@ -68,7 +68,7 @@ jobs: slice="$pmd/python-multiplatform/build/python-standalone/extracted/3.14.7/ios/Python.xcframework/ios-arm64_x86_64-simulator" # TODO(python-multiplatform#90): PYTHON_MULTIPLATFORM_DIR and the -framework Python link flags # are interim; the published plugin will stage Python.xcframework and its link options. - xcodebuild -project sample/src/iosMain/app.xcodeproj -target iosApp \ + xcodebuild -project usage-example/src/iosMain/app.xcodeproj -target iosApp \ -sdk iphonesimulator -configuration Debug \ ARCHS=arm64 ONLY_ACTIVE_ARCH=YES CODE_SIGNING_ALLOWED=NO \ SYMROOT="$GITHUB_WORKSPACE/build-ios" \ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33cd036..5c09c7c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,8 +6,8 @@ name: Test # # Both modules depend on org.thisisthepy.python.multiplatform:packpack:0.1.0 from # mavenLocal, so each job first publishes it from pypackpack's develop branch. -# sample/ is its own build (toolchain#22, #62; python-multiplatform's Kotlin), run by the -# consumer and e2e jobs with this repository's wrapper (../gradlew from sample/ = ./gradlew -p sample). +# usage-example/ is its own build (toolchain#22, #62; python-multiplatform's Kotlin), run by the +# consumer and e2e jobs with this repository's wrapper (../gradlew from usage-example/ = ./gradlew -p usage-example). on: pull_request: push: @@ -94,7 +94,7 @@ jobs: # Unit tests run on Kotlin 2.x's stdlib, but a consumer runs the plugin on the kotlin-stdlib Gradle # embeds. pypackpack#31 broke every suspend call that way and no unit test could see it. This job is - # a real consumer: sample (its own build) with a real pip dependency installs, bundles, zips. + # a real consumer: usage-example (its own build) with a real pip dependency installs, bundles, zips. consumer: runs-on: ubuntu-latest timeout-minutes: 60 @@ -120,9 +120,9 @@ jobs: python-version: "3.14" - uses: astral-sh/setup-uv@v6 - # sample applies three things from mavenLocal: packpack (through the plugin), the + # usage-example applies three things from mavenLocal: packpack (through the plugin), the # toolchain plugin, and python-multiplatform's library and bindings plugin. Versions pinned in - # sample/gradle/libs.versions.toml (library 3.14.7-alpha01, plugin 3.13.0 until + # usage-example/gradle/libs.versions.toml (library 3.14.7-alpha01, plugin 3.13.0 until # python-multiplatform#70). - name: Publish packpack, the toolchain plugin and python-multiplatform to mavenLocal run: | @@ -137,7 +137,7 @@ jobs: (cd .ci/python-multiplatform && ./gradlew -p python-multiplatform-gradle-plugin publishToMavenLocal --console=plain) - name: Install, bundle and zip as a consumer - working-directory: sample + working-directory: usage-example run: | ../gradlew installPythonDependencies buildPython packagePython \ --console=plain > consumer.log 2>&1 || { cat consumer.log; exit 1; } @@ -194,11 +194,11 @@ jobs: (cd .ci/python-multiplatform && ./gradlew -p python-multiplatform-gradle-plugin publishToMavenLocal --console=plain) - name: Package the desktop app - working-directory: sample + working-directory: usage-example run: ../gradlew createDistributable --console=plain - name: Run the packaged app's Python, headless and without PYTHONHOME - working-directory: sample + working-directory: usage-example run: | set -euo pipefail app=$(find build/compose/binaries/main/app -maxdepth 3 -type f -path '*/bin/*' | head -n 1) @@ -253,7 +253,7 @@ jobs: (cd .ci/python-multiplatform && ./gradlew -p python-multiplatform-gradle-plugin publishToMavenLocal --console=plain) - name: Build the debug APK - working-directory: sample + working-directory: usage-example run: ../gradlew assembleDebug --console=plain - name: Enable KVM for the emulator @@ -270,7 +270,7 @@ jobs: target: google_apis disable-animations: true script: | - set -eu; apk=$(find sample/build/outputs/apk/debug -name '*.apk' | head -n 1); [ -n "$apk" ]; adb install -r "$apk"; adb logcat -c; adb shell am start -W -n org.thisisthepy.python.multiplatform.toolchain.example/.MainActivity --ez python-smoke true; sleep 20; adb logcat -d -s PythonSmoke:V > smoke.log; cat smoke.log; grep -q 'PYTHON_SMOKE_OK ' smoke.log; grep 'PYTHON_SMOKE_OK ' smoke.log | grep -q '/data/' + set -eu; apk=$(find usage-example/build/outputs/apk/debug -name '*.apk' | head -n 1); [ -n "$apk" ]; adb install -r "$apk"; adb logcat -c; adb shell am start -W -n org.thisisthepy.python.multiplatform.toolchain.example/.MainActivity --ez python-smoke true; sleep 20; adb logcat -d -s PythonSmoke:V > smoke.log; cat smoke.log; grep -q 'PYTHON_SMOKE_OK ' smoke.log; grep 'PYTHON_SMOKE_OK ' smoke.log | grep -q '/data/' guide: runs-on: ubuntu-latest diff --git a/AGENTS.md b/AGENTS.md index a609f58..dc6db5c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,7 +38,7 @@ there. Work belongs inside an existing module or directory: sources under `src/< CI-only scripts under `.github/scripts/`, temporary files under the git-ignored `.tmp/`. If you think a new top-level entry is needed, propose it (what, why, which alternatives inside existing directories you ruled out) and wait for approval. This was added after unapproved root folders -(`ksp-fixtures/`, `tools/`, `kotlin-js-store/`, `iosApp/`, `sample/python`) had to be dismantled. +(`ksp-fixtures/`, `tools/`, `kotlin-js-store/`, `iosApp/`, `usage-example/python`) had to be dismantled. ## 3. Worktrees link large artefacts instead of copying them @@ -170,8 +170,8 @@ GitHub issues `thisisthepy/toolchain#2` (plugin checklist) and `#1` (`tcl`), it - Never edit, move, rename or `git add` it. - When the code's DSL disagrees with it, the file wins, and the disagreement is recorded in `docs/SPEC.md` and `docs/INTENT.md` §4 until the maintainer decides. Do not "fix" either side on your own. -- `sample/` is the **executable subset** of that file: the part the plugin actually reads. - When a DSL property becomes live, add it to `sample/build.gradle.kts`, so there is a build +- `usage-example/` is the **executable subset** of that file: the part the plugin actually reads. + When a DSL property becomes live, add it to `usage-example/build.gradle.kts`, so there is a build that fails if the wiring breaks. ## 12. Layout @@ -179,7 +179,7 @@ GitHub issues `thisisthepy/toolchain#2` (plugin checklist) and `#1` (`tcl`), it | Module | What it is | |---|---| | `toolchain/` (`:toolchain`) | The Gradle plugin (id `org.thisisthepy.python.multiplatform`, class `PythonPlugin`; source set `main`). DSL in `dsl/`, tasks in `bundle/`, `dependency/`, `hotreload/`. The same module holds toolchain-lite, the `tcl install ` CLI, in its own source sets (`src/cliMain`, `src/cliTest`; #78): they depend on packpack and coroutines only, never on `main`, and the plugin's publication carries none of them. | -| `sample/` | **Its own Gradle build** (own settings and catalog; toolchain#22): a Compose Multiplatform app applying this plugin and python-multiplatform, on python-multiplatform's Kotlin/Compose/AGP. Run it with this repository's wrapper: `./gradlew -p sample …`. Its Python package is `sample/src/commonMain/python/`. | +| `usage-example/` | **Its own Gradle build** (own settings and catalog; toolchain#22): a Compose Multiplatform app applying this plugin and python-multiplatform, on python-multiplatform's Kotlin/Compose/AGP. Run it with this repository's wrapper: `./gradlew -p usage-example …`. Its Python package is `usage-example/src/commonMain/python/`. | | `.github/scripts/release/` | The develop → release → main sync (rule 4). | `pyproject.toml` at the root is toolchain-lite, the PyPI distribution of `tcl` (#69): one platform @@ -188,8 +188,8 @@ wheel per OS carrying the native `tcl` binary, plus the launcher package `toolch wheels; its version must equal `toolchain/build.gradle.kts`'s `tclVersion`, and `docs/pypi/README.md` is its PyPI page. Keep the launcher a launcher: the work stays in Kotlin. -Nothing else belongs at the root (#62): no IDE directories, no lock-file directories (the sample's wasm -yarn lock is `sample/gradle/wasm-yarn.lock`), no copied wrappers. The pre-#62 layout is the tag +Nothing else belongs at the root (#62): no IDE directories, no lock-file directories (usage-example's wasm +yarn lock is `usage-example/gradle/wasm-yarn.lock`), no copied wrappers. The pre-#62 layout is the tag `archive/pre-restructure`. ## 13. pypackpack owns the work; toolchain owns the vocabulary @@ -233,10 +233,10 @@ history removing. classpath broke every consumer's wasm target once. - `-Xskip-metadata-version-check` exists because `packpack` is built with a newer Kotlin than this build. Bumping Kotlin build-wide is a decision for the maintainer, not a fix. -- `sample` resolves the plugin **by Maven coordinate from `mavenLocal()`**, not through +- `usage-example` resolves the plugin **by Maven coordinate from `mavenLocal()`**, not through `includeBuild`. After changing `:toolchain`, run `:toolchain:publishToMavenLocal` before building - `sample`, or you are testing the previous plugin. -- `sample` is a separate build on python-multiplatform's toolchain (Kotlin 2.4.20-Beta2, Compose + `usage-example`, or you are testing the previous plugin. +- `usage-example` is a separate build on python-multiplatform's toolchain (Kotlin 2.4.20-Beta2, Compose 1.11.1, AGP 8.10.1, Gradle 8.11.1), because a Kotlin 2.1 compiler cannot read python-multiplatform's klibs. The plugin itself stays on this build's Kotlin for its consumers; do not bump it to match. @@ -244,7 +244,7 @@ history removing. Prerequisites: `org.thisisthepy.python.multiplatform:packpack:0.1.0` in `~/.m2` (published from the `pypackpack` repository), `uv` on `PATH`, and network access: `InstallDependenciesTaskTest` and -`InstallerTest` run a real `uv add` against PyPI. `sample` additionally needs an Android SDK +`InstallerTest` run a real `uv add` against PyPI. `usage-example` additionally needs an Android SDK (`ANDROID_HOME`) and python-multiplatform in `~/.m2`: from a python-multiplatform checkout, `./gradlew publishAllToMavenLocal` (library `3.14.7-alpha01`, bindings plugin `3.13.0` until its #70). diff --git a/PROJECT.md b/PROJECT.md index 6ad2bc2..34d4d56 100644 --- a/PROJECT.md +++ b/PROJECT.md @@ -10,7 +10,7 @@ Kotlin Multiplatform 앱의 Python 부분을 Gradle `python { }` 블록으로 | 목표 DSL (사용자 작성) | 메인 체크아웃 루트의 `(플러그인예시)build.gradle.kts`: 추적되지 않는 파일, worktree 에는 없다 | | 플러그인 체크리스트 | GitHub 이슈 `thisisthepy/toolchain#2` | | toolchain-lite | GitHub 이슈 `thisisthepy/toolchain#1` (`tcl install pythonx-compose`) | -| 실행 가능한 부분집합 | `sample/build.gradle.kts` | +| 실행 가능한 부분집합 | `usage-example/build.gradle.kts` | | 의도 / 계약 | `docs/INTENT.md` / `docs/SPEC.md` | ## 현재 상태 (2026-10-03, 코드와 테스트를 읽고 판정) @@ -86,7 +86,7 @@ Python 코드와 의존성이 실려 빌드·실행되는 상태. 기한을 맞 | 마일스톤 | 기한 | 범위 | 완료 기준 | 근거 | |---|---|---|---|---| -| M1 DSL = 예시 파일 | 10-17 | 플랫폼(#7 완료), pip(#9), `compileSdk` 상수(#10), `defaultConfig` 버전(#11), `buildFeatures`(#12), `projectFlavors`(#13), 플러그인 적용·zip·jar/APK 테스트(#14) | 예시 파일의 모든 속성이 컴파일되고, 읽히거나 좁게 거부됨. `sample` 이 그 모양으로 빌드됨 | 이슈 7개, 외부 의존 없음 | +| M1 DSL = 예시 파일 | 10-17 | 플랫폼(#7 완료), pip(#9), `compileSdk` 상수(#10), `defaultConfig` 버전(#11), `buildFeatures`(#12), `projectFlavors`(#13), 플러그인 적용·zip·jar/APK 테스트(#14) | 예시 파일의 모든 속성이 컴파일되고, 읽히거나 좁게 거부됨. `usage-example` 이 그 모양으로 빌드됨 | 이슈 7개, 외부 의존 없음 | | M2 실제 페이로드 | 11-07 | `bytecode`(#15), 소스셋·타깃별 의존성(#16), `embedLevel`(#17), ~~`compileSdk` 로 인터프리터 선택(#18)~~ → python-multiplatform `pythonVersion` 대조(#42), `KLIBDEPENS`(#19) | 각 변형의 번들에 그 타깃의 wheel 이 들어가고, bytecode 변형은 `.pyc` 를 실음 | pypackpack M2(타깃별 실제 설치)에 의존 | | M3 쓸 수 있는 수준 | 11-30 | iOS 페이로드 연결(#20), TypedPython 검사 태스크(#21), 세 플랫폼 실행(#22) | 예시 앱이 Android 에뮬레이터·iOS 시뮬레이터·데스크톱에서 Python 과 의존성을 실행 | python-multiplatform 런타임 로딩에 의존 | @@ -99,7 +99,7 @@ Python 코드와 의존성이 실려 빌드·실행되는 상태. 기한을 맞 ``` toolchain/ Gradle 플러그인 (dsl/, bundle/, dependency/, hotreload/) toolchain/src/cliMain, src/cliTest toolchain-lite CLI `tcl` (`:toolchain` 의 별도 소스셋, #78) -sample/ 별도 Gradle 빌드: 플러그인과 python-multiplatform 을 적용한 Compose Multiplatform 앱 + python/ +usage-example/ 별도 Gradle 빌드: 플러그인과 python-multiplatform 을 적용한 Compose Multiplatform 앱 + python/ (python-multiplatform 의 Kotlin 2.4.20-Beta2 / Compose 1.11.1 / AGP 8.10.1, 자체 wrapper) docs/ INTENT.md, SPEC.md, locale/, guide/ (GitHub Pages) ``` @@ -111,19 +111,19 @@ docs/ INTENT.md, SPEC.md, locale/, guide/ (GitHub Pages) ```bash ./gradlew :toolchain:test --rerun --console=plain > .tmp/toolchain-test.log 2>&1; echo "EXIT=$?" ./gradlew :toolchain:cliTest --rerun --console=plain > .tmp/tcl-test.log 2>&1; echo "EXIT=$?" -./gradlew :toolchain:publishToMavenLocal # sample 빌드 전에 반드시 +./gradlew :toolchain:publishToMavenLocal # usage-example 빌드 전에 반드시 python3 docs/guide/check_guide.py # 가이드 검사 -# sample 은 별도 빌드: python-multiplatform 체크아웃에서 ./gradlew publishAllToMavenLocal 후 -./gradlew -p sample packagePython -./gradlew -p sample createDistributable # 데스크톱 앱; 실행 시 --python-smoke 로 헤드리스 확인 +# usage-example 은 별도 빌드: python-multiplatform 체크아웃에서 ./gradlew publishAllToMavenLocal 후 +./gradlew -p usage-example packagePython +./gradlew -p usage-example createDistributable # 데스크톱 앱; 실행 시 --python-smoke 로 헤드리스 확인 ``` Python 테스트는 없다. 루트 `pyproject.toml` 이 가리키는 Python 패키지도 존재하지 않는다. ## 결정 사항 -- **sample 은 별도 빌드** (#22, 리드 결정 2026-10-03): python-multiplatform 은 Kotlin 2.4.20-Beta2 로 빌드되고 Kotlin 2.1 - 컴파일러는 그 klib 을 읽지 못한다. 소비자인 sample 이 의존성의 툴체인에 맞추고, 플러그인 자체는 소비자를 위해 +- **usage-example 은 별도 빌드** (#22, 리드 결정 2026-10-03): python-multiplatform 은 Kotlin 2.4.20-Beta2 로 빌드되고 Kotlin 2.1 + 컴파일러는 그 klib 을 읽지 못한다. 소비자인 usage-example 이 의존성의 툴체인에 맞추고, 플러그인 자체는 소비자를 위해 지금의 Kotlin 에 둔다. - **위임**: 의존성은 `BackendInterface.create(BackendType.UV)`, 번들은 diff --git a/README.md b/README.md index 72139f8..4834520 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ owns the Gradle vocabulary in between. | PyPI `toolchain-lite` | `tcl`, the command line for Python users (`uv tool install toolchain-lite`) | Apply the plugin next to Kotlin Multiplatform and point it at a `pypackpack` package. This is -`sample/build.gradle.kts`, trimmed: +`usage-example/build.gradle.kts`, trimmed: ```kotlin plugins { @@ -76,17 +76,17 @@ python { compileSdk = "3.13" localLibraryPath = "src/commonMain/python" // a pypackpack package: pyproject.toml + src/main/ packaging { - fileName = "sample" + fileName = "usage-example" } } ``` ```shell -./gradlew -p sample packagePython # install → bundle → zip (sample/ is its own build) -./gradlew -p sample stagePythonBundle # stage python/ for android, ios and desktop +./gradlew -p usage-example packagePython # install → bundle → zip (usage-example/ is its own build) +./gradlew -p usage-example stagePythonBundle # stage python/ for android, ios and desktop ``` -> **iOS, interim:** sample's Xcode phase (`sample/src/iosMain/install-python-phase.sh`) needs +> **iOS, interim:** usage-example's Xcode phase (`usage-example/src/iosMain/install-python-phase.sh`) needs > `PYTHON_MULTIPLATFORM_DIR` pointing at a python-multiplatform checkout for `Python.xcframework` and the > stdlib, until python-multiplatform#90 ships that wiring in its published plugin. diff --git a/docs/INTENT.md b/docs/INTENT.md index bee2a86..19c61e4 100644 --- a/docs/INTENT.md +++ b/docs/INTENT.md @@ -14,7 +14,7 @@ The intent is derived from what the maintainer wrote by hand, in this order of a | GitHub issue [`toolchain#2`](https://github.com/thisisthepy/toolchain/issues/2), "Kotlin Gradle Plugin and Build Tools" | The plugin checklist: Python version setup, target platforms, hot reload / code push, source sets, compile levels, build automation. | | GitHub issue [`toolchain#1`](https://github.com/thisisthepy/toolchain/issues/1), "Toolchain-lite for python-only users" | A simplified CLI for Python users: `tcl install pythonx-compose`. | | `pyproject.toml` / the original `README.md` | "Python Multiplatform Build Plugin/Tool with Kotlin Multiplatform Mobile". | -| `sample/` | The executable subset of the target DSL that the plugin reads today. | +| `usage-example/` | The executable subset of the target DSL that the plugin reads today. | Anything below that is an inference rather than a statement from those sources is marked `> Inferred: confirm with the maintainer.` diff --git a/docs/SPEC.md b/docs/SPEC.md index a39cbc0..b09ffc6 100644 --- a/docs/SPEC.md +++ b/docs/SPEC.md @@ -34,7 +34,7 @@ plugin id to a ProjectBuilder project and checks the extension, every task name (`installPythonDependencies`, `buildPython`, `packagePython`, `stagePythonBundle` and its `Android`/`Ios`/`Desktop` tasks; `hotReloadPython` and `codePushPython` after evaluation), the `python` group, and the `packagePython → buildPython → installPythonDependencies` chain. Resolving -the plugin from `mavenLocal()` is still exercised only by building `sample`. +the plugin from `mavenLocal()` is still exercised only by building `usage-example`. ### 1.2 `compileSdk`: the Python version `compileSdk` accepts `X.Y`, `X.Y.Z`, `X.Y.Z-alpha[N]` or `X.Y.Z-rc[N]` and classifies it into @@ -53,7 +53,7 @@ automatically (INTENT §4.1), which is not available yet: the reason fails `buil when there is a package to bundle), not the configuration. **Status: implemented**. `plugin/dsl/PythonSdk.kt`; `ptest/dsl/PythonSdkTest.kt`, -`ptest/bundle/BuildPythonSdkRejectionTest.kt`; `sample` uses `compileSdk = PY3_14_7`. +`ptest/bundle/BuildPythonSdkRejectionTest.kt`; `usage-example` uses `compileSdk = PY3_14_7`. **What `compileSdk` selects (#42).** `compileSdk` selects the Python version of the wheels that go into `python/`: it is the `--python-version` of every per-target install (§1.10, #16). It does @@ -284,7 +284,7 @@ family and flavor, options, rejection), `ptest/PythonPluginTargetDependenciesTes install directories, `libDirs` and dependencies on an applied plugin), `ptest/dependency/lang/python/InstallDependenciesTaskTest.kt` and `ptest/dependency/lang/python/InstallTargetDependenciesTaskTest.kt` (a real install of `six` for -`aarch64-linux-android`; both need `uv` and network). CI's consumer job checks that sample's +`aarch64-linux-android`; both need `uv` and network). CI's consumer job checks that usage-example's `iniconfig` is in the bundle and the zip. → *Known limits: without `compileSdk` no `python-version` is passed and uv uses the interpreter it finds. `installPythonDependencies` still `uv add`s every source set for the host, so a package with @@ -386,7 +386,7 @@ Hand-off to the platform's packaging step: `build/pythonStaging/ios/python/` is missing or empty (no package configured). It never copies into the `.app`. With python-multiplatform, its `tools/xcode/install-python.sh` is the single phase that copies `python/` (and the stdlib): it takes `PYTHON_PAYLOAD_DIR` (or `PYTHON_PAYLOAD_TASK` within its - own Gradle root); the sample's `sample/src/iosMain/install-python-phase.sh` computes the directory + own Gradle root); usage-example's `usage-example/src/iosMain/install-python-phase.sh` computes the directory with this task and passes it. Exactly one Xcode phase may copy `python/`. Wiring by hand without python-multiplatform: the guide's staging page has the safe phase snippet (capture, parse, check the directory, then `rsync --delete`); the repository no longer ships it as a script (#62). @@ -520,7 +520,7 @@ commands, skip warning, mode, exit-code interpretation). The TestKit tests in `pyrefly` wheels) and `uv`; without it they are **skipped** with that reason, as on CI. Not covered by a test here: exit 2 end to end (only `interpretTypedpythonResult`), and the install in a *consumer's* classpath: `withPluginClasspath()` bypasses the Kotlin DSL's `kotlin-stdlib` pin; -that was verified by building sample's `buildPython`. +that was verified by building usage-example's `buildPython`. → *Until `typedpython` is on PyPI, a build without `-Ptypedpython.wheelDir` skips the check with a warning.* → *Platform overlays (`src/`) are checked as files but only `src/main` is an import root: **partial**.* @@ -575,7 +575,7 @@ These exist in the code but are not asked for by the example build file or the i 1. **`python { localLibraryPath = "…" }`**: not in the example build file, which uses `sourceSets { commonMain { srcDirs(…) } }`. It overrides `srcDirs` and is the only source root - hot reload reads. `sample` depends on it. + hot reload reads. `usage-example` depends on it. 2. **`-Ppython.buildType=`**: a project property choosing the active build type when no platform variant is declared. The example build file says nothing about selecting a build type. 3. **Hot reload over `adb push` + broadcast.** The example describes an HTTPS `serverHost` with a diff --git a/docs/guide/getting-started.html b/docs/guide/getting-started.html index fcd9817..e608a5c 100644 --- a/docs/guide/getting-started.html +++ b/docs/guide/getting-started.html @@ -40,7 +40,7 @@

1. Prerequisites1. 준비

2. A Python package2. Python 패키지

The plugin bundles a pypackpack package: a directory with a pyproject.toml and its code under src/main/. Platform-specific code can sit in src/android, src/ios and so on; the bundler overlays it.

플러그인이 번들링하는 것은 pypackpack 패키지입니다. pyproject.toml 이 있고 코드가 src/main/ 아래에 있는 디렉터리입니다. 플랫폼 전용 코드는 src/android, src/ios 등에 두면 번들러가 덮어씌웁니다.

-
sample/src/commonMain/python/
+
usage-example/src/commonMain/python/
 ├── pyproject.toml
 └── src/main/example_py/
     ├── __init__.py
@@ -59,17 +59,17 @@ 

3. Apply the plugin3. 플 compileSdk = "3.13" localLibraryPath = "src/commonMain/python" packaging { - fileName = "sample" + fileName = "usage-example" } }

-

This is the repository's own sample/build.gradle.kts. Instead of localLibraryPath you can point sourceSets { commonMain { srcDirs(...) } } at the package.

이 저장소의 sample/build.gradle.kts 그대로입니다. localLibraryPath 대신 sourceSets { commonMain { srcDirs(...) } } 로 패키지를 가리켜도 됩니다.

+

This is the repository's own usage-example/build.gradle.kts. Instead of localLibraryPath you can point sourceSets { commonMain { srcDirs(...) } } at the package.

이 저장소의 usage-example/build.gradle.kts 그대로입니다. localLibraryPath 대신 sourceSets { commonMain { srcDirs(...) } } 로 패키지를 가리켜도 됩니다.

4. Run it4. 실행

-
./gradlew -p sample packagePython            # installPythonDependencies → buildPython → zip
-./gradlew -p sample stagePythonBundle        # copy python/ where each platform packages from
-./gradlew -p sample tasks --group python     # everything the plugin registered
+
./gradlew -p usage-example packagePython            # installPythonDependencies → buildPython → zip
+./gradlew -p usage-example stagePythonBundle        # copy python/ where each platform packages from
+./gradlew -p usage-example tasks --group python     # everything the plugin registered
diff --git a/docs/guide/guide-staging.html b/docs/guide/guide-staging.html index c9203e7..8ec2862 100644 --- a/docs/guide/guide-staging.html +++ b/docs/guide/guide-staging.html @@ -52,7 +52,7 @@

iOS: the Xcode build phasei dir=$(printf '%s\n' "$out" | sed -n 's/^PYTHON_PAYLOAD_DIR=//p') [ -n "$dir" ] && [ -d "$dir" ] || { echo "error: no Python payload dir from Gradle" >&2; exit 1; } rsync -a --delete "$dir/" "$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/python/" -

With python-multiplatform, its tools/xcode/install-python.sh is the one phase that copies python/ (and the stdlib): give it the directory this task prints as PYTHON_PAYLOAD_DIR, as the sample's sample/src/iosMain/install-python-phase.sh does, and do not add the snippet above as well. Only one Xcode phase may copy python/, because each rsync --deletes the same directory. The snippet above is for wiring by hand without python-multiplatform.

python-multiplatform 을 쓰면 그쪽 tools/xcode/install-python.sh 가 python/(와 stdlib)을 복사하는 유일한 단계입니다. 이 태스크가 출력한 디렉터리를 PYTHON_PAYLOAD_DIR 로 넘기세요(샘플의 sample/src/iosMain/install-python-phase.sh 처럼). 위 스니펫을 함께 넣지 마세요. 둘 다 같은 디렉터리를 rsync --delete 하므로 python/ 을 복사하는 Xcode 단계는 하나여야 합니다. 위 스니펫은 python-multiplatform 없이 손으로 배선할 때를 위한 것입니다.

+

With python-multiplatform, its tools/xcode/install-python.sh is the one phase that copies python/ (and the stdlib): give it the directory this task prints as PYTHON_PAYLOAD_DIR, as usage-example's usage-example/src/iosMain/install-python-phase.sh does, and do not add the snippet above as well. Only one Xcode phase may copy python/, because each rsync --deletes the same directory. The snippet above is for wiring by hand without python-multiplatform.

python-multiplatform 을 쓰면 그쪽 tools/xcode/install-python.sh 가 python/(와 stdlib)을 복사하는 유일한 단계입니다. 이 태스크가 출력한 디렉터리를 PYTHON_PAYLOAD_DIR 로 넘기세요(샘플의 usage-example/src/iosMain/install-python-phase.sh 처럼). 위 스니펫을 함께 넣지 마세요. 둘 다 같은 디렉터리를 rsync --delete 하므로 python/ 을 복사하는 Xcode 단계는 하나여야 합니다. 위 스니펫은 python-multiplatform 없이 손으로 배선할 때를 위한 것입니다.

Do not shorten it to dir=$(./gradlew … | sed …) && rsync …: the pipeline's status is sed's, so a failed Gradle leaves dir empty and rsync --delete "/" runs.

dir=$(./gradlew … | sed …) && rsync … 처럼 줄이면 안 됩니다. 파이프라인의 종료 상태는 sed 의 것이라, Gradle 이 실패하면 dir 이 비어 rsync --delete "/" 가 실행됩니다.

diff --git a/docs/locale/README_ko.md b/docs/locale/README_ko.md index 8086994..173384a 100644 --- a/docs/locale/README_ko.md +++ b/docs/locale/README_ko.md @@ -62,7 +62,7 @@ Python 을 내장한 Kotlin Multiplatform 앱에는 맞물려 돌아가야 하 | PyPI `toolchain-lite` | Python 사용자를 위한 명령줄 도구 `tcl` (`uv tool install toolchain-lite`) | Kotlin Multiplatform 옆에 플러그인을 적용하고 `pypackpack` 패키지를 가리키게 합니다. 아래는 -`sample/build.gradle.kts` 를 줄인 것입니다. +`usage-example/build.gradle.kts` 를 줄인 것입니다. ```kotlin plugins { @@ -75,17 +75,17 @@ python { compileSdk = "3.13" localLibraryPath = "src/commonMain/python" // pypackpack 패키지: pyproject.toml + src/main/ packaging { - fileName = "sample" + fileName = "usage-example" } } ``` ```shell -./gradlew -p sample packagePython # 설치 → 번들 → zip (sample/ 은 별도 빌드) -./gradlew -p sample stagePythonBundle # android, ios, desktop 용 python/ 스테이징 +./gradlew -p usage-example packagePython # 설치 → 번들 → zip (usage-example/ 은 별도 빌드) +./gradlew -p usage-example stagePythonBundle # android, ios, desktop 용 python/ 스테이징 ``` -> **iOS, 임시:** sample 의 Xcode 단계(`sample/src/iosMain/install-python-phase.sh`)는 +> **iOS, 임시:** usage-example 의 Xcode 단계(`usage-example/src/iosMain/install-python-phase.sh`)는 > python-multiplatform#90 이 published 플러그인으로 그 배선을 제공할 때까지 `Python.xcframework` 와 stdlib 을 위해 > python-multiplatform 체크아웃을 가리키는 `PYTHON_MULTIPLATFORM_DIR` 가 필요합니다. diff --git a/sample/src/commonMain/python/pyproject.toml b/sample/src/commonMain/python/pyproject.toml deleted file mode 100644 index 16ef0c6..0000000 --- a/sample/src/commonMain/python/pyproject.toml +++ /dev/null @@ -1,5 +0,0 @@ -[project] -name = "sample-python" -version = "0.1.0" -description = "The Python half of the sample app, bundled by pypackpack and staged by the toolchain plugin." -requires-python = ">=3.13" diff --git a/settings.gradle.kts b/settings.gradle.kts index 50894b3..2f98c13 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -32,5 +32,5 @@ dependencyResolutionManagement { rootProject.name = "ToolchainProject" include(":toolchain") -// sample/ is its own build, run with this wrapper: ./gradlew -p sample …. It uses python-multiplatform's +// usage-example/ is its own build, run with this wrapper: ./gradlew -p usage-example …. It uses python-multiplatform's // Kotlin; the plugin here stays on its own for its consumers (toolchain#22, #62). diff --git a/toolchain/build.gradle.kts b/toolchain/build.gradle.kts index d299eca..d522430 100644 --- a/toolchain/build.gradle.kts +++ b/toolchain/build.gradle.kts @@ -20,8 +20,8 @@ dependencies { // not left as an independent literal. A skewed pin here (previously `2.0.0` against a `2.1.0` // root) put two different `kotlin-gradle-plugin` versions on the plugin classpath any consumer // sees once it applies both this plugin and `org.jetbrains.kotlin.multiplatform` in the same - // `plugins {}` block (as `sample/build.gradle.kts` does). Gradle does not merge/conflict - // -resolve those into one: `sample/build.gradle.kts` compiled its `KotlinWebpackConfig + // `plugins {}` block (as `usage-example/build.gradle.kts` does). Gradle does not merge/conflict + // -resolve those into one: `usage-example/build.gradle.kts` compiled its `KotlinWebpackConfig // .DevServer()` call (browser { commonWebpackConfig { ... } }) against 2.0.0's shape (`proxy: // Map`), while the actually-applied multiplatform plugin (2.1.0, `proxy: // List` as of that release) drove `wasmJsBrowserTest` task creation at runtime -- @@ -51,7 +51,7 @@ dependencies { // Test-only: `PythonPluginAttachmentTest` applies `com.android.application` to a ProjectBuilder // project to check that the staged Android root really lands in `android.sourceSets.main.assets` // (the plugin reaches that object reflectively, so only a real AGP proves the method chain). - // Same version as `sample` (`gradle/libs.versions.toml` `agp`); never on the plugin's + // Same version as `usage-example` (`gradle/libs.versions.toml` `agp`); never on the plugin's // own runtime classpath. testImplementation("com.android.tools.build:gradle:${libs.versions.agp.get()}") } diff --git a/toolchain/src/main/kotlin/org/thisisthepy/python/multiplatform/toolchain/PythonPlugin.kt b/toolchain/src/main/kotlin/org/thisisthepy/python/multiplatform/toolchain/PythonPlugin.kt index fab36ba..21365fa 100644 --- a/toolchain/src/main/kotlin/org/thisisthepy/python/multiplatform/toolchain/PythonPlugin.kt +++ b/toolchain/src/main/kotlin/org/thisisthepy/python/multiplatform/toolchain/PythonPlugin.kt @@ -107,7 +107,7 @@ class PythonPlugin : Plugin { // destination roots are derived from the build directory alone (`PythonStagingPlatform. // rootIn`): an AGP asset source root has to be declared while the consumer's build script is // still being evaluated, because AGP reads its source sets in its own `afterEvaluate` and - // this plugin -- applied last in a `plugins { }` block, as `sample` applies it -- + // this plugin -- applied last in a `plugins { }` block, as `usage-example` applies it -- // registers its `afterEvaluate` callback after AGP's and therefore runs after it. A // `srcDir` added at that point is added to a source set nothing will look at again. // @@ -266,8 +266,8 @@ class PythonPlugin : Plugin { // second code path doing the same job -- `buildTask` (`BuildPythonArtifactTask`) already // delegates the real work to `pypackpack`'s `ResourceBundler` into `build/pythonBundle` // (this task's own report; `docs/ecosystem.md` §1, §5). Confirmed nothing depended on - // it before deleting: no source under `sample/` reads `src/main/assets/python` or - // `build/pythonLibraries`, `sample` itself never sets `python.localLibraryPath` + // it before deleting: no source under `usage-example/` reads `src/main/assets/python` or + // `build/pythonLibraries`, `usage-example` itself never sets `python.localLibraryPath` // today, and `copyPythonLibrariesToAssets`/`preBuild` wiring existed only inside this // now-removed block, so nothing outside it could have depended on that task by name // either. Wiring the real bundle output into Android assets (or any other platform's @@ -620,7 +620,7 @@ private fun registerStagingTasks(project: Project): Map): List.zip`. `sample` declares no platforms, so the only + * host-target bundle, one `.zip`. `usage-example` declares no platforms, so the only * chain that currently runs end to end is unaffected by any of this. The platform block is what * creates more than one target; without it there is exactly one, and one build type chosen by * `-Ppython.buildType` as before. diff --git a/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/bundle/StagePythonBundleTaskTest.kt b/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/bundle/StagePythonBundleTaskTest.kt index 384cdc1..56c2ba9 100644 --- a/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/bundle/StagePythonBundleTaskTest.kt +++ b/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/bundle/StagePythonBundleTaskTest.kt @@ -121,7 +121,7 @@ class StagePythonBundleTaskTest { // A regression guard for a defect this task actually had. With the bundle declared nowhere, // Gradle had nothing to compare and reported `stagePythonBundleDesktop UP-TO-DATE` on every // run after the first, so the staged tree -- and the jar built from it -- kept a payload - // from an earlier revision of the Python package. Found by building `:sample: + // from an earlier revision of the Python package. Found by building `:usage-example: // desktopJar`, deleting a module, and building again: the module was still in the archive. // // Asserted on the annotation rather than through a Gradle run because up-to-date checking diff --git a/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/typedpython/TypedpythonCheckTaskTest.kt b/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/typedpython/TypedpythonCheckTaskTest.kt index 94944ae..7e40e2b 100644 --- a/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/typedpython/TypedpythonCheckTaskTest.kt +++ b/toolchain/src/test/kotlin/org/thisisthepy/python/multiplatform/toolchain/typedpython/TypedpythonCheckTaskTest.kt @@ -26,10 +26,10 @@ import kotlin.test.BeforeTest * The build scripts are Kotlin DSL (`build.gradle.kts`), as a consumer's are. What these tests * **cannot** see: `withPluginClasspath()` injects the plugin's classes instead of resolving them, so * the Kotlin DSL's pin of the buildscript `kotlin-stdlib` to Gradle's embedded version - * (`{strictly 1.9.23}` on Gradle 8.9, see `:sample:buildEnvironment`) does not apply here. A + * (`{strictly 1.9.23}` on Gradle 8.9, see `:usage-example:buildEnvironment`) does not apply here. A * gate install through `pypackpack`'s suspend backend passed every test below and still died in - * `sample` with `NoClassDefFoundError: kotlin/coroutines/jvm/internal/SpillingKt` -- see - * [TypedpythonCheckTask]. Classpath problems show up in `sample`, not here. + * `usage-example` with `NoClassDefFoundError: kotlin/coroutines/jvm/internal/SpillingKt` -- see + * [TypedpythonCheckTask]. Classpath problems show up in `usage-example`, not here. * * Before `typedpythonCheck` exists, these fail with "Task 'typedpythonCheck' not found" or with * `buildPython` succeeding over an `Any` leak -- the pre-implementation failure, not a regression. diff --git a/sample/build.gradle.kts b/usage-example/build.gradle.kts similarity index 96% rename from sample/build.gradle.kts rename to usage-example/build.gradle.kts index 34b8c40..9168cdb 100644 --- a/sample/build.gradle.kts +++ b/usage-example/build.gradle.kts @@ -13,14 +13,14 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.compose.multiplatform) alias(libs.plugins.compose.compiler) - // sample is its own build (settings.gradle.kts here). The toolchain plugin is resolved by + // usage-example is its own build (settings.gradle.kts here). The toolchain plugin is resolved by // coordinate from mavenLocal (`./gradlew :toolchain:publishToMavenLocal` in ../), as is // python-multiplatform's bindings plugin, which stages and packages the CPython stdlib (#22). alias(libs.plugins.toolchain) alias(libs.plugins.python.multiplatform.bindings) } -// Exercises the target DSL surface end to end -- until now `sample` did not apply the +// Exercises the target DSL surface end to end -- until now `usage-example` did not apply the // plugin at all, so the DSL in `dsl/` had no executable definition (`docs/ecosystem.md` §2, §4 // item 7). This is deliberately the subset of `(플러그인예시)build.gradle.kts` that today's tasks // (`PythonPlugin.kt`) actually read: `compileSdk`, `packaging`, `buildTypes`, `platforms`, and @@ -56,7 +56,7 @@ python { } } packaging { - fileName = "sample" + fileName = "usage-example" } // `compose = true` is left out: it needs `python.compose.pythonxCompose` and // `python.compose.kotlinModule`, and neither artifact is published yet (docs/SPEC.md §1.16). diff --git a/sample/gradle.properties b/usage-example/gradle.properties similarity index 100% rename from sample/gradle.properties rename to usage-example/gradle.properties diff --git a/sample/gradle/libs.versions.toml b/usage-example/gradle/libs.versions.toml similarity index 95% rename from sample/gradle/libs.versions.toml rename to usage-example/gradle/libs.versions.toml index 25d1651..5751dec 100644 --- a/sample/gradle/libs.versions.toml +++ b/usage-example/gradle/libs.versions.toml @@ -1,4 +1,4 @@ -# sample/ is its own build (toolchain#22): a consumer of python-multiplatform, so it uses +# usage-example/ is its own build (toolchain#22): a consumer of python-multiplatform, so it uses # python-multiplatform's toolchain (its gradle/libs.versions.toml), not the toolchain plugin's. # The plugin itself (../toolchain) stays on its own Kotlin for its consumers. [versions] diff --git a/sample/settings.gradle.kts b/usage-example/settings.gradle.kts similarity index 79% rename from sample/settings.gradle.kts rename to usage-example/settings.gradle.kts index 0a3439c..1284f17 100644 --- a/sample/settings.gradle.kts +++ b/usage-example/settings.gradle.kts @@ -1,5 +1,5 @@ -// sample/ is its own Gradle build (toolchain#22, #62), run with the repository's wrapper: -// ./gradlew -p sample …. It consumes python-multiplatform, which is built with Kotlin 2.4, so it uses +// usage-example/ is its own Gradle build (toolchain#22, #62), run with the repository's wrapper: +// ./gradlew -p usage-example …. It consumes python-multiplatform, which is built with Kotlin 2.4, so it uses // that toolchain (gradle/libs.versions.toml here); the plugin in ../toolchain stays on // its own Kotlin for its consumers. Both plugins and the // python-multiplatform library come from mavenLocal: publish them first (see AGENTS.md §16). @@ -32,4 +32,4 @@ dependencyResolutionManagement { } } -rootProject.name = "sample" +rootProject.name = "usage-example" diff --git a/sample/src/androidMain/AndroidManifest.xml b/usage-example/src/androidMain/AndroidManifest.xml similarity index 100% rename from sample/src/androidMain/AndroidManifest.xml rename to usage-example/src/androidMain/AndroidManifest.xml diff --git a/sample/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainActivity.kt b/usage-example/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainActivity.kt similarity index 100% rename from sample/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainActivity.kt rename to usage-example/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainActivity.kt diff --git a/sample/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.android.kt b/usage-example/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.android.kt similarity index 100% rename from sample/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.android.kt rename to usage-example/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.android.kt diff --git a/sample/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.android.kt b/usage-example/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.android.kt similarity index 100% rename from sample/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.android.kt rename to usage-example/src/androidMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.android.kt diff --git a/sample/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml b/usage-example/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from sample/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml rename to usage-example/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml diff --git a/sample/src/androidMain/res/drawable/ic_launcher_background.xml b/usage-example/src/androidMain/res/drawable/ic_launcher_background.xml similarity index 100% rename from sample/src/androidMain/res/drawable/ic_launcher_background.xml rename to usage-example/src/androidMain/res/drawable/ic_launcher_background.xml diff --git a/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml b/usage-example/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml rename to usage-example/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml b/usage-example/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from sample/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to usage-example/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png b/usage-example/src/androidMain/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-hdpi/ic_launcher.png rename to usage-example/src/androidMain/res/mipmap-hdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png b/usage-example/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from sample/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png rename to usage-example/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png diff --git a/sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png b/usage-example/src/androidMain/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-mdpi/ic_launcher.png rename to usage-example/src/androidMain/res/mipmap-mdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png b/usage-example/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from sample/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png rename to usage-example/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png diff --git a/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png b/usage-example/src/androidMain/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xhdpi/ic_launcher.png rename to usage-example/src/androidMain/res/mipmap-xhdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png b/usage-example/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png rename to usage-example/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png b/usage-example/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png rename to usage-example/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png b/usage-example/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png rename to usage-example/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png b/usage-example/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png rename to usage-example/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png b/usage-example/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from sample/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png rename to usage-example/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/sample/src/androidMain/res/values/strings.xml b/usage-example/src/androidMain/res/values/strings.xml similarity index 100% rename from sample/src/androidMain/res/values/strings.xml rename to usage-example/src/androidMain/res/values/strings.xml diff --git a/sample/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/App.kt b/usage-example/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/App.kt similarity index 100% rename from sample/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/App.kt rename to usage-example/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/App.kt diff --git a/sample/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Greeting.kt b/usage-example/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Greeting.kt similarity index 100% rename from sample/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Greeting.kt rename to usage-example/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Greeting.kt diff --git a/sample/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.kt b/usage-example/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.kt similarity index 100% rename from sample/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.kt rename to usage-example/src/commonMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.kt diff --git a/usage-example/src/commonMain/python/pyproject.toml b/usage-example/src/commonMain/python/pyproject.toml new file mode 100644 index 0000000..f78ed03 --- /dev/null +++ b/usage-example/src/commonMain/python/pyproject.toml @@ -0,0 +1,5 @@ +[project] +name = "usage-example-python" +version = "0.1.0" +description = "The Python half of the usage-example app, bundled by pypackpack and staged by the toolchain plugin." +requires-python = ">=3.13" diff --git a/sample/src/commonMain/python/src/main/example_py/__init__.py b/usage-example/src/commonMain/python/src/main/example_py/__init__.py similarity index 80% rename from sample/src/commonMain/python/src/main/example_py/__init__.py rename to usage-example/src/commonMain/python/src/main/example_py/__init__.py index 2b57ef6..330c213 100644 --- a/sample/src/commonMain/python/src/main/example_py/__init__.py +++ b/usage-example/src/commonMain/python/src/main/example_py/__init__.py @@ -8,4 +8,4 @@ def greeting() -> str: - return f"Hello from the sample's Python payload {VERSION}" + return f"Hello from usage-example's Python payload {VERSION}" diff --git a/sample/src/commonMain/python/src/main/example_py/data/table.json b/usage-example/src/commonMain/python/src/main/example_py/data/table.json similarity index 100% rename from sample/src/commonMain/python/src/main/example_py/data/table.json rename to usage-example/src/commonMain/python/src/main/example_py/data/table.json diff --git a/sample/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.jvm.kt b/usage-example/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.jvm.kt similarity index 100% rename from sample/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.jvm.kt rename to usage-example/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.jvm.kt diff --git a/sample/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.kt b/usage-example/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.kt similarity index 100% rename from sample/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.kt rename to usage-example/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.kt diff --git a/sample/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt b/usage-example/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt similarity index 100% rename from sample/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt rename to usage-example/src/desktopMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt diff --git a/sample/src/iosMain/Configuration/Config.xcconfig b/usage-example/src/iosMain/Configuration/Config.xcconfig similarity index 100% rename from sample/src/iosMain/Configuration/Config.xcconfig rename to usage-example/src/iosMain/Configuration/Config.xcconfig diff --git a/sample/src/iosMain/app.xcodeproj/project.pbxproj b/usage-example/src/iosMain/app.xcodeproj/project.pbxproj similarity index 99% rename from sample/src/iosMain/app.xcodeproj/project.pbxproj rename to usage-example/src/iosMain/app.xcodeproj/project.pbxproj index 7217dbf..1e4bfea 100644 --- a/sample/src/iosMain/app.xcodeproj/project.pbxproj +++ b/usage-example/src/iosMain/app.xcodeproj/project.pbxproj @@ -176,7 +176,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/../../..\"\n./gradlew -p sample embedAndSignAppleFrameworkForXcode\n"; + shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/../../..\"\n./gradlew -p usage-example embedAndSignAppleFrameworkForXcode\n"; }; A7C3F1E20B5D4C6E8F901234 /* Install Python */ = { isa = PBXShellScriptBuildPhase; diff --git a/sample/src/iosMain/install-python-phase.sh b/usage-example/src/iosMain/install-python-phase.sh similarity index 91% rename from sample/src/iosMain/install-python-phase.sh rename to usage-example/src/iosMain/install-python-phase.sh index 7772614..9a237c1 100755 --- a/sample/src/iosMain/install-python-phase.sh +++ b/usage-example/src/iosMain/install-python-phase.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Xcode Run Script phase for the sample's iOS app (toolchain#22): put this app's python/ payload, +# Xcode Run Script phase for usage-example's iOS app (toolchain#22): put this app's python/ payload, # CPython's standard library and Python.framework into the .app. # # The payload comes from this build: stagePythonBundleIosForXcode prints PYTHON_PAYLOAD_DIR=, which is @@ -15,10 +15,10 @@ set -euo pipefail # TODO(python-multiplatform#90): no checkout once the plugin provides these to consumers. : "${PYTHON_MULTIPLATFORM_DIR:?set PYTHON_MULTIPLATFORM_DIR to a python-multiplatform checkout (interim, python-multiplatform#90)}" -# 1. This app's payload, from the sample's own build. Captured, parsed, then checked, so a failing +# 1. This app's payload, from usage-example's own build. Captured, parsed, then checked, so a failing # Gradle can never hand rsync an empty source. cd "$SRCROOT/../../.." -out=$(./gradlew -q -p sample stagePythonBundleIosForXcode) +out=$(./gradlew -q -p usage-example stagePythonBundleIosForXcode) payload=$(printf '%s\n' "$out" | sed -n 's/^PYTHON_PAYLOAD_DIR=//p') [ -n "$payload" ] && [ -d "$payload" ] || { echo "error: no Python payload dir from stagePythonBundleIosForXcode" >&2; exit 1; } export PYTHON_PAYLOAD_DIR="$payload" diff --git a/sample/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainViewController.kt b/usage-example/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainViewController.kt similarity index 100% rename from sample/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainViewController.kt rename to usage-example/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/MainViewController.kt diff --git a/sample/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.ios.kt b/usage-example/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.ios.kt similarity index 100% rename from sample/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.ios.kt rename to usage-example/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.ios.kt diff --git a/sample/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.ios.kt b/usage-example/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.ios.kt similarity index 100% rename from sample/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.ios.kt rename to usage-example/src/iosMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/PythonSmoke.ios.kt diff --git a/sample/src/iosMain/swift/Assets.xcassets/AccentColor.colorset/Contents.json b/usage-example/src/iosMain/swift/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from sample/src/iosMain/swift/Assets.xcassets/AccentColor.colorset/Contents.json rename to usage-example/src/iosMain/swift/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/sample/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/Contents.json b/usage-example/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from sample/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/Contents.json rename to usage-example/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/sample/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png b/usage-example/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png similarity index 100% rename from sample/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png rename to usage-example/src/iosMain/swift/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png diff --git a/sample/src/iosMain/swift/Assets.xcassets/Contents.json b/usage-example/src/iosMain/swift/Assets.xcassets/Contents.json similarity index 100% rename from sample/src/iosMain/swift/Assets.xcassets/Contents.json rename to usage-example/src/iosMain/swift/Assets.xcassets/Contents.json diff --git a/sample/src/iosMain/swift/ContentView.swift b/usage-example/src/iosMain/swift/ContentView.swift similarity index 100% rename from sample/src/iosMain/swift/ContentView.swift rename to usage-example/src/iosMain/swift/ContentView.swift diff --git a/sample/src/iosMain/swift/Info.plist b/usage-example/src/iosMain/swift/Info.plist similarity index 100% rename from sample/src/iosMain/swift/Info.plist rename to usage-example/src/iosMain/swift/Info.plist diff --git a/sample/src/iosMain/swift/Preview Content/Preview Assets.xcassets/Contents.json b/usage-example/src/iosMain/swift/Preview Content/Preview Assets.xcassets/Contents.json similarity index 100% rename from sample/src/iosMain/swift/Preview Content/Preview Assets.xcassets/Contents.json rename to usage-example/src/iosMain/swift/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/sample/src/iosMain/swift/app.swift b/usage-example/src/iosMain/swift/app.swift similarity index 100% rename from sample/src/iosMain/swift/app.swift rename to usage-example/src/iosMain/swift/app.swift diff --git a/sample/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.wasmJs.kt b/usage-example/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.wasmJs.kt similarity index 100% rename from sample/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.wasmJs.kt rename to usage-example/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/Platform.wasmJs.kt diff --git a/sample/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt b/usage-example/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt similarity index 100% rename from sample/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt rename to usage-example/src/wasmJsMain/kotlin/org/thisisthepy/python/multiplatform/toolchain/example/main.kt diff --git a/sample/src/wasmJsMain/resources/index.html b/usage-example/src/wasmJsMain/resources/index.html similarity index 100% rename from sample/src/wasmJsMain/resources/index.html rename to usage-example/src/wasmJsMain/resources/index.html diff --git a/sample/src/wasmJsMain/resources/styles.css b/usage-example/src/wasmJsMain/resources/styles.css similarity index 100% rename from sample/src/wasmJsMain/resources/styles.css rename to usage-example/src/wasmJsMain/resources/styles.css