-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add manifest files generated from ksp into final jar (#1094)
* Repro for KSP issue related to files generated under META-INF * Merge META-INF/services generated by KSP into output JAR * Add manifest files generated from ksp into final jar * Add EOL * Add missing build file changes * Add tests to check exact entry matches * Fix build * Fix more lint errors * Revert pre-commit changes in module.bazel * Rename test file * Move tests to assertion test --------- Co-authored-by: James Barr <[email protected]>
- Loading branch information
1 parent
06a36ed
commit 2a67a50
Showing
15 changed files
with
267 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ abstract static class Builder { | |
|
||
abstract CoffeeAppJavaModel build(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package coffee; | ||
|
||
import com.google.auto.service.AutoService; | ||
|
||
@AutoService(Object.class) | ||
public class CoffeeAppService { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
load("//kotlin:core.bzl", "kt_ksp_plugin") | ||
load("//kotlin:jvm.bzl", "kt_jvm_library") | ||
|
||
# Copyright 2018 The Bazel Authors. All rights reserved. | ||
# | ||
# 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(default_visibility = ["//visibility:private"]) | ||
|
||
kt_ksp_plugin( | ||
name = "autoservice", | ||
processor_class = "dev.zacsweers.autoservice.ksp.AutoServiceSymbolProcessor$Provider", | ||
deps = [ | ||
"@kotlin_rules_maven//:dev_zacsweers_autoservice_auto_service_ksp", | ||
], | ||
) | ||
|
||
kt_ksp_plugin( | ||
name = "moshi", | ||
processor_class = "com.squareup.moshi.kotlin.codegen.ksp.JsonClassSymbolProcessorProvider", | ||
deps = [ | ||
"@kotlin_rules_maven//:com_squareup_moshi_moshi", | ||
"@kotlin_rules_maven//:com_squareup_moshi_moshi_kotlin", | ||
"@kotlin_rules_maven//:com_squareup_moshi_moshi_kotlin_codegen", | ||
], | ||
) | ||
|
||
kt_jvm_library( | ||
name = "moshi_lib", | ||
srcs = ["CoffeeAppModel.kt"], | ||
plugins = [":moshi"], | ||
deps = [ | ||
"@kotlin_rules_maven//:com_squareup_moshi_moshi", | ||
"@kotlin_rules_maven//:com_squareup_moshi_moshi_kotlin", | ||
"@kotlin_rules_maven//:com_squareup_moshi_moshi_kotlin_codegen", | ||
], | ||
) | ||
|
||
kt_jvm_library( | ||
name = "coffee_lib", | ||
srcs = ["CoffeeAppService.java"], | ||
plugins = [":autoservice"], | ||
deps = [ | ||
"@kotlin_rules_maven//:dev_zacsweers_autoservice_auto_service_ksp", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "ksp", | ||
srcs = [ | ||
":coffee_lib.jar", | ||
":moshi_lib.jar", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2018 The Bazel Authors. All rights reserved. | ||
* | ||
* 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 coffee | ||
|
||
import com.squareup.moshi.Moshi | ||
|
||
class CoffeeApp { | ||
|
||
companion object { | ||
|
||
private val adapter = CoffeeAppModelJsonAdapter(Moshi.Builder().build()) | ||
private val d = AutoValue_CoffeeAppJavaModel.Builder() | ||
.setCoffeeAppModel(CoffeeAppModel("1")) | ||
.build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2018 The Bazel Authors. All rights reserved. | ||
* | ||
* 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 src.test.data.jvm.ksp | ||
|
||
import com.squareup.moshi.JsonClass | ||
|
||
@JsonClass(generateAdapter = true) | ||
data class CoffeeAppModel(val id: Int) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright 2018 The Bazel Authors. All rights reserved. | ||
* | ||
* 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 src.test.data.jvm.ksp; | ||
|
||
import com.google.auto.service.AutoService; | ||
|
||
@AutoService(Object.class) | ||
public class CoffeeAppService { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.