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

Gradle: separate from aion repo and build scripts #60

Merged
merged 6 commits into from
Feb 14, 2019
Merged

Conversation

aion-kelvin
Copy link
Contributor

@aion-kelvin aion-kelvin commented Feb 6, 2019

  • build.gradle referenced files and build logic from the aion repo -- this PR removes them
  • Added a dir called lib/maven_repo that will have a Maven repo dir structure, so aion_api can use it as a Maven repo
  • Added jar and pom files for dependencies on kernel modules into that Maven repo

Details of how jar and pom were added:

Short version: From a cloned aion repo, run:
./gradlew :modAionBase:publish :modCrypto:publish :modLogger:publish :modRlp:publish :3rdParty.libnzmq:publish :aion_vm_api:publish :modUtil:publish -PpublishTarget=/home/you/path_to/aion_api/lib/maven_repo

That basically runs publish for a bunch of kernel modules we specifically name in the command. The modules we named are the ones we added in build.gradle (modAionBase, modCrypto, modLogger, modRlp, libnzmq), plus all transitive dependencies (modUtil, aion_vm_api).

Long version

After updating build.gradle in aion_api, if you build, it will tell you that it can't find the dependencies, since modAionBAse, modLogger, etc are not in a Maven Central repo. This command can be run for a nicer view of missing dependencies:

$ ./gradlew dependencies --configuration compile -q 

------------------------------------------------------------
Root project
------------------------------------------------------------

compile - Dependencies for source set 'main' (deprecated, use 'implementation ' instead).
+--- network.aion:modAionBase:0.3.2 FAILED
+--- network.aion:modCrypto:0.3.2 FAILED
+--- network.aion:modLogger:0.3.2 FAILED
+--- network.aion:modRlp:0.3.2 FAILED
+--- network.aion:libnzmq:1.0 FAILED
+--- com.madgag.spongycastle:prov:1.58.0.0
|    +--- com.madgag.spongycastle:core:1.58.0.0
|    \--- junit:junit:4.12
|         \--- org.hamcrest:hamcrest-core:1.3
+--- com.madgag.spongycastle:core:1.58.0.0
+--- org.apache.commons:commons-collections4:4.0
+--- org.slf4j:slf4j-api:1.7.25
+--- com.google.protobuf:protobuf-java:3.5.0
+--- com.google.code.gson:gson:2.7
+--- ch.qos.logback:logback-core:1.2.3
+--- ch.qos.logback:logback-classic:1.2.3
|    +--- ch.qos.logback:logback-core:1.2.3
|    \--- org.slf4j:slf4j-api:1.7.25
\--- com.google.code.findbugs:jsr305:3.0.2

So in kernel, we use the publish target of the missing dependencies and tell Gradle to write it to aion_api's maven repo dir:

./gradlew :modAionBase:publish :modCrypto:publish :modLogger:publish :modRlp:publish :3rdParty.libnzmq:publish -PpublishTarget=/home/sergiu/repos/aion_api/lib/maven_repo 

If we try to build aion_api again, there's new missing dependencies. That's because the kernel modules we just published have dependencies on other kernel modules.

$ ./gradlew build -q

FAILURE: Build failed with an exception.

* Where:
Build file '/home/sergiu/repos/aion_api/build.gradle' line: 168

* What went wrong:
Could not determine the dependencies of task ':fatJar'.
> Could not resolve all files for configuration ':compile'.
   > Could not find network.aion:aion_vm_api:0.3.2.
     Searched in the following locations:
       - file:/home/sergiu/.m2/repository/network/aion/aion_vm_api/0.3.2/aion_vm_api-0.3.2.pom
       - file:/home/sergiu/.m2/repository/network/aion/aion_vm_api/0.3.2/aion_vm_api-0.3.2.jar
       [...]
     Required by:
         project : > network.aion:modAionBase:0.3.2
   > Could not find network.aion:modUtil:0.3.2.
     Searched in the following locations:
       - file:/home/sergiu/.m2/repository/network/aion/modUtil/0.3.2/modUtil-0.3.2.pom
       - file:/home/sergiu/.m2/repository/network/aion/modUtil/0.3.2/modUtil-0.3.2.jar
      [...]
     Required by:
         project : > network.aion:modCrypto:0.3.2
         project : > network.aion:modRlp:0.3.2

So, we go back to the kernel and publish those ones as well (./gradlew :aion_vm_api:publish :modUtil:publish -PpublishTarget=/home/sergiu/repos/aion_api/lib/maven_repo ). After that, aion_api can build.

Testing

I've tested the output jar of pack build against Aion Wallet (replaced its aion_api jar with the one produced by this code) and it appears to function fine on Linux. Note: still need to add Mac and Windows support to libnzmq before we update Aion Wallet jars with these new ones.

@aion-kelvin aion-kelvin self-assigned this Feb 6, 2019
@aion-kelvin aion-kelvin changed the title Gradle: separate from aion repo and build scripts [wip] Gradle: separate from aion repo and build scripts Feb 7, 2019
@aion-kelvin aion-kelvin changed the title [wip] Gradle: separate from aion repo and build scripts Gradle: separate from aion repo and build scripts Feb 12, 2019
Copy link
Contributor

@AlexandraRoatis AlexandraRoatis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions from this PRs description should be added to the README.md file.

@aion-kelvin
Copy link
Contributor Author

I updated the README with the instructions. It seems pretty outdated, we should spend some time to update the rest of it soon.

@AionJayT AionJayT merged commit e59d9a8 into master Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants