Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile is broken on > v0.9.14 version #382

Open
AlfredoG87 opened this issue Jan 26, 2025 · 5 comments
Open

Compile is broken on > v0.9.14 version #382

AlfredoG87 opened this issue Jan 26, 2025 · 5 comments
Labels
Bug An error that causes the feature to behave differently than what was expected based on design.

Comments

@AlfredoG87
Copy link

AlfredoG87 commented Jan 26, 2025

Description

We try to do a compile of pbj as part of our build process on the BlockNode, however is failing with the following error:

/Users/user/Projects/hedera-block-node/stream/build/generated/source/pbj-proto/main/java/com/hedera/hapi/streams/codec/ContractBytecodeProtoCodec.java:174: error: method writeMessage in class ProtoWriterTools cannot be applied to given types;
        writeMessage(out, CONTRACT_ID, data.contractId(), com.hedera.hapi.node.base.ContractID.PROTOBUF::write, com.hedera.hapi.node.base.ContractID.PROTOBUF::measureRecord);
        ^
  required: WritableSequentialData,FieldDefinition,T,Codec<T>
  found:    WritableSequentialData,FieldDefinition,ContractID,com.hedera[...]write,com.hedera[...]ecord
  reason: cannot infer type-variable(s) T
    (actual and formal argument lists differ in length)
  where T is a type-variable:
    T extends Object declared in method <T>writeMessage(WritableSequentialData,FieldDefinition,T,Codec<T>)

Steps to reproduce

Just pull version dependabot/gradle/hiero-dependency-versions/pbjVersion-0.9.14 and attempt to build:

./gradlew clean build

Additional context

Similar/Same error is happening in all other classes:

Image

@AlfredoG87 AlfredoG87 added the Bug An error that causes the feature to behave differently than what was expected based on design. label Jan 26, 2025
@AlfredoG87 AlfredoG87 changed the title Compile is broken on latest version Compile is broken on 0.9.14 version Jan 26, 2025
@AlfredoG87 AlfredoG87 changed the title Compile is broken on 0.9.14 version Compile is broken on >v0.9.14 version Jan 26, 2025
@AlfredoG87 AlfredoG87 changed the title Compile is broken on >v0.9.14 version Compile is broken on > v0.9.14 version Jan 26, 2025
@jsync-swirlds
Copy link
Member

This should be fixed in the current main branch; we just need to verify that and publish a new release.

@jjohannes
Copy link
Collaborator

To test PBJ dev development version (e.g. in hedera-services).

In pbj:

  • Make sure version is correct in pbj-core/version.txt -> set to 0.9.17-SNAPSHOT
  • ./gradlew publishToMavenLocal

In hedera-services:

  • adjust settings.gradle.kts to load both plugin and runtime from mavenLocal():
pluginManagement {
    repositories {
        gradlePluginPortal()
        mavenLocal()
    }
}
dependencyResolutionManagement {
    repositories { mavenLocal() }
}
  • Adjust PBJ version in hapi/build.gradle.kts and hiero-dependency-versions/build.gradle.kts to 0.9.17-SNAPSHOT

@anthony-swirldslabs
Copy link
Contributor

@jjohannes :

  • Adjust PBJ version in hapi/build.gradle.kts and hiero-dependency-versions/build.gradle.kts to 0.9.17-SNAPSHOT

Is it possible to have only one place where the dependency version is specified?

@jjohannes
Copy link
Collaborator

jjohannes commented Feb 4, 2025

@anthony-swirldslabs good point. I am also not happy with that. We can't use just the "normal" version definition in hiero-dependency-versions, because we also define the version for the PBJ Gradle plugin. This is required when Gradle starts up (before that file is even looked at).

This is special, because it is the only Gradle plugin for which we define an individual version in the repositories that use it.

I identified a solution to define the plugin version in a way such that it can be accessed in hiero-dependency-versions. Then the runtime version is automatically based on the plugin (compiler) version.

I added this adjustment to: hiero-ledger/hiero-consensus-node#17528

Version is now in settings.gradle.kts:

    versionCatalogs.register("additionalPlugins") {
        plugin("pbj", "com.hedera.pbj.pbj-compiler").version("0.9.16")
    }

@anthony-swirldslabs
Copy link
Contributor

That is awesome. Thank you, @jjohannes !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An error that causes the feature to behave differently than what was expected based on design.
Projects
None yet
Development

No branches or pull requests

4 participants