Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix addMainModuleInfo erroneously considered UP-TO-DATE #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import org.gradle.api.logging.Logger
import org.gradle.api.logging.Logging
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.WorkResult
Expand All @@ -33,7 +34,7 @@ import org.moditect.gradleplugin.add.model.MainModuleConfiguration
class AddMainModuleInfoTask extends AbstractAddModuleInfoTask {
private static final Logger LOGGER = Logging.getLogger(AddMainModuleInfoTask)

@Input @Optional
@Nested @Optional
final Property<MainModuleConfiguration> mainModule

AddMainModuleInfoTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
Expand All @@ -44,9 +45,13 @@ abstract class AbstractModuleConfiguration {
@Input @Optional
String mainClass

@Input
abstract String getShortName()
@InputFile
abstract File getInputJar()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not specified @PathSensitive(PathSensitivity.NONE) here because for AddMainModuleInfoTask the path matters since the file is overwritten.

I hope this does not cause issues for ModuleConfiguration which overrides this method and adds its own annotations.

@Input
abstract String getVersion()
@Nested
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not tested this.

abstract Set<ModuleId> getOptionalDependencies()

AbstractModuleConfiguration(Project project) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class ModuleConfiguration extends AbstractModuleConfiguration {
primaryArtifact.file
}

@Input
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is redundant because the overridden method already defines this (but have not tested this!).

@Override
String getVersion() {
primaryArtifact.moduleVersion.id.version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
package org.moditect.gradleplugin.common

import groovy.transform.Canonical
import org.gradle.api.tasks.Input

@Canonical
class ModuleId implements Serializable {
@Input
String group
@Input
Comment on lines +23 to +25
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to define these as inputs, but I have not tested this.

String name
}