eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
399 stars 62 forks source link

`ceylon src` should support checking sources from source repo #6511

Open FroMage opened 8 years ago

FroMage commented 8 years ago

We should add the following annotation to the language module:

shared annotation class SourceRepository(shared String url, 
  shared String branch = "master", 
  shared String repositoryType = "git"){}

So we can annotate modules to point to the source repository. Then, ceylon src ceylon.openshift/1.3.0 will prompt:

$ ceylon src ceylon.openshift/1.3.0
ceylon.openshift is available from git at https://github.com/ceylon.openshift (master), 
do you want to check it out from git or just fetch the source files for that release?
Fetch from git [Y/Enter], or just source files [N]: Y
git clone https://github.com/ceylon.openshift
cd ceylon.openshift
git checkout master

Pros:

Cons:

quintesse commented 8 years ago

I would wholeheartedly agree with a ceylon src that would take GitHub URLs, but adding those URLs to the code... personally I don't really like the idea.

FroMage commented 8 years ago

Why not? Maven does that. It's useful, it also points the users to where the entire source code is, and which tag/branch to use in the module documentation.

quintesse commented 8 years ago

Where How does maven do that? I've never seen Java code with URLs to their source code repos.

FroMage commented 8 years ago

Well, in the pom.xml of course, that's where Maven defines modules.

quintesse commented 8 years ago

But that's indeed a Maven-only project-level artifact. That's not something we have. But on the other hand it's the only logical place we have. Ah well.

tombentley commented 8 years ago

For me the problem is maintaining those annotations. If I do a git branch I have to remember to update the annotations, and there must exist at least one commit in which the annotations are wrong.

Maven has the release plugin which tries to atomically keep version control and poms in sync when you release version x and start on version y. I tried to use it once and it was not an experience I'd wish to repeat or inflict on users.

Another problem is that you cannot guarantee that the binary you're running was actually compiled from the source code you've obtained.

So I don't really have a problem with the url and repositoryType attributes, it's the branch which just looks flaky, because it's so hard to maintain right. What might work better was a way to insert a git hash automatically at compile time. We'd need plugins for each RCS, but maybe we'd only need to support git initially.