Skip to content

Commit

Permalink
Adds joda-convert and joda-time library to build.
Browse files Browse the repository at this point in the history
They have known issues, but we add them anyway to track when they get fixed.

Adds a proper design for multi-library projects and for libraries that
depend on other libraries we also test.
  • Loading branch information
advayDev1 committed Sep 26, 2015
1 parent 269f831 commit 0ab892e
Show file tree
Hide file tree
Showing 18 changed files with 169 additions and 45 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ os: osx
# on Traivs.
env:
- TEST_DIR=gson
- TEST_DIR=joda-convert
- TEST_DIR=joda-time

matrix:
allow_failures:
# Blocked on https://github.com/JodaOrg/joda-convert/issues/7
- env: TEST_DIR=joda-convert
# Blocked on https://github.com/JodaOrg/joda-convert/issues/7
- env: TEST_DIR=joda-time

branches:
only:
Expand Down
31 changes: 30 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,35 @@ You are not required to run the system tests locally before creating a PR (they
time and processing power), however if the tests fail on Travis you will need to update
the PR until they pass.

#### Adding a new library

When you add a new library to build, make sure it is referenced in run-all.sh (for
human contributors) and in .travis.yml (for continuous builds).
human contributors) and in .travis.yml (for continuous builds). If your library has failures
add the env row to the allow_failures section of .travis.yml and document the blockers.

The structure for each library to test is as follows:

```
libraryBuilds/
- common/ - Existing directory with common build config
- dependsOnLibrary1/ - Existing root of a library that newLibrary depends on
- dependsOnLibrary1/ - Existing project for a library that newLibrary depends on
- dependsOnLibrary2/ - Ditto.
- dependsOnLibrary2/ - Ditto.
- newLibrary/ - New directory for the root project
- newLibrary/ - New directory for the library itself
- build.gradle - Build file containing j2objcTranslation directive for newLibrary
- dependsOnLibrary1/ - Soft link to ../dependsOnLibrary1/dependsOnLibrary1/
- dependsOnLibrary2/ - Soft link to ../dependsOnLibrary2/dependsOnLibrary2/
- settings.gradle - 'include' directive for newLibrary and libraries it depends on
- build.gradle - Soft link to ../common/build.gradle, contains the preamble
- gradlew - Soft link to ../../j2objc-gradle/gradlew
- local.properties - Soft link to ../common/local.properties
```

Every library newLibrary depends on must have its own similar structure as a top-level project,
as illustrated by dependsOnLibrar1 and 2. Note the two level directory structure above: even if
your library has no dependencies, the build.gradle file for the library must lie 2 directories
below libraryBuilds1/.

TODO: Create a script to setup the above structure.
34 changes: 34 additions & 0 deletions libraryBuilds/common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
repositories {
jcenter()
}
dependencies {
// This is the build output of the plugin itself.
classpath fileTree(dir: '../../j2objc-gradle/build/libs', include: ['*.jar'])
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'com.github.j2objccontrib.j2objcgradle'

repositories {
mavenCentral()
}
}
44 changes: 0 additions & 44 deletions libraryBuilds/gson/build.gradle

This file was deleted.

1 change: 1 addition & 0 deletions libraryBuilds/gson/build.gradle
27 changes: 27 additions & 0 deletions libraryBuilds/gson/gson/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

dependencies {
j2objcTranslation 'com.google.code.gson:gson:2.3.1:sources'
}

j2objcConfig {
filenameCollisionCheck false

// Almost always there are no tests provided in an external source jar.
testMinExpectedTests 0
finalConfigure()
}
1 change: 1 addition & 0 deletions libraryBuilds/gson/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':gson'
1 change: 1 addition & 0 deletions libraryBuilds/joda-convert/build.gradle
1 change: 1 addition & 0 deletions libraryBuilds/joda-convert/gradlew
27 changes: 27 additions & 0 deletions libraryBuilds/joda-convert/joda-convert/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

dependencies {
j2objcTranslation 'org.joda:joda-convert:1.7:sources'
}

j2objcConfig {
filenameCollisionCheck false

// Almost always there are no tests provided in an external source jar.
testMinExpectedTests 0
finalConfigure()
}
1 change: 1 addition & 0 deletions libraryBuilds/joda-convert/local.properties
1 change: 1 addition & 0 deletions libraryBuilds/joda-convert/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':joda-convert'
1 change: 1 addition & 0 deletions libraryBuilds/joda-time/build.gradle
1 change: 1 addition & 0 deletions libraryBuilds/joda-time/gradlew
1 change: 1 addition & 0 deletions libraryBuilds/joda-time/joda-convert
29 changes: 29 additions & 0 deletions libraryBuilds/joda-time/joda-time/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2015 the authors of j2objc-common-libs-e2e-test
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

dependencies {
compile project(':joda-convert')
j2objcTranslation 'joda-time:joda-time:2.8.2:sources'
}

j2objcConfig {
autoConfigureDeps true
filenameCollisionCheck false

// Almost always there are no tests provided in an external source jar.
testMinExpectedTests 0
finalConfigure()
}
1 change: 1 addition & 0 deletions libraryBuilds/joda-time/local.properties
1 change: 1 addition & 0 deletions libraryBuilds/joda-time/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':joda-convert', ':joda-time'
2 changes: 2 additions & 0 deletions libraryBuilds/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
set -ev

./run-test.sh gson
./run-test.sh joda-convert
./run-test.sh joda-time

0 comments on commit 0ab892e

Please sign in to comment.