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

Remove project.task from uploadPlugin and make them inputs #21

Merged
merged 1 commit into from
May 10, 2024
Merged
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 @@ -20,6 +20,8 @@ public void apply(Project project) {

uploadPluginTaskTaskProvider.configure(it -> {
it.dependsOn(generateBlockMapTaskTaskProvider);
it.blockmapFile.set(generateBlockMapTaskTaskProvider.get().blockmapFile);
it.blockmapHashFile.set(generateBlockMapTaskTaskProvider.get().blockmapHashFile);
});

generateBlockMapTaskTaskProvider.configure(it -> {
Expand Down
32 changes: 25 additions & 7 deletions src/main/java/dev/bmac/gradle/intellij/UploadPluginTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import org.gradle.api.logging.Logger;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.*;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;

import javax.inject.Inject;

Expand Down Expand Up @@ -72,7 +75,6 @@ public class UploadPluginTask extends ConventionTask {
@Optional
public final Property<PluginUploader.RepoType> repoType;


/**
* @deprecated Update to use repoType
*/
Expand All @@ -81,6 +83,15 @@ public class UploadPluginTask extends ConventionTask {
@Deprecated
public final Property<PluginUploader.UploadMethod> uploadMethod;


/**
* Internal inputs
*/
@InputFile
public final RegularFileProperty blockmapFile;
@InputFile
final RegularFileProperty blockmapHashFile;

@Inject
public UploadPluginTask(ObjectFactory objectFactory) {
url = objectFactory.property(String.class);
Expand All @@ -99,6 +110,8 @@ public UploadPluginTask(ObjectFactory objectFactory) {
untilBuild = objectFactory.property(String.class);
repoType = objectFactory.property(PluginUploader.RepoType.class);
uploadMethod = objectFactory.property(PluginUploader.UploadMethod.class);
blockmapFile = objectFactory.fileProperty();
blockmapHashFile = objectFactory.fileProperty();
}


Expand All @@ -122,9 +135,6 @@ public void execute() throws Exception {
}
}

GenerateBlockMapTask bmt = getProject().getTasks()
.named(GenerateBlockMapTask.TASK_NAME, GenerateBlockMapTask.class).get();

new PluginUploader(1000, 5, logger,
url.get(),
downloadUrlPrefix.getOrNull(),
Expand All @@ -141,8 +151,8 @@ public void execute() throws Exception {
sinceBuild.getOrNull(),
untilBuild.getOrNull(),
rt,
bmt.blockmapFile.getAsFile().get(),
bmt.blockmapHashFile.getAsFile().get()).execute();
blockmapFile.getAsFile().get(),
blockmapHashFile.getAsFile().get()).execute();
}

public Property<String> getUrl() {
Expand Down Expand Up @@ -205,6 +215,14 @@ public Property<PluginUploader.RepoType> getRepoType() {
return repoType;
}

public RegularFileProperty getBlockmapFile() {
return blockmapFile;
}

public RegularFileProperty getBlockmapHashFile() {
return blockmapHashFile;
}

@Deprecated
public Property<PluginUploader.UploadMethod> getUploadMethod() {
return uploadMethod;
Expand Down
Loading