-
Notifications
You must be signed in to change notification settings - Fork 32
cljc version of math.combinatorics #3
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
Conversation
|
Please note that currently Clojure contrib projects with cljc cannot be built in the Clojure CI system (due to a stack of yaks). The only project currently using cljc is test.check, which must be built through a painful manual process. Because of that, I would prefer to delay this until that issue is fixed. We have mapped out the path to fixing this issue but it's been delayed due to other work. It is considered an important issue to fix and we do intend to do it. |
this sounds like a good idea :) |
@puredanger Is it possible now to have Clojure contrib projects with |
(:refer-clojure :exclude [update])) | ||
clojure.math.combinatorics | ||
(:refer-clojure :exclude [update]) | ||
#?(:cljs (:require [goog.string :refer [format]]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jurgenphotek the correct way of using goog.string.format
is by requiring goog.string.format
like this: (:require goog.string.format)
Now, we can have contrib projects with @jurgenphotek @Engelberg do you want to update the PR? |
@viebel Note the earlier comment here that Contrib projects cannot accept PRs -- changes must go through JIRA (and be covered by a signed contributor's agreement). |
Looks like @Engelberg has this under way: http://dev.clojure.org/jira/browse/MCOMB-6 |
I have some time to take care of this over the next couple of days. Is
there anything I need to know about the way the new build system handles
cross-platform code, or should it be as simple as getting a cljc file
working and then running the build and deploy cycle via the same web tool
as before?
…On Tue, Dec 13, 2016 at 5:15 AM, jurgenphotek ***@***.***> wrote:
Looks like @Engelberg <https://github.com/Engelberg> has this under way:
http://dev.clojure.org/jira/browse/MCOMB-6
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIdSwKRvcz1qSYQ-2AQxDJpITKR-Oodks5rHpp1gaJpZM4HauPh>
.
|
The first step should be that "mvn clean package" builds the correct archive on your local machine. I believe I have made the necessary changes to the build system and the project config such that it should "just work" to then deploy on the build box as before. But when that is found to be tragically wrong, please let me know. :) |
Note that the standard Maven build includes support for running tests in cljc files on the JVM and compiling archives that include cljc files. It does not include any support for testing cljs. However, data.xml has done some additional work to make cljs testing happen with Nashorn in the context of the Maven build if you're interested in borrowing from there. |
When I run "mvn clean package" I get an error that the combinatorics.clj
file is missing (which is understandable since I renamed it to
combinatorics.cljc, but I'm not sure what to do about it).
|
This is the current version of pom.xml in the project:
https://github.com/clojure/math.combinatorics/blob/master/pom.xml
It appears to have been updated 23 days ago (related to cross-platform
support?), but I don't see anything in the file related to cross-platform
support.
https://github.com/clojure/math.combinatorics/blob/master/pom.xml
|
I've managed to get something working by cobbling together pieces from the
pom.xml in clojure.data.xml. I now have something that is building and
passing tests in both Clojure and Clojurescript on my machine. My pom.xml
now looks like this (question below, so please read past the pom.xml to see
the question):
```
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>math.combinatorics</artifactId>
<version>0.1.4-SNAPSHOT</version>
<name>math.combinatorics</name>
<parent>
<groupId>org.clojure</groupId>
<artifactId>pom.contrib</artifactId>
<version>0.2.0</version>
</parent>
<developers>
<developer>
<name>Mark Engelberg</name>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>org.clojure</groupId>
<artifactId>clojurescript</artifactId>
<version>1.9.293</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/clojurescript</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<!-- cljc-maven-plugin produces .clj files from .cljc files,
hence enabling usage of .cljc while supporting clojure < 1.7.0
-->
<groupId>net.bendlas</groupId>
<artifactId>cljc-maven-plugin</artifactId>
<version>0.1.2</version>
<executions>
<execution>
<id>split-compile</id>
<phase>generate-sources</phase>
<goals><goal>split</goal></goals>
</execution>
<execution>
<id>split-compile-tests</id>
<phase>generate-test-sources</phase>
<goals><goal>split-tests</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<includes>
<include>**/*.clj</include>
<include>**/*.cljs</include>
<include>**/*.cljc</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<clojure.version>1.4.0</clojure.version>
</properties>
<pluginRepositories>
<!-- use clojars for cljc-maven-plugin -->
<pluginRepository>
<id>clojars.org</id>
<url>https://clojars.org/repo</url>
</pluginRepository>
</pluginRepositories>
<scm>
<connection>scm:git:git@github.com:
clojure/math.combinatorics.git</connection>
<developerConnection>scm:git:git@github.com:
clojure/math.combinatorics.git</developerConnection>
<url>git@github.com:clojure/math.combinatorics.git</url>
<tag>HEAD</tag>
</scm>
</project>
```
I'd like to specifically ask about:
```
<properties>
<clojure.version>1.4.0</clojure.version>
</properties>
```
I am assuming that this designates the minimum version of Clojure that this
works with. Is that correct? While making changes so it would be
cross-platform code, I intentionally made some changes that I knew would
break support for 1.2. I have no idea why it no longer works with 1.3
(complains about not being able to find `deftest` which doesn't make much
sense to me because I think deftest has been around much longer than
that). So I've marked the minimum version as 1.4.0.
Is it safe to assume that when I push it and run the build tool that it
will pick up on that property and only test from 1.4 up in the build-matrix?
|
The |
On Fri, Jan 6, 2017 at 1:42 AM, Herwig Hochleitner ***@***.*** > wrote:
The clojure.version property is the one, that the package gets compiled
with, i.e. the one that will generate .class files. Lower versions won't be
able to load it because of clojure's ABI changes, but the test matrix will
have to be adjusted separately.
So I might as well put 1.8.0 in the clojure.version property then. But how
do I make that adjustment to the test matrix?
|
As I said, lower versions of clojure won't be able to load class files generated by higher versions (the ABI is about classes and methods on a java level), so putting 1.8.0 will mean that your minimum requirement is 1.8.0 As for the test matrix, @puredanger helped adjust that for data.xml. Depending on your access level on jenkins, you might be able to do it yourself. |
FYI, you should not need cljc-maven-plugin to do a basic cljc build and I'd prefer not to include it if there is no reason to use it, as it's just more stuff to maintain. I can adjust the test.matrix - everything on the build box is generated from a data file (https://github.com/clojure/build.ci/blob/master/ci_data.clj), so any manual adjustments there will get blown away. |
Thanks for reclarifying, Herwig. I think I understand your point now. I
misunderstood and thought you were advocating 1.8 to make sure I was
getting the highest-quality and speediest class files, but you were saying
it wouldn't be backwards compatible if I did that.
So the main reason to use the cljc-maven-plugin (aside from the fact that I
wasn't getting a working build prior to including it) is that it allows the
library to be backwards compatible to 1.4. I'm all for supporting back
versions if it is easy to do so.
But Alex, if you'd prefer for me to just use the existing pom.xml and only
support 1.7 and up, I'll do it, but I'll need a little more instruction
about what to do next with the pom.xml since the build triggered by that
one seems to still be looking for the clj file and not finding it.
…On Fri, Jan 6, 2017 at 6:15 AM, Alex Miller ***@***.***> wrote:
FYI, you should not need cljc-maven-plugin to do a basic cljc build and
I'd prefer not to include it if there is no reason to use it, as it's just
more stuff to maintain.
I can adjust the test.matrix - everything on the build box is generated
from a data file (https://github.com/clojure/build.ci/blob/master/ci_data.
clj), so any manual adjustments there will get blown away.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAIdSx5zpx3IIf3wqtdBvuc5ATNWZu21ks5rPkxogaJpZM4HauPh>
.
|
@Engelberg I think it's ok to make Clojure 1.7 the min requirement and not use cljc-maven-plugin and that would be my preference. Users for <1.7 can still use the prior version if needed. Can you commit stuff to a branch or put a patch somewhere so I can look at it? |
I just pushed changes to master that convert to cljc. For me, this builds and tests locally and produces a correct jar file. Someone should actually test it on ClojureScript though. |
This also builds and tests properly on the build box. Someone needs to test the clojurescript version before including it in a release though. |
Hm, when looking at the jar file distributed through maven, there are no
@puredanger |
@bendlas by default, most of the contribs are not distributed as AOT-compiled jars. However, the default parent pom is configured to AOT compile the project as a check to ensure that it compiles (see https://github.com/clojure/build.poms/blob/master/pom.xml#L112-L114). The clojure.version is used when performing the main project build on the build box. The test-matrix project will test all Clojure and JDK versions that are specified as supported in the ci_data file (https://github.com/clojure/build.ci/blob/master/ci_data.clj). I dislike doing source pre-processing. The whole point of having cljc files is to avoid doing source pre-processing like we did with cljx. I also dislike including more plugins as that just adds more infrastructure that needs to be understood, maintained, and updated. My belief based on the state of the overall ecosystem is that the overwhelming majority of users are using Clojure 1.7+ and thus using cljc files is a sufficient solution. For those that are not, they can continue using older versions of the library. |
I pushed my version using the cljc-maven-plugin to a branch called cljc for
you to look at.
P.S. Git does crazy, bizarre things to the line endings whenever I deal
with contrib source code. I'm on Windows, and the recommended setting on
Windows is for git to convert endings to CRLF when checking things out and
convert back to LF when checking things in. Despite having things
configured in this recommended way, I get bizarre diffs on contrib
projects, some of which show additional carriage returns and some of which
show that I've touched every line when I haven't. I think it may have to
do with the patch-based system we use in contrib, which could be
circumventing the usual line-ending logic. I *hope* that despite the weird
things I see on this end, git is committing my changes with LF line
endings. If you see weirdness on your end when browsing the branch, and
see an easy way to clean it up, let me know.
|
P.P.S. I *have* tested my branch and know that it works on the latest
version of clojurescript.
|
The diff looks clean on the github side:
https://github.com/clojure/math.combinatorics/compare/cljc?expand=1
Maybe I need to completely blow away my local repo and clone it fresh.
|
Alex, I updated my pom.xml to match your modifications today (going back to
the basic one with no extra maven plugin) and it is now building on my
machine.
So, I think I'm ready to push all these changes to master and build a new
release with your simpler pom.xml. I'll wait a little while to give anyone
who wants to look at it a chance to peruse the branch I just pushed.
|
@puredanger alright, thanks for clarifying that. I'll conform to your stance in data.xml and remove |
@bendlas I'd also much rather have cljs test runner support :) |
Implemented in 0.1.4 |
this is not actually ready yet. but would you be interested?
This would be 1.7+ only.