fix(antd-java): make examples runnable via gradle :examples subproject#80
Open
Nic-dorman wants to merge 1 commit into
Open
fix(antd-java): make examples runnable via gradle :examples subproject#80Nic-dorman wants to merge 1 commit into
Nic-dorman wants to merge 1 commit into
Conversation
The README told users to run examples via gradle, but that never worked: $ bash gradlew examples:run -PmainClass=... FAILURE: Build failed with an exception. * What went wrong: Cannot locate tasks that match examples:build as project examples not found in root project antd-java. settings.gradle.kts only declared the root project; examples lived as loose .java files in examples/ with no package and no Gradle module to compile them. Mirror the antd-kotlin layout instead: - New examples/ subproject with the application plugin (run via gradle :examples:run; pick which example with -PmainClass=...) - Sources moved to examples/src/main/java/com/autonomi/examples/ with a package declaration - examples/build.gradle.kts declares its own mavenCentral repo and implementation(project(:)) so it links against the SDK - settings.gradle.kts gets include(examples) - gradlew was committed without the executable bit; chmod +x While moving the sources, two pre-existing type bugs surfaced (the files never compiled before so these were hidden): - Example03Files.java: assigned client.fileCost(...) to String, but the SDK returns UploadCostEstimate. Print individual fields, mirroring the Python/Rust/PHP examples. - Example06PrivateData.java: same shape for client.dataCost(...). Closes #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #71.
The README documented examples being run via
bash gradlew examples:run -PmainClass=..., but no such task existed —settings.gradle.ktsdeclared only the root project, and the example sources sat as loose.javafiles inexamples/with no package and no Gradle module to compile them.Mirror the
antd-kotlinlayout instead.Changes
Structural
:examplessubproject using theapplicationpluginexamples/src/main/java/com/autonomi/examples/with a package declaration on eachexamples/build.gradle.ktsdeclares its ownmavenCentral()repo andimplementation(project(":"))so the example module compiles against the SDKsettings.gradle.ktsgetsinclude("examples")gradlewwas committed without the executable bit —chmod +x'dBug fixes uncovered while moving the sources
The files never compiled before, so these were hidden:
Example03Files.javaassignedclient.fileCost(...)toString, but the SDK returnsUploadCostEstimate. Print individual fields, mirroring the Python / Rust / PHP examples.Example06PrivateData.java— same shape forclient.dataCost(...).How to run
Default
mainClassisExample02PublicData, so just./gradlew :examples:runworks for the round-trip smoke check.Test plan
./gradlew :examples:buildcompiles./gradlew :examples:run -PmainClass=com.autonomi.examples.Example02PublicDataagainst a local devnet — exits 0, stores + retrieves the payload, round-trip OKUploadCostEstimatetype fixSample output
(Empty
Cost:is the same daemon-side blank-cost behaviour seen in #74 and #77 — not new from this PR.)What this does NOT touch
Example04Files.javadoesn't exist in the original tree (was numbered 03, 05, 06 — no 04). The 5 existing examples are migrated as-is apart from the two type fixes above.