-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Samples composite build #440
Samples composite build #440
Conversation
I see, the first point in the issue lacks a possibility to test the setup. I have updated the description; merged the first and the last point. |
got back to this after some time... tried starting it what do you think? |
I think I managed to execute all tests eventually and its successful |
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.
@assaflei very unfortunate but we cannot use gradles' composite build. I did not have a look at it yet but saw now that it does not work:
When a configuration other than default is published.
Builds using these features function incorrectly when included in a composite build. We plan to improve this in the future.
So yeah... we'll have to workaround it, implement our own composite build functionality.
Let me know if you still want to tackle this problem. I quickly outline an alternative solution: some of the steps which will be required:
- publish Atrium to a local maven repository (will require that we tweak the publishing a bit as it usually requires gpg to be setup)
- replace the atrium-version in the samples with the current snapshot version
- include mavenLocal() into the samples
- build the modified samples
I suggest that I will do the first step. In case you are interested, you could to steps 2 - 4. Let me know and I can give more information.
@@ -0,0 +1,7 @@ | |||
task run { | |||
dependsOn gradle.includedBuild('junit5').task(':test') |
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.
I am afraid but I made a wrong assumption. I did not have a look at how composite builds work in gradle but they work the opposite way. I.e. the project which depends on another needs to do the includeBuild. Which means, we don't need a atrium-samples-test
at all because not atrium has a dependency but the opposite. Thus remove the whole atrium-samples-test
again. Instead it is enough if we add the --include-build
to the CI-definitions (.travis.yml and java-windows.yml). So basically duplicate the existing build-steps/jobs and add --include-build. for instance, for mpp in java-windows.yml:
- name: Build sample mpp with current Atrium
run: samples\multiplatform\gradlew -p samples\multiplatform build --include-build ../../../
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.
Wait wait... maybe gradle is wrong (let's hope). Maybe this approach works but you surely need to include Atrium as well (and make atrium-samples-test an independent project entirely, i.e. do not add it to settings.gradle in the root of the project). In order to test if it works, I advice you to change apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/anyAssertions.kt use the following for toBe
fun <T> Expect<T>.toBe(expected: T) = addAssertion(ExpectImpl.any.notToBe(this, expected))
if the composite build works, then the tests should be executed and fail.
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.
what is the meaning of ../../../?
where are we pointing to?
the include build was required in case we wanted a composite build, if we wont use it than why use --include-build?
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.
Wait wait... maybe gradle is wrong (let's hope). Maybe this approach works but you surely need to include Atrium as well (and make atrium-samples-test an independent project entirely, i.e. do not add it to settings.gradle in the root of the project). In order to test if it works, I advice you to change apis/fluent-en_GB/atrium-api-fluent-en_GB-common/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/anyAssertions.kt use the following for toBe
fun <T> Expect<T>.toBe(expected: T) = addAssertion(ExpectImpl.any.notToBe(this, expected))
if the composite build works, then the tests should be executed and fail.
I missed this comment...
Should we revert?
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.
the include build was required in case we wanted a composite build, if we wont use it than why use --include-build?
Sorry for the confusion, that comment was before I saw the restriction of composite builds.
But to answer your other question
what is the meaning of ../../../?
note the parameter -p in
samples\multiplatform\gradlew -p samples\multiplatform build --include-build ../../../
so ../../../
is pointing back to the root of the project.
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.
arent we running from the root already?
samples... looks like reference from the root
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.
-p
specifies the working directory for gradle and --include-build is relative to this working directory.
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.
understood
so leave the yml files without change or should I try and add the include-build param?
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.
I'll see if I can build up on your current work, tweaking gradle a bit so that we still can use composite build. But this would require atrium-samples-test
. So for the moment you can wait until I get back to you.
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.
What you can do already in the meantime is:
- squash your commits, rebase on master and force push
Lets go for the next steps as you require, I'll learn whats required |
Cool, I'll look a bit more into composite builds and let you know once pre-work is done. |
Nice, I have a working workaround, so you can proceed:
I can also merge your changes into a separate branch and push my changes, if you prefer -- I mean, you don't have to do double work really. Unless you want to do this on your own I am going to merge this into a separate branch. |
which settings.gradle do you mean? at the root? or of the js and jvm projects we address? |
I meant settings.gradle of atrium-samples-test and build.gradle of atrium-samples-test |
You can see my changes here (note that it is not based on your latest commits): |
updated as required, whats next? |
squash your commits, rebase on master and force push |
Looks good, the only thing left is that you have merge conflicts you need to resolve (let me know in case you need help with that). |
trying to understand this first... never done before |
I usually do it as follows (from top of my head, errors included 😉)
takes you back to f6e09c6 and adds all modification to the staged changes (do a
now you have one single commit (see
Here you will get a conflict in settings.gradle.
now your commit should be on master
force push your branch, i.e. let the branch-pointer switch from the previous commit hash to the new one |
55bcf97
to
051fb05
Compare
Followed your instructions and its all good, thank you! |
I think it should be good now but let's wait to see if the build is green. |
Codecov Report
@@ Coverage Diff @@
## master #440 +/- ##
==========================================
Coverage 87.84% 87.84%
+ Complexity 125 1 -124
==========================================
Files 712 712
Lines 6152 6152
Branches 241 241
==========================================
Hits 5404 5404
Misses 698 698
Partials 50 50
Continue to review full report at Codecov.
|
@assaflei you need to give
this can be done as follows:
commit and push afterwards |
add this to this file gradlew? |
No worries, I guess you are a Windows user and it might be not trivial to do it there. I'll do it. |
So is this issue closed? |
I created a new PR: #471 let's see if the build passes now. If it does then everything is done 👍 |
just to understand the context, you wanted to add the commands to gradlew file in order for them to run as part of the travis build? |
travis tries to execute gradlew as part of the build (that's what you have set up: |
But you can see it when you do:
See, the mode of the file changed from 644 to 755. For more information about the modes: https://en.wikipedia.org/wiki/Modes_(Unix) |
I didnt see any line of code related to this change |
Exactly, I changed the file mode, committed that change as you would commit any other change and pushed it. GitHub (and many IDEs) are lacking the feature of showing file mode changes. That's unfortunate but in the end |
btw. the other PR passed, thanks for your contribution 👍 There is #470 which deals with a sample project, so kind of in the same context. Would you like to tackle this one? Or perhaps more Kotlin related? For instance 460 would be a good start. |
throw whatever is more important :) |
In this case, it would be great if you could tackle #167 ps: I have sent you a contributor invitation |
Started following instructions
How do I test the setup?
In misc\tools\atrium-samples-test\build.gradle I simply copied the file from atrium-bc-test and renamed jvm to js hope its enough
I think that this comment in this file is redundand, is it?
//TODO tests are now mostly in the common module. However, we cannot unzip this to the jvm project but // require a common module for it. Probably easiest to introduce a second bc-test which is an MPP project // add(testJarSources, "$groupId:atrium-api-$apiName-common:$oldVersion:testsources") { // exclude group: '*' // }
I confirm that I have read the Contributor Agreements v1.0, agree to be bound on them and confirm that my contribution is compliant.