diff --git a/build.gradle b/build.gradle index 3a87a423e1..98184f9d55 100644 --- a/build.gradle +++ b/build.gradle @@ -49,14 +49,38 @@ dependencies { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } + modularity.inferModulePath.set(true) } tasks.withType(JavaCompile) { options.compilerArgs << "-parameters" } +Provider<SourceSet> java11 = sourceSets.register("java11") { + it.java { + srcDir("src/main/java11") + } +} + +tasks.withType(JavaCompile).named("compileJava11Java") { compileTask -> + compileTask.javaCompiler = javaToolchains.compilerFor { + // We use a LTS version of Java for building + // but use target 9 for maximum compatibility + languageVersion = JavaLanguageVersion.of(11) + } + compileTask.options.release.set(9) +} + +configurations { + "java11Implementation" { + extendsFrom(api) + extendsFrom(implementation) + } +} + apply from: file("gradle/javadoc_cleanup.gradle") javadoc { @@ -86,6 +110,12 @@ animalsniffer { } jar { + from(java11.map { it.output }) { + into("META-INF/versions/9") + include("module-info.class") + } + // Cover for bnd still not supporting MR Jars: https://github.com/bndtools/bnd/issues/2227 + bnd('-fixupmessages': '^Classes found in the wrong directory: \\\\{META-INF/versions/9/module-info\\\\.class=module-info}$') bnd( "Bundle-Name": "rxjava", "Bundle-Vendor": "RxJava Contributors", @@ -95,7 +125,8 @@ jar { "Eclipse-ExtensibleAPI": "true", "Automatic-Module-Name": "io.reactivex.rxjava3", "Export-Package": "!io.reactivex.rxjava3.internal.*, io.reactivex.rxjava3.*", - "Bundle-SymbolicName": "io.reactivex.rxjava3.rxjava" + "Bundle-SymbolicName": "io.reactivex.rxjava3.rxjava", + "Multi-Release": "true" ) } @@ -168,6 +199,9 @@ checkstyle { "checkstyle.suppressions.file": project.file("config/checkstyle/suppressions.xml"), "checkstyle.header.file" : project.file("config/license/HEADER_JAVA") ] + // Don't enable on the java11 source set as checkstyle hiccups on those sources and they're + // just a module-info and bogus files anyway + sourceSets = [project.sourceSets.main, project.sourceSets.test, project.sourceSets.jmh] } if (project.hasProperty("releaseMode")) { diff --git a/src/main/java11/io/reactivex/rxjava3/annotations/Bogus.java b/src/main/java11/io/reactivex/rxjava3/annotations/Bogus.java new file mode 100644 index 0000000000..38673b49a4 --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/annotations/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.annotations; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/core/Bogus.java b/src/main/java11/io/reactivex/rxjava3/core/Bogus.java new file mode 100644 index 0000000000..985b2f3333 --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/core/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.core; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/disposables/Bogus.java b/src/main/java11/io/reactivex/rxjava3/disposables/Bogus.java new file mode 100644 index 0000000000..a7fce4985f --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/disposables/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.disposables; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/exceptions/Bogus.java b/src/main/java11/io/reactivex/rxjava3/exceptions/Bogus.java new file mode 100644 index 0000000000..6046146fbf --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/exceptions/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.exceptions; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/flowables/Bogus.java b/src/main/java11/io/reactivex/rxjava3/flowables/Bogus.java new file mode 100644 index 0000000000..815f4cc949 --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/flowables/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.flowables; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/functions/Bogus.java b/src/main/java11/io/reactivex/rxjava3/functions/Bogus.java new file mode 100644 index 0000000000..0bc23e8ecb --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/functions/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.functions; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/observables/Bogus.java b/src/main/java11/io/reactivex/rxjava3/observables/Bogus.java new file mode 100644 index 0000000000..500871c69b --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/observables/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.observables; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/observers/Bogus.java b/src/main/java11/io/reactivex/rxjava3/observers/Bogus.java new file mode 100644 index 0000000000..1ea1f73f2b --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/observers/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.observers; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/parallel/Bogus.java b/src/main/java11/io/reactivex/rxjava3/parallel/Bogus.java new file mode 100644 index 0000000000..fe391202cc --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/parallel/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.parallel; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/plugins/Bogus.java b/src/main/java11/io/reactivex/rxjava3/plugins/Bogus.java new file mode 100644 index 0000000000..b398d5101a --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/plugins/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.plugins; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/processors/Bogus.java b/src/main/java11/io/reactivex/rxjava3/processors/Bogus.java new file mode 100644 index 0000000000..7450f2511d --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/processors/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.processors; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/schedulers/Bogus.java b/src/main/java11/io/reactivex/rxjava3/schedulers/Bogus.java new file mode 100644 index 0000000000..7598c11d18 --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/schedulers/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.schedulers; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/subjects/Bogus.java b/src/main/java11/io/reactivex/rxjava3/subjects/Bogus.java new file mode 100644 index 0000000000..4746929393 --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/subjects/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.subjects; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/io/reactivex/rxjava3/subscribers/Bogus.java b/src/main/java11/io/reactivex/rxjava3/subscribers/Bogus.java new file mode 100644 index 0000000000..56a8a3f57f --- /dev/null +++ b/src/main/java11/io/reactivex/rxjava3/subscribers/Bogus.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ +package io.reactivex.rxjava3.subscribers; + +/** Stub file to make javac happy about the module referencing this package. */ +public class Bogus { + +} diff --git a/src/main/java11/module-info.java b/src/main/java11/module-info.java new file mode 100644 index 0000000000..054366e2a2 --- /dev/null +++ b/src/main/java11/module-info.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016-present, RxJava Contributors. + * + * 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. + */ + +@SuppressWarnings("JavaModuleNaming") +module io.reactivex.rxjava3 { + exports io.reactivex.rxjava3.annotations; + exports io.reactivex.rxjava3.core; + exports io.reactivex.rxjava3.disposables; + exports io.reactivex.rxjava3.exceptions; + exports io.reactivex.rxjava3.flowables; + exports io.reactivex.rxjava3.functions; + exports io.reactivex.rxjava3.observables; + exports io.reactivex.rxjava3.observers; + exports io.reactivex.rxjava3.parallel; + exports io.reactivex.rxjava3.plugins; + exports io.reactivex.rxjava3.processors; + exports io.reactivex.rxjava3.schedulers; + exports io.reactivex.rxjava3.subjects; + exports io.reactivex.rxjava3.subscribers; + + requires transitive org.reactivestreams; +} \ No newline at end of file