From 80085ef0f0e9cd31f452c48638ad2568571b8231 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 5 Sep 2021 20:57:03 -0400 Subject: [PATCH 1/6] Add java 11 source set with module-info.java --- src/main/java11/module-info.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/main/java11/module-info.java diff --git a/src/main/java11/module-info.java b/src/main/java11/module-info.java new file mode 100644 index 0000000000..deefa77777 --- /dev/null +++ b/src/main/java11/module-info.java @@ -0,0 +1,31 @@ +/* + * 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.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 org.reactivestreams; +} \ No newline at end of file From 150502369f79093d5bb870579f13de5b1b67d706 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 5 Sep 2021 20:57:13 -0400 Subject: [PATCH 2/6] Add bogus files for javac to be happy --- .../reactivex/rxjava3/annotations/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/core/Bogus.java | 18 ++++++++++++++++++ .../reactivex/rxjava3/disposables/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/exceptions/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/functions/Bogus.java | 18 ++++++++++++++++++ .../reactivex/rxjava3/observables/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/observers/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/parallel/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/plugins/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/processors/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/schedulers/Bogus.java | 18 ++++++++++++++++++ .../io/reactivex/rxjava3/subjects/Bogus.java | 18 ++++++++++++++++++ .../reactivex/rxjava3/subscribers/Bogus.java | 18 ++++++++++++++++++ 13 files changed, 234 insertions(+) create mode 100644 src/main/java11/io/reactivex/rxjava3/annotations/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/core/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/disposables/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/exceptions/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/functions/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/observables/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/observers/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/parallel/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/plugins/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/processors/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/schedulers/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/subjects/Bogus.java create mode 100644 src/main/java11/io/reactivex/rxjava3/subscribers/Bogus.java 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/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 { + +} From 6c925be4de1812c2dfcfc9b843664cde25f7a16c Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 5 Sep 2021 20:58:02 -0400 Subject: [PATCH 3/6] Use toolchains and configure MR Jar witih module-info --- build.gradle | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3a87a423e1..0383d4155e 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 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" ) } From c7988ccb8b9f6b183bd56542e3f378ce2d50ca78 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 5 Sep 2021 21:10:50 -0400 Subject: [PATCH 4/6] Disable checkstyle on java11 sourceset --- build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index 0383d4155e..98184f9d55 100644 --- a/build.gradle +++ b/build.gradle @@ -199,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")) { From 0ca5ef71d2148bb4962368adb77abc1c16f83077 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 5 Sep 2021 21:21:06 -0400 Subject: [PATCH 5/6] Add flowables package --- .../io/reactivex/rxjava3/flowables/Bogus.java | 18 ++++++++++++++++++ src/main/java11/module-info.java | 1 + 2 files changed, 19 insertions(+) create mode 100644 src/main/java11/io/reactivex/rxjava3/flowables/Bogus.java 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/module-info.java b/src/main/java11/module-info.java index deefa77777..27cecb963c 100644 --- a/src/main/java11/module-info.java +++ b/src/main/java11/module-info.java @@ -17,6 +17,7 @@ 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; From 21bed9d1f253ab696817af450fefda4df33fd0c2 Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Sun, 5 Sep 2021 21:23:12 -0400 Subject: [PATCH 6/6] Mark org.reactivestreams as transitive --- src/main/java11/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java11/module-info.java b/src/main/java11/module-info.java index 27cecb963c..054366e2a2 100644 --- a/src/main/java11/module-info.java +++ b/src/main/java11/module-info.java @@ -28,5 +28,5 @@ exports io.reactivex.rxjava3.subjects; exports io.reactivex.rxjava3.subscribers; - requires org.reactivestreams; + requires transitive org.reactivestreams; } \ No newline at end of file