Migrate multi-module project to single project.

This commit is contained in:
Andreas Schildbach 2019-07-19 19:14:13 +02:00
parent 04382fe67e
commit 070fcad64a
220 changed files with 73 additions and 85 deletions

6
.gitignore vendored
View file

@ -1,2 +1,6 @@
build/
.classpath
.project
.settings/
.gradle/
bin/
build/

View file

@ -1,10 +1,31 @@
Welcome to Public Transport Enabler, a Java library allowing you to get data from public transport providers.
Public Transport Enabler
========================
This project contains several subprojects:
This is a Java library allowing you to get data from public transport providers.
Look into [NetworkProvider.java](https://github.com/schildbach/public-transport-enabler/blob/master/enabler/src/de/schildbach/pte/NetworkProvider.java) for an overview of the API.
* [__enabler__](enabler):
The library itself. This is probably what you're searching for. See the subproject's [README](enabler/README.md) for more information.
Using providers that require secrets
------------------------------------
You can build all sub-projects at once using Gradle:
For some providers a secret like an API key is required to use their API.
Copy the `secrets.properties.template` file to `secrets.properties` like so:
`gradle clean build`
$ cp test/de/schildbach/pte/live/secrets.properties.template test/de/schildbach/pte/live/secrets.properties
You need to request the secrets directly from the provider. For Navitia based providers, you can [request a secret here](http://www.navitia.io/register).
How to run live tests?
----------------------
Make sure the test you want to run does not require a secret and if it does, see above for how to get one.
Once you have the secret or if your provider does not need one, you can run the tests in your IDE.
Both IntelliJ and Eclipse have excellent support for JUnit tests.
If you prefer to run tests from the command line, you can comment out the test exclude at the end of
[build.gradle](https://github.com/schildbach/public-transport-enabler/blob/master/enabler/build.gradle#L30)
and use this command to only execute a test for a single provider:
$ gradle -Dtest.single=ParisProviderLive test
This uses the `ParisProvider` as an example.
Just replace it with the provider you want to test.

View file

@ -1,5 +1,43 @@
allprojects {
repositories {
jcenter()
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
group = 'de.schildbach.pte'
archivesBaseName = 'public-transport-enabler'
repositories {
jcenter()
}
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.12.3'
compile 'com.squareup.okhttp3:logging-interceptor:3.12.3'
compile 'com.google.guava:guava:28.0-android'
compile 'org.slf4j:slf4j-api:1.7.25'
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'org.json:json:20090211' // provided by Android
compile 'net.sf.kxml:kxml2:2.3.0' // provided by Android
testCompile 'junit:junit:4.12'
testRuntime 'org.slf4j:slf4j-jdk14:1.7.25'
}
sourceSets {
main {
java.srcDirs = ['src']
resources.srcDirs = ['src']
}
test {
java.srcDirs = ['test']
resources.srcDirs = ['test']
}
}
compileJava {
sourceCompatibility '1.7'
targetCompatibility '1.7'
options.encoding = 'UTF-8'
}
test {
exclude 'de/schildbach/pte/live/**'
}

4
enabler/.gitignore vendored
View file

@ -1,4 +0,0 @@
/.classpath
/.project
/.settings/
/bin/

View file

@ -1,31 +0,0 @@
Public Transport Enabler
========================
This is a Java library allowing you to get data from public transport providers.
Look into [NetworkProvider.java](https://github.com/schildbach/public-transport-enabler/blob/master/enabler/src/de/schildbach/pte/NetworkProvider.java) for an overview of the API.
Using providers that require secrets
------------------------------------
For some providers a secret like an API key is required to use their API.
Copy the `secrets.properties.template` file to `secrets.properties` like so:
$ cp test/de/schildbach/pte/live/secrets.properties.template test/de/schildbach/pte/live/secrets.properties
You need to request the secrets directly from the provider. For Navitia based providers, you can [request a secret here](http://www.navitia.io/register).
How to run live tests?
----------------------
Make sure the test you want to run does not require a secret and if it does, see above for how to get one.
Once you have the secret or if your provider does not need one, you can run the tests in your IDE.
Both IntelliJ and Eclipse have excellent support for JUnit tests.
If you prefer to run tests from the command line, you can comment out the test exclude at the end of
[build.gradle](https://github.com/schildbach/public-transport-enabler/blob/master/enabler/build.gradle#L30)
and use this command to only execute a test for a single provider:
$ gradle -Dtest.single=ParisProviderLive test
This uses the `ParisProvider` as an example.
Just replace it with the provider you want to test.

View file

@ -1,39 +0,0 @@
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
group = 'de.schildbach.pte'
archivesBaseName = 'public-transport-enabler'
dependencies {
compile 'com.squareup.okhttp3:okhttp:3.12.3'
compile 'com.squareup.okhttp3:logging-interceptor:3.12.3'
compile 'com.google.guava:guava:28.0-android'
compile 'org.slf4j:slf4j-api:1.7.25'
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'org.json:json:20090211' // provided by Android
compile 'net.sf.kxml:kxml2:2.3.0' // provided by Android
testCompile 'junit:junit:4.12'
testRuntime 'org.slf4j:slf4j-jdk14:1.7.25'
}
sourceSets {
main {
java.srcDirs = ['src']
resources.srcDirs = ['src']
}
test {
java.srcDirs = ['test']
resources.srcDirs = ['test']
}
}
compileJava {
sourceCompatibility '1.7'
targetCompatibility '1.7'
options.encoding = 'UTF-8'
}
test {
exclude 'de/schildbach/pte/live/**'
}

View file

@ -1 +0,0 @@
include 'enabler'

Some files were not shown because too many files have changed in this diff Show more