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

Have the pluginHead branch auto sync to plugin head. #38

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ matrix:

branches:
only:
# master branch's j2objc-gradle submodule should track
# only the latest production release of j2objc-gradle.
# For now it tracks a particular unreleased commit because v0.5.0-alpha
# must be released for depedency features to work.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/depedency/dependency/

Also, I didn't understand what you meant by this?

# Maintainers must manually update submodule to the latest release.
- master
# pluginHead branch is used to always test the latest
# HEAD of the j2objc-gradle repository. They are automatically
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 we should standardize on a single space after a period. In the plugin we have 58 cases of '. ' (single space) in comments and 17 cases of '. ' (double space). I think single space is far more common.

# configured below.
- pluginHead
- /^release.*$/
- /^v[0-9].*$/
Copy link
Contributor

Choose a reason for hiding this comment

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

Should release and v[0-9].* exist? They're not used right now.


Expand All @@ -34,6 +43,9 @@ install:
- /usr/libexec/java_home -v 1.7 -F -V
- java -Xmx32m -version && javac -J-Xmx32m -version
- pushd j2objc-gradle
- echo For branch $TRAVIS_BRANCH
# Update the plugin submodule to latest HEAD if in the appropriate branch
- if [[ $TRAVIS_BRANCH == pluginHead ]]; then git pull origin master; fi
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 master should refer to both the master in e2e and master in the plugin. Then get rid of "pluginHead" and replace it with "pluginRelease", so that it's use is more clear. You can then make it update to head and then grab the latest tag or HEAD (master) as appropriate. Replace the current line with:

git pull origin master
if [[ $TRAVIS_BRANCH == pluginLatestVersion ]]; then
    TAG=`git tag -l | sort | tail -n 1`
    echo Plugin Tag: $TAG
    git checkout tags/TAG
fi

The sort is so that if the latest tag was a hotfix on old release (e.g. 0.4.2.1), it will still use the latest version for builds (v0.5.0), even though it was an older tag. We could then get really fancy and add another section again:

if [[ $TRAVIS_BRANCH == pluginLatestTag ]]; then
    LATEST_VERSION=`git tag -l | sort | tail -n 1`
    LATEST_TAG=`git tag -l | tail -n 1`
    if [[ $LATEST_TAG != $LATEST_VERSION ]]; then
        echo Plugin Tag: $LATEST_TAG
        git checkout tags/LATEST_TAG
    else
        # LATEST_TAG == LATEST_VERSION, so testing isn't needed
        # SOMEHOW STOP THE BUILD AND PASS EVERYTHING
    fi
fi

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, maybe for now we only build pluginLatestVersion and assume that we ask people to update to a later version rather than do backward hotfixes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah let's just keep it simple. Only one branch (master) that follows the latest release. Frankly when we make a j2objc-config release, we can just do the update to the submodule. That way the release is persistent, even outside Travis. However, we can start that policy only with 0.5.0 as 0.4.2 (or whatever) lacks needed dependency code.

Btw, the tag sorting script fails when multiple digits are involved. What you really want is:
git tag -l --sort=version:refname v\* | tail -n 1 which was made for this

- ./gradlew wrapper
- ./gradlew dependencies
# In this repo, building of the j2objc-gradle plugin is just preperation.
Expand Down
15 changes: 10 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,33 @@ Please keep in mind that your "Contribution(s)" are submitted under
the [Apache 2.0 License](LICENSE).

#### Updating j2objc-gradle
The version of j2objc-gradle in this repo is not automatically kept up
to date with HEAD of https://github.com/j2objc-contrib/j2objc-gradle.
When a new release of j2objc-gradle is made, you should update the submodule
in the `master` branch of this repo.

As a submodule, you can update j2objc-gradle by doing:
As a submodule, you can update j2objc-gradle (to for example v0.5.0-alpha) by doing:

```shell
# (start with a clean git working directory)
# (from your local repo for this project)
git checkout -b update-plugin
pushd j2objc-gradle
git pull
git reset --hard v0.5.0-alpha
popd
git add .
git commit -m 'Updating j2objc-gradle to HEAD'
git commit -m 'Updating j2objc-gradle to v0.5.0-alpha'
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be yanked if you switch to the automatic process I suggested above.

# (submit the update-plugin branch as a PR to the repo)
```

Make sure this PR is seperate from any other work. If a library you want
to build depends on the update, work in a new branch parented to the commit
above.

TODO: [Automate this](https://github.com/j2objc-contrib/j2objc-common-libs-e2e-test/issues/33)
In the `pluginHead` branch, Travis automatically syncs the submodule to
HEAD of the plugin. Note this isn't persisted in Git, it is merely configured
Copy link
Contributor

Choose a reason for hiding this comment

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

single space after period

by .travis.yml. Also note that Travis does not rerun builds unless a commit
Copy link
Contributor

Choose a reason for hiding this comment

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

single space after period

is made to a branch - it has no way of detecting that j2objc-gradle has
been updated.

#### Library build verification

Expand Down