diff --git a/Taskfile.yml b/Taskfile.yml deleted file mode 100644 index 0c367294c..000000000 --- a/Taskfile.yml +++ /dev/null @@ -1,83 +0,0 @@ -version: "3" - -silent: true - -tasks: - default: - deps: - - build - - docs: - cmds: - - ./gradlew javadoc - - build: - cmds: - - ./gradlew compileJava {{.CLI_ARGS}} - clean: - cmds: - - ./gradlew clean - - package: - cmds: - - ./gradlew sdk:assemble - test: - deps: - - "test:unit" - - "test:integration" - - "test:unit": - cmds: - - ./gradlew test {{.CLI_ARGS}} - - "test:integration": - cmds: - - ./gradlew -POPERATOR_ID=$OPERATOR_ID -POPERATOR_KEY=$OPERATOR_KEY -PHEDERA_NETWORK=$HEDERA_NETWORK testIntegration {{.CLI_ARGS}} - env: - OPERATOR_KEY: '0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4' - OPERATOR_ID: '0.0.1022' - HEDERA_NETWORK: 'localhost' - - "update:snapshots": - cmds: - - rm sdk/src/test/java/com/hedera/hashgraph/sdk/*.snap - - ./gradlew clean test - - "update:proto": - vars: - proto: '{{.proto | default }}' - cmds: - - ./scripts/update_protobufs.py {{.proto}} - - "update:addressbooks:mainnet": - cmds: - - ./gradlew examples:runGetAddressBook - - mv examples/address-book.proto.bin sdk/src/main/resources/addressbook/mainnet.pb - env: - HEDERA_NETWORK: mainnet - - "update:addressbooks:testnet": - cmds: - - ./gradlew examples:runGetAddressBook - - mv examples/address-book.proto.bin sdk/src/main/resources/addressbook/testnet.pb - env: - HEDERA_NETWORK: testnet - - "update:addressbooks:previewnet": - cmds: - - ./gradlew examples:runGetAddressBook - - mv examples/address-book.proto.bin sdk/src/main/resources/addressbook/previewnet.pb - env: - HEDERA_NETWORK: previewnet - - "update:addressbooks": - cmds: - - task: "update:addressbooks:mainnet" - - task: "update:addressbooks:testnet" - - task: "update:addressbooks:previewnet" - - update: - cmds: - - task: "update:proto" - - task: "update:snapshots" - - task: "update:addressbooks" diff --git a/developers.properties b/developers.properties deleted file mode 100644 index faf098b15..000000000 --- a/developers.properties +++ /dev/null @@ -1 +0,0 @@ -info@lfdecentralizedtrust.org=The Hiero Team diff --git a/docs/sdk/developer-guide.md b/docs/sdk/developer-guide.md index 7902653d7..6ffa36a98 100644 --- a/docs/sdk/developer-guide.md +++ b/docs/sdk/developer-guide.md @@ -116,22 +116,18 @@ More details about how to add/modify dependencies are found in the Hiero Gradle ## Maintaining generated files -> To execute the tasks below, you need to install the tool from this link: https://taskfile.dev/ -> (these tasks are from the file Taskfile.yml, which is located in the root of the repository). -> Once installed, you can run the commands as shown below. -> -> Note that the below `task` commands should be run from the root of the project. +> Note that the below `./gradlew` commands should be run from the root of the project. ### Updating unit tests snapshots ```sh -task update:snapshots +./gradlew updateSnapshots ``` ### Updating proto files ```sh -task update:proto +./gradlew updateSnapshots ``` ### Updating address books @@ -139,23 +135,23 @@ task update:proto Update all address books: ```sh -task update:addressbooks +./gradlew examples:updateAddressbooks ``` Update address books only for a mainnet: ```sh -task update:addressbooks:mainnet +./gradlew examples:updateAddressbooksMainnet ``` Update address books only for a testnet: ```sh -task update:addressbooks:testnet +./gradlew examples:updateAddressbooksTestnet ``` Update address books only for a previewnet: ```sh -task update:addressbooks:previewnet +./gradlew examples:updateAddressbooksPreviewnet ``` diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index e6514d07d..56a10c3fc 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -90,3 +90,22 @@ abstract class RunAllExample : DefaultTask() { } } } + +val updateAddressbooks = tasks.register("updateAddressbooks") + +listOf("mainnet", "testnet", "previewnet").forEach { network -> + val taskName = "updateAddressbooks${network.replaceFirstChar(Char::titlecase)}" + tasks.register(taskName) { + workingDir = rootDir + classpath = configurations.runtimeClasspath.get() + files(tasks.jar) + mainModule = "com.hedera.hashgraph.examples" + mainClass = "com.hedera.hashgraph.sdk.examples.GetAddressBookExample" + environment("HEDERA_NETWORK", network) + doLast { + val binFile = File(workingDir, "address-book.proto.bin") + val target = File(workingDir, "../sdk/src/main/resources/addressbook/$network.pb") + binFile.copyTo(target, overwrite = true) + } + } + updateAddressbooks { dependsOn(taskName) } +} diff --git a/scripts/premade/FeeDataType-0.txt b/scripts/premade/FeeDataType-0.txt index 4774bdc53..107a40059 100644 --- a/scripts/premade/FeeDataType-0.txt +++ b/scripts/premade/FeeDataType-0.txt @@ -1,25 +1,7 @@ -/*- - * - * Hedera Java SDK - * - * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package com.hedera.hashgraph.sdk; +// SPDX-License-Identifier: Apache-2.0 +package org.hiero.sdk; -import com.hedera.hashgraph.sdk.proto.SubType; +import org.hiero.sdk.proto.SubType; /** * Enum for the fee data types. diff --git a/scripts/premade/FreezeType-0.txt b/scripts/premade/FreezeType-0.txt index b412fbc7f..4596c96d7 100644 --- a/scripts/premade/FreezeType-0.txt +++ b/scripts/premade/FreezeType-0.txt @@ -1,23 +1,5 @@ -/*- - * - * Hedera Java SDK - * - * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package com.hedera.hashgraph.sdk; +// SPDX-License-Identifier: Apache-2.0 +package org.hiero.sdk; /** * Enum for the freeze types. diff --git a/scripts/premade/FreezeType-2.txt b/scripts/premade/FreezeType-2.txt index bc23bbe81..4e6bfb50a 100644 --- a/scripts/premade/FreezeType-2.txt +++ b/scripts/premade/FreezeType-2.txt @@ -1,8 +1,8 @@ - final com.hedera.hashgraph.sdk.proto.FreezeType code; + final org.hiero.sdk.proto.FreezeType code; - FreezeType(com.hedera.hashgraph.sdk.proto.FreezeType code) { + FreezeType(org.hiero.sdk.proto.FreezeType code) { this.code = code; } - static FreezeType valueOf(com.hedera.hashgraph.sdk.proto.FreezeType code) { + static FreezeType valueOf(org.hiero.sdk.proto.FreezeType code) { return switch (code) { diff --git a/scripts/premade/RequestType-0.txt b/scripts/premade/RequestType-0.txt index 518de2499..8e0dfc3eb 100644 --- a/scripts/premade/RequestType-0.txt +++ b/scripts/premade/RequestType-0.txt @@ -1,25 +1,7 @@ -/*- - * - * Hedera Java SDK - * - * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package com.hedera.hashgraph.sdk; +// SPDX-License-Identifier: Apache-2.0 +package org.hiero.sdk; -import com.hedera.hashgraph.sdk.proto.HederaFunctionality; +import org.hiero.sdk.proto.HederaFunctionality; /** * Enum for the request types. diff --git a/scripts/premade/Status-0.txt b/scripts/premade/Status-0.txt index 4a5933fff..85915c4fd 100644 --- a/scripts/premade/Status-0.txt +++ b/scripts/premade/Status-0.txt @@ -1,25 +1,7 @@ -/*- - * - * Hedera Java SDK - * - * Copyright (C) 2020 - 2024 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -package com.hedera.hashgraph.sdk; +// SPDX-License-Identifier: Apache-2.0 +package org.hiero.sdk; -import com.hedera.hashgraph.sdk.proto.ResponseCodeEnum; +import org.hiero.sdk.proto.ResponseCodeEnum; import java.util.Objects; diff --git a/scripts/update_protobufs.py b/scripts/update_protobufs.py index 38e805d33..c4fc4f549 100755 --- a/scripts/update_protobufs.py +++ b/scripts/update_protobufs.py @@ -46,7 +46,7 @@ def go_to_script_dir(): MAIN_PATH = os.path.join("..", "sdk", "src", "main") PROTO_OUT_PATH = os.path.join(MAIN_PATH, "proto") PROTO_MIRROR_OUT_PATH = os.path.join(PROTO_OUT_PATH, "mirror") -JAVA_OUT_PATH = os.path.join(MAIN_PATH, "java", "com", "hedera", "hashgraph", "sdk") +JAVA_OUT_PATH = os.path.join(MAIN_PATH, "java", "org", "hiero", "sdk") REQUEST_TYPE_OUT_PATH = os.path.join(JAVA_OUT_PATH, "RequestType.java") STATUS_OUT_PATH = os.path.join(JAVA_OUT_PATH, "Status.java") FEE_DATA_TYPE_OUT_PATH = os.path.join(JAVA_OUT_PATH, "FeeDataType.java") @@ -325,7 +325,7 @@ def add_to_FeeDataType(original_name, cap_snake_name, comment_lines): def add_to_FreezeType(original_name, cap_snake_name, comment_lines): FreezeType_sections[1] += \ - generate_enum(original_name, cap_snake_name, comment_lines, "com.hedera.hashgraph.sdk.proto.FreezeType", 1) + generate_enum(original_name, cap_snake_name, comment_lines, "org.hiero.sdk.proto.FreezeType", 1) FreezeType_sections[3] += generate_valueOf(original_name, cap_snake_name, 3) diff --git a/sdk/build.gradle.kts b/sdk/build.gradle.kts index d40446318..8d5f46229 100644 --- a/sdk/build.gradle.kts +++ b/sdk/build.gradle.kts @@ -76,3 +76,13 @@ dependencyAnalysis.abi { excludeClasses(".*Grpc") } } + +tasks.register("updateSnapshots") { + delete(sourceSets.test.get().allSource.matching { include("**/*.snap") }) + finalizedBy(tasks.test) +} + +tasks.register("updateProto") { + executable = File(rootDir, "scripts/update_protobufs.py").absolutePath + args("main") // argument is the branch/tag +}