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

added recipe for openjdk #5792

Merged
merged 8 commits into from
Sep 30, 2021
Merged

Conversation

boussaffawalid
Copy link
Contributor

Added recipe for openjdk
inspired by https://github.com/conan-io/conan-center-index/tree/master/recipes/zulu-openjdk


  • I've read the guidelines for contributing.
  • I've followed the PEP8 style guides for Python code in the recipes.
  • I've used the latest Conan client version.
  • I've tried at least one configuration locally with the
    conan-center hook activated.

@conan-center-bot

This comment has been minimized.

recipes/openjdk/all/conanfile.py Outdated Show resolved Hide resolved
destination=self._source_subfolder, strip_root=True)

def build(self):
pass # nothing to do, but this shall trigger no warnings ;-)
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a no_copy_source to skip this

@conan-center-bot

This comment has been minimized.

@prince-chrismc
Copy link
Contributor

Please do not force push we need to restart the reviewing

@prince-chrismc
Copy link
Contributor

You need to open an issue against the hooks to add this as an exception.

You can see the Zulu or for more information

@boussaffawalid
Copy link
Contributor Author

@prince-chrismc conan-io/hooks#306

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

I need to ask if this recipe is needed by some other recipe. According to our packaging policy, we allow only packages that are built from sources. If they are needed for other PRs or libraries, better to say it in the description of the PR.

Thanks!

@boussaffawalid
Copy link
Contributor Author

@jgsogo this recipe is not needed by any other other recipe. I prepared this recipe as I needed it for my own project and I thought it may be useful for other people as well.

@conan-center-bot

This comment has been minimized.

@SSE4
Copy link
Contributor

SSE4 commented Jun 30, 2021

AFAIK, there is no official binaries of OpenJDK, anyone (e.g. Zulu) can make his own distribution from the sources.
e.g. Microsoft now has started to to that as well: https://www.microsoft.com/openjdk
the list is: https://en.wikipedia.org/wiki/OpenJDK#OpenJDK_builds

return "source_subfolder"

def configure(self):
if self.settings.arch != "x86_64":
Copy link
Contributor

Choose a reason for hiding this comment

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

from conans.errors import ConanException
from io import StringIO

required_conan_version = ">=1.36.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if you're running an older version? The main recipe works and then it errors out during test?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I know it raises an error, but I'm talking about the placement.
I usually see this line in the main conanfile.py. By having it on the test_package's conanfile.py, would you allow the package to build and then error out during test?
Are both conanfiles evaluated before build?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch

Copy link
Contributor

Choose a reason for hiding this comment

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

test_package is not evaluated before the build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so should I add the required_conan_version to the main conanfile ?

Copy link
Contributor

@madebr madebr Jul 27, 2021

Choose a reason for hiding this comment

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

I think you are correct here.
The main recipe needs conan 1.33. -> you need to add it there too
The test recipe needs conan 1.36.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it does not make sense to require two different versions. lets use 1.36 in main recipe

Copy link
Contributor

Choose a reason for hiding this comment

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

You can build the main recipe without a test recipe (-tf None) or build with a different test recipe (-tf other_test_package).

Copy link
Contributor

Choose a reason for hiding this comment

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

This is ok. For a client using 1.33 it will fail in a conan create command, but it is accurate and, as said before, you can avoid running these tests, or use a different test folder... and a conan install ... --build=openjdk won't fail, which is the command you would run when retrieving this recipe from a remote (test_package is not uploaded to the remote).

@conan-center-bot

This comment has been minimized.

prince-chrismc
prince-chrismc previously approved these changes Aug 28, 2021
prince-chrismc added a commit to prince-chrismc/conan-center-index-pending-review that referenced this pull request Aug 28, 2021
the assumption is that OP reacted to the review and applied the required changes!

Testing locally this caught 7 PRs including conan-io/conan-center-index#5792 which was well over due
@prince-chrismc
Copy link
Contributor

prince-chrismc commented Aug 28, 2021

Refining my bot caught this PR.... it had lots of approvals and OP applied the required changes...

Please review again!

test_type = "build_requires"

def build(self):
pass # nothing to build, but tests should not warn
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps compiling something JNI?


def test(self):
output = StringIO()
self.run("java --version", output=output, run_environment=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be run conditionally, when not cross building.

@stale
Copy link

stale bot commented Sep 27, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 27, 2021
Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

We talked about this PR some time ago. We decided that as long as the tool is required to build some other project or used by other projects, it would be ok to redistribute already built packages. Of course, if building from sources is not possible at the moment and redistribution is allowed by the licensing.

recipes/openjdk/all/test_package/conanfile.py Outdated Show resolved Hide resolved
from conans.errors import ConanException
from io import StringIO

required_conan_version = ">=1.36.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is ok. For a client using 1.33 it will fail in a conan create command, but it is accurate and, as said before, you can avoid running these tests, or use a different test folder... and a conan install ... --build=openjdk won't fail, which is the command you would run when retrieving this recipe from a remote (test_package is not uploaded to the remote).

@stale stale bot removed the stale label Sep 27, 2021
Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>
@conan-center-bot

This comment has been minimized.

Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
@conan-center-bot
Copy link
Collaborator

All green in build 17 (9e093ced819bd7f6a765629a3dd46269e1b3cbaf):

  • openjdk/16.0.1@:
    All packages built successfully! (All logs)

Copy link
Contributor

@jgsogo jgsogo left a comment

Choose a reason for hiding this comment

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

LGTM.

We can improve the recipe in following PRs (checks that should go to validate())

@conan-center-bot conan-center-bot merged commit 0ef2071 into conan-io:master Sep 30, 2021
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.

9 participants